send reading progress updates for ipad grid only

This commit is contained in:
Satindar Dhillon
2022-03-09 08:25:54 -08:00
parent f7f21300f3
commit b1b3915b7b
2 changed files with 8 additions and 1 deletions

View File

@ -270,6 +270,9 @@ import Views
}
}
.listStyle(PlainListStyle())
.onAppear {
viewModel.sendProgressUpdates = false
}
}
}
@ -347,6 +350,9 @@ import Views
LoadingSection()
}
}
.onAppear {
viewModel.sendProgressUpdates = true
}
}
}

View File

@ -12,6 +12,7 @@ final class HomeFeedViewModel: ObservableObject {
@Published var isLoading = false
@Published var showPushNotificationPrimer = false
var cursor: String?
var sendProgressUpdates = false
// These are used to make sure we handle search result
// responses in the right order
@ -160,7 +161,7 @@ final class HomeFeedViewModel: ObservableObject {
}
func updateProgress(itemID: String, progress: Double) {
guard let item = items.first(where: { $0.id == itemID }) else { return }
guard sendProgressUpdates, let item = items.first(where: { $0.id == itemID }) else { return }
if let index = items.firstIndex(of: item) {
items[index].readingProgress = progress
}