@capgo/capacitor-inappbrowser 8.22.0 → 8.22.1
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/ios/Sources/InAppBrowserPlugin/InAppBrowserPlugin.swift +4 -4
- package/ios/Sources/InAppBrowserPlugin/NavigationBarShadowSupport.swift +33 -0
- package/ios/Sources/InAppBrowserPlugin/ShareActivityItemSource.swift +29 -0
- package/ios/Sources/InAppBrowserPlugin/WKWebViewController.swift +4 -31
- package/package.json +1 -1
|
@@ -446,7 +446,7 @@ public class CapgoInAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
446
446
|
case aware = "AWARE"
|
|
447
447
|
case fakeVisible = "FAKE_VISIBLE"
|
|
448
448
|
}
|
|
449
|
-
private let pluginVersion: String = "8.22.
|
|
449
|
+
private let pluginVersion: String = "8.22.1"
|
|
450
450
|
public let identifier = "CapgoInAppBrowserPlugin"
|
|
451
451
|
public let jsName = "CapgoInAppBrowser"
|
|
452
452
|
public let pluginMethods: [CAPPluginMethod] = [
|
|
@@ -1779,9 +1779,9 @@ public class CapgoInAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
1779
1779
|
self.navigationWebViewController?.toolbar.isTranslucent = false
|
|
1780
1780
|
|
|
1781
1781
|
// Ensure no lines or borders appear by default
|
|
1782
|
-
self.navigationWebViewController?.navigationBar
|
|
1783
|
-
|
|
1784
|
-
|
|
1782
|
+
if let navigationBar = self.navigationWebViewController?.navigationBar {
|
|
1783
|
+
NavigationBarShadowSupport.hideShadow(on: navigationBar)
|
|
1784
|
+
}
|
|
1785
1785
|
self.navigationWebViewController?.toolbar.setShadowImage(UIImage(), forToolbarPosition: .any)
|
|
1786
1786
|
|
|
1787
1787
|
// Handle web view background color
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import UIKit
|
|
2
|
+
|
|
3
|
+
enum NavigationBarShadowSupport {
|
|
4
|
+
static func hideShadow(on navigationBar: UINavigationBar, backgroundColor: UIColor? = nil) {
|
|
5
|
+
navigationBar.setBackgroundImage(UIImage(), for: .default)
|
|
6
|
+
navigationBar.shadowImage = UIImage()
|
|
7
|
+
|
|
8
|
+
if #available(iOS 13.0, *) {
|
|
9
|
+
let appearance = UINavigationBarAppearance()
|
|
10
|
+
if let backgroundColor {
|
|
11
|
+
appearance.configureWithOpaqueBackground()
|
|
12
|
+
appearance.backgroundColor = backgroundColor
|
|
13
|
+
} else {
|
|
14
|
+
appearance.configureWithDefaultBackground()
|
|
15
|
+
}
|
|
16
|
+
appearance.backgroundEffect = nil
|
|
17
|
+
appearance.shadowColor = .clear
|
|
18
|
+
appearance.shadowImage = UIImage()
|
|
19
|
+
|
|
20
|
+
if let titleTextAttributes = navigationBar.titleTextAttributes {
|
|
21
|
+
appearance.titleTextAttributes = titleTextAttributes
|
|
22
|
+
}
|
|
23
|
+
if let largeTitleTextAttributes = navigationBar.largeTitleTextAttributes {
|
|
24
|
+
appearance.largeTitleTextAttributes = largeTitleTextAttributes
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
navigationBar.standardAppearance = appearance
|
|
28
|
+
navigationBar.compactAppearance = appearance
|
|
29
|
+
navigationBar.scrollEdgeAppearance = appearance
|
|
30
|
+
navigationBar.compactScrollEdgeAppearance = appearance
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import UIKit
|
|
2
|
+
|
|
3
|
+
final class ShareActivityItemSource: NSObject, UIActivityItemSource {
|
|
4
|
+
private let item: Any
|
|
5
|
+
private let subject: String?
|
|
6
|
+
|
|
7
|
+
init(item: Any, subject: String?) {
|
|
8
|
+
self.item = item
|
|
9
|
+
self.subject = subject
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
func activityViewControllerPlaceholderItem(_ activityViewController: UIActivityViewController) -> Any {
|
|
13
|
+
item
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
func activityViewController(
|
|
17
|
+
_ activityViewController: UIActivityViewController,
|
|
18
|
+
itemForActivityType activityType: UIActivity.ActivityType?
|
|
19
|
+
) -> Any? {
|
|
20
|
+
item
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
func activityViewController(
|
|
24
|
+
_ activityViewController: UIActivityViewController,
|
|
25
|
+
subjectForActivityType activityType: UIActivity.ActivityType?
|
|
26
|
+
) -> String {
|
|
27
|
+
subject ?? ""
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -1359,30 +1359,7 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
|
|
|
1359
1359
|
navigationBar.backgroundColor = color
|
|
1360
1360
|
navigationBar.barTintColor = color
|
|
1361
1361
|
navigationBar.isTranslucent = false
|
|
1362
|
-
|
|
1363
|
-
navigationBar.shadowImage = UIImage()
|
|
1364
|
-
navigationBar.setValue(true, forKey: "hidesShadow")
|
|
1365
|
-
|
|
1366
|
-
if #available(iOS 13.0, *) {
|
|
1367
|
-
let appearance = UINavigationBarAppearance()
|
|
1368
|
-
appearance.configureWithOpaqueBackground()
|
|
1369
|
-
appearance.backgroundColor = color
|
|
1370
|
-
appearance.backgroundEffect = nil
|
|
1371
|
-
appearance.shadowColor = .clear
|
|
1372
|
-
appearance.shadowImage = UIImage()
|
|
1373
|
-
|
|
1374
|
-
if let titleTextAttributes = navigationBar.titleTextAttributes {
|
|
1375
|
-
appearance.titleTextAttributes = titleTextAttributes
|
|
1376
|
-
}
|
|
1377
|
-
if let largeTitleTextAttributes = navigationBar.largeTitleTextAttributes {
|
|
1378
|
-
appearance.largeTitleTextAttributes = largeTitleTextAttributes
|
|
1379
|
-
}
|
|
1380
|
-
|
|
1381
|
-
navigationBar.standardAppearance = appearance
|
|
1382
|
-
navigationBar.compactAppearance = appearance
|
|
1383
|
-
navigationBar.scrollEdgeAppearance = appearance
|
|
1384
|
-
navigationBar.compactScrollEdgeAppearance = appearance
|
|
1385
|
-
}
|
|
1362
|
+
NavigationBarShadowSupport.hideShadow(on: navigationBar, backgroundColor: color)
|
|
1386
1363
|
}
|
|
1387
1364
|
|
|
1388
1365
|
// Make status bar background with colored view underneath
|
|
@@ -2393,11 +2370,6 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
|
|
|
2393
2370
|
|
|
2394
2371
|
let webView = WKWebView(frame: .zero, configuration: webConfiguration)
|
|
2395
2372
|
|
|
2396
|
-
// if webView.responds(to: Selector(("setInspectable:"))) {
|
|
2397
|
-
// // Fix: https://stackoverflow.com/questions/76216183/how-to-debug-wkwebview-in-ios-16-4-1-using-xcode-14-2/76603043#76603043
|
|
2398
|
-
// webView.perform(Selector(("setInspectable:")), with: isInspectable)
|
|
2399
|
-
// }
|
|
2400
|
-
|
|
2401
2373
|
if #available(iOS 16.4, *) {
|
|
2402
2374
|
webView.isInspectable = isInspectable
|
|
2403
2375
|
}
|
|
@@ -3366,8 +3338,9 @@ fileprivate extension WKWebViewController {
|
|
|
3366
3338
|
|
|
3367
3339
|
// Separated the actual sharing functionality
|
|
3368
3340
|
private func showShareSheet(items: [Any], sender: AnyObject) {
|
|
3369
|
-
let
|
|
3370
|
-
|
|
3341
|
+
let subject = self.shareSubject ?? self.title
|
|
3342
|
+
let activityItems = items.map { ShareActivityItemSource(item: $0, subject: subject) }
|
|
3343
|
+
let activityViewController = UIActivityViewController(activityItems: activityItems, applicationActivities: nil)
|
|
3371
3344
|
if let barButtonItem = sender as? UIBarButtonItem {
|
|
3372
3345
|
activityViewController.popoverPresentationController?.barButtonItem = barButtonItem
|
|
3373
3346
|
}
|