@capgo/inappbrowser 7.2.15 → 7.2.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/android/build.gradle
CHANGED
|
@@ -59,7 +59,7 @@ dependencies {
|
|
|
59
59
|
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
60
60
|
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
|
61
61
|
implementation "androidx.browser:browser:$androidxBrowserVersion"
|
|
62
|
-
implementation 'androidx.constraintlayout:constraintlayout:2.
|
|
62
|
+
implementation 'androidx.constraintlayout:constraintlayout:2.2.0'
|
|
63
63
|
implementation 'com.google.android.material:material:1.12.0'
|
|
64
64
|
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.2.0'
|
|
65
65
|
}
|
|
@@ -212,9 +212,8 @@ public class InAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
212
212
|
|
|
213
213
|
DispatchQueue.main.async {
|
|
214
214
|
let url = URL(string: urlString)
|
|
215
|
-
|
|
216
215
|
if self.isPresentAfterPageLoad {
|
|
217
|
-
self.webViewController = WKWebViewController.init(url: url!, headers: headers, isInspectable: isInspectable, credentials: credentials, preventDeeplink: preventDeeplink)
|
|
216
|
+
self.webViewController = WKWebViewController.init(url: url!, headers: headers, isInspectable: isInspectable, credentials: credentials, preventDeeplink: preventDeeplink, blankNavigationTab: toolbarType == "blank")
|
|
218
217
|
} else {
|
|
219
218
|
self.webViewController = WKWebViewController.init()
|
|
220
219
|
self.webViewController?.setHeaders(headers: headers)
|
|
@@ -257,6 +256,7 @@ public class InAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
257
256
|
self.navigationWebViewController?.modalPresentationStyle = .fullScreen
|
|
258
257
|
if toolbarType == "blank" {
|
|
259
258
|
self.navigationWebViewController?.navigationBar.isHidden = true
|
|
259
|
+
self.webViewController?.blankNavigationTab = true
|
|
260
260
|
}
|
|
261
261
|
if showReloadButton {
|
|
262
262
|
let toolbarItems = self.getToolbarItems(toolbarType: toolbarType)
|
|
@@ -75,6 +75,16 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
|
|
|
75
75
|
self.setPreventDeeplink(preventDeeplink: preventDeeplink)
|
|
76
76
|
self.initWebview(isInspectable: isInspectable)
|
|
77
77
|
}
|
|
78
|
+
|
|
79
|
+
public init(url: URL, headers: [String: String], isInspectable: Bool, credentials: WKWebViewCredentials? = nil, preventDeeplink: Bool, blankNavigationTab: Bool) {
|
|
80
|
+
super.init(nibName: nil, bundle: nil)
|
|
81
|
+
self.blankNavigationTab = blankNavigationTab
|
|
82
|
+
self.source = .remote(url)
|
|
83
|
+
self.credentials = credentials
|
|
84
|
+
self.setHeaders(headers: headers)
|
|
85
|
+
self.setPreventDeeplink(preventDeeplink: preventDeeplink)
|
|
86
|
+
self.initWebview(isInspectable: isInspectable)
|
|
87
|
+
}
|
|
78
88
|
|
|
79
89
|
open var hasDynamicTitle = false
|
|
80
90
|
open var source: WKWebSource?
|
|
@@ -101,6 +111,7 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
|
|
|
101
111
|
open var ignoreUntrustedSSLError = false
|
|
102
112
|
var viewWasPresented = false
|
|
103
113
|
var preventDeeplink: Bool = false
|
|
114
|
+
var blankNavigationTab: Bool = false;
|
|
104
115
|
|
|
105
116
|
internal var preShowSemaphore: DispatchSemaphore?
|
|
106
117
|
internal var preShowError: String?
|
|
@@ -295,7 +306,6 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
|
|
|
295
306
|
}
|
|
296
307
|
|
|
297
308
|
open func initWebview(isInspectable: Bool = true) {
|
|
298
|
-
|
|
299
309
|
self.view.backgroundColor = UIColor.white
|
|
300
310
|
|
|
301
311
|
self.extendedLayoutIncludesOpaqueBars = true
|
|
@@ -316,6 +326,20 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
|
|
|
316
326
|
webView.perform(Selector(("setInspectable:")), with: isInspectable)
|
|
317
327
|
}
|
|
318
328
|
|
|
329
|
+
if (self.blankNavigationTab) {
|
|
330
|
+
// First add the webView to view hierarchy
|
|
331
|
+
self.view.addSubview(webView)
|
|
332
|
+
|
|
333
|
+
// Then set up constraints
|
|
334
|
+
webView.translatesAutoresizingMaskIntoConstraints = false
|
|
335
|
+
NSLayoutConstraint.activate([
|
|
336
|
+
webView.topAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.topAnchor),
|
|
337
|
+
webView.leadingAnchor.constraint(equalTo: self.view.leadingAnchor),
|
|
338
|
+
webView.trailingAnchor.constraint(equalTo: self.view.trailingAnchor),
|
|
339
|
+
webView.bottomAnchor.constraint(equalTo: self.view.bottomAnchor)
|
|
340
|
+
])
|
|
341
|
+
}
|
|
342
|
+
|
|
319
343
|
webView.uiDelegate = self
|
|
320
344
|
webView.navigationDelegate = self
|
|
321
345
|
|
|
@@ -327,9 +351,10 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
|
|
|
327
351
|
webView.addObserver(self, forKeyPath: titleKeyPath, options: .new, context: nil)
|
|
328
352
|
}
|
|
329
353
|
webView.addObserver(self, forKeyPath: #keyPath(WKWebView.url), options: .new, context: nil)
|
|
330
|
-
// NotificationCenter.default.addObserver(self, selector: #selector(restateViewHeight), name: UIDevice.orientationDidChangeNotification, object: nil)
|
|
331
354
|
|
|
332
|
-
self.
|
|
355
|
+
if (!self.blankNavigationTab) {
|
|
356
|
+
self.view = webView
|
|
357
|
+
}
|
|
333
358
|
self.webView = webView
|
|
334
359
|
|
|
335
360
|
self.webView?.customUserAgent = self.customUserAgent ?? self.userAgent ?? self.originalUserAgent
|
|
@@ -804,7 +829,6 @@ fileprivate extension WKWebViewController {
|
|
|
804
829
|
self.present(alert, animated: true, completion: nil)
|
|
805
830
|
} else {
|
|
806
831
|
let activityViewController = UIActivityViewController(activityItems: items, applicationActivities: nil)
|
|
807
|
-
#imageLiteral(resourceName: "simulator_screenshot_B8B44B8D-EB30-425C-9BF4-1F37697A8459.png")
|
|
808
832
|
activityViewController.setValue(self.shareSubject ?? self.title, forKey: "subject")
|
|
809
833
|
activityViewController.popoverPresentationController?.barButtonItem = (sender as! UIBarButtonItem)
|
|
810
834
|
self.present(activityViewController, animated: true, completion: nil)
|