mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
update reading progress on the item in home view model
This commit is contained in:
parent
525cb9b8b9
commit
f7f21300f3
2 changed files with 8 additions and 1 deletions
|
|
@ -158,4 +158,11 @@ final class HomeFeedViewModel: ObservableObject {
|
|||
)
|
||||
.store(in: &subscriptions)
|
||||
}
|
||||
|
||||
func updateProgress(itemID: String, progress: Double) {
|
||||
guard let item = items.first(where: { $0.id == itemID }) else { return }
|
||||
if let index = items.firstIndex(of: item) {
|
||||
items[index].readingProgress = progress
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ final class LinkItemDetailViewModel: ObservableObject {
|
|||
case let .shareHighlight(highlightID):
|
||||
print("show share modal for highlight with id: \(highlightID)")
|
||||
case let .updateReadingProgess(progress: progress):
|
||||
self?.item.readingProgress = Double(progress)
|
||||
self?.homeFeedViewModel.updateProgress(itemID: self?.item.id ?? "", progress: Double(progress))
|
||||
}
|
||||
}
|
||||
.store(in: &newWebAppWrapperViewModel.subscriptions)
|
||||
|
|
|
|||
Loading…
Reference in a new issue