From 25b0573a5d1cb228110b376c5904af9f4c8a8f66 Mon Sep 17 00:00:00 2001 From: Jinsujin Date: Thu, 13 Apr 2023 19:46:07 +0900 Subject: [PATCH 1/7] =?UTF-8?q?[PI-43]=20=EB=A9=94=EC=9D=B8=ED=99=94?= =?UTF-8?q?=EB=A9=B4=EC=97=90=20=EC=95=BD=EC=86=8D=20=EA=B4=80=EB=A6=AC=20?= =?UTF-8?q?=ED=83=AD=ED=99=94=EB=A9=B4=20=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HomeContainerFeature/HomeContainerCore.swift | 15 +++++++++++++++ .../HomeContainerFeature/HomeContainerView.swift | 8 +++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/AppPackage/Sources/HomeContainerFeature/HomeContainerCore.swift b/AppPackage/Sources/HomeContainerFeature/HomeContainerCore.swift index fede91f..a60b30e 100644 --- a/AppPackage/Sources/HomeContainerFeature/HomeContainerCore.swift +++ b/AppPackage/Sources/HomeContainerFeature/HomeContainerCore.swift @@ -8,6 +8,7 @@ import Foundation import HomeFeature import MakePromise import SharedModel +import PromiseManagement public enum Tab: CaseIterable, Equatable { case home @@ -19,15 +20,19 @@ public struct HomeContainerCore: ReducerProtocol { public struct State: Equatable { var selectedTab: Tab var homeState: HomeCore.State + var managementPromiseState: PromiseManagement.State + @PresentationState var destinationState: DestinationState? public init( selectedTab: Tab = .home, homeState: HomeCore.State = .init(), + managementPromiseState: PromiseManagement.State = .init(), destinationState: DestinationState? = nil ) { self.selectedTab = selectedTab self.homeState = homeState + self.managementPromiseState = managementPromiseState self.destinationState = destinationState } } @@ -35,6 +40,7 @@ public struct HomeContainerCore: ReducerProtocol { public enum Action: Equatable { case selectedTabChanged(tab: Tab) case home(action: HomeCore.Action) + case management(action: PromiseManagement.Action) case destination(PresentationAction) } @@ -57,6 +63,12 @@ public struct HomeContainerCore: ReducerProtocol { child: HomeCore.init ) + Scope( + state: \.managementPromiseState, + action: /HomeContainerCore.Action.management, + child: PromiseManagement.init + ) + Reduce { state, action in switch action { case let .selectedTabChanged(tab: tab): @@ -129,6 +141,9 @@ public struct HomeContainerCore: ReducerProtocol { case .destination, .home: return .none + + case let .management(action): + return .none } } .ifLet(\.$destinationState, action: /Action.destination) { diff --git a/AppPackage/Sources/HomeContainerFeature/HomeContainerView.swift b/AppPackage/Sources/HomeContainerFeature/HomeContainerView.swift index e1b913b..13223fd 100644 --- a/AppPackage/Sources/HomeContainerFeature/HomeContainerView.swift +++ b/AppPackage/Sources/HomeContainerFeature/HomeContainerView.swift @@ -5,6 +5,7 @@ import Entity import HomeFeature import MakePromise import SharedModel +import PromiseManagement import SwiftUI import SwiftUIHelper import SwiftUINavigation @@ -101,7 +102,12 @@ public struct HomeContainerView: View { Color.clear case .promiseManagement: - Text("Promise") + ManagementView( + store: store.scope( + state: \.managementPromiseState, + action: HomeContainerCore.Action.management + ) + ) } } } From a917ba1a5f2ef38b72c314353f93b2e96e429b5b Mon Sep 17 00:00:00 2001 From: Jinsujin Date: Thu, 13 Apr 2023 20:31:09 +0900 Subject: [PATCH 2/7] =?UTF-8?q?[PI-43]=20=EC=95=BD=EC=86=8D=EC=9E=A1?= =?UTF-8?q?=EA=B8=B0=20delegate=20action=20=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HomeContainerFeature/HomeContainerCore.swift | 11 ++++++++++- .../Sources/PromiseManagement/ManagementView.swift | 14 +++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/AppPackage/Sources/HomeContainerFeature/HomeContainerCore.swift b/AppPackage/Sources/HomeContainerFeature/HomeContainerCore.swift index a60b30e..73674c9 100644 --- a/AppPackage/Sources/HomeContainerFeature/HomeContainerCore.swift +++ b/AppPackage/Sources/HomeContainerFeature/HomeContainerCore.swift @@ -142,7 +142,16 @@ public struct HomeContainerCore: ReducerProtocol { case .destination, .home: return .none - case let .management(action): + case let .management(.delegate(action)): + switch action { + case .makePromise: + state.destinationState = .makePromise(.init()) + return .none + default: + return .none + } + + case .management: return .none } } diff --git a/AppPackage/Sources/PromiseManagement/ManagementView.swift b/AppPackage/Sources/PromiseManagement/ManagementView.swift index 4fa17e0..cb69e54 100644 --- a/AppPackage/Sources/PromiseManagement/ManagementView.swift +++ b/AppPackage/Sources/PromiseManagement/ManagementView.swift @@ -45,6 +45,12 @@ public struct PromiseManagement: ReducerProtocol { case closeDetailButtonTapped case standbyFetchAllResponse([StandbyCell.State]) case confirmedFetchAllResponse([ConfirmedCell.State]) + case delegate(Delegate) + case makePromiseButtonTapped + + public enum Delegate: Equatable { + case makePromise + } } public var body: some ReducerProtocol { @@ -52,6 +58,12 @@ public struct PromiseManagement: ReducerProtocol { Reduce { state, action in switch action { + case .delegate: + return .none + + case .makePromiseButtonTapped: + return .send(.delegate(.makePromise)) + case let .standbyFetchAllResponse(result): let rows = IdentifiedArrayOf(uniqueElements: result) state.standbyTab = StandbyListFeature.State(rows: rows) @@ -209,7 +221,7 @@ public struct ManagementView: View { .toolbar { ToolbarItem(placement: .navigationBarTrailing) { Button { - print("Add Item") + viewStore.send(.makePromiseButtonTapped) } label: { PDS.Icon.plus.image } From 7c0a43d7de0a286560c12e9637982e37266c27d5 Mon Sep 17 00:00:00 2001 From: Jinsujin Date: Thu, 13 Apr 2023 21:06:29 +0900 Subject: [PATCH 3/7] =?UTF-8?q?[PI-43]=20=EC=95=BD=EC=86=8D=EA=B4=80?= =?UTF-8?q?=EB=A6=AC=EC=97=90=EC=84=9C=20=EC=83=81=EC=84=B8=ED=99=94?= =?UTF-8?q?=EB=A9=B4=20=EB=9D=84=EC=9A=B0=EB=8A=94=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 메인 화면에서 처리하기 위함 - 약속관리에서 상위로 전달하는 이벤트는 delegate Action 으로 정의 --- AppPackage/Package.swift | 1 + .../HomeContainerCore.swift | 8 ++- .../PromiseManagement/ManagementView.swift | 54 ++++--------------- 3 files changed, 18 insertions(+), 45 deletions(-) diff --git a/AppPackage/Package.swift b/AppPackage/Package.swift index db555f0..47e8a52 100644 --- a/AppPackage/Package.swift +++ b/AppPackage/Package.swift @@ -145,6 +145,7 @@ let package = Package( name: "HomeContainerFeature", dependencies: [ "DesignSystem", + "PromiseManagement", "MakePromise", "HomeFeature", "CalendarFeature", diff --git a/AppPackage/Sources/HomeContainerFeature/HomeContainerCore.swift b/AppPackage/Sources/HomeContainerFeature/HomeContainerCore.swift index 73674c9..3f4c7b4 100644 --- a/AppPackage/Sources/HomeContainerFeature/HomeContainerCore.swift +++ b/AppPackage/Sources/HomeContainerFeature/HomeContainerCore.swift @@ -147,7 +147,13 @@ public struct HomeContainerCore: ReducerProtocol { case .makePromise: state.destinationState = .makePromise(.init()) return .none - default: + + case let .standbyDetail(state): + // TODO: 상세화면 띄우기 + return .none + + case let .confirmedDetail(state): + // TODO: 상세화면 띄우기 return .none } diff --git a/AppPackage/Sources/PromiseManagement/ManagementView.swift b/AppPackage/Sources/PromiseManagement/ManagementView.swift index cb69e54..7fdc819 100644 --- a/AppPackage/Sources/PromiseManagement/ManagementView.swift +++ b/AppPackage/Sources/PromiseManagement/ManagementView.swift @@ -24,16 +24,13 @@ public struct PromiseManagement: ReducerProtocol { @BindingState var visibleTab: Tab = .standby var confirmedTab = ConfirmedListFeature.State() var standbyTab = StandbyListFeature.State() - @BindingState var detailItem: PromiseDetailViewState? public init( standbyRows: IdentifiedArrayOf = [], - confirmedRows: IdentifiedArrayOf = [], - detailItem: PromiseDetailViewState? = nil + confirmedRows: IdentifiedArrayOf = [] ) { standbyTab = StandbyListFeature.State(rows: standbyRows) confirmedTab = ConfirmedListFeature.State(rows: confirmedRows) - self.detailItem = detailItem } } @@ -42,14 +39,15 @@ public struct PromiseManagement: ReducerProtocol { case onAppear case standbyTab(StandbyListFeature.Action) case confirmedTab(ConfirmedListFeature.Action) - case closeDetailButtonTapped case standbyFetchAllResponse([StandbyCell.State]) case confirmedFetchAllResponse([ConfirmedCell.State]) - case delegate(Delegate) case makePromiseButtonTapped + case delegate(Delegate) public enum Delegate: Equatable { case makePromise + case confirmedDetail(PromiseDetailView.State) + case standbyDetail(PromiseDetailView.State) } } @@ -82,27 +80,22 @@ public struct PromiseManagement: ReducerProtocol { case let .confirmedTab(.delegate(action)): switch action { case let .showDetailView(item): - state.detailItem = PromiseDetailViewState( + + let detailState = PromiseDetailViewState( id: UUID(uuidString: String(item.id)) ?? UUID(), title: item.title, theme: item.theme, - - // MARK: - TODO must fix it - date: .now, place: item.place, participants: item.participants ) - return .none + return .send(.delegate(.confirmedDetail(detailState))) } - case .closeDetailButtonTapped: - state.detailItem = nil - return .none case let .standbyTab(.delegate(action)): switch action { case let .showDetailView(item): - state.detailItem = PromiseDetailViewState( + let detailState = PromiseDetailViewState( id: UUID(uuidString: String(item.id)) ?? UUID(), title: item.title, theme: "테마", @@ -110,7 +103,7 @@ public struct PromiseManagement: ReducerProtocol { place: "강남역", participants: item.members ) - return .none + return .send(.delegate(.standbyDetail(detailState))) } default: @@ -228,24 +221,6 @@ public struct ManagementView: View { } } .onAppear { viewStore.send(.onAppear) } - .fullScreenCover( - unwrapping: viewStore.binding(\.$detailItem) - ) { state in - NavigationStack { - PromiseDetailView(state: state.wrappedValue) - .toolbar { - ToolbarItem { - Button { - viewStore.send(.closeDetailButtonTapped) - } label: { - PDS.Icon.close.image - } - } - } - .navigationTitle("약속 상세보기") - .navigationBarTitleDisplayMode(.inline) - } - } } } } @@ -257,16 +232,7 @@ struct ManagementView_Previews: PreviewProvider { ManagementView(store: StoreOf( initialState: PromiseManagement.State( standbyRows: .mock, - confirmedRows: .mock, - detailItem: - PromiseDetailViewState( - id: UUID(), - title: "약속명", - theme: "여행", - date: .now, - place: "강남", - participants: ["정인혜", "이은영"] - ) + confirmedRows: .mock ), reducer: PromiseManagement()._printChanges() )) From 38cd9fe2f11d91a017b4315988c8ef408aa357f3 Mon Sep 17 00:00:00 2001 From: Jinsujin Date: Thu, 13 Apr 2023 21:34:55 +0900 Subject: [PATCH 4/7] =?UTF-8?q?[PI-43]=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20?= =?UTF-8?q?=EC=97=86=EC=9D=84=EB=95=8C=20=ED=99=94=EB=A9=B4=EC=9D=98=20?= =?UTF-8?q?=EC=95=BD=EC=86=8D=EC=9E=A1=EA=B8=B0=20=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/CommonView/EmptyDataView.swift | 1 - .../Confirmed/ConfirmedListView.swift | 16 +++++++++------- .../PromiseManagement/ManagementView.swift | 6 ++++++ .../Standby/StandbyListView.swift | 16 +++++++++------- 4 files changed, 24 insertions(+), 15 deletions(-) diff --git a/AppPackage/Sources/CommonView/EmptyDataView.swift b/AppPackage/Sources/CommonView/EmptyDataView.swift index 4538efd..dfebe08 100644 --- a/AppPackage/Sources/CommonView/EmptyDataView.swift +++ b/AppPackage/Sources/CommonView/EmptyDataView.swift @@ -61,7 +61,6 @@ public struct EmptyDataView: View { ) Button("약속잡기") { - // TODO: - 약속잡기 화면 이동 viewStore.send(.makePromiseButtonTapped) } .buttonStyle(RoundCornerButtonStyle()) diff --git a/AppPackage/Sources/PromiseManagement/Confirmed/ConfirmedListView.swift b/AppPackage/Sources/PromiseManagement/Confirmed/ConfirmedListView.swift index 4f7f8d4..3840a5b 100644 --- a/AppPackage/Sources/PromiseManagement/Confirmed/ConfirmedListView.swift +++ b/AppPackage/Sources/PromiseManagement/Confirmed/ConfirmedListView.swift @@ -26,6 +26,7 @@ public struct ConfirmedListFeature: ReducerProtocol { public enum Delegate: Equatable { case showDetailView(ConfirmedCell.State) + case showMakePromise } } @@ -42,10 +43,10 @@ public struct ConfirmedListFeature: ReducerProtocol { } return .send(.delegate(.showDetailView(selectedData))) - case .delegate: - return .none - case .emptyData(.delegate(.makePromise)): + return .send(.delegate(.showMakePromise)) + + case .delegate: return .none default: @@ -67,10 +68,11 @@ struct ConfirmedListView: View { WithViewStore(store, observe: { $0 }) { viewStore in if viewStore.rows.isEmpty { - EmptyDataView(store: self.store.scope( - state: \.emptyData, - action: ConfirmedListFeature.Action.emptyData - ) + EmptyDataView( + store: self.store.scope( + state: \.emptyData, + action: ConfirmedListFeature.Action.emptyData + ) ) } else { diff --git a/AppPackage/Sources/PromiseManagement/ManagementView.swift b/AppPackage/Sources/PromiseManagement/ManagementView.swift index 7fdc819..2e51754 100644 --- a/AppPackage/Sources/PromiseManagement/ManagementView.swift +++ b/AppPackage/Sources/PromiseManagement/ManagementView.swift @@ -90,6 +90,9 @@ public struct PromiseManagement: ReducerProtocol { participants: item.participants ) return .send(.delegate(.confirmedDetail(detailState))) + + case .showMakePromise: + return .send(.delegate(.makePromise)) } case let .standbyTab(.delegate(action)): @@ -104,6 +107,9 @@ public struct PromiseManagement: ReducerProtocol { participants: item.members ) return .send(.delegate(.standbyDetail(detailState))) + + case .showMakePromise: + return .send(.delegate(.makePromise)) } default: diff --git a/AppPackage/Sources/PromiseManagement/Standby/StandbyListView.swift b/AppPackage/Sources/PromiseManagement/Standby/StandbyListView.swift index dbc67c8..495f47c 100644 --- a/AppPackage/Sources/PromiseManagement/Standby/StandbyListView.swift +++ b/AppPackage/Sources/PromiseManagement/Standby/StandbyListView.swift @@ -26,6 +26,7 @@ public struct StandbyListFeature: ReducerProtocol { public enum Delegate: Equatable { case showDetailView(StandbyCell.State) + case showMakePromise } } @@ -38,10 +39,10 @@ public struct StandbyListFeature: ReducerProtocol { } return .send(.delegate(.showDetailView(selectedData))) - case .delegate: - return .none - case .emptyData(.delegate(.makePromise)): + return .send(.delegate(.showMakePromise)) + + case .delegate: return .none default: @@ -60,10 +61,11 @@ struct StandbyListView: View { var body: some View { WithViewStore(store, observe: { $0 }) { viewStore in if viewStore.rows.isEmpty { - EmptyDataView(store: self.store.scope( - state: \.emptyData, - action: StandbyListFeature.Action.emptyData - ) + EmptyDataView( + store: self.store.scope( + state: \.emptyData, + action: StandbyListFeature.Action.emptyData + ) ) } else { List { From a47d0dc561832ba407f23babd2fdb4a67938ed2a Mon Sep 17 00:00:00 2001 From: Jinsujin Date: Thu, 13 Apr 2023 21:38:58 +0900 Subject: [PATCH 5/7] =?UTF-8?q?[PI-43]=20Bundle=20Identifier=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 배포시 변경 필요했음 --- Planz.xcodeproj/project.pbxproj | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Planz.xcodeproj/project.pbxproj b/Planz.xcodeproj/project.pbxproj index 60b8aa2..3b26d2f 100644 --- a/Planz.xcodeproj/project.pbxproj +++ b/Planz.xcodeproj/project.pbxproj @@ -512,7 +512,7 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = "Team-Planz.Planz"; + PRODUCT_BUNDLE_IDENTIFIER = "com.Team-Planz.Planz"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; @@ -541,7 +541,7 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = "Team-Planz.Planz"; + PRODUCT_BUNDLE_IDENTIFIER = "com.Team-Planz.Planz"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; @@ -559,7 +559,7 @@ GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 16.0; MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = "Team-Planz.PlanzTests"; + PRODUCT_BUNDLE_IDENTIFIER = "com.Team-Planz.PlanzTests"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = NO; SWIFT_VERSION = 5.0; @@ -579,7 +579,7 @@ GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 16.0; MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = "Team-Planz.PlanzTests"; + PRODUCT_BUNDLE_IDENTIFIER = "com.Team-Planz.PlanzTests"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = NO; SWIFT_VERSION = 5.0; @@ -597,7 +597,7 @@ CURRENT_PROJECT_VERSION = 1; GENERATE_INFOPLIST_FILE = YES; MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = "Team-Planz.PlanzUITests"; + PRODUCT_BUNDLE_IDENTIFIER = "com.Team-Planz.PlanzUITests"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = NO; SWIFT_VERSION = 5.0; @@ -614,7 +614,7 @@ CURRENT_PROJECT_VERSION = 1; GENERATE_INFOPLIST_FILE = YES; MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = "Team-Planz.PlanzUITests"; + PRODUCT_BUNDLE_IDENTIFIER = "com.Team-Planz.PlanzUITests"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = NO; SWIFT_VERSION = 5.0; From d71adcfee2aacd12e85e4702b99bcd4567b35fa7 Mon Sep 17 00:00:00 2001 From: Jinsujin Date: Sun, 16 Apr 2023 23:05:20 +0900 Subject: [PATCH 6/7] =?UTF-8?q?[PI-43]=20=EB=AA=A8=EB=93=88=EB=AA=85,=20?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=EB=AA=85=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AppPackage/Package.swift | 6 +- .../HomeContainerCore.swift | 20 ++--- .../HomeContainerView.swift | 8 +- .../Common/RoleType.swift | 0 .../Common/View/ManagementTitleCellView.swift | 0 .../Confirmed/ConfirmedCellView.swift | 0 .../Confirmed/ConfirmedListView.swift | 0 .../HeaderTab/HeaderTabView.swift | 0 .../HeaderTab/Tab.swift | 0 .../ManagePromiseCore.swift} | 82 ++----------------- .../ManagePromiseView.swift | 81 ++++++++++++++++++ .../Standby/StandbyCellView.swift | 0 .../Standby/StandbyListView.swift | 0 13 files changed, 103 insertions(+), 94 deletions(-) rename AppPackage/Sources/{PromiseManagement => ManagePromiseFeature}/Common/RoleType.swift (100%) rename AppPackage/Sources/{PromiseManagement => ManagePromiseFeature}/Common/View/ManagementTitleCellView.swift (100%) rename AppPackage/Sources/{PromiseManagement => ManagePromiseFeature}/Confirmed/ConfirmedCellView.swift (100%) rename AppPackage/Sources/{PromiseManagement => ManagePromiseFeature}/Confirmed/ConfirmedListView.swift (100%) rename AppPackage/Sources/{PromiseManagement => ManagePromiseFeature}/HeaderTab/HeaderTabView.swift (100%) rename AppPackage/Sources/{PromiseManagement => ManagePromiseFeature}/HeaderTab/Tab.swift (100%) rename AppPackage/Sources/{PromiseManagement/ManagementView.swift => ManagePromiseFeature/ManagePromiseCore.swift} (67%) create mode 100644 AppPackage/Sources/ManagePromiseFeature/ManagePromiseView.swift rename AppPackage/Sources/{PromiseManagement => ManagePromiseFeature}/Standby/StandbyCellView.swift (100%) rename AppPackage/Sources/{PromiseManagement => ManagePromiseFeature}/Standby/StandbyListView.swift (100%) diff --git a/AppPackage/Package.swift b/AppPackage/Package.swift index 47e8a52..93e887b 100644 --- a/AppPackage/Package.swift +++ b/AppPackage/Package.swift @@ -11,7 +11,7 @@ let package = Package( "TimeTableFeature", "Share", "MakePromise", - "PromiseManagement", + "ManagePromiseFeature", "LoginFeature", "SwiftUIHelper", "Entity" @@ -122,7 +122,7 @@ let package = Package( ] ), .target( - name: "PromiseManagement", + name: "ManagePromiseFeature", dependencies: [ "DesignSystem", "CommonView", @@ -145,7 +145,7 @@ let package = Package( name: "HomeContainerFeature", dependencies: [ "DesignSystem", - "PromiseManagement", + "ManagePromiseFeature", "MakePromise", "HomeFeature", "CalendarFeature", diff --git a/AppPackage/Sources/HomeContainerFeature/HomeContainerCore.swift b/AppPackage/Sources/HomeContainerFeature/HomeContainerCore.swift index 3f4c7b4..83a62ee 100644 --- a/AppPackage/Sources/HomeContainerFeature/HomeContainerCore.swift +++ b/AppPackage/Sources/HomeContainerFeature/HomeContainerCore.swift @@ -8,7 +8,7 @@ import Foundation import HomeFeature import MakePromise import SharedModel -import PromiseManagement +import ManagePromiseFeature public enum Tab: CaseIterable, Equatable { case home @@ -20,19 +20,19 @@ public struct HomeContainerCore: ReducerProtocol { public struct State: Equatable { var selectedTab: Tab var homeState: HomeCore.State - var managementPromiseState: PromiseManagement.State + var managePromiseState: ManagePromiseCore.State @PresentationState var destinationState: DestinationState? public init( selectedTab: Tab = .home, homeState: HomeCore.State = .init(), - managementPromiseState: PromiseManagement.State = .init(), + managePromiseState: ManagePromiseCore.State = .init(), destinationState: DestinationState? = nil ) { self.selectedTab = selectedTab self.homeState = homeState - self.managementPromiseState = managementPromiseState + self.managePromiseState = managePromiseState self.destinationState = destinationState } } @@ -40,7 +40,7 @@ public struct HomeContainerCore: ReducerProtocol { public enum Action: Equatable { case selectedTabChanged(tab: Tab) case home(action: HomeCore.Action) - case management(action: PromiseManagement.Action) + case manage(action: ManagePromiseCore.Action) case destination(PresentationAction) } @@ -64,9 +64,9 @@ public struct HomeContainerCore: ReducerProtocol { ) Scope( - state: \.managementPromiseState, - action: /HomeContainerCore.Action.management, - child: PromiseManagement.init + state: \.managePromiseState, + action: /HomeContainerCore.Action.manage, + child: ManagePromiseCore.init ) Reduce { state, action in @@ -142,7 +142,7 @@ public struct HomeContainerCore: ReducerProtocol { case .destination, .home: return .none - case let .management(.delegate(action)): + case let .manage(.delegate(action)): switch action { case .makePromise: state.destinationState = .makePromise(.init()) @@ -157,7 +157,7 @@ public struct HomeContainerCore: ReducerProtocol { return .none } - case .management: + case .manage: return .none } } diff --git a/AppPackage/Sources/HomeContainerFeature/HomeContainerView.swift b/AppPackage/Sources/HomeContainerFeature/HomeContainerView.swift index 13223fd..67a1a4f 100644 --- a/AppPackage/Sources/HomeContainerFeature/HomeContainerView.swift +++ b/AppPackage/Sources/HomeContainerFeature/HomeContainerView.swift @@ -5,7 +5,7 @@ import Entity import HomeFeature import MakePromise import SharedModel -import PromiseManagement +import ManagePromiseFeature import SwiftUI import SwiftUIHelper import SwiftUINavigation @@ -102,10 +102,10 @@ public struct HomeContainerView: View { Color.clear case .promiseManagement: - ManagementView( + ManagePromiseView( store: store.scope( - state: \.managementPromiseState, - action: HomeContainerCore.Action.management + state: \.managePromiseState, + action: HomeContainerCore.Action.manage ) ) } diff --git a/AppPackage/Sources/PromiseManagement/Common/RoleType.swift b/AppPackage/Sources/ManagePromiseFeature/Common/RoleType.swift similarity index 100% rename from AppPackage/Sources/PromiseManagement/Common/RoleType.swift rename to AppPackage/Sources/ManagePromiseFeature/Common/RoleType.swift diff --git a/AppPackage/Sources/PromiseManagement/Common/View/ManagementTitleCellView.swift b/AppPackage/Sources/ManagePromiseFeature/Common/View/ManagementTitleCellView.swift similarity index 100% rename from AppPackage/Sources/PromiseManagement/Common/View/ManagementTitleCellView.swift rename to AppPackage/Sources/ManagePromiseFeature/Common/View/ManagementTitleCellView.swift diff --git a/AppPackage/Sources/PromiseManagement/Confirmed/ConfirmedCellView.swift b/AppPackage/Sources/ManagePromiseFeature/Confirmed/ConfirmedCellView.swift similarity index 100% rename from AppPackage/Sources/PromiseManagement/Confirmed/ConfirmedCellView.swift rename to AppPackage/Sources/ManagePromiseFeature/Confirmed/ConfirmedCellView.swift diff --git a/AppPackage/Sources/PromiseManagement/Confirmed/ConfirmedListView.swift b/AppPackage/Sources/ManagePromiseFeature/Confirmed/ConfirmedListView.swift similarity index 100% rename from AppPackage/Sources/PromiseManagement/Confirmed/ConfirmedListView.swift rename to AppPackage/Sources/ManagePromiseFeature/Confirmed/ConfirmedListView.swift diff --git a/AppPackage/Sources/PromiseManagement/HeaderTab/HeaderTabView.swift b/AppPackage/Sources/ManagePromiseFeature/HeaderTab/HeaderTabView.swift similarity index 100% rename from AppPackage/Sources/PromiseManagement/HeaderTab/HeaderTabView.swift rename to AppPackage/Sources/ManagePromiseFeature/HeaderTab/HeaderTabView.swift diff --git a/AppPackage/Sources/PromiseManagement/HeaderTab/Tab.swift b/AppPackage/Sources/ManagePromiseFeature/HeaderTab/Tab.swift similarity index 100% rename from AppPackage/Sources/PromiseManagement/HeaderTab/Tab.swift rename to AppPackage/Sources/ManagePromiseFeature/HeaderTab/Tab.swift diff --git a/AppPackage/Sources/PromiseManagement/ManagementView.swift b/AppPackage/Sources/ManagePromiseFeature/ManagePromiseCore.swift similarity index 67% rename from AppPackage/Sources/PromiseManagement/ManagementView.swift rename to AppPackage/Sources/ManagePromiseFeature/ManagePromiseCore.swift index 2e51754..1abb210 100644 --- a/AppPackage/Sources/PromiseManagement/ManagementView.swift +++ b/AppPackage/Sources/ManagePromiseFeature/ManagePromiseCore.swift @@ -1,21 +1,18 @@ // -// ManagementView.swift -// Planz +// ManagePromiseCore.swift // -// Created by Sujin Jin on 2023/02/25. -// Copyright © 2023 Team-Planz. All rights reserved. +// +// Created by Sujin Jin on 2023/04/16. // import APIClient import APIClientLive -import CommonView import ComposableArchitecture -import DesignSystem import Entity import SharedModel -import SwiftUI +import Foundation -public struct PromiseManagement: ReducerProtocol { +public struct ManagePromiseCore: ReducerProtocol { public init() {} @Dependency(\.apiClient) var apiClient @@ -175,72 +172,3 @@ public struct PromiseManagement: ReducerProtocol { } catch {} } } - -public struct ManagementView: View { - private let store: StoreOf - - public init(store: StoreOf) { - self.store = store - } - - public var body: some View { - WithViewStore(self.store) { viewStore in - NavigationView { - GeometryReader { geo in - VStack { - HeaderTabView( - activeTab: - viewStore.binding(\.$visibleTab), - tabs: Tab.allCases, - fullWidth: geo.size.width - 40 - ) - - TabView(selection: - viewStore.binding(\.$visibleTab) - ) { - StandbyListView(store: self.store.scope( - state: \.standbyTab, - action: PromiseManagement.Action.standbyTab - ) - ) - .tag(Tab.standby) - - ConfirmedListView(store: store.scope( - state: \.confirmedTab, - action: PromiseManagement.Action.confirmedTab - )) - .tag(Tab.confirmed) - } - .animation(.default, value: viewStore.visibleTab.rawValue) - .frame(width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height - 200) - .tabViewStyle(.page(indexDisplayMode: .never)) - } - .navigationTitle("약속 관리") - .navigationBarTitleDisplayMode(.inline) - .toolbar { - ToolbarItem(placement: .navigationBarTrailing) { - Button { - viewStore.send(.makePromiseButtonTapped) - } label: { - PDS.Icon.plus.image - } - } - } - .onAppear { viewStore.send(.onAppear) } - } - } - } - } -} - -struct ManagementView_Previews: PreviewProvider { - static var previews: some View { - ManagementView(store: StoreOf( - initialState: PromiseManagement.State( - standbyRows: .mock, - confirmedRows: .mock - ), - reducer: PromiseManagement()._printChanges() - )) - } -} diff --git a/AppPackage/Sources/ManagePromiseFeature/ManagePromiseView.swift b/AppPackage/Sources/ManagePromiseFeature/ManagePromiseView.swift new file mode 100644 index 0000000..fdbbf7e --- /dev/null +++ b/AppPackage/Sources/ManagePromiseFeature/ManagePromiseView.swift @@ -0,0 +1,81 @@ +// +// ManagePromiseView.swift +// Planz +// +// Created by Sujin Jin on 2023/02/25. +// Copyright © 2023 Team-Planz. All rights reserved. +// + +import CommonView +import ComposableArchitecture +import DesignSystem +import SwiftUI + +public struct ManagePromiseView: View { + private let store: StoreOf + + public init(store: StoreOf) { + self.store = store + } + + public var body: some View { + WithViewStore(self.store) { viewStore in + NavigationView { + GeometryReader { geo in + VStack { + HeaderTabView( + activeTab: + viewStore.binding(\.$visibleTab), + tabs: Tab.allCases, + fullWidth: geo.size.width - 40 + ) + + TabView(selection: + viewStore.binding(\.$visibleTab) + ) { + StandbyListView(store: self.store.scope( + state: \.standbyTab, + action: ManagePromiseCore.Action.standbyTab + ) + ) + .tag(Tab.standby) + + ConfirmedListView(store: store.scope( + state: \.confirmedTab, + action: ManagePromiseCore.Action.confirmedTab + )) + .tag(Tab.confirmed) + } + .animation(.default, value: viewStore.visibleTab.rawValue) + .frame(width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height - 200) + .tabViewStyle(.page(indexDisplayMode: .never)) + } + .navigationTitle("약속 관리") + .navigationBarTitleDisplayMode(.inline) + .toolbar { + ToolbarItem(placement: .navigationBarTrailing) { + Button { + viewStore.send(.makePromiseButtonTapped) + } label: { + PDS.Icon.plus.image + } + } + } + .onAppear { viewStore.send(.onAppear) } + } + } + } + } +} + +struct ManagementView_Previews: PreviewProvider { + static var previews: some View { + ManagePromiseView(store: StoreOf( + initialState: ManagePromiseCore.State( + standbyRows: .mock, + confirmedRows: .mock + ), + reducer: ManagePromiseCore()._printChanges() + )) + } +} diff --git a/AppPackage/Sources/PromiseManagement/Standby/StandbyCellView.swift b/AppPackage/Sources/ManagePromiseFeature/Standby/StandbyCellView.swift similarity index 100% rename from AppPackage/Sources/PromiseManagement/Standby/StandbyCellView.swift rename to AppPackage/Sources/ManagePromiseFeature/Standby/StandbyCellView.swift diff --git a/AppPackage/Sources/PromiseManagement/Standby/StandbyListView.swift b/AppPackage/Sources/ManagePromiseFeature/Standby/StandbyListView.swift similarity index 100% rename from AppPackage/Sources/PromiseManagement/Standby/StandbyListView.swift rename to AppPackage/Sources/ManagePromiseFeature/Standby/StandbyListView.swift From cd3d95046019d31a9f6fe4408053ecd42afd4574 Mon Sep 17 00:00:00 2001 From: Jinsujin Date: Sun, 16 Apr 2023 23:21:31 +0900 Subject: [PATCH 7/7] =?UTF-8?q?[PI-43]=20=EC=95=BD=EC=86=8D=20=EC=83=81?= =?UTF-8?q?=EC=84=B8=ED=99=94=EB=A9=B4=20State=20=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit rebase 후 빌드에러 해결 --- .../Sources/HomeContainerFeature/HomeContainerCore.swift | 2 +- .../Sources/HomeContainerFeature/HomeContainerView.swift | 2 +- .../Sources/ManagePromiseFeature/ManagePromiseCore.swift | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/AppPackage/Sources/HomeContainerFeature/HomeContainerCore.swift b/AppPackage/Sources/HomeContainerFeature/HomeContainerCore.swift index 83a62ee..c36f936 100644 --- a/AppPackage/Sources/HomeContainerFeature/HomeContainerCore.swift +++ b/AppPackage/Sources/HomeContainerFeature/HomeContainerCore.swift @@ -7,8 +7,8 @@ import ComposableArchitecture import Foundation import HomeFeature import MakePromise -import SharedModel import ManagePromiseFeature +import SharedModel public enum Tab: CaseIterable, Equatable { case home diff --git a/AppPackage/Sources/HomeContainerFeature/HomeContainerView.swift b/AppPackage/Sources/HomeContainerFeature/HomeContainerView.swift index 67a1a4f..f5caf66 100644 --- a/AppPackage/Sources/HomeContainerFeature/HomeContainerView.swift +++ b/AppPackage/Sources/HomeContainerFeature/HomeContainerView.swift @@ -4,8 +4,8 @@ import DesignSystem import Entity import HomeFeature import MakePromise -import SharedModel import ManagePromiseFeature +import SharedModel import SwiftUI import SwiftUIHelper import SwiftUINavigation diff --git a/AppPackage/Sources/ManagePromiseFeature/ManagePromiseCore.swift b/AppPackage/Sources/ManagePromiseFeature/ManagePromiseCore.swift index 1abb210..481ac07 100644 --- a/AppPackage/Sources/ManagePromiseFeature/ManagePromiseCore.swift +++ b/AppPackage/Sources/ManagePromiseFeature/ManagePromiseCore.swift @@ -9,8 +9,8 @@ import APIClient import APIClientLive import ComposableArchitecture import Entity -import SharedModel import Foundation +import SharedModel public struct ManagePromiseCore: ReducerProtocol { public init() {} @@ -43,8 +43,8 @@ public struct ManagePromiseCore: ReducerProtocol { public enum Delegate: Equatable { case makePromise - case confirmedDetail(PromiseDetailView.State) - case standbyDetail(PromiseDetailView.State) + case confirmedDetail(PromiseDetailViewState) + case standbyDetail(PromiseDetailViewState) } }