Skip to content

Commit

Permalink
[design] #154 PokitSplit 모달 시트 연결
Browse files Browse the repository at this point in the history
  • Loading branch information
ShapeKim98 committed Oct 26, 2024
1 parent 89ef1b2 commit 73a448a
Show file tree
Hide file tree
Showing 10 changed files with 106 additions and 34 deletions.
1 change: 0 additions & 1 deletion Projects/App/Sources/MainTab/MainTabFeatureView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ private extension MainTabView {
.frame(width: 60, height: 60)
}
}
.pokitMaxWidth()
.animation(.pokitDissolve, value: store.selectedTab)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,21 @@ public struct MainTabSplitFeature {
private extension MainTabSplitFeature {
/// - View Effect
func handleViewAction(_ action: Action.View, state: inout State) -> Effect<Action> {
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
Expand Down
55 changes: 38 additions & 17 deletions Projects/App/Sources/MainTabSplit/Pokit/PokitSplitFeature.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public struct PokitSplitFeature {
var 설정: PokitSettingFeature.State?
@Presents
var 링크상세: ContentDetailFeature.State?
@Presents
var 알람: PokitAlertBoxFeature.State?

@Shared(.inMemory("SelectCategory"))
var categoryId: Int?
Expand All @@ -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<PokitCategorySettingFeature.Action>)
case 검색(PresentationAction<PokitSearchFeature.Action>)
case 설정(PresentationAction<PokitSettingFeature.Action>)
case 링크상세(PresentationAction<ContentDetailFeature.Action>)
case 알람(PresentationAction<PokitAlertBoxFeature.Action>)

@CasePathable
public enum View: Equatable, BindableAction {
case binding(BindingAction<State>)

case 뷰가_나타났을때
case 링크추가_버튼_눌렀을때
case 포킷추가_버튼_눌렀을때
case 검색_버튼_눌렀을때
case 알람_버튼_눌렀을때
case 설정_버튼_눌렀을때
Expand All @@ -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<PokitCategorySettingFeature.Action>)
case 검색(PresentationAction<PokitSearchFeature.Action>)
case 설정(PresentationAction<PokitSettingFeature.Action>)
case 링크상세(PresentationAction<ContentDetailFeature.Action>)
case 알람(PresentationAction<PokitAlertBoxFeature.Action>)
}

public enum DelegateAction: Equatable { case 없음 }
public enum DelegateAction: Equatable {
case 링크추가및수정_활성화
}
}

/// - Initiallizer
Expand Down Expand Up @@ -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)))
}
}

Expand All @@ -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
Expand All @@ -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
}
}
Expand Down Expand Up @@ -235,12 +249,19 @@ private extension PokitSplitFeature {

case .링크상세:
return .none

case .알람:
return .none
}
}

/// - Delegate Effect
func handleDelegateAction(_ action: Action.DelegateAction, state: inout State) -> Effect<Action> {
return .none
switch action {
case .링크추가및수정_활성화:
state.columnVisibility = .all
return .none
}
}
}

Expand Down
52 changes: 45 additions & 7 deletions Projects/App/Sources/MainTabSplit/Pokit/PokitSplitView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
}
}
Expand Down Expand Up @@ -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),
Expand Down
1 change: 0 additions & 1 deletion Projects/DSKit/Sources/Components/PokitAlert.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ public struct PokitAlert: View {
)
.background()
}
.pokitMaxWidth()
}
.pokitPresentationBackground()
.pokitPresentationCornerRadius()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import SwiftUI
import ComposableArchitecture
import Domain
import DSKit
import Util
import NukeUI

@ViewAction(for: PokitCategorySettingFeature.self)
Expand All @@ -35,7 +36,6 @@ public extension PokitCategorySettingView {
}
.padding(.horizontal, 20)
.padding(.top, 16)
.pokitMaxWidth()
.pokitNavigationBar { navigationBar }
.ignoresSafeArea(edges: isFocused ? [] : .bottom)
.sheet(isPresented: $store.isProfileSheetPresented) {
Expand All @@ -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)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ public extension ContentSettingView {
)
}
}
.pokitMaxWidth()
}

let isDisable = store.urlText.isEmpty || store.title.isEmpty || store.memoTextAreaState == .error(message: "최대 100자까지 입력가능합니다.")
Expand All @@ -78,7 +77,6 @@ public extension ContentSettingView {
action: { send(.저장_버튼_눌렀을때) }
)
.padding(.horizontal, 20)
.pokitMaxWidth()
}
.pokitNavigationBar { navigationBar }
.ignoresSafeArea(edges: focusedType == nil ? .bottom : [])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import SwiftUI
import ComposableArchitecture
import DSKit
import Domain
import Util
import NukeUI

@ViewAction(for: PokitAlertBoxFeature.self)
Expand Down Expand Up @@ -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)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import SwiftUI

import ComposableArchitecture
import DSKit
import Util

@ViewAction(for: PokitSearchFeature.self)
public struct PokitSearchView: View {
Expand Down Expand Up @@ -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) }
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import SwiftUI

import ComposableArchitecture
import DSKit
import Util

@ViewAction(for: PokitSettingFeature.self)
public struct PokitSettingView: View {
Expand Down Expand Up @@ -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)
}
}
Expand Down

0 comments on commit 73a448a

Please sign in to comment.