Skip to content

Commit

Permalink
Implement Reverso Context #19
Browse files Browse the repository at this point in the history
  • Loading branch information
filimo committed Oct 10, 2019
1 parent 038a0a1 commit d8db648
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
6 changes: 4 additions & 2 deletions ReaderTranslator/Components/WebKit/WKCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ extension WKCoordinator: WKScriptMessageHandler {
}
}

extension WKCoordinator: WKNavigationDelegate, WKCoordinatorNavigationDelegate {
extension WKCoordinator: WKNavigationDelegate {
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
if let url = navigationAction.request.url {
if url.absoluteString == self.store.lastWebPage {
Expand All @@ -71,7 +71,9 @@ extension WKCoordinator: WKNavigationDelegate, WKCoordinatorNavigationDelegate {
func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) {
print(error)
}

}

extension WKCoordinator: WKCoordinatorNavigationDelegate {
func goBack(_ webView: WKWebView) {
if let webView = webView as? WKPageView { parent.goBack(webView) }
}
Expand Down
9 changes: 7 additions & 2 deletions ReaderTranslator/Views/ReaderView/ReaderView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@ struct ReaderView: View {
#if os(macOS)
ReaderView_Safari()
#endif
TranslatorView()
ReversoContextView()
if store.viewMode == .safari {
ReversoContextView()
TranslatorView()
}else{
TranslatorView()
ReversoContextView()
}
}
}
}
Expand Down

0 comments on commit d8db648

Please sign in to comment.