Skip to content

Commit

Permalink
[feat] #154 카테고리 선택 핸들링 로직 작성
Browse files Browse the repository at this point in the history
  • Loading branch information
ShapeKim98 committed Oct 25, 2024
1 parent fba9734 commit 4d62a4c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ private extension PokitSplitFeature {
switch action {
case let .카테고리_상세_활성화(category):
state.카테고리상세 = .init(category: category)
return .none
return .send(.카테고리상세(.delegate(.카테고리_내_컨텐츠_목록_조회)))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ public struct ContentSettingFeature {
case 컨텐츠_수정_API
case 컨텐츠_추가_API
case 클립보드_감지
case 선택한_포킷_인메모리_구독
}

public enum ScopeAction: Equatable { case 없음 }
Expand Down Expand Up @@ -189,7 +190,8 @@ private extension ContentSettingFeature {
var mergeEffect: [Effect<Action>] = [
.send(.async(.카테고리_목록_조회_API)),
.send(.inner(.URL_유효성_확인)),
.send(.async(.클립보드_감지))
.send(.async(.클립보드_감지)),
.send(.async(.선택한_포킷_인메모리_구독), animation: .pokitDissolve)
]
if let id = state.domain.contentId {
mergeEffect.append(.send(.async(.컨텐츠_상세_조회_API(id: id))))
Expand Down Expand Up @@ -330,10 +332,10 @@ private extension ContentSettingFeature {
return .run { send in
if let sharedId {
let category = try await categoryClient.카테고리_상세_조회("\(sharedId)").toDomain()
await send(.inner(.카테고리_상세_조회_API_반영(category: category)))
await send(.inner(.카테고리_상세_조회_API_반영(category: category)), animation: .pokitDissolve)
} else if let id {
let category = try await categoryClient.카테고리_상세_조회("\(id)").toDomain()
await send(.inner(.카테고리_상세_조회_API_반영(category: category)))
await send(.inner(.카테고리_상세_조회_API_반영(category: category)), animation: .pokitDissolve)
}
}
case .카테고리_목록_조회_API:
Expand Down Expand Up @@ -390,6 +392,12 @@ private extension ContentSettingFeature {
await send(.inner(.linkPopup(url)), animation: .pokitSpring)
}
}
case .선택한_포킷_인메모리_구독:
return .run { [categoryId = state.$categoryId] send in
for await _ in categoryId.publisher.values {
await send(.async(.카테고리_목록_조회_API), animation: .pokitDissolve)
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ private extension PokitRootFeature {
return .run { send in await send(.inner(.카테고리_시트_활성화(true))) }

case .카테고리_눌렀을때(let category):
return .run { send in await send(.delegate(.categoryTapped(category))) }
return .run { send in await send(.delegate(.categoryTapped(category)), animation: .pokitDissolve) }

/// - 링크 아이템을 눌렀을 때
case .컨텐츠_항목_눌렀을때(let selectedItem):
Expand Down
2 changes: 1 addition & 1 deletion Projects/Util/Sources/Extension/UIDevice+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by 김도형 on 10/24/24.
//

import UIKit
import SwiftUI

public extension UIDevice {
static let device = UIDevice.current.userInterfaceIdiom
Expand Down

0 comments on commit 4d62a4c

Please sign in to comment.