Skip to content

Commit

Permalink
Merge pull request #163 from Team-Ampersand/154-modify-personnel-hide
Browse files Browse the repository at this point in the history
🔀 :: [#154] 인원 수정 기능 숨겨두기
  • Loading branch information
baekteun authored Aug 13, 2023
2 parents aef6327 + 1a97129 commit a6454d8
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ final class HomeMoordinator: Moordinator {
self.inputDialogFactory = inputDialogFactory
}

// swiftlint: disable cyclomatic_complexity
func route(to path: RoutePath) -> MoordinatorContributors {
guard let path = path.asDotori else { return .none }
switch path {
Expand Down Expand Up @@ -72,6 +73,7 @@ final class HomeMoordinator: Moordinator {
}
return .none
}
// swiftlint: enable cyclomatic_complexity
}

private extension HomeMoordinator {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import UserDomainInterface

extension MassageStatusType {
func buttonDisplay(userRole: UserRoleType) -> String {
guard userRole == .member else {
return L10n.Home.modifyLimitButtonTitle
}
#warning("FIXME: 디자인 변경 대응 시 재활성화")
// guard userRole == .member else {
// return L10n.Home.modifyLimitButtonTitle
// }
switch self {
case .can: return L10n.Home.canMassageButtonTitle
case .cant: return L10n.Home.cantApplyButtonTitle
Expand All @@ -16,9 +17,10 @@ extension MassageStatusType {
}

func buttonIsEnabled(userRole: UserRoleType) -> Bool {
guard userRole == .member else {
return true
}
#warning("FIXME: 디자인 변경 대응 시 재활성화")
// guard userRole == .member else {
// return true
// }
switch self {
case .can, .applied: return true
case .cant: return false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ import UserDomainInterface

extension SelfStudyStatusType {
func buttonDisplay(userRole: UserRoleType) -> String {
guard userRole == .member else {
return L10n.Home.modifyLimitButtonTitle
}
switch self {
case .can: return L10n.Home.canSelfStudyButtonTitle
case .applied: return L10n.Home.appliedSelfStudyButtonTitle
Expand All @@ -17,9 +14,6 @@ extension SelfStudyStatusType {
}

func buttonIsEnabled(userRole: UserRoleType) -> Bool {
guard userRole == .member else {
return true
}
switch self {
case .can, .applied: return true
case .cant, .impossible: return false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ final class HomeViewController: BaseStoredViewController<HomeStore> {
self.navigationItem.setRightBarButton(myInfoBarButtonItem, animated: true)
}

// swiftlint: disable function_body_length
override func bindAction() {
viewDidLoadPublisher
.map { Store.Action.viewDidLoad }
Expand Down Expand Up @@ -122,6 +123,9 @@ final class HomeViewController: BaseStoredViewController<HomeStore> {
.store(in: &subscription)
}

// swiftlint: enable function_body_length

// swiftlint: disable function_body_length
override func bindState() {
let sharedState = store.state.share()
.receive(on: DispatchQueue.main)
Expand Down Expand Up @@ -222,4 +226,5 @@ final class HomeViewController: BaseStoredViewController<HomeStore> {
.sink(receiveValue: massageApplicationCardView.updateRecentRefresh(date:))
.store(in: &subscription)
}
// swiftlint: enable function_body_length
}
74 changes: 38 additions & 36 deletions Projects/Feature/HomeFeature/Sources/Scene/Store/HomeStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -201,24 +201,25 @@ private extension HomeStore {
}

func applySelfStudyButtonDidTap() {
guard currentState.currentUserRole == .member else {
let inputDialogRoutePath = DotoriRoutePath.inputDialog(
title: L10n.Home.selfStudyModifyLimitTitle,
placeholder: "\(currentState.selfStudyInfo.1)",
inputType: .number
) { [modifySelfStudyPersonnelUseCase, weak self] limit in
do {
guard let limitInt = Int(limit) else { return }
try await modifySelfStudyPersonnelUseCase(limit: limitInt)
await DotoriToast.makeToast(text: L10n.Home.completeToModifySelfStudyLimitTitle, style: .success)
self?.send(.refreshSelfStudyButtonDidTap)
} catch {
await DotoriToast.makeToast(text: error.localizedDescription, style: .error)
}
}
route.send(inputDialogRoutePath)
return
}
#warning("FIXME: 디자인 변경 대응 시 재활성화")
// guard currentState.currentUserRole == .member else {
// let inputDialogRoutePath = DotoriRoutePath.inputDialog(
// title: L10n.Home.selfStudyModifyLimitTitle,
// placeholder: "\(currentState.selfStudyInfo.1)",
// inputType: .number
// ) { [modifySelfStudyPersonnelUseCase, weak self] limit in
// do {
// guard let limitInt = Int(limit) else { return }
// try await modifySelfStudyPersonnelUseCase(limit: limitInt)
// await DotoriToast.makeToast(text: L10n.Home.completeToModifySelfStudyLimitTitle, style: .success)
// self?.send(.refreshSelfStudyButtonDidTap)
// } catch {
// await DotoriToast.makeToast(text: error.localizedDescription, style: .error)
// }
// }
// route.send(inputDialogRoutePath)
// return
// }

Task.catching {
if self.currentState.selfStudyStatus == .applied {
Expand All @@ -241,24 +242,25 @@ private extension HomeStore {
}

func applyMassageButtonDidTap() {
guard currentState.currentUserRole == .member else {
let inputDialogRoutePath = DotoriRoutePath.inputDialog(
title: L10n.Home.massageModifyLimitTitle,
placeholder: "\(currentState.massageInfo.1)",
inputType: .number
) { [modifyMassagePersonnelUseCase, weak self] limit in
do {
guard let limitInt = Int(limit) else { return }
try await modifyMassagePersonnelUseCase(limit: limitInt)
await DotoriToast.makeToast(text: L10n.Home.completeToModifyMassageLimitTitle, style: .success)
self?.send(.refreshMassageButtonDidTap)
} catch {
await DotoriToast.makeToast(text: error.localizedDescription, style: .error)
}
}
route.send(inputDialogRoutePath)
return
}
#warning("FIXME: 디자인 변경 대응 시 재활성화")
// guard currentState.currentUserRole == .member else {
// let inputDialogRoutePath = DotoriRoutePath.inputDialog(
// title: L10n.Home.massageModifyLimitTitle,
// placeholder: "\(currentState.massageInfo.1)",
// inputType: .number
// ) { [modifyMassagePersonnelUseCase, weak self] limit in
// do {
// guard let limitInt = Int(limit) else { return }
// try await modifyMassagePersonnelUseCase(limit: limitInt)
// await DotoriToast.makeToast(text: L10n.Home.completeToModifyMassageLimitTitle, style: .success)
// self?.send(.refreshMassageButtonDidTap)
// } catch {
// await DotoriToast.makeToast(text: error.localizedDescription, style: .error)
// }
// }
// route.send(inputDialogRoutePath)
// return
// }

Task.catching {
if self.currentState.massageStatus == .applied {
Expand Down
5 changes: 4 additions & 1 deletion Scripts/.swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ excluded:
- Dependencies
- Carthage

disabled_rules:
- void_function_in_ternary

identifier_name:
min_length: 1
max_length: 60
Expand All @@ -21,4 +24,4 @@ line_length:
type_name:
min_length: 2
max_length: 60
allowed_symbols: [_]
allowed_symbols: [_]

0 comments on commit a6454d8

Please sign in to comment.