Skip to content

Commit

Permalink
[PI-43] 모듈명, 파일명 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
Jinsujin committed Apr 16, 2023
1 parent a47d0dc commit d71adcf
Show file tree
Hide file tree
Showing 13 changed files with 103 additions and 94 deletions.
6 changes: 3 additions & 3 deletions AppPackage/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let package = Package(
"TimeTableFeature",
"Share",
"MakePromise",
"PromiseManagement",
"ManagePromiseFeature",
"LoginFeature",
"SwiftUIHelper",
"Entity"
Expand Down Expand Up @@ -122,7 +122,7 @@ let package = Package(
]
),
.target(
name: "PromiseManagement",
name: "ManagePromiseFeature",
dependencies: [
"DesignSystem",
"CommonView",
Expand All @@ -145,7 +145,7 @@ let package = Package(
name: "HomeContainerFeature",
dependencies: [
"DesignSystem",
"PromiseManagement",
"ManagePromiseFeature",
"MakePromise",
"HomeFeature",
"CalendarFeature",
Expand Down
20 changes: 10 additions & 10 deletions AppPackage/Sources/HomeContainerFeature/HomeContainerCore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Foundation
import HomeFeature
import MakePromise
import SharedModel
import PromiseManagement
import ManagePromiseFeature

public enum Tab: CaseIterable, Equatable {
case home
Expand All @@ -20,27 +20,27 @@ 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
}
}

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<DestinationAction>)
}

Expand All @@ -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> { state, action in
Expand Down Expand Up @@ -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())
Expand All @@ -157,7 +157,7 @@ public struct HomeContainerCore: ReducerProtocol {
return .none
}

case .management:
case .manage:
return .none
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Entity
import HomeFeature
import MakePromise
import SharedModel
import PromiseManagement
import ManagePromiseFeature
import SwiftUI
import SwiftUIHelper
import SwiftUINavigation
Expand Down Expand Up @@ -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
)
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -175,72 +172,3 @@ public struct PromiseManagement: ReducerProtocol {
} catch {}
}
}

public struct ManagementView: View {
private let store: StoreOf<PromiseManagement>

public init(store: StoreOf<PromiseManagement>) {
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<PromiseManagement>(
initialState: PromiseManagement.State(
standbyRows: .mock,
confirmedRows: .mock
),
reducer: PromiseManagement()._printChanges()
))
}
}
81 changes: 81 additions & 0 deletions AppPackage/Sources/ManagePromiseFeature/ManagePromiseView.swift
Original file line number Diff line number Diff line change
@@ -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<ManagePromiseCore>

public init(store: StoreOf<ManagePromiseCore>) {
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<ManagePromiseCore>(
initialState: ManagePromiseCore.State(
standbyRows: .mock,
confirmedRows: .mock
),
reducer: ManagePromiseCore()._printChanges()
))
}
}

0 comments on commit d71adcf

Please sign in to comment.