From 73a448abd41dbb8c60768a826665e739aeff8e66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=8F=84=ED=98=95?= <108233361+ShapeKim98@users.noreply.github.com> Date: Sat, 26 Oct 2024 22:37:55 +0900 Subject: [PATCH] =?UTF-8?q?[design]=20#154=20PokitSplit=20=EB=AA=A8?= =?UTF-8?q?=EB=8B=AC=20=EC=8B=9C=ED=8A=B8=20=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/MainTab/MainTabFeatureView.swift | 1 - .../MainTab/MainTabSplitFeature.swift | 16 +++++- .../Pokit/PokitSplitFeature.swift | 55 +++++++++++++------ .../MainTabSplit/Pokit/PokitSplitView.swift | 52 +++++++++++++++--- .../DSKit/Sources/Components/PokitAlert.swift | 1 - .../Sources/PokitCategorySettingView.swift | 4 +- .../ContentSetting/ContentSettingView.swift | 2 - .../Sources/Alert/PokitAlertBoxView.swift | 3 +- .../Sources/Search/PokitSearchView.swift | 3 +- .../Sources/Setting/PokitSettingView.swift | 3 +- 10 files changed, 106 insertions(+), 34 deletions(-) diff --git a/Projects/App/Sources/MainTab/MainTabFeatureView.swift b/Projects/App/Sources/MainTab/MainTabFeatureView.swift index abe6d5d6..94e97512 100644 --- a/Projects/App/Sources/MainTab/MainTabFeatureView.swift +++ b/Projects/App/Sources/MainTab/MainTabFeatureView.swift @@ -235,7 +235,6 @@ private extension MainTabView { .frame(width: 60, height: 60) } } - .pokitMaxWidth() .animation(.pokitDissolve, value: store.selectedTab) } diff --git a/Projects/App/Sources/MainTabSplit/MainTab/MainTabSplitFeature.swift b/Projects/App/Sources/MainTabSplit/MainTab/MainTabSplitFeature.swift index 7b094281..a6a718b1 100644 --- a/Projects/App/Sources/MainTabSplit/MainTab/MainTabSplitFeature.swift +++ b/Projects/App/Sources/MainTabSplit/MainTab/MainTabSplitFeature.swift @@ -99,7 +99,21 @@ public struct MainTabSplitFeature { private extension MainTabSplitFeature { /// - View Effect func handleViewAction(_ action: Action.View, state: inout State) -> Effect { - return .none + switch action { + case .포킷_버튼_눌렀을때: + state = .pokit(.init()) + return .none + case .리마인드_버튼_눌렀을때: + state = .remind(.init()) + return .none + case .추가_버튼_눌렀을때: + switch state { + case .pokit: + return .send(.pokit(.delegate(.링크추가및수정_활성화))) + case .remind: + return .none + } + } } /// - Inner Effect diff --git a/Projects/App/Sources/MainTabSplit/Pokit/PokitSplitFeature.swift b/Projects/App/Sources/MainTabSplit/Pokit/PokitSplitFeature.swift index 8daae15e..9404e0fe 100644 --- a/Projects/App/Sources/MainTabSplit/Pokit/PokitSplitFeature.swift +++ b/Projects/App/Sources/MainTabSplit/Pokit/PokitSplitFeature.swift @@ -40,6 +40,8 @@ public struct PokitSplitFeature { var 설정: PokitSettingFeature.State? @Presents var 링크상세: ContentDetailFeature.State? + @Presents + var 알람: PokitAlertBoxFeature.State? @Shared(.inMemory("SelectCategory")) var categoryId: Int? @@ -59,17 +61,18 @@ public struct PokitSplitFeature { case 포킷(PokitRootFeature.Action) case 카테고리상세(CategoryDetailFeature.Action) case 링크추가및수정(ContentSettingFeature.Action) - case 포킷추가및수정(PokitCategorySettingFeature.Action) - case 검색(PokitSearchFeature.Action) - case 설정(PokitSettingFeature.Action) - case 링크상세(ContentDetailFeature.Action) + case 포킷추가및수정(PresentationAction) + case 검색(PresentationAction) + case 설정(PresentationAction) + case 링크상세(PresentationAction) + case 알람(PresentationAction) @CasePathable public enum View: Equatable, BindableAction { case binding(BindingAction) case 뷰가_나타났을때 - case 링크추가_버튼_눌렀을때 + case 포킷추가_버튼_눌렀을때 case 검색_버튼_눌렀을때 case 알람_버튼_눌렀을때 case 설정_버튼_눌렀을때 @@ -85,13 +88,16 @@ public struct PokitSplitFeature { case 포킷(PokitRootFeature.Action) case 카테고리상세(CategoryDetailFeature.Action) case 링크추가및수정(ContentSettingFeature.Action) - case 포킷추가및수정(PokitCategorySettingFeature.Action) - case 검색(PokitSearchFeature.Action) - case 설정(PokitSettingFeature.Action) - case 링크상세(ContentDetailFeature.Action) + case 포킷추가및수정(PresentationAction) + case 검색(PresentationAction) + case 설정(PresentationAction) + case 링크상세(PresentationAction) + case 알람(PresentationAction) } - public enum DelegateAction: Equatable { case 없음 } + public enum DelegateAction: Equatable { + case 링크추가및수정_활성화 + } } /// - Initiallizer @@ -133,6 +139,8 @@ public struct PokitSplitFeature { return .send(.scope(.설정(settingAction))) case .링크상세(let contentDetailAction): return .send(.scope(.링크상세(contentDetailAction))) + case .알람(let alertAction): + return .send(.scope(.알람(alertAction))) } } @@ -151,18 +159,21 @@ public struct PokitSplitFeature { .ifLet(\.카테고리상세, action: \.카테고리상세) { CategoryDetailFeature() } - .ifLet(\.포킷추가및수정, action: \.포킷추가및수정) { + .ifLet(\.$포킷추가및수정, action: \.포킷추가및수정) { PokitCategorySettingFeature() } - .ifLet(\.검색, action: \.검색) { + .ifLet(\.$검색, action: \.검색) { PokitSearchFeature() } - .ifLet(\.설정, action: \.설정) { + .ifLet(\.$설정, action: \.설정) { PokitSettingFeature() } - .ifLet(\.링크상세, action: \.링크상세) { + .ifLet(\.$링크상세, action: \.링크상세) { ContentDetailFeature() } + .ifLet(\.$알람, action: \.알람) { + PokitAlertBoxFeature() + } } } //MARK: - FeatureAction Effect @@ -174,14 +185,17 @@ private extension PokitSplitFeature { return .none case .뷰가_나타났을때: return .none - case .링크추가_버튼_눌렀을때: - state.columnVisibility = .all + case .포킷추가_버튼_눌렀을때: + state.포킷추가및수정 = .init(type: .추가) return .none case .검색_버튼_눌렀을때: + state.검색 = .init() return .none case .알람_버튼_눌렀을때: + state.알람 = .init() return .none case .설정_버튼_눌렀을때: + state.설정 = .init() return .none } } @@ -235,12 +249,19 @@ private extension PokitSplitFeature { case .링크상세: return .none + + case .알람: + return .none } } /// - Delegate Effect func handleDelegateAction(_ action: Action.DelegateAction, state: inout State) -> Effect { - return .none + switch action { + case .링크추가및수정_활성화: + state.columnVisibility = .all + return .none + } } } diff --git a/Projects/App/Sources/MainTabSplit/Pokit/PokitSplitView.swift b/Projects/App/Sources/MainTabSplit/Pokit/PokitSplitView.swift index 607b6555..ea7555f1 100644 --- a/Projects/App/Sources/MainTabSplit/Pokit/PokitSplitView.swift +++ b/Projects/App/Sources/MainTabSplit/Pokit/PokitSplitView.swift @@ -63,6 +63,46 @@ public extension PokitSplitView { .ignoresSafeArea() } } + .sheet( + item: $store.scope( + state: \.포킷추가및수정, + action: \.포킷추가및수정 + ) + ) { store in + PokitCategorySettingView(store: store) + .pokitPresentationBackground() + .pokitPresentationCornerRadius() + } + .fullScreenCover( + item: $store.scope( + state: \.검색, + action: \.검색 + ) + ) { store in + PokitSearchView(store: store) + .pokitPresentationBackground() + .pokitPresentationCornerRadius() + } + .sheet( + item: $store.scope( + state: \.알람, + action: \.알람 + ) + ) { store in + PokitAlertBoxView(store: store) + .pokitPresentationBackground() + .pokitPresentationCornerRadius() + } + .sheet( + item: $store.scope( + state: \.설정, + action: \.설정 + ) + ) { store in + PokitSettingView(store: store) + .pokitPresentationBackground() + .pokitPresentationCornerRadius() + } } } } @@ -92,13 +132,11 @@ private extension PokitSplitView { } PokitHeaderItems(placement: .trailing) { - if store.columnVisibility == .doubleColumn { - PokitToolbarButton( - .icon(.edit), - action: { send(.링크추가_버튼_눌렀을때) } - ) - .pokitBlurReplaceTransition(.pokitDissolve) - } + PokitToolbarButton( + .icon(.edit), + action: { send(.포킷추가_버튼_눌렀을때) } + ) + .pokitBlurReplaceTransition(.pokitDissolve) PokitToolbarButton( .icon(.search), diff --git a/Projects/DSKit/Sources/Components/PokitAlert.swift b/Projects/DSKit/Sources/Components/PokitAlert.swift index ea3c7896..596c6401 100644 --- a/Projects/DSKit/Sources/Components/PokitAlert.swift +++ b/Projects/DSKit/Sources/Components/PokitAlert.swift @@ -63,7 +63,6 @@ public struct PokitAlert: View { ) .background() } - .pokitMaxWidth() } .pokitPresentationBackground() .pokitPresentationCornerRadius() diff --git a/Projects/Feature/FeatureCategorySetting/Sources/PokitCategorySettingView.swift b/Projects/Feature/FeatureCategorySetting/Sources/PokitCategorySettingView.swift index e0244982..d1be2da6 100644 --- a/Projects/Feature/FeatureCategorySetting/Sources/PokitCategorySettingView.swift +++ b/Projects/Feature/FeatureCategorySetting/Sources/PokitCategorySettingView.swift @@ -9,6 +9,7 @@ import SwiftUI import ComposableArchitecture import Domain import DSKit +import Util import NukeUI @ViewAction(for: PokitCategorySettingFeature.self) @@ -35,7 +36,6 @@ public extension PokitCategorySettingView { } .padding(.horizontal, 20) .padding(.top, 16) - .pokitMaxWidth() .pokitNavigationBar { navigationBar } .ignoresSafeArea(edges: isFocused ? [] : .bottom) .sheet(isPresented: $store.isProfileSheetPresented) { @@ -54,7 +54,7 @@ private extension PokitCategorySettingView { var navigationBar: some View { PokitHeader(title: store.type.title) { PokitHeaderItems(placement: .leading) { - PokitToolbarButton(.icon(.arrowLeft)) { + PokitToolbarButton(.icon(Device.isPhone ? .arrowLeft : .x)) { send(.dismiss) } } diff --git a/Projects/Feature/FeatureContentSetting/Sources/ContentSetting/ContentSettingView.swift b/Projects/Feature/FeatureContentSetting/Sources/ContentSetting/ContentSettingView.swift index 7e91b2b5..8fab8966 100644 --- a/Projects/Feature/FeatureContentSetting/Sources/ContentSetting/ContentSettingView.swift +++ b/Projects/Feature/FeatureContentSetting/Sources/ContentSetting/ContentSettingView.swift @@ -66,7 +66,6 @@ public extension ContentSettingView { ) } } - .pokitMaxWidth() } let isDisable = store.urlText.isEmpty || store.title.isEmpty || store.memoTextAreaState == .error(message: "최대 100자까지 입력가능합니다.") @@ -78,7 +77,6 @@ public extension ContentSettingView { action: { send(.저장_버튼_눌렀을때) } ) .padding(.horizontal, 20) - .pokitMaxWidth() } .pokitNavigationBar { navigationBar } .ignoresSafeArea(edges: focusedType == nil ? .bottom : []) diff --git a/Projects/Feature/FeatureSetting/Sources/Alert/PokitAlertBoxView.swift b/Projects/Feature/FeatureSetting/Sources/Alert/PokitAlertBoxView.swift index 90bc990a..04c688a8 100644 --- a/Projects/Feature/FeatureSetting/Sources/Alert/PokitAlertBoxView.swift +++ b/Projects/Feature/FeatureSetting/Sources/Alert/PokitAlertBoxView.swift @@ -9,6 +9,7 @@ import SwiftUI import ComposableArchitecture import DSKit import Domain +import Util import NukeUI @ViewAction(for: PokitAlertBoxFeature.self) @@ -67,7 +68,7 @@ private extension PokitAlertBoxView { var navigationBar: some View { PokitHeader(title: "알림함") { PokitHeaderItems(placement: .leading) { - PokitToolbarButton(.icon(.arrowLeft)) { + PokitToolbarButton(.icon(Device.isPhone ? .arrowLeft : .x)) { send(.dismiss) } } diff --git a/Projects/Feature/FeatureSetting/Sources/Search/PokitSearchView.swift b/Projects/Feature/FeatureSetting/Sources/Search/PokitSearchView.swift index d92902e0..c0ca2094 100644 --- a/Projects/Feature/FeatureSetting/Sources/Search/PokitSearchView.swift +++ b/Projects/Feature/FeatureSetting/Sources/Search/PokitSearchView.swift @@ -8,6 +8,7 @@ import SwiftUI import ComposableArchitecture import DSKit +import Util @ViewAction(for: PokitSearchFeature.self) public struct PokitSearchView: View { @@ -81,7 +82,7 @@ private extension PokitSearchView { var navigationBar: some View { HStack(spacing: 8) { PokitToolbarButton( - .icon(.arrowLeft), + .icon(Device.isPhone ? .arrowLeft : .x), action: { send(.dismiss) } ) diff --git a/Projects/Feature/FeatureSetting/Sources/Setting/PokitSettingView.swift b/Projects/Feature/FeatureSetting/Sources/Setting/PokitSettingView.swift index b092f054..32a2f5c9 100644 --- a/Projects/Feature/FeatureSetting/Sources/Setting/PokitSettingView.swift +++ b/Projects/Feature/FeatureSetting/Sources/Setting/PokitSettingView.swift @@ -8,6 +8,7 @@ import SwiftUI import ComposableArchitecture import DSKit +import Util @ViewAction(for: PokitSettingFeature.self) public struct PokitSettingView: View { @@ -127,7 +128,7 @@ private extension PokitSettingView { var navigationBar: some View { PokitHeader(title: "설정") { PokitHeaderItems(placement: .leading) { - PokitToolbarButton(.icon(.arrowLeft)) { + PokitToolbarButton(.icon(Device.isPhone ? .arrowLeft : .x)) { send(.dismiss) } }