diff --git a/Pocket.xcodeproj/xcshareddata/xcschemes/Pocket (iOS).xcscheme b/Pocket.xcodeproj/xcshareddata/xcschemes/Pocket (iOS).xcscheme
index 6efe017f5..00604f565 100644
--- a/Pocket.xcodeproj/xcshareddata/xcschemes/Pocket (iOS).xcscheme
+++ b/Pocket.xcodeproj/xcshareddata/xcschemes/Pocket (iOS).xcscheme
@@ -338,6 +338,13 @@
isEnabled = "NO">
+
+
+
+
pagination.maxItems ? pagination.maxItems : totalCount))
+ initialDownloadState.send(.paginating(totalCount: min(totalCount, pagination.maxItems)))
}
try await updateLocalStorage(result: result)
diff --git a/PocketKit/Sources/Sync/Operations/FetchSaves.swift b/PocketKit/Sources/Sync/Operations/FetchSaves.swift
index c8483567a..eea9a1d1f 100644
--- a/PocketKit/Sources/Sync/Operations/FetchSaves.swift
+++ b/PocketKit/Sources/Sync/Operations/FetchSaves.swift
@@ -76,7 +76,7 @@ class FetchSaves: SyncOperation {
if case .started = initialDownloadState.value,
let totalCount = result.data?.user?.savedItems?.totalCount,
pagination.cursor == nil {
- initialDownloadState.send(.paginating(totalCount: totalCount > pagination.maxItems ? pagination.maxItems : totalCount))
+ initialDownloadState.send(.paginating(totalCount: min(totalCount, pagination.maxItems)))
}
try await updateLocalStorage(result: result)
diff --git a/PocketKit/Sources/Sync/Operations/SyncTask.swift b/PocketKit/Sources/Sync/Operations/SyncTask.swift
index a70e58067..a38a034be 100644
--- a/PocketKit/Sources/Sync/Operations/SyncTask.swift
+++ b/PocketKit/Sources/Sync/Operations/SyncTask.swift
@@ -1,8 +1,8 @@
import Foundation
enum SyncTask: Codable {
- case fetchSaves(maxItems: Int)
- case fetchArchive(maxItems: Int)
+ case fetchSaves
+ case fetchArchive
case favorite(remoteID: String)
case unfavorite(remoteID: String)
case delete(remoteID: String)
diff --git a/PocketKit/Sources/Sync/PocketSource.swift b/PocketKit/Sources/Sync/PocketSource.swift
index fe3b90fd5..eddcc1663 100644
--- a/PocketKit/Sources/Sync/PocketSource.swift
+++ b/PocketKit/Sources/Sync/PocketSource.swift
@@ -204,7 +204,7 @@ public class PocketSource: Source {
// MARK: - Saves/Archive items
extension PocketSource {
- public func refreshSaves(maxItems: Int, completion: (() -> Void)? = nil) {
+ public func refreshSaves(completion: (() -> Void)? = nil) {
if lastRefresh.lastRefreshSaves == nil {
initialSavesDownloadState.send(.started)
}
@@ -218,10 +218,10 @@ extension PocketSource {
lastRefresh: lastRefresh
)
- enqueue(operation: operation, task: .fetchSaves(maxItems: maxItems), completion: completion)
+ enqueue(operation: operation, task: .fetchSaves, completion: completion)
}
- public func refreshArchive(maxItems: Int, completion: (() -> Void)? = nil) {
+ public func refreshArchive(completion: (() -> Void)? = nil) {
if lastRefresh.lastRefreshArchive == nil {
initialArchiveDownloadState.send(.started)
}
@@ -234,7 +234,7 @@ extension PocketSource {
lastRefresh: lastRefresh
)
- enqueue(operation: operation, task: .fetchSaves(maxItems: maxItems), completion: completion)
+ enqueue(operation: operation, task: .fetchSaves, completion: completion)
}
public func favorite(item: SavedItem) {
@@ -514,7 +514,7 @@ extension PocketSource {
mutation: FavoriteItemMutation(itemID: remoteID)
)
enqueue(operation: operation, persistentTask: persistentTask)
- case .fetchSaves(let maxItems):
+ case .fetchSaves:
let operation = operations.fetchSaves(
user: user,
apollo: apollo,
@@ -524,7 +524,7 @@ extension PocketSource {
lastRefresh: lastRefresh
)
enqueue(operation: operation, persistentTask: persistentTask)
- case .fetchArchive(let maxItems):
+ case .fetchArchive:
let operation = operations.fetchArchive(
apollo: apollo,
space: space,
diff --git a/PocketKit/Sources/Sync/Source+async.swift b/PocketKit/Sources/Sync/Source+async.swift
index 6ccb2db92..9b44ca4a1 100644
--- a/PocketKit/Sources/Sync/Source+async.swift
+++ b/PocketKit/Sources/Sync/Source+async.swift
@@ -1,7 +1,7 @@
extension Source {
- public func refresh(maxItems: Int = 400) async {
+ public func refresh() async {
await withCheckedContinuation { (continuation: CheckedContinuation) in
- refreshSaves(maxItems: maxItems) {
+ refreshSaves {
continuation.resume(returning: ())
}
}
diff --git a/PocketKit/Sources/Sync/Source.swift b/PocketKit/Sources/Sync/Source.swift
index fc38ed505..7e51f987c 100644
--- a/PocketKit/Sources/Sync/Source.swift
+++ b/PocketKit/Sources/Sync/Source.swift
@@ -32,9 +32,9 @@ public protocol Source {
func object(id: NSManagedObjectID) -> T?
- func refreshSaves(maxItems: Int, completion: (() -> Void)?)
+ func refreshSaves(completion: (() -> Void)?)
- func refreshArchive(maxItems: Int, completion: (() -> Void)?)
+ func refreshArchive(completion: (() -> Void)?)
func retryImmediately()
@@ -95,18 +95,18 @@ public protocol Source {
public extension Source {
func refreshSaves(completion: (() -> Void)?) {
- self.refreshSaves(maxItems: SyncConstants.Saves.firstLoadMaxCount, completion: completion)
+ self.refreshSaves(completion: completion)
}
func refreshSaves() {
- self.refreshSaves(maxItems: SyncConstants.Saves.firstLoadMaxCount, completion: nil)
+ self.refreshSaves(completion: nil)
}
func refreshArchive(completion: (() -> Void)?) {
- self.refreshArchive(maxItems: SyncConstants.Archive.firstLoadMaxCount, completion: completion)
+ self.refreshArchive(completion: completion)
}
func refreshArchive() {
- self.refreshArchive(maxItems: SyncConstants.Archive.firstLoadMaxCount, completion: nil)
+ self.refreshArchive(completion: nil)
}
}