rename WebView to OmnivoreWebView to avaoid clash with AppKit class
This commit is contained in:
@ -77,32 +77,32 @@ import WebKit
|
||||
func updateUIView(_ webView: WKWebView, context: Context) {
|
||||
if annotationSaveTransactionID != context.coordinator.lastSavedAnnotationID {
|
||||
context.coordinator.lastSavedAnnotationID = annotationSaveTransactionID
|
||||
(webView as? WebView)?.dispatchEvent(.saveAnnotation(annotation: annotation))
|
||||
(webView as? OmnivoreWebView)?.dispatchEvent(.saveAnnotation(annotation: annotation))
|
||||
}
|
||||
|
||||
if updateFontFamilyActionID != context.coordinator.previousUpdateFontFamilyActionID {
|
||||
context.coordinator.previousUpdateFontFamilyActionID = updateFontFamilyActionID
|
||||
(webView as? WebView)?.updateFontFamily()
|
||||
(webView as? OmnivoreWebView)?.updateFontFamily()
|
||||
}
|
||||
|
||||
if updateFontActionID != context.coordinator.previousUpdateFontActionID {
|
||||
context.coordinator.previousUpdateFontActionID = updateFontActionID
|
||||
(webView as? WebView)?.updateFontSize()
|
||||
(webView as? OmnivoreWebView)?.updateFontSize()
|
||||
}
|
||||
|
||||
if updateTextContrastActionID != context.coordinator.previousUpdateTextContrastActionID {
|
||||
context.coordinator.previousUpdateTextContrastActionID = updateTextContrastActionID
|
||||
(webView as? WebView)?.updateTextContrast()
|
||||
(webView as? OmnivoreWebView)?.updateTextContrast()
|
||||
}
|
||||
|
||||
if updateMaxWidthActionID != context.coordinator.previousUpdateMaxWidthActionID {
|
||||
context.coordinator.previousUpdateMaxWidthActionID = updateMaxWidthActionID
|
||||
(webView as? WebView)?.updateMaxWidthPercentage()
|
||||
(webView as? OmnivoreWebView)?.updateMaxWidthPercentage()
|
||||
}
|
||||
|
||||
if updateLineHeightActionID != context.coordinator.previousUpdateLineHeightActionID {
|
||||
context.coordinator.previousUpdateLineHeightActionID = updateLineHeightActionID
|
||||
(webView as? WebView)?.updateLineHeight()
|
||||
(webView as? OmnivoreWebView)?.updateLineHeight()
|
||||
}
|
||||
|
||||
if showNavBarActionID != context.coordinator.previousShowNavBarActionID {
|
||||
@ -112,7 +112,7 @@ import WebKit
|
||||
|
||||
if shareActionID != context.coordinator.previousShareActionID {
|
||||
context.coordinator.previousShareActionID = shareActionID
|
||||
(webView as? WebView)?.shareOriginalItem()
|
||||
(webView as? OmnivoreWebView)?.shareOriginalItem()
|
||||
}
|
||||
|
||||
// If the webview had been terminated `needsReload` will have been set to true
|
||||
|
||||
@ -8,7 +8,7 @@ public enum WebViewAction: String, CaseIterable {
|
||||
case readingProgressUpdate
|
||||
}
|
||||
|
||||
public final class WebView: WKWebView {
|
||||
public final class OmnivoreWebView: WKWebView {
|
||||
#if os(iOS)
|
||||
private var panGestureRecognizer: UIPanGestureRecognizer?
|
||||
private var tapGestureRecognizer: UITapGestureRecognizer?
|
||||
@ -95,7 +95,7 @@ public final class WebView: WKWebView {
|
||||
}
|
||||
|
||||
#if os(iOS)
|
||||
extension WebView: UIGestureRecognizerDelegate, WKScriptMessageHandler {
|
||||
extension OmnivoreWebView: UIGestureRecognizerDelegate, WKScriptMessageHandler {
|
||||
func initNativeIOSMenus() {
|
||||
isUserInteractionEnabled = true
|
||||
|
||||
@ -20,12 +20,12 @@ enum WebViewConfigurationManager {
|
||||
|
||||
public enum WebViewManager {
|
||||
public static let sharedView = create()
|
||||
public static func shared() -> WebView {
|
||||
public static func shared() -> OmnivoreWebView {
|
||||
sharedView
|
||||
}
|
||||
|
||||
public static func create() -> WebView {
|
||||
WebView(frame: CGRect.zero, configuration: WebViewConfigurationManager.create())
|
||||
public static func create() -> OmnivoreWebView {
|
||||
OmnivoreWebView(frame: CGRect.zero, configuration: WebViewConfigurationManager.create())
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,17 +95,17 @@ public enum WebViewManager {
|
||||
|
||||
if annotationSaveTransactionID != context.coordinator.lastSavedAnnotationID {
|
||||
context.coordinator.lastSavedAnnotationID = annotationSaveTransactionID
|
||||
(webView as? WebView)?.dispatchEvent(.saveAnnotation(annotation: annotation))
|
||||
(webView as? OmnivoreWebView)?.dispatchEvent(.saveAnnotation(annotation: annotation))
|
||||
}
|
||||
|
||||
if sendIncreaseFontSignal {
|
||||
sendIncreaseFontSignal = false
|
||||
(webView as? WebView)?.updateFontSize()
|
||||
(webView as? OmnivoreWebView)?.updateFontSize()
|
||||
}
|
||||
|
||||
if sendDecreaseFontSignal {
|
||||
sendDecreaseFontSignal = false
|
||||
(webView as? WebView)?.updateFontSize()
|
||||
(webView as? OmnivoreWebView)?.updateFontSize()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -135,7 +135,7 @@ public enum WebViewManager {
|
||||
|
||||
func makeNSView(context: Context) -> WKWebView {
|
||||
let contentController = WKUserContentController()
|
||||
let webView = WebView(frame: CGRect.zero)
|
||||
let webView = OmnivoreWebView(frame: CGRect.zero)
|
||||
|
||||
webView.navigationDelegate = context.coordinator
|
||||
webView.configuration.userContentController = contentController
|
||||
@ -170,17 +170,17 @@ public enum WebViewManager {
|
||||
|
||||
if annotationSaveTransactionID != context.coordinator.lastSavedAnnotationID {
|
||||
context.coordinator.lastSavedAnnotationID = annotationSaveTransactionID
|
||||
(webView as? WebView)?.dispatchEvent(.saveAnnotation(annotation: annotation))
|
||||
(webView as? OmnivoreWebView)?.dispatchEvent(.saveAnnotation(annotation: annotation))
|
||||
}
|
||||
|
||||
if sendIncreaseFontSignal {
|
||||
sendIncreaseFontSignal = false
|
||||
(webView as? WebView)?.updateFontSize()
|
||||
(webView as? OmnivoreWebView)?.updateFontSize()
|
||||
}
|
||||
|
||||
if sendDecreaseFontSignal {
|
||||
sendDecreaseFontSignal = false
|
||||
(webView as? WebView)?.updateFontSize()
|
||||
(webView as? OmnivoreWebView)?.updateFontSize()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ import WebKit
|
||||
}
|
||||
|
||||
public func makeNSView(context _: Context) -> WKWebView {
|
||||
let webView = WebView(frame: CGRect.zero)
|
||||
let webView = OmnivoreWebView(frame: CGRect.zero)
|
||||
if let url = request.url {
|
||||
// Dark mode is still rendering a white background on mac for some reason.
|
||||
// Forcing light mode for now until we figure out a fix
|
||||
|
||||
Reference in New Issue
Block a user