From 7f8c794dfcf2e5c5beff13a415a103cee9d86f18 Mon Sep 17 00:00:00 2001 From: Satindar Dhillon Date: Thu, 24 Mar 2022 13:00:21 -0700 Subject: [PATCH] pass annotation to create highlight call --- apple/OmnivoreKit/Sources/App/Views/WebReader/WebReader.swift | 4 +++- .../Sources/App/Views/WebReader/WebReaderViewModel.swift | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReader.swift b/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReader.swift index dbcff789b..83e07696a 100644 --- a/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReader.swift +++ b/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReader.swift @@ -56,7 +56,9 @@ struct WebReader: UIViewRepresentable { webView.configuration.userContentController.add(webView, name: "viewerAction") - webView.configuration.userContentController.addScriptMessageHandler(context.coordinator, contentWorld: .page, name: "articleAction") + webView.configuration.userContentController.addScriptMessageHandler( + context.coordinator, contentWorld: .page, name: "articleAction" + ) context.coordinator.linkHandler = openLinkAction context.coordinator.webViewActionHandler = webViewActionHandler diff --git a/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderViewModel.swift b/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderViewModel.swift index 63c10082a..1dd5aa8dd 100644 --- a/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderViewModel.swift +++ b/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderViewModel.swift @@ -50,7 +50,8 @@ final class WebReaderViewModel: ObservableObject { highlightID: messageBody["id"] as? String ?? "", quote: messageBody["quote"] as? String ?? "", patch: messageBody["patch"] as? String ?? "", - articleId: messageBody["articleId"] as? String ?? "" + articleId: messageBody["articleId"] as? String ?? "", + annotation: messageBody["annotation"] as? String ?? "" ) .sink { completion in guard case .failure = completion else { return }