Pull on html content when syncing on Android
This commit is contained in:
@ -47,6 +47,7 @@ query UpdatesSince(
|
||||
updatedAt
|
||||
language
|
||||
wordsCount
|
||||
content
|
||||
}
|
||||
}
|
||||
pageInfo {
|
||||
|
||||
@ -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(
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
Reference in New Issue
Block a user