diff --git a/apple/OmnivoreKit/Sources/App/Views/LinkItemDetailView.swift b/apple/OmnivoreKit/Sources/App/Views/LinkItemDetailView.swift index aed43d232..78a3a4199 100644 --- a/apple/OmnivoreKit/Sources/App/Views/LinkItemDetailView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/LinkItemDetailView.swift @@ -87,12 +87,12 @@ final class LinkItemDetailViewModel: ObservableObject { rawAuthCookie: rawAuthCookie ) - newWebAppWrapperViewModel.performActionSubject.sink { action in + newWebAppWrapperViewModel.performActionSubject.sink { [weak self] action in switch action { case let .shareHighlight(highlightID): print("show share modal for highlight with id: \(highlightID)") case let .updateReadingProgess(progress: progress): - print("new reading progress: \(progress)") + self?.item.readingProgress = Double(progress) } } .store(in: &newWebAppWrapperViewModel.subscriptions) diff --git a/apple/OmnivoreKit/Sources/Views/Article/WebAppWrapperView.swift b/apple/OmnivoreKit/Sources/Views/Article/WebAppWrapperView.swift index 4fe383aca..7c16c83a8 100644 --- a/apple/OmnivoreKit/Sources/Views/Article/WebAppWrapperView.swift +++ b/apple/OmnivoreKit/Sources/Views/Article/WebAppWrapperView.swift @@ -6,7 +6,7 @@ import WebKit public final class WebAppWrapperViewModel: ObservableObject { public enum Action { case shareHighlight(highlightID: String) - case updateReadingProgess(progress: Double) + case updateReadingProgess(progress: Int) } public var subscriptions = Set() @@ -87,11 +87,11 @@ public struct WebAppWrapperView: View { if message.name == WebViewAction.highlightAction.rawValue { handleHighlightAction(message: message) } - + if message.name == WebViewAction.readingProgressUpdate.rawValue { - guard let messageBody = message.body as? [String: String] else { return } + guard let messageBody = message.body as? [String: Double] else { return } guard let progress = messageBody["progress"] else { return } - print(progress) + viewModel.performActionSubject.send(.updateReadingProgess(progress: Int(progress))) } }