diff --git a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift index fbf62761c..3b343f115 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift @@ -77,9 +77,6 @@ import Views viewModel.loadItems(dataService: dataService, isRefresh: true) } } - .onChange(of: viewModel.selectedLinkItem) { _ in - viewModel.commitItemUpdates() - } } } diff --git a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewModel.swift b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewModel.swift index 306fe09e0..fc9e5330d 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewModel.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewModel.swift @@ -9,9 +9,6 @@ import Views @MainActor final class HomeFeedViewModel: ObservableObject { var currentDetailViewModel: LinkItemDetailViewModel? - /// Track progress updates to be committed when user navigates back to grid view - var uncommittedReadingProgressUpdates = [String: Double]() - @Published var items = [LinkedItem]() @Published var isLoading = false @Published var showPushNotificationPrimer = false @@ -181,16 +178,6 @@ import Views .store(in: &subscriptions) } - /// Update `FeedItem`s with the cached reading progress and label values so it can animate when the - /// user navigates back to the grid view (and also avoid mutations of the grid items - /// that can cause the `NavigationView` to pop. - func commitItemUpdates() { - for (key, value) in uncommittedReadingProgressUpdates { - updateProgress(itemID: key, progress: value) - } - uncommittedReadingProgressUpdates = [:] - } - private func updateProgress(itemID: String, progress: Double) { guard let item = items.first(where: { $0.id == itemID }) else { return } if let index = items.firstIndex(of: item) { diff --git a/apple/OmnivoreKit/Sources/App/Views/LinkItemDetailView.swift b/apple/OmnivoreKit/Sources/App/Views/LinkItemDetailView.swift index 69c63d494..c6465a8ec 100644 --- a/apple/OmnivoreKit/Sources/App/Views/LinkItemDetailView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/LinkItemDetailView.swift @@ -90,8 +90,6 @@ enum PDFProvider { switch action { case let .shareHighlight(highlightID): print("show share modal for highlight with id: \(highlightID)") - case let .updateReadingProgess(progress: progress): - self?.homeFeedViewModel.uncommittedReadingProgressUpdates[self?.item.id ?? ""] = Double(progress) } } .store(in: &newWebAppWrapperViewModel.subscriptions) diff --git a/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContainer.swift b/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContainer.swift index ad26908e5..3c7323d6d 100644 --- a/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContainer.swift +++ b/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContainer.swift @@ -33,14 +33,6 @@ import WebKit } func webViewActionHandler(message: WKScriptMessage, replyHandler: WKScriptMessageReplyHandler?) { - if message.name == WebViewAction.readingProgressUpdate.rawValue { - let messageBody = message.body as? [String: Double] - - if let messageBody = messageBody, let progress = messageBody["progress"] { - homeFeedViewModel.uncommittedReadingProgressUpdates[item.unwrappedID] = Double(progress) - } - } - if let replyHandler = replyHandler { viewModel.webViewActionWithReplyHandler( message: message, @@ -53,12 +45,6 @@ import WebKit if message.name == WebViewAction.highlightAction.rawValue { handleHighlightAction(message: message) } - - if message.name == WebViewAction.readingProgressUpdate.rawValue { - guard let messageBody = message.body as? [String: Double] else { return } - guard let progress = messageBody["progress"] else { return } - homeFeedViewModel.uncommittedReadingProgressUpdates[item.unwrappedID] = Double(progress) - } } private func handleHighlightAction(message: WKScriptMessage) { diff --git a/apple/OmnivoreKit/Sources/Views/Article/WebAppWrapperView.swift b/apple/OmnivoreKit/Sources/Views/Article/WebAppWrapperView.swift index e6cba3544..44d0ae7c4 100644 --- a/apple/OmnivoreKit/Sources/Views/Article/WebAppWrapperView.swift +++ b/apple/OmnivoreKit/Sources/Views/Article/WebAppWrapperView.swift @@ -6,7 +6,6 @@ import WebKit public final class WebAppWrapperViewModel: ObservableObject { public enum Action { case shareHighlight(highlightID: String) - case updateReadingProgess(progress: Int) } public var subscriptions = Set() @@ -87,12 +86,6 @@ 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: Double] else { return } - guard let progress = messageBody["progress"] else { return } - viewModel.performActionSubject.send(.updateReadingProgess(progress: Int(progress))) - } } private func handleHighlightAction(message: WKScriptMessage) {