diff --git a/Projects/Feature/FeatureContentList/Sources/ContentList/ContentListFeature.swift b/Projects/Feature/FeatureContentList/Sources/ContentList/ContentListFeature.swift index 72dd4f95..4df8caa6 100644 --- a/Projects/Feature/FeatureContentList/Sources/ContentList/ContentListFeature.swift +++ b/Projects/Feature/FeatureContentList/Sources/ContentList/ContentListFeature.swift @@ -94,7 +94,7 @@ public struct ContentListFeature { case 즐겨찾기_링크모음_조회 case 컨텐츠_삭제(id: Int) case pagenation_네트워크 - case 컨텐츠_목록_갱신(size: Int) + case 컨텐츠_목록_갱신 } public enum ScopeAction: Equatable { @@ -177,19 +177,12 @@ private extension ContentListFeature { return .run { _ in await dismiss() } case .contentListViewOnAppeared: - return .run { [ - type = state.contentType, - size = state.domain.contentList.data?.count - ] send in - if let size { - await send(.async(.컨텐츠_목록_갱신(size: size)), animation: .pokitSpring) - } else { - switch type { - case .unread: - await send(.async(.읽지않음_컨텐츠_조회), animation: .pokitDissolve) - case .favorite: - await send(.async(.즐겨찾기_링크모음_조회), animation: .pokitDissolve) - } + return .run { [type = state.contentType] send in + switch type { + case .unread: + await send(.async(.읽지않음_컨텐츠_조회), animation: .pokitDissolve) + case .favorite: + await send(.async(.즐겨찾기_링크모음_조회), animation: .pokitDissolve) } for await _ in self.pasteBoard.changes() { @@ -285,7 +278,7 @@ private extension ContentListFeature { break } } - case let .컨텐츠_목록_갱신(size): + case .컨텐츠_목록_갱신: state.domain.pageable.page = 0 return .run { [ type = state.contentType, @@ -296,7 +289,7 @@ private extension ContentListFeature { let contentList = try await remindClient.읽지않음_컨텐츠_조회( BasePageableRequest( page: pageable.page, - size: size, + size: pageable.size, sort: pageable.sort ) ).toDomain() @@ -305,7 +298,7 @@ private extension ContentListFeature { let contentList = try await remindClient.즐겨찾기_링크모음_조회( BasePageableRequest( page: pageable.page, - size: size, + size: pageable.size, sort: pageable.sort ) ).toDomain() @@ -340,15 +333,11 @@ private extension ContentListFeature { func handleDelegateAction(_ action: Action.DelegateAction, state: inout State) -> Effect { switch action { case .컨텐츠_목록_조회: - if let size = state.domain.contentList.data?.count { - return .send(.async(.컨텐츠_목록_갱신(size: size)), animation: .pokitSpring) - } else { - switch state.contentType { - case .favorite: - return .send(.async(.즐겨찾기_링크모음_조회)) - case .unread: - return .send(.async(.읽지않음_컨텐츠_조회)) - } + switch state.contentType { + case .favorite: + return .send(.async(.즐겨찾기_링크모음_조회)) + case .unread: + return .send(.async(.읽지않음_컨텐츠_조회)) } default: return .none diff --git a/Projects/Feature/FeaturePokit/Sources/PokitRootFeature.swift b/Projects/Feature/FeaturePokit/Sources/PokitRootFeature.swift index 6ad0b106..7217a89f 100644 --- a/Projects/Feature/FeaturePokit/Sources/PokitRootFeature.swift +++ b/Projects/Feature/FeaturePokit/Sources/PokitRootFeature.swift @@ -116,8 +116,8 @@ public struct PokitRootFeature { case 포킷삭제(categoryId: Int) case 미분류_카테고리_컨텐츠_페이징_조회 case 카테고리_페이징_조회 - case 미분류_카테고리_컨텐츠_조회(size: Int) - case 카테고리_조회(size: Int) + case 미분류_카테고리_컨텐츠_조회 + case 카테고리_조회 } public enum ScopeAction: Equatable { @@ -225,15 +225,15 @@ private extension PokitRootFeature { case .pokitRootViewOnAppeared: switch state.folderType { case .folder(.포킷): - guard let size = state.domain.categoryList.data?.count else { + guard let _ = state.domain.categoryList.data?.count else { return .send(.inner(.페이지네이션_초기화)) } - return .send(.async(.카테고리_조회(size: size)), animation: .pokitSpring) + return .send(.async(.카테고리_조회), animation: .pokitSpring) case .folder(.미분류): - guard let size = state.domain.unclassifiedContentList.data?.count else { + guard let _ = state.domain.unclassifiedContentList.data?.count else { return .send(.inner(.페이지네이션_초기화)) } - return .send(.async(.미분류_카테고리_컨텐츠_조회(size: size)), animation: .pokitSpring) + return .send(.async(.미분류_카테고리_컨텐츠_조회), animation: .pokitSpring) default: return .none } case .다음페이지_로딩_presented: @@ -361,7 +361,7 @@ private extension PokitRootFeature { ).toDomain() await send(.inner(.카테고리_페이지네이션_결과(contentList: classified)), animation: .pokitDissolve) } - case let .미분류_카테고리_컨텐츠_조회(size): + case .미분류_카테고리_컨텐츠_조회: state.domain.pageable.page = 0 return .run { [ pageable = state.domain.pageable @@ -369,13 +369,13 @@ private extension PokitRootFeature { let contentList = try await contentClient.미분류_카테고리_컨텐츠_조회( .init( page: pageable.page, - size: size, + size: pageable.size, sort: pageable.sort ) ).toDomain() await send(.inner(.미분류_카테고리_컨텐츠_갱신(contentList: contentList)), animation: .pokitSpring) } - case let .카테고리_조회(size): + case .카테고리_조회: state.domain.pageable.page = 0 return .run { [ pageable = state.domain.pageable @@ -383,7 +383,7 @@ private extension PokitRootFeature { let classified = try await categoryClient.카테고리_목록_조회( .init( page: pageable.page, - size: size, + size: pageable.size, sort: pageable.sort ), true @@ -491,15 +491,15 @@ private extension PokitRootFeature { case .미분류_카테고리_컨텐츠_조회: switch state.folderType { case .folder(.포킷): - guard let size = state.domain.categoryList.data?.count else { + guard let _ = state.domain.categoryList.data?.count else { return .send(.inner(.페이지네이션_초기화)) } - return .send(.async(.카테고리_조회(size: size)), animation: .pokitSpring) + return .send(.async(.카테고리_조회), animation: .pokitSpring) case .folder(.미분류): - guard let size = state.domain.unclassifiedContentList.data?.count else { + guard let _ = state.domain.unclassifiedContentList.data?.count else { return .send(.inner(.페이지네이션_초기화)) } - return .send(.async(.미분류_카테고리_컨텐츠_조회(size: size)), animation: .pokitSpring) + return .send(.async(.미분류_카테고리_컨텐츠_조회), animation: .pokitSpring) default: return .none } default: