From d71adcfee2aacd12e85e4702b99bcd4567b35fa7 Mon Sep 17 00:00:00 2001 From: Jinsujin Date: Sun, 16 Apr 2023 23:05:20 +0900 Subject: [PATCH] =?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