From ad5a996d59a7922fc9860261ad2b90d466d27566 Mon Sep 17 00:00:00 2001 From: minhokim Date: Sun, 12 Jan 2025 15:56:14 +0900 Subject: [PATCH] =?UTF-8?q?[feat]=20#177=20=ED=8F=AC=ED=82=B7=20=EC=9D=B4?= =?UTF-8?q?=EB=8F=99=20=EC=84=B1=EA=B3=B5=EC=8B=9C=20=ED=8C=9D=EC=97=85=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../App/Sources/MainTab/MainTabPath.swift | 4 +++ .../Sources/PokitLinkEditFeature.swift | 28 +++++++++++-------- .../Sources/PokitRootFeature.swift | 8 +++++- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/Projects/App/Sources/MainTab/MainTabPath.swift b/Projects/App/Sources/MainTab/MainTabPath.swift index 21ec7cfd..11fba4db 100644 --- a/Projects/App/Sources/MainTab/MainTabPath.swift +++ b/Projects/App/Sources/MainTab/MainTabPath.swift @@ -196,6 +196,10 @@ public extension MainTabFeature { let .path(.element(_, action: .포킷추가및수정(.delegate(.linkCopyDetected(url))))), let .path(.element(_, action: .링크목록(.delegate(.linkCopyDetected(url))))): return .run { send in await send(.inner(.linkCopySuccess(url)), animation: .pokitSpring) } + /// 바텀메세지 + case let .pokit(.delegate(.linkPopup(text))): + state.linkPopup = .text(title: text) + return .none /// 링크목록 `안읽음` case .remind(.delegate(.링크목록_안읽음)): state.path.append(.링크목록(ContentListFeature.State(contentType: .unread))) diff --git a/Projects/Feature/FeaturePokit/Sources/PokitLinkEditFeature.swift b/Projects/Feature/FeaturePokit/Sources/PokitLinkEditFeature.swift index 6b118179..94c34d62 100644 --- a/Projects/Feature/FeaturePokit/Sources/PokitLinkEditFeature.swift +++ b/Projects/Feature/FeaturePokit/Sources/PokitLinkEditFeature.swift @@ -85,7 +85,7 @@ public struct PokitLinkEditFeature { } public enum DelegateAction: Equatable { - case 링크_편집_종료(items: [BaseContentItem]) + case 링크_편집_종료(items: [BaseContentItem], type: LinkEditType) } } @@ -135,8 +135,7 @@ private extension PokitLinkEditFeature { return .none case .dismiss: - return .send(.delegate(.링크_편집_종료(items: state.list.elements))) -// return .run { _ in await dismiss() } + return .send(.delegate(.링크_편집_종료(items: state.list.elements, type: .dismiss))) case .뷰가_나타났을때: return fetchCateogryList() @@ -170,7 +169,7 @@ private extension PokitLinkEditFeature { .send(.inner(.경고팝업_활성화(.error(title: "링크를 선택해주세요.")))) ) } else { - return moveContentList(categoryId: pokit.id, state: &state) + return moveContentList(category: pokit, state: &state) } case .링크팝업_버튼_눌렀을때: @@ -212,7 +211,7 @@ private extension PokitLinkEditFeature { case let .미분류_API_반영(type): /// 1. 시트 내리기 - if type == .링크이동 { + if case .링크이동 = type { state.categorySelectSheetPresetend = false } else { state.linkDeleteSheetPresented = false @@ -222,10 +221,16 @@ private extension PokitLinkEditFeature { .map { $0.id } .forEach { state.list.remove(id: $0) } state.selectedItems.removeAll() - + /// 3. 분류가 남은 링크가 없을 때 편집하기 종료 if state.list.isEmpty { - return .send(.delegate(.링크_편집_종료(items: []))) + return .send(.delegate(.링크_편집_종료(items: [], type: type))) + } + /// 4. 링크이동을 했을 때 바텀 메세지 출력 + if case let .링크이동(categoryName) = type { + state.linkPopup = .text(title: "\(categoryName)\n카테고리로 이동되었습니다.") + return .none } + return .none } } @@ -286,12 +291,12 @@ private extension PokitLinkEditFeature { } /// 미분류 링크 카테고리 이동 API - func moveContentList(categoryId: Int, state: inout State) -> Effect { + func moveContentList(category: BaseCategoryItem, state: inout State) -> Effect { return .run { [contentIds = state.selectedItems] send in let contentIds = contentIds.map { $0.id } - let request = ContentMoveRequest(contentIds: contentIds, categoryId: categoryId) + let request = ContentMoveRequest(contentIds: contentIds, categoryId: category.id) try await contentClient.미분류_링크_포킷_이동(request) - await send(.inner(.미분류_API_반영(.링크이동))) + await send(.inner(.미분류_API_반영(.링크이동(categoryName: category.categoryName)))) } catch: { error, send in await send(.inner(.error(error))) } @@ -309,7 +314,8 @@ private extension PokitLinkEditFeature { } public extension PokitLinkEditFeature { enum LinkEditType: Equatable { - case 링크이동 + case dismiss + case 링크이동(categoryName: String) case 링크삭제 } } diff --git a/Projects/Feature/FeaturePokit/Sources/PokitRootFeature.swift b/Projects/Feature/FeaturePokit/Sources/PokitRootFeature.swift index 4b43571f..b72bf872 100644 --- a/Projects/Feature/FeaturePokit/Sources/PokitRootFeature.swift +++ b/Projects/Feature/FeaturePokit/Sources/PokitRootFeature.swift @@ -130,6 +130,7 @@ public struct PokitRootFeature { case settingButtonTapped case categoryTapped(BaseCategoryItem) + case linkPopup(text: String) case 수정하기(BaseCategoryItem) case 링크수정하기(id: Int) /// 링크상세로 이동 @@ -544,7 +545,7 @@ private extension PokitRootFeature { case .contents: return .none - case let .linkEdit(.presented(.delegate(.링크_편집_종료(list)))): + case let .linkEdit(.presented(.delegate(.링크_편집_종료(list, type)))): /// 링크가 비어있을때는 전부 삭제 if list.isEmpty { state.contents.removeAll() @@ -562,6 +563,11 @@ private extension PokitRootFeature { state.contents = linkIds } state.linkEdit = nil + + if case let .링크이동(categoryName) = type { + let text = "\(categoryName)\n카테고리로 이동되었습니다." + return .send(.delegate(.linkPopup(text: text))) + } return .none case .linkEdit: