diff --git a/android/Omnivore/app/src/main/graphql/UpdatesSince.graphql b/android/Omnivore/app/src/main/graphql/UpdatesSince.graphql index 8055d2199..0c8c37d33 100644 --- a/android/Omnivore/app/src/main/graphql/UpdatesSince.graphql +++ b/android/Omnivore/app/src/main/graphql/UpdatesSince.graphql @@ -1,64 +1,65 @@ query UpdatesSince( - $folder: String - $after: String - $first: Int - $since: Date! + $folder: String + $after: String + $first: Int + $since: Date! ) { - updatesSince(after: $after, first: $first, folder: $folder, since: $since) { - ... on UpdatesSinceSuccess { - edges { - cursor - itemID - updateReason - node { - id - title - folder - slug - url - pageType - contentReader - createdAt - isArchived - readingProgressPercent - readingProgressAnchorIndex - author - image - description - publishedAt - ownedByViewer - originalArticleUrl - uploadFileId - labels { - ...LabelFields - } - highlights { - ...HighlightFields - } - pageId - shortId - quote - annotation - state - siteName - subscription - readAt - savedAt - updatedAt - language - wordsCount - } - } - pageInfo { - hasNextPage - hasPreviousPage - startCursor - endCursor - totalCount - } - } - ... on UpdatesSinceError { - errorCodes + updatesSince(after: $after, first: $first, folder: $folder, since: $since) { + ... on UpdatesSinceSuccess { + edges { + cursor + itemID + updateReason + node { + id + title + folder + slug + url + pageType + contentReader + createdAt + isArchived + readingProgressPercent + readingProgressAnchorIndex + author + image + description + publishedAt + ownedByViewer + originalArticleUrl + uploadFileId + labels { + ...LabelFields + } + highlights { + ...HighlightFields + } + pageId + shortId + quote + annotation + state + siteName + subscription + readAt + savedAt + updatedAt + language + wordsCount + content } + } + pageInfo { + hasNextPage + hasPreviousPage + startCursor + endCursor + totalCount + } } + ... on UpdatesSinceError { + errorCodes + } + } } diff --git a/android/Omnivore/app/src/main/java/app/omnivore/omnivore/core/data/LibrarySync.kt b/android/Omnivore/app/src/main/java/app/omnivore/omnivore/core/data/LibrarySync.kt index 639a9a903..3843f3b2e 100644 --- a/android/Omnivore/app/src/main/java/app/omnivore/omnivore/core/data/LibrarySync.kt +++ b/android/Omnivore/app/src/main/java/app/omnivore/omnivore/core/data/LibrarySync.kt @@ -66,7 +66,8 @@ suspend fun DataService.sync(since: String, cursor: String?, limit: Int = 20): S slug = it.slug, isArchived = it.isArchived, contentReader = it.contentReader.rawValue, - wordsCount = it.wordsCount + wordsCount = it.wordsCount, + content = it.content ) val labels = it.labels?.map { label -> SavedItemLabel( diff --git a/android/Omnivore/app/src/main/java/app/omnivore/omnivore/feature/following/FollowingViewModel.kt b/android/Omnivore/app/src/main/java/app/omnivore/omnivore/feature/following/FollowingViewModel.kt index 8c63aef4a..a3639d034 100644 --- a/android/Omnivore/app/src/main/java/app/omnivore/omnivore/feature/following/FollowingViewModel.kt +++ b/android/Omnivore/app/src/main/java/app/omnivore/omnivore/feature/following/FollowingViewModel.kt @@ -255,19 +255,9 @@ class FollowingViewModel @Inject constructor( since: String, count: Int, startTime: String, - isInitialBatch: Boolean = true ) { libraryRepository.syncOfflineItemsWithServerIfNeeded() val result = libraryRepository.sync(since = since, cursor = cursor, limit = 20) - - // Fetch content for the initial batch only - if (isInitialBatch) { - for (slug in result.savedItemSlugs) { - delay(250) - contentRequestChannel.send(slug) - } - } - val totalCount = count + result.count if (!result.hasError && result.hasMoreItems && result.cursor != null) { @@ -276,7 +266,6 @@ class FollowingViewModel @Inject constructor( since = since, count = totalCount, startTime = startTime, - isInitialBatch = false ) } else { datastoreRepo.putString(libraryLastSyncTimestamp, startTime) diff --git a/android/Omnivore/app/src/main/java/app/omnivore/omnivore/feature/library/LibraryViewModel.kt b/android/Omnivore/app/src/main/java/app/omnivore/omnivore/feature/library/LibraryViewModel.kt index 0aa31d10e..d2b27fc81 100644 --- a/android/Omnivore/app/src/main/java/app/omnivore/omnivore/feature/library/LibraryViewModel.kt +++ b/android/Omnivore/app/src/main/java/app/omnivore/omnivore/feature/library/LibraryViewModel.kt @@ -273,20 +273,11 @@ class LibraryViewModel @Inject constructor( cursor: String?, since: String, count: Int, - startTime: String, - isInitialBatch: Boolean = true + startTime: String ) { libraryRepository.syncOfflineItemsWithServerIfNeeded() + val result = libraryRepository.sync(since = since, cursor = cursor, limit = 20) - - // Fetch content for the initial batch only - if (isInitialBatch) { - for (slug in result.savedItemSlugs) { - delay(250) - contentRequestChannel.send(slug) - } - } - val totalCount = count + result.count if (!result.hasError && result.hasMoreItems && result.cursor != null) { @@ -295,7 +286,6 @@ class LibraryViewModel @Inject constructor( since = since, count = totalCount, startTime = startTime, - isInitialBatch = false ) } else { datastoreRepository.putString(libraryLastSyncTimestamp, startTime)