Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 페이지네이션 수정 #117

Merged
merged 1 commit into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public struct ContentListFeature {
case 즐겨찾기_링크모음_조회
case 컨텐츠_삭제(id: Int)
case pagenation_네트워크
case 컨텐츠_목록_갱신(size: Int)
case 컨텐츠_목록_갱신
}

public enum ScopeAction: Equatable {
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -285,7 +278,7 @@ private extension ContentListFeature {
break
}
}
case let .컨텐츠_목록_갱신(size):
case .컨텐츠_목록_갱신:
state.domain.pageable.page = 0
return .run { [
type = state.contentType,
Expand All @@ -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()
Expand All @@ -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()
Expand Down Expand Up @@ -340,15 +333,11 @@ private extension ContentListFeature {
func handleDelegateAction(_ action: Action.DelegateAction, state: inout State) -> Effect<Action> {
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
Expand Down
28 changes: 14 additions & 14 deletions Projects/Feature/FeaturePokit/Sources/PokitRootFeature.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ public struct PokitRootFeature {
case 포킷삭제(categoryId: Int)
case 미분류_카테고리_컨텐츠_페이징_조회
case 카테고리_페이징_조회
case 미분류_카테고리_컨텐츠_조회(size: Int)
case 카테고리_조회(size: Int)
case 미분류_카테고리_컨텐츠_조회
case 카테고리_조회
}

public enum ScopeAction: Equatable {
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -361,29 +361,29 @@ 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
] send in
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
] send in
let classified = try await categoryClient.카테고리_목록_조회(
.init(
page: pageable.page,
size: size,
size: pageable.size,
sort: pageable.sort
),
true
Expand Down Expand Up @@ -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:
Expand Down