@capacitor-plus/ios 8.0.0-beta.0
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/Capacitor/Capacitor/AppUUID.swift +51 -0
- package/Capacitor/Capacitor/Array+Capacitor.swift +31 -0
- package/Capacitor/Capacitor/CAPApplicationDelegateProxy.swift +32 -0
- package/Capacitor/Capacitor/CAPBridge.swift +25 -0
- package/Capacitor/Capacitor/CAPBridgeDelegate.swift +6 -0
- package/Capacitor/Capacitor/CAPBridgeProtocol.swift +148 -0
- package/Capacitor/Capacitor/CAPBridgeViewController+CDVScreenOrientationDelegate.h +6 -0
- package/Capacitor/Capacitor/CAPBridgeViewController+CDVScreenOrientationDelegate.m +5 -0
- package/Capacitor/Capacitor/CAPBridgeViewController.swift +384 -0
- package/Capacitor/Capacitor/CAPBridgedJSTypes.h +18 -0
- package/Capacitor/Capacitor/CAPBridgedJSTypes.m +43 -0
- package/Capacitor/Capacitor/CAPBridgedPlugin+getMethod.swift +13 -0
- package/Capacitor/Capacitor/CAPBridgedPlugin.h +41 -0
- package/Capacitor/Capacitor/CAPFile.swift +14 -0
- package/Capacitor/Capacitor/CAPInstanceConfiguration.h +38 -0
- package/Capacitor/Capacitor/CAPInstanceConfiguration.m +93 -0
- package/Capacitor/Capacitor/CAPInstanceConfiguration.swift +78 -0
- package/Capacitor/Capacitor/CAPInstanceDescriptor.h +167 -0
- package/Capacitor/Capacitor/CAPInstanceDescriptor.m +56 -0
- package/Capacitor/Capacitor/CAPInstanceDescriptor.swift +198 -0
- package/Capacitor/Capacitor/CAPInstancePlugin.swift +10 -0
- package/Capacitor/Capacitor/CAPLog.swift +11 -0
- package/Capacitor/Capacitor/CAPNotifications.swift +69 -0
- package/Capacitor/Capacitor/CAPPlugin+LoadInstance.swift +20 -0
- package/Capacitor/Capacitor/CAPPlugin.h +60 -0
- package/Capacitor/Capacitor/CAPPlugin.m +180 -0
- package/Capacitor/Capacitor/CAPPluginCall.h +25 -0
- package/Capacitor/Capacitor/CAPPluginCall.m +36 -0
- package/Capacitor/Capacitor/CAPPluginCall.swift +97 -0
- package/Capacitor/Capacitor/CAPPluginMethod.h +36 -0
- package/Capacitor/Capacitor/CAPPluginMethod.m +44 -0
- package/Capacitor/Capacitor/CAPPluginMethod.swift +17 -0
- package/Capacitor/Capacitor/Capacitor.h +15 -0
- package/Capacitor/Capacitor/Capacitor.modulemap +8 -0
- package/Capacitor/Capacitor/CapacitorBridge.swift +768 -0
- package/Capacitor/Capacitor/CapacitorExtension.swift +24 -0
- package/Capacitor/Capacitor/Codable/JSValueDecoder.swift +479 -0
- package/Capacitor/Capacitor/Codable/JSValueEncoder.swift +671 -0
- package/Capacitor/Capacitor/Data+Capacitor.swift +22 -0
- package/Capacitor/Capacitor/DocLinks.swift +8 -0
- package/Capacitor/Capacitor/Info.plist +24 -0
- package/Capacitor/Capacitor/JS.swift +122 -0
- package/Capacitor/Capacitor/JSExport.swift +218 -0
- package/Capacitor/Capacitor/JSTypes.swift +254 -0
- package/Capacitor/Capacitor/KeyPath.swift +60 -0
- package/Capacitor/Capacitor/KeyValueStore.swift +303 -0
- package/Capacitor/Capacitor/NotificationHandlerProtocol.swift +6 -0
- package/Capacitor/Capacitor/NotificationRouter.swift +60 -0
- package/Capacitor/Capacitor/PluginCallResult.swift +106 -0
- package/Capacitor/Capacitor/PluginConfig.swift +56 -0
- package/Capacitor/Capacitor/Plugins/CapacitorCookieManager.swift +141 -0
- package/Capacitor/Capacitor/Plugins/CapacitorCookies.swift +57 -0
- package/Capacitor/Capacitor/Plugins/CapacitorHttp.swift +57 -0
- package/Capacitor/Capacitor/Plugins/CapacitorUrlRequest.swift +225 -0
- package/Capacitor/Capacitor/Plugins/Console.swift +16 -0
- package/Capacitor/Capacitor/Plugins/HttpRequestHandler.swift +236 -0
- package/Capacitor/Capacitor/Plugins/SystemBars.swift +133 -0
- package/Capacitor/Capacitor/Plugins/WebView.swift +44 -0
- package/Capacitor/Capacitor/PrivacyInfo.xcprivacy +14 -0
- package/Capacitor/Capacitor/Router.swift +29 -0
- package/Capacitor/Capacitor/TmpViewController.swift +8 -0
- package/Capacitor/Capacitor/UIColor.swift +55 -0
- package/Capacitor/Capacitor/UIStatusBarManager+CAPHandleTapAction.m +37 -0
- package/Capacitor/Capacitor/WKWebView+Capacitor.m +15 -0
- package/Capacitor/Capacitor/WKWebView+Capacitor.swift +80 -0
- package/Capacitor/Capacitor/WebViewAssetHandler.swift +550 -0
- package/Capacitor/Capacitor/WebViewDelegationHandler.swift +361 -0
- package/Capacitor/Capacitor/assets/native-bridge.js +1029 -0
- package/Capacitor.podspec +23 -0
- package/CapacitorCordova/CapacitorCordova/CapacitorCordova.h +25 -0
- package/CapacitorCordova/CapacitorCordova/CapacitorCordova.modulemap +6 -0
- package/CapacitorCordova/CapacitorCordova/Classes/Public/AppDelegate.h +8 -0
- package/CapacitorCordova/CapacitorCordova/Classes/Public/AppDelegate.m +5 -0
- package/CapacitorCordova/CapacitorCordova/Classes/Public/CDV.h +28 -0
- package/CapacitorCordova/CapacitorCordova/Classes/Public/CDVAvailability.h +109 -0
- package/CapacitorCordova/CapacitorCordova/Classes/Public/CDVAvailabilityDeprecated.h +21 -0
- package/CapacitorCordova/CapacitorCordova/Classes/Public/CDVCommandDelegate.h +49 -0
- package/CapacitorCordova/CapacitorCordova/Classes/Public/CDVCommandDelegateImpl.h +39 -0
- package/CapacitorCordova/CapacitorCordova/Classes/Public/CDVCommandDelegateImpl.m +149 -0
- package/CapacitorCordova/CapacitorCordova/Classes/Public/CDVConfigParser.h +31 -0
- package/CapacitorCordova/CapacitorCordova/Classes/Public/CDVConfigParser.m +81 -0
- package/CapacitorCordova/CapacitorCordova/Classes/Public/CDVInvokedUrlCommand.h +52 -0
- package/CapacitorCordova/CapacitorCordova/Classes/Public/CDVInvokedUrlCommand.m +116 -0
- package/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPlugin+Resources.h +39 -0
- package/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPlugin+Resources.m +38 -0
- package/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPlugin.h +76 -0
- package/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPlugin.m +136 -0
- package/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPluginManager.h +25 -0
- package/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPluginManager.m +77 -0
- package/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPluginResult.h +82 -0
- package/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPluginResult.m +216 -0
- package/CapacitorCordova/CapacitorCordova/Classes/Public/CDVScreenOrientationDelegate.h +33 -0
- package/CapacitorCordova/CapacitorCordova/Classes/Public/CDVURLProtocol.h +27 -0
- package/CapacitorCordova/CapacitorCordova/Classes/Public/CDVURLProtocol.m +74 -0
- package/CapacitorCordova/CapacitorCordova/Classes/Public/CDVViewController.h +30 -0
- package/CapacitorCordova/CapacitorCordova/Classes/Public/CDVViewController.m +37 -0
- package/CapacitorCordova/CapacitorCordova/Classes/Public/CDVWebViewProcessPoolFactory.h +34 -0
- package/CapacitorCordova/CapacitorCordova/Classes/Public/CDVWebViewProcessPoolFactory.m +55 -0
- package/CapacitorCordova/CapacitorCordova/Classes/Public/NSDictionary+CordovaPreferences.h +35 -0
- package/CapacitorCordova/CapacitorCordova/Classes/Public/NSDictionary+CordovaPreferences.m +63 -0
- package/CapacitorCordova/CapacitorCordova/Info.plist +26 -0
- package/CapacitorCordova/CapacitorCordova/PrivacyInfo.xcprivacy +14 -0
- package/CapacitorCordova.podspec +26 -0
- package/LICENSE +21 -0
- package/package.json +33 -0
- package/scripts/pods_helpers.rb +12 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
|
|
3
|
+
extension InstanceConfiguration {
|
|
4
|
+
@objc public var appStartFileURL: URL {
|
|
5
|
+
if let path = appStartPath {
|
|
6
|
+
return appLocation.appendingPathComponent(path)
|
|
7
|
+
}
|
|
8
|
+
return appLocation
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@objc public var appStartServerURL: URL {
|
|
12
|
+
if let path = appStartPath {
|
|
13
|
+
return serverURL.appendingPathComponent(path)
|
|
14
|
+
}
|
|
15
|
+
return serverURL
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@objc public var errorPathURL: URL? {
|
|
19
|
+
guard let errorPath = errorPath else {
|
|
20
|
+
return nil
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return localURL.appendingPathComponent(errorPath)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@available(*, deprecated, message: "Use getPluginConfig")
|
|
27
|
+
@objc public func getPluginConfigValue(_ pluginId: String, _ configKey: String) -> Any? {
|
|
28
|
+
return (pluginConfigurations as? JSObject)?[keyPath: KeyPath("\(pluginId).\(configKey)")]
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@objc public func getPluginConfig(_ pluginId: String) -> PluginConfig {
|
|
32
|
+
if let cfg = (pluginConfigurations as? JSObject)?[keyPath: KeyPath("\(pluginId)")] as? JSObject {
|
|
33
|
+
return PluginConfig(config: cfg)
|
|
34
|
+
}
|
|
35
|
+
return PluginConfig(config: JSObject())
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@objc public func shouldAllowNavigation(to host: String) -> Bool {
|
|
39
|
+
for hostname in allowedNavigationHostnames {
|
|
40
|
+
if doesHost(host, match: hostname) {
|
|
41
|
+
return true
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return false
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@available(*, deprecated, message: "Use direct property accessors")
|
|
48
|
+
@objc public func getValue(_ key: String) -> Any? {
|
|
49
|
+
return (legacyConfig as? JSObject)?[keyPath: KeyPath(key)]
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@available(*, deprecated, message: "Use direct property accessors")
|
|
53
|
+
@objc public func getString(_ key: String) -> String? {
|
|
54
|
+
return (legacyConfig as? JSObject)?[keyPath: KeyPath(key)] as? String
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// MARK: - Private
|
|
58
|
+
|
|
59
|
+
private func doesHost(_ host: String, match pattern: String) -> Bool {
|
|
60
|
+
// bail early in the simple case
|
|
61
|
+
if pattern == "*" {
|
|
62
|
+
return true
|
|
63
|
+
}
|
|
64
|
+
// break apart the pieces
|
|
65
|
+
var hostComponents = host.lowercased().split(separator: ".")
|
|
66
|
+
var patternComponents = pattern.lowercased().split(separator: ".")
|
|
67
|
+
guard hostComponents.count == patternComponents.count else {
|
|
68
|
+
return false
|
|
69
|
+
}
|
|
70
|
+
// remove any wildcard segments
|
|
71
|
+
for wildcard in patternComponents.enumerated().reversed().filter({ $0.element == "*" }) {
|
|
72
|
+
hostComponents.remove(at: wildcard.offset)
|
|
73
|
+
patternComponents.remove(at: wildcard.offset)
|
|
74
|
+
}
|
|
75
|
+
// match with what's left
|
|
76
|
+
return hostComponents == patternComponents
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
#ifndef CAPInstanceDescriptor_h
|
|
2
|
+
#define CAPInstanceDescriptor_h
|
|
3
|
+
|
|
4
|
+
@import UIKit;
|
|
5
|
+
@import Cordova;
|
|
6
|
+
|
|
7
|
+
typedef NS_ENUM(NSInteger, CAPInstanceType) {
|
|
8
|
+
CAPInstanceTypeFixed NS_SWIFT_NAME(fixed),
|
|
9
|
+
CAPInstanceTypeVariable NS_SWIFT_NAME(variable)
|
|
10
|
+
} NS_SWIFT_NAME(InstanceType);
|
|
11
|
+
|
|
12
|
+
typedef NS_OPTIONS(NSUInteger, CAPInstanceWarning) {
|
|
13
|
+
CAPInstanceWarningMissingAppDir NS_SWIFT_NAME(missingAppDir) = 1 << 0,
|
|
14
|
+
CAPInstanceWarningMissingFile NS_SWIFT_NAME(missingFile) = 1 << 1,
|
|
15
|
+
CAPInstanceWarningInvalidFile NS_SWIFT_NAME(invalidFile) = 1 << 2,
|
|
16
|
+
CAPInstanceWarningMissingCordovaFile NS_SWIFT_NAME(missingCordovaFile) = 1 << 3,
|
|
17
|
+
CAPInstanceWarningInvalidCordovaFile NS_SWIFT_NAME(invalidCordovaFile) = 1 << 4
|
|
18
|
+
} NS_SWIFT_NAME(InstanceWarning);
|
|
19
|
+
|
|
20
|
+
typedef NS_OPTIONS(NSUInteger, CAPInstanceLoggingBehavior) {
|
|
21
|
+
CAPInstanceLoggingBehaviorNone NS_SWIFT_NAME(none) = 1 << 0,
|
|
22
|
+
CAPInstanceLoggingBehaviorDebug NS_SWIFT_NAME(debug) = 1 << 1,
|
|
23
|
+
CAPInstanceLoggingBehaviorProduction NS_SWIFT_NAME(production) = 1 << 2,
|
|
24
|
+
} NS_SWIFT_NAME(InstanceLoggingBehavior);
|
|
25
|
+
|
|
26
|
+
extern NSString * _Nonnull const CAPInstanceDescriptorDefaultScheme NS_SWIFT_UNAVAILABLE("Use InstanceDescriptorDefaults");
|
|
27
|
+
extern NSString * _Nonnull const CAPInstanceDescriptorDefaultHostname NS_SWIFT_UNAVAILABLE("Use InstanceDescriptorDefaults");
|
|
28
|
+
|
|
29
|
+
NS_SWIFT_NAME(InstanceDescriptor)
|
|
30
|
+
@interface CAPInstanceDescriptor : NSObject
|
|
31
|
+
/**
|
|
32
|
+
@brief A value to append to the @c User-Agent string. Ignored if @c overridenUserAgentString is set.
|
|
33
|
+
@discussion Set by @c appendUserAgent in the configuration file.
|
|
34
|
+
*/
|
|
35
|
+
@property (nonatomic, copy, nullable) NSString *appendedUserAgentString;
|
|
36
|
+
/**
|
|
37
|
+
@brief A value that will completely replace the @c User-Agent string. Overrides @c appendedUserAgentString.
|
|
38
|
+
@discussion Set by @c overrideUserAgent in the configuration file.
|
|
39
|
+
*/
|
|
40
|
+
@property (nonatomic, copy, nullable) NSString *overridenUserAgentString;
|
|
41
|
+
/**
|
|
42
|
+
@brief The background color to set on the web view where content is not visible.
|
|
43
|
+
@discussion Set by @c backgroundColor in the configuration file.
|
|
44
|
+
*/
|
|
45
|
+
@property (nonatomic, retain, nullable) UIColor *backgroundColor;
|
|
46
|
+
/**
|
|
47
|
+
@brief Hostnames to which the web view is allowed to navigate without opening an external browser.
|
|
48
|
+
@discussion Set by @c allowNavigation in the configuration file.
|
|
49
|
+
*/
|
|
50
|
+
@property (nonatomic, copy, nonnull) NSArray<NSString*> *allowedNavigationHostnames;
|
|
51
|
+
/**
|
|
52
|
+
@brief The scheme that will be used for the server URL.
|
|
53
|
+
@discussion Defaults to @c capacitor. Set by @c server.iosScheme in the configuration file.
|
|
54
|
+
*/
|
|
55
|
+
@property (nonatomic, copy, nullable) NSString *urlScheme;
|
|
56
|
+
/**
|
|
57
|
+
@brief The path to a local html page to display in case of errors.
|
|
58
|
+
@discussion Defaults to nil.
|
|
59
|
+
*/
|
|
60
|
+
@property (nonatomic, copy, nullable) NSString *errorPath;
|
|
61
|
+
/**
|
|
62
|
+
@brief The hostname that will be used for the server URL.
|
|
63
|
+
@discussion Defaults to @c localhost. Set by @c server.hostname in the configuration file.
|
|
64
|
+
*/
|
|
65
|
+
@property (nonatomic, copy, nullable) NSString *urlHostname;
|
|
66
|
+
/**
|
|
67
|
+
@brief The fully formed URL that will be used as the server URL.
|
|
68
|
+
@discussion Defaults to nil, in which case the server URL will be constructed from @c urlScheme and @c urlHostname. If set, it will override the other properties. Set by @c server.url in the configuration file.
|
|
69
|
+
*/
|
|
70
|
+
@property (nonatomic, copy, nullable) NSString *serverURL;
|
|
71
|
+
/**
|
|
72
|
+
@brief The JSON dictionary that contains the plugin-specific configuration information.
|
|
73
|
+
@discussion Set by @c plugins in the configuration file.
|
|
74
|
+
*/
|
|
75
|
+
@property (nonatomic, retain, nonnull) NSDictionary *pluginConfigurations;
|
|
76
|
+
/**
|
|
77
|
+
@brief The build configurations under which logging should be enabled.
|
|
78
|
+
@discussion Defaults to @c debug. Set by @c loggingBehavior in the configuration file.
|
|
79
|
+
*/
|
|
80
|
+
@property (nonatomic, assign) CAPInstanceLoggingBehavior loggingBehavior;
|
|
81
|
+
/**
|
|
82
|
+
@brief Whether or not the web view can scroll.
|
|
83
|
+
@discussion Set by @c ios.scrollEnabled in the configuration file. Corresponds to @c isScrollEnabled on WKWebView.
|
|
84
|
+
*/
|
|
85
|
+
@property (nonatomic, assign) BOOL scrollingEnabled;
|
|
86
|
+
/**
|
|
87
|
+
@brief Whether or not the web view can zoom.
|
|
88
|
+
@discussion Set by @c zoomEnabled in the configuration file.
|
|
89
|
+
*/
|
|
90
|
+
@property (nonatomic, assign) BOOL zoomingEnabled;
|
|
91
|
+
/**
|
|
92
|
+
@brief Whether or not the web view will preview links.
|
|
93
|
+
@discussion Set by @c ios.allowsLinkPreview in the configuration file. Corresponds to @c allowsLinkPreview on WKWebView.
|
|
94
|
+
*/
|
|
95
|
+
@property (nonatomic, assign) BOOL allowLinkPreviews;
|
|
96
|
+
/**
|
|
97
|
+
@brief Whether or not the Capacitor runtime will set itself as the @c UNUserNotificationCenter delegate.
|
|
98
|
+
@discussion Defaults to @c true. Required to be @c true for notification plugins to work correctly. Set to @c false if your application will handle notifications independently.
|
|
99
|
+
*/
|
|
100
|
+
@property (nonatomic, assign) BOOL handleApplicationNotifications;
|
|
101
|
+
/**
|
|
102
|
+
@brief Enables web debugging by setting isInspectable of @c WKWebView to @c true on iOS 16.4 and greater
|
|
103
|
+
@discussion Defaults to true in debug mode and false in production
|
|
104
|
+
*/
|
|
105
|
+
@property (nonatomic, assign) BOOL isWebDebuggable;
|
|
106
|
+
/**
|
|
107
|
+
@brief Whether or not the webview will have focus.
|
|
108
|
+
@discussion Defaults to @c true. Set by @c ios.initialFocus in the configuration file.
|
|
109
|
+
*/
|
|
110
|
+
@property (nonatomic, assign) BOOL hasInitialFocus;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
@brief How the web view will inset its content
|
|
114
|
+
@discussion Set by @c ios.contentInset in the configuration file. Corresponds to @c contentInsetAdjustmentBehavior on WKWebView.
|
|
115
|
+
*/
|
|
116
|
+
@property (nonatomic, assign) UIScrollViewContentInsetAdjustmentBehavior contentInsetAdjustmentBehavior;
|
|
117
|
+
/**
|
|
118
|
+
@brief The base file URL from which Capacitor will load resources
|
|
119
|
+
@discussion Defaults to @c public/ located at the root of the application bundle.
|
|
120
|
+
*/
|
|
121
|
+
@property (nonatomic, copy, nonnull) NSURL *appLocation;
|
|
122
|
+
/**
|
|
123
|
+
@brief The path (relative to @c appLocation) which Capacitor will use for the inital URL at launch.
|
|
124
|
+
@discussion Defaults to nil, in which case Capacitor will attempt to load @c index.html.
|
|
125
|
+
*/
|
|
126
|
+
@property (nonatomic, copy, nullable) NSString *appStartPath;
|
|
127
|
+
/**
|
|
128
|
+
@brief Whether or not the Capacitor WebView will limit the navigation to @c WKAppBoundDomains listed in the Info.plist.
|
|
129
|
+
@discussion Defaults to @c false. Set by @c ios.limitsNavigationsToAppBoundDomains in the configuration file. Required to be @c true for plugins to work if the app includes @c WKAppBoundDomains in the Info.plist.
|
|
130
|
+
*/
|
|
131
|
+
@property (nonatomic, assign) BOOL limitsNavigationsToAppBoundDomains;
|
|
132
|
+
/**
|
|
133
|
+
@brief The content mode for the web view to use when it loads and renders web content.
|
|
134
|
+
@discussion Defaults to @c recommended. Set by @c ios.preferredContentMode in the configuration file.
|
|
135
|
+
*/
|
|
136
|
+
@property (nonatomic, copy, nullable) NSString *preferredContentMode;
|
|
137
|
+
/**
|
|
138
|
+
@brief The parser used to load the cofiguration for Cordova plugins.
|
|
139
|
+
*/
|
|
140
|
+
@property (nonatomic, copy, nonnull) CDVConfigParser *cordovaConfiguration;
|
|
141
|
+
/**
|
|
142
|
+
@brief Warnings generated during initialization.
|
|
143
|
+
*/
|
|
144
|
+
@property (nonatomic, assign) CAPInstanceWarning warnings;
|
|
145
|
+
/**
|
|
146
|
+
@brief The type of instance.
|
|
147
|
+
*/
|
|
148
|
+
@property (nonatomic, readonly) CAPInstanceType instanceType;
|
|
149
|
+
/**
|
|
150
|
+
@brief The JSON dictionary representing the contents of the configuration file.
|
|
151
|
+
@warning Deprecated. Do not use.
|
|
152
|
+
*/
|
|
153
|
+
@property (nonatomic, retain, nonnull) NSDictionary *legacyConfig;
|
|
154
|
+
/**
|
|
155
|
+
@brief Initialize the descriptor with the default environment. This assumes that the application was built with the help of the Capacitor CLI and that that the web app is located inside the application bundle at @c public/.
|
|
156
|
+
*/
|
|
157
|
+
- (instancetype _Nonnull)initAsDefault NS_SWIFT_NAME(init());
|
|
158
|
+
/**
|
|
159
|
+
@brief Initialize the descriptor for use in other contexts. The app location is the one required parameter.
|
|
160
|
+
@param appURL The location of the folder containing the web app.
|
|
161
|
+
@param configURL The location of the Capacitor configuration file.
|
|
162
|
+
@param cordovaURL The location of the Cordova configuration file.
|
|
163
|
+
*/
|
|
164
|
+
- (instancetype _Nonnull)initAtLocation:(NSURL* _Nonnull)appURL configuration:(NSURL* _Nullable)configURL cordovaConfiguration:(NSURL* _Nullable)cordovaURL NS_SWIFT_NAME(init(at:configuration:cordovaConfiguration:));
|
|
165
|
+
@end
|
|
166
|
+
|
|
167
|
+
#endif /* CAPInstanceDescriptor_h */
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#import "CAPInstanceDescriptor.h"
|
|
2
|
+
#import <Capacitor/Capacitor-Swift.h>
|
|
3
|
+
|
|
4
|
+
// Swift extensions marked as @objc and internal are available to the Obj-C runtime but are not available at compile time.
|
|
5
|
+
// so we need this declaration to avoid compiler complaints
|
|
6
|
+
@interface CAPInstanceDescriptor (InternalSwiftExtension)
|
|
7
|
+
- (void)_parseConfigurationAt:(NSURL *)configURL cordovaConfiguration:(NSURL *)cordovaURL;
|
|
8
|
+
@end
|
|
9
|
+
|
|
10
|
+
NSString* const CAPInstanceDescriptorDefaultScheme = @"capacitor";
|
|
11
|
+
NSString* const CAPInstanceDescriptorDefaultHostname = @"localhost";
|
|
12
|
+
|
|
13
|
+
@implementation CAPInstanceDescriptor
|
|
14
|
+
- (instancetype)initAsDefault {
|
|
15
|
+
if (self = [super init]) {
|
|
16
|
+
_instanceType = CAPInstanceTypeFixed;
|
|
17
|
+
[self _setDefaultsWithAppLocation:[[NSBundle mainBundle] URLForResource:@"public" withExtension:nil]];
|
|
18
|
+
[self _parseConfigurationAt:[[NSBundle mainBundle] URLForResource:@"capacitor.config" withExtension:@"json"] cordovaConfiguration:[[NSBundle mainBundle] URLForResource:@"config" withExtension:@"xml"]];
|
|
19
|
+
}
|
|
20
|
+
return self;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
- (instancetype)initAtLocation:(NSURL*)appURL configuration:(NSURL*)configURL cordovaConfiguration:(NSURL*)cordovaURL {
|
|
24
|
+
if (self = [super init]) {
|
|
25
|
+
_instanceType = CAPInstanceTypeVariable;
|
|
26
|
+
[self _setDefaultsWithAppLocation:appURL];
|
|
27
|
+
[self _parseConfigurationAt:configURL cordovaConfiguration:cordovaURL];
|
|
28
|
+
}
|
|
29
|
+
return self;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
- (void)_setDefaultsWithAppLocation:(NSURL*)location {
|
|
33
|
+
_allowedNavigationHostnames = @[];
|
|
34
|
+
_urlScheme = CAPInstanceDescriptorDefaultScheme;
|
|
35
|
+
_urlHostname = CAPInstanceDescriptorDefaultHostname;
|
|
36
|
+
_pluginConfigurations = @{};
|
|
37
|
+
_legacyConfig = @{};
|
|
38
|
+
_loggingBehavior = CAPInstanceLoggingBehaviorDebug;
|
|
39
|
+
_scrollingEnabled = YES;
|
|
40
|
+
_zoomingEnabled = NO;
|
|
41
|
+
_allowLinkPreviews = YES;
|
|
42
|
+
_handleApplicationNotifications = YES;
|
|
43
|
+
_isWebDebuggable = NO;
|
|
44
|
+
_hasInitialFocus = YES;
|
|
45
|
+
_contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
|
46
|
+
_appLocation = location;
|
|
47
|
+
_limitsNavigationsToAppBoundDomains = FALSE;
|
|
48
|
+
_cordovaConfiguration = [[CDVConfigParser alloc] init];
|
|
49
|
+
_warnings = 0;
|
|
50
|
+
if (location == nil) {
|
|
51
|
+
_warnings |= CAPInstanceWarningMissingAppDir;
|
|
52
|
+
// location is nil so assume it was supposed to be the default
|
|
53
|
+
_appLocation = [[[NSBundle mainBundle] resourceURL] URLByAppendingPathComponent:@"public"];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
@end
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
|
|
3
|
+
public enum InstanceDescriptorDefaults {
|
|
4
|
+
public static let scheme = "capacitor"
|
|
5
|
+
public static let hostname = "localhost"
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
private extension InstanceLoggingBehavior {
|
|
9
|
+
static func behavior(from: String) -> InstanceLoggingBehavior? {
|
|
10
|
+
switch from.lowercased() {
|
|
11
|
+
case "none":
|
|
12
|
+
return InstanceLoggingBehavior.none
|
|
13
|
+
case "debug":
|
|
14
|
+
return InstanceLoggingBehavior.debug
|
|
15
|
+
case "production":
|
|
16
|
+
return InstanceLoggingBehavior.production
|
|
17
|
+
default:
|
|
18
|
+
return nil
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
The purpose of this function is to hide the messy details of parsing the configuration(s) so
|
|
25
|
+
the complexity is worth it. And the name starts with an underscore to match the convention of
|
|
26
|
+
private APIs in Obj-C (from which it is called).
|
|
27
|
+
*/
|
|
28
|
+
internal extension InstanceDescriptor {
|
|
29
|
+
// swiftlint:disable cyclomatic_complexity
|
|
30
|
+
// swiftlint:disable function_body_length
|
|
31
|
+
// swiftlint:disable:next identifier_name
|
|
32
|
+
@objc func _parseConfiguration(at capacitorURL: URL?, cordovaConfiguration cordovaURL: URL?) {
|
|
33
|
+
// sanity check that the app directory is valid
|
|
34
|
+
var isDirectory: ObjCBool = ObjCBool(false)
|
|
35
|
+
if warnings.contains(.missingAppDir) == false,
|
|
36
|
+
FileManager.default.fileExists(atPath: appLocation.path, isDirectory: &isDirectory) == false || isDirectory.boolValue == false {
|
|
37
|
+
warnings.update(with: .missingAppDir)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// parse the capacitor configuration
|
|
41
|
+
var config: JSObject?
|
|
42
|
+
if let capacitorURL = capacitorURL,
|
|
43
|
+
FileManager.default.fileExists(atPath: capacitorURL.path, isDirectory: &isDirectory),
|
|
44
|
+
isDirectory.boolValue == false {
|
|
45
|
+
do {
|
|
46
|
+
let contents = try Data(contentsOf: capacitorURL)
|
|
47
|
+
config = JSTypes.coerceDictionaryToJSObject(try JSONSerialization.jsonObject(with: contents) as? [String: Any])
|
|
48
|
+
} catch {
|
|
49
|
+
warnings.update(with: .invalidFile)
|
|
50
|
+
}
|
|
51
|
+
} else {
|
|
52
|
+
warnings.update(with: .missingFile)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// parse the cordova configuration
|
|
56
|
+
var configParser: XMLParser?
|
|
57
|
+
if let cordovaURL = cordovaURL,
|
|
58
|
+
FileManager.default.fileExists(atPath: cordovaURL.path, isDirectory: &isDirectory),
|
|
59
|
+
isDirectory.boolValue == false {
|
|
60
|
+
configParser = XMLParser(contentsOf: cordovaURL)
|
|
61
|
+
} else {
|
|
62
|
+
warnings.update(with: .missingCordovaFile)
|
|
63
|
+
// we don't want to break up string literals
|
|
64
|
+
// swiftlint:disable:next line_length
|
|
65
|
+
if let cordovaXML = "<?xml version='1.0' encoding='utf-8'?><widget version=\"1.0.0\" xmlns=\"http://www.w3.org/ns/widgets\" xmlns:cdv=\"http://cordova.apache.org/ns/1.0\"><access origin=\"*\" /></widget>".data(using: .utf8) {
|
|
66
|
+
configParser = XMLParser(data: cordovaXML)
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
configParser?.delegate = cordovaConfiguration
|
|
70
|
+
configParser?.parse()
|
|
71
|
+
|
|
72
|
+
// extract our configuration values
|
|
73
|
+
if let config = config {
|
|
74
|
+
// to be removed
|
|
75
|
+
legacyConfig = config
|
|
76
|
+
|
|
77
|
+
if let agentString = (config[keyPath: "ios.appendUserAgent"] as? String) ?? (config[keyPath: "appendUserAgent"] as? String) {
|
|
78
|
+
appendedUserAgentString = agentString
|
|
79
|
+
}
|
|
80
|
+
if let agentString = (config[keyPath: "ios.overrideUserAgent"] as? String) ?? (config[keyPath: "overrideUserAgent"] as? String) {
|
|
81
|
+
overridenUserAgentString = agentString
|
|
82
|
+
}
|
|
83
|
+
if let colorString = (config[keyPath: "ios.backgroundColor"] as? String) ?? (config[keyPath: "backgroundColor"] as? String),
|
|
84
|
+
let color = UIColor.capacitor.color(fromHex: colorString) {
|
|
85
|
+
backgroundColor = color
|
|
86
|
+
}
|
|
87
|
+
if let allowNav = config[keyPath: "server.allowNavigation"] as? [String] {
|
|
88
|
+
allowedNavigationHostnames = allowNav
|
|
89
|
+
}
|
|
90
|
+
if let scheme = (config[keyPath: "server.iosScheme"] as? String)?.lowercased() {
|
|
91
|
+
urlScheme = scheme
|
|
92
|
+
}
|
|
93
|
+
if let host = config[keyPath: "server.hostname"] as? String {
|
|
94
|
+
urlHostname = host
|
|
95
|
+
}
|
|
96
|
+
if let urlString = config[keyPath: "server.url"] as? String {
|
|
97
|
+
serverURL = urlString
|
|
98
|
+
}
|
|
99
|
+
if let errorPathString = (config[keyPath: "server.errorPath"] as? String) {
|
|
100
|
+
errorPath = errorPathString
|
|
101
|
+
}
|
|
102
|
+
if let insetBehavior = config[keyPath: "ios.contentInset"] as? String {
|
|
103
|
+
let availableInsets: [String: UIScrollView.ContentInsetAdjustmentBehavior] = ["automatic": .automatic,
|
|
104
|
+
"scrollableAxes": .scrollableAxes,
|
|
105
|
+
"never": .never,
|
|
106
|
+
"always": .always]
|
|
107
|
+
if let option = availableInsets[insetBehavior] {
|
|
108
|
+
contentInsetAdjustmentBehavior = option
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if let allowPreviews = config[keyPath: "ios.allowsLinkPreview"] as? Bool {
|
|
112
|
+
allowLinkPreviews = allowPreviews
|
|
113
|
+
}
|
|
114
|
+
if let scrollEnabled = config[keyPath: "ios.scrollEnabled"] as? Bool {
|
|
115
|
+
scrollingEnabled = scrollEnabled
|
|
116
|
+
}
|
|
117
|
+
if let zoomEnabled = (config[keyPath: "ios.zoomEnabled"] as? Bool) ?? (config[keyPath: "zoomEnabled"] as? Bool) {
|
|
118
|
+
zoomingEnabled = zoomEnabled
|
|
119
|
+
}
|
|
120
|
+
if let pluginConfig = config[keyPath: "plugins"] as? JSObject {
|
|
121
|
+
pluginConfigurations = pluginConfig
|
|
122
|
+
}
|
|
123
|
+
if let value = (config[keyPath: "ios.loggingBehavior"] as? String) ?? (config[keyPath: "loggingBehavior"] as? String) {
|
|
124
|
+
if let behavior = InstanceLoggingBehavior.behavior(from: value) {
|
|
125
|
+
loggingBehavior = behavior
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if let limitsNavigations = config[keyPath: "ios.limitsNavigationsToAppBoundDomains"] as? Bool {
|
|
129
|
+
limitsNavigationsToAppBoundDomains = limitsNavigations
|
|
130
|
+
}
|
|
131
|
+
if let preferredMode = (config[keyPath: "ios.preferredContentMode"] as? String) {
|
|
132
|
+
preferredContentMode = preferredMode
|
|
133
|
+
}
|
|
134
|
+
if let handleNotifications = config[keyPath: "ios.handleApplicationNotifications"] as? Bool {
|
|
135
|
+
handleApplicationNotifications = handleNotifications
|
|
136
|
+
}
|
|
137
|
+
if let webContentsDebuggingEnabled = config[keyPath: "ios.webContentsDebuggingEnabled"] as? Bool {
|
|
138
|
+
isWebDebuggable = webContentsDebuggingEnabled
|
|
139
|
+
} else {
|
|
140
|
+
#if DEBUG
|
|
141
|
+
isWebDebuggable = true
|
|
142
|
+
#else
|
|
143
|
+
// this is needed for SPM xcframework Capacitor. Can eventually be removed when the SPM package moves to being source-based.
|
|
144
|
+
if let debugValue = Bundle.main.object(forInfoDictionaryKey: "CAPACITOR_DEBUG") as? String, debugValue == "true" {
|
|
145
|
+
isWebDebuggable = true
|
|
146
|
+
}
|
|
147
|
+
#endif
|
|
148
|
+
}
|
|
149
|
+
if let initialFocus = (config[keyPath: "ios.initialFocus"] as? Bool) ?? (config[keyPath: "initialFocus"] as? Bool) {
|
|
150
|
+
hasInitialFocus = initialFocus
|
|
151
|
+
}
|
|
152
|
+
if let startPath = (config[keyPath: "server.appStartPath"] as? String) {
|
|
153
|
+
appStartPath = startPath
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
// swiftlint:enable cyclomatic_complexity
|
|
158
|
+
// swiftlint:enable function_body_length
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
extension InstanceDescriptor {
|
|
162
|
+
@objc public var cordovaDeployDisabled: Bool {
|
|
163
|
+
return (cordovaConfiguration.settings?["DisableDeploy".lowercased()] as? NSString)?.boolValue ?? false
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
@objc public func normalize() {
|
|
167
|
+
// first, make sure the scheme is valid
|
|
168
|
+
var schemeValid = false
|
|
169
|
+
if let scheme = urlScheme, WKWebView.handlesURLScheme(scheme) == false,
|
|
170
|
+
scheme.range(of: "^[a-z][a-z0-9.+-]*$", options: [.regularExpression, .caseInsensitive], range: nil, locale: nil) != nil {
|
|
171
|
+
schemeValid = true
|
|
172
|
+
}
|
|
173
|
+
if !schemeValid {
|
|
174
|
+
// reset to the default
|
|
175
|
+
urlScheme = InstanceDescriptorDefaults.scheme
|
|
176
|
+
}
|
|
177
|
+
// make sure we have a hostname
|
|
178
|
+
if urlHostname == nil {
|
|
179
|
+
urlHostname = InstanceDescriptorDefaults.hostname
|
|
180
|
+
}
|
|
181
|
+
// now validate the server.url
|
|
182
|
+
var urlValid = false
|
|
183
|
+
if let server = serverURL, URL(string: server) != nil {
|
|
184
|
+
urlValid = true
|
|
185
|
+
}
|
|
186
|
+
if !urlValid {
|
|
187
|
+
serverURL = nil
|
|
188
|
+
}
|
|
189
|
+
// reset the path if it's not valid
|
|
190
|
+
if let path = appStartPath?.trimmingCharacters(in: .whitespacesAndNewlines), path.isEmpty {
|
|
191
|
+
appStartPath = nil
|
|
192
|
+
}
|
|
193
|
+
// if the plugin configuration was programmatically modified, the necessary type information may have been lost.
|
|
194
|
+
// so perform a coercion here to make sure that casting will work as expected
|
|
195
|
+
pluginConfigurations = JSTypes.coerceDictionaryToJSObject(pluginConfigurations) ?? [:]
|
|
196
|
+
legacyConfig = JSTypes.coerceDictionaryToJSObject(legacyConfig) ?? [:]
|
|
197
|
+
}
|
|
198
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//
|
|
2
|
+
// CAPInstancePlugin.swift
|
|
3
|
+
// Capacitor
|
|
4
|
+
//
|
|
5
|
+
// Created by Steven Sherry on 11/21/22.
|
|
6
|
+
// Copyright © 2022 Drifty Co. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
/// A CAPPlugin subclass meant to be explicitly initialized by the caller and not the bridge.
|
|
10
|
+
@objc open class CAPInstancePlugin: CAPPlugin {}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
public class CAPLog {
|
|
2
|
+
public static var enableLogging: Bool = true
|
|
3
|
+
|
|
4
|
+
public static func print(_ items: Any..., separator: String = " ", terminator: String = "\n") {
|
|
5
|
+
if enableLogging {
|
|
6
|
+
for (itemIndex, item) in items.enumerated() {
|
|
7
|
+
Swift.print("\(item)".prefix(4068), terminator: itemIndex == items.count - 1 ? terminator : separator)
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Notificaton types for NotificationCenter and NSNotificationCenter
|
|
3
|
+
|
|
4
|
+
We want to include `capacitor` in the name(s) to uniquely identify these even though it can make the names long
|
|
5
|
+
and the deprecated notifications are only here for backwards compatibility.
|
|
6
|
+
*/
|
|
7
|
+
// swiftlint:disable identifier_name
|
|
8
|
+
extension Notification.Name {
|
|
9
|
+
public static let capacitorOpenURL = Notification.Name(rawValue: "CapacitorOpenURLNotification")
|
|
10
|
+
public static let capacitorOpenUniversalLink = Notification.Name(rawValue: "CapacitorOpenUniversalLinkNotification")
|
|
11
|
+
public static let capacitorContinueActivity = Notification.Name(rawValue: "CapacitorContinueActivityNotification")
|
|
12
|
+
public static let capacitorDidRegisterForRemoteNotifications =
|
|
13
|
+
Notification.Name(rawValue: "CapacitorDidRegisterForRemoteNotificationsNotification")
|
|
14
|
+
public static let capacitorDidFailToRegisterForRemoteNotifications =
|
|
15
|
+
Notification.Name(rawValue: "CapacitorDidFailToRegisterForRemoteNotificationsNotification")
|
|
16
|
+
public static let capacitorDecidePolicyForNavigationAction =
|
|
17
|
+
Notification.Name(rawValue: "CapacitorDecidePolicyForNavigationActionNotification")
|
|
18
|
+
public static let capacitorStatusBarTapped = Notification.Name(rawValue: "CapacitorStatusBarTappedNotification")
|
|
19
|
+
public static let capacitorViewDidAppear = Notification.Name(rawValue: "CapacitorViewDidAppear")
|
|
20
|
+
public static let capacitorViewWillTransition = Notification.Name(rawValue: "CapacitorViewWillTransition")
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@objc extension NSNotification {
|
|
24
|
+
public static let capacitorOpenURL = Notification.Name.capacitorOpenURL
|
|
25
|
+
public static let capacitorOpenUniversalLink = Notification.Name.capacitorOpenUniversalLink
|
|
26
|
+
public static let capacitorContinueActivity = Notification.Name.capacitorContinueActivity
|
|
27
|
+
public static let capacitorDidRegisterForRemoteNotifications = Notification.Name.capacitorDidRegisterForRemoteNotifications
|
|
28
|
+
public static let capacitorDidFailToRegisterForRemoteNotifications = Notification.Name.capacitorDidFailToRegisterForRemoteNotifications
|
|
29
|
+
public static let capacitorDecidePolicyForNavigationAction = Notification.Name.capacitorDecidePolicyForNavigationAction
|
|
30
|
+
public static let capacitorStatusBarTapped = Notification.Name.capacitorStatusBarTapped
|
|
31
|
+
public static let capacitorViewDidAppear = Notification.Name.capacitorViewDidAppear
|
|
32
|
+
public static let capacitorViewWillTransition = Notification.Name.capacitorViewWillTransition
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
Deprecated, will be removed
|
|
37
|
+
*/
|
|
38
|
+
@objc public enum CAPNotifications: Int {
|
|
39
|
+
@available(*, deprecated, message: "renamed to 'Notification.Name.capacitorOpenURL'")
|
|
40
|
+
case URLOpen
|
|
41
|
+
@available(*, deprecated, message: "renamed to 'Notification.Name.capacitorOpenUniversalLink'")
|
|
42
|
+
case UniversalLinkOpen
|
|
43
|
+
@available(*, deprecated, message: "Notification.Name.capacitorContinueActivity'")
|
|
44
|
+
case ContinueActivity
|
|
45
|
+
@available(*, deprecated, message: "renamed to 'Notification.Name.capacitorDidRegisterForRemoteNotifications'")
|
|
46
|
+
case DidRegisterForRemoteNotificationsWithDeviceToken
|
|
47
|
+
@available(*, deprecated, message: "renamed to 'Notification.Name.capacitorDidFailToRegisterForRemoteNotifications'")
|
|
48
|
+
case DidFailToRegisterForRemoteNotificationsWithError
|
|
49
|
+
@available(*, deprecated, message: "renamed to 'Notification.Name.capacitorDecidePolicyForNavigationAction'")
|
|
50
|
+
case DecidePolicyForNavigationAction
|
|
51
|
+
|
|
52
|
+
public func name() -> String {
|
|
53
|
+
switch self {
|
|
54
|
+
case .URLOpen:
|
|
55
|
+
return Notification.Name.capacitorOpenURL.rawValue
|
|
56
|
+
case .UniversalLinkOpen:
|
|
57
|
+
return Notification.Name.capacitorOpenUniversalLink.rawValue
|
|
58
|
+
case .ContinueActivity:
|
|
59
|
+
return Notification.Name.capacitorContinueActivity.rawValue
|
|
60
|
+
case .DidRegisterForRemoteNotificationsWithDeviceToken:
|
|
61
|
+
return Notification.Name.capacitorDidRegisterForRemoteNotifications.rawValue
|
|
62
|
+
case .DidFailToRegisterForRemoteNotificationsWithError:
|
|
63
|
+
return Notification.Name.capacitorDidFailToRegisterForRemoteNotifications.rawValue
|
|
64
|
+
case .DecidePolicyForNavigationAction:
|
|
65
|
+
return Notification.Name.capacitorDecidePolicyForNavigationAction.rawValue
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
// swiftlint:enable identifier_name
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//
|
|
2
|
+
// CAPPlugin+LoadInstance.swift
|
|
3
|
+
// Capacitor
|
|
4
|
+
//
|
|
5
|
+
// Created by Steven Sherry on 11/9/22.
|
|
6
|
+
// Copyright © 2022 Drifty Co. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
extension CAPBridgedPlugin where Self: CAPPlugin {
|
|
10
|
+
func load(on bridge: CAPBridgeProtocol) {
|
|
11
|
+
self.bridge = bridge
|
|
12
|
+
webView = bridge.webView
|
|
13
|
+
shouldStringifyDatesInCalls = true
|
|
14
|
+
retainedEventArguments = [:]
|
|
15
|
+
eventListeners = [:]
|
|
16
|
+
pluginId = identifier
|
|
17
|
+
pluginName = jsName
|
|
18
|
+
load()
|
|
19
|
+
}
|
|
20
|
+
}
|