@capacitor/ios 4.0.0-alpha.1 → 4.0.0-alpha.2
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/CHANGELOG.md +17 -0
- package/Capacitor/Capacitor/CAPBridgeViewController.swift +9 -0
- package/Capacitor/Capacitor/CAPInstanceConfiguration.h +1 -0
- package/Capacitor/Capacitor/CAPInstanceConfiguration.m +1 -0
- package/Capacitor/Capacitor/CAPInstanceDescriptor.h +5 -0
- package/Capacitor/Capacitor/CAPInstanceDescriptor.swift +3 -0
- package/Capacitor/Capacitor/CAPPlugin.h +1 -1
- package/Capacitor/Capacitor/CAPPlugin.m +1 -4
- package/Capacitor/Capacitor/JSExport.swift +1 -1
- package/Capacitor/Capacitor/PluginConfig.swift +6 -6
- package/Capacitor/Capacitor/WebViewDelegationHandler.swift +0 -3
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,23 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [4.0.0-alpha.2](https://github.com/ionic-team/capacitor/compare/3.4.1...4.0.0-alpha.2) (2022-05-12)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **ios:** make removeAllListeners return a promise ([#5526](https://github.com/ionic-team/capacitor/issues/5526)) ([815f71b](https://github.com/ionic-team/capacitor/commit/815f71b6b62f6c4d5f66e6a36c190bb00a96fdcc))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* **ios:** add getConfig to CAPPlugin ([#5495](https://github.com/ionic-team/capacitor/issues/5495)) ([224a9d0](https://github.com/ionic-team/capacitor/commit/224a9d075629d9c9da9ddc658eb282617fc46d09))
|
|
17
|
+
* **ios:** Add preferredContentMode configuration option ([#5583](https://github.com/ionic-team/capacitor/issues/5583)) ([5b6dfa3](https://github.com/ionic-team/capacitor/commit/5b6dfa3fe29c85632546b299f03cc04a77cf7475))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
6
23
|
# [4.0.0-alpha.1](https://github.com/ionic-team/capacitor/compare/3.4.1...4.0.0-alpha.1) (2022-03-25)
|
|
7
24
|
|
|
8
25
|
|
|
@@ -115,6 +115,15 @@ import Cordova
|
|
|
115
115
|
webViewConfiguration.applicationNameForUserAgent = appendUserAgent
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
+
if let preferredContentMode = instanceConfiguration.preferredContentMode {
|
|
119
|
+
var mode = WKWebpagePreferences.ContentMode.recommended
|
|
120
|
+
if preferredContentMode == "mobile" {
|
|
121
|
+
mode = WKWebpagePreferences.ContentMode.mobile
|
|
122
|
+
} else if preferredContentMode == "desktop" {
|
|
123
|
+
mode = WKWebpagePreferences.ContentMode.desktop
|
|
124
|
+
}
|
|
125
|
+
webViewConfiguration.defaultWebpagePreferences.preferredContentMode = mode
|
|
126
|
+
}
|
|
118
127
|
return webViewConfiguration
|
|
119
128
|
}
|
|
120
129
|
|
|
@@ -23,6 +23,7 @@ NS_SWIFT_NAME(InstanceConfiguration)
|
|
|
23
23
|
@property (nonatomic, readonly, nonnull) NSURL *appLocation;
|
|
24
24
|
@property (nonatomic, readonly, nullable) NSString *appStartPath;
|
|
25
25
|
@property (nonatomic, readonly) BOOL limitsNavigationsToAppBoundDomains;
|
|
26
|
+
@property (nonatomic, readonly, nullable) NSString *preferredContentMode;
|
|
26
27
|
|
|
27
28
|
@property (nonatomic, readonly, nonnull) NSDictionary *legacyConfig DEPRECATED_MSG_ATTRIBUTE("Use direct properties instead");
|
|
28
29
|
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
_appLocation = descriptor.appLocation;
|
|
36
36
|
_appStartPath = descriptor.appStartPath;
|
|
37
37
|
_limitsNavigationsToAppBoundDomains = descriptor.limitsNavigationsToAppBoundDomains;
|
|
38
|
+
_preferredContentMode = descriptor.preferredContentMode;
|
|
38
39
|
_pluginConfigurations = descriptor.pluginConfigurations;
|
|
39
40
|
_legacyConfig = descriptor.legacyConfig;
|
|
40
41
|
// construct the necessary URLs
|
|
@@ -108,6 +108,11 @@ NS_SWIFT_NAME(InstanceDescriptor)
|
|
|
108
108
|
@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.
|
|
109
109
|
*/
|
|
110
110
|
@property (nonatomic, assign) BOOL limitsNavigationsToAppBoundDomains;
|
|
111
|
+
/**
|
|
112
|
+
@brief The content mode for the web view to use when it loads and renders web content.
|
|
113
|
+
@discussion Defaults to @c recommended. Set by @c ios.preferredContentMode in the configuration file.
|
|
114
|
+
*/
|
|
115
|
+
@property (nonatomic, copy, nullable) NSString *preferredContentMode;
|
|
111
116
|
/**
|
|
112
117
|
@brief The parser used to load the cofiguration for Cordova plugins.
|
|
113
118
|
*/
|
|
@@ -125,6 +125,9 @@ internal extension InstanceDescriptor {
|
|
|
125
125
|
if let limitsNavigations = config[keyPath: "ios.limitsNavigationsToAppBoundDomains"] as? Bool {
|
|
126
126
|
limitsNavigationsToAppBoundDomains = limitsNavigations
|
|
127
127
|
}
|
|
128
|
+
if let preferredMode = (config[keyPath: "ios.preferredContentMode"] as? String) {
|
|
129
|
+
preferredContentMode = preferredMode
|
|
130
|
+
}
|
|
128
131
|
}
|
|
129
132
|
}
|
|
130
133
|
// swiftlint:enable cyclomatic_complexity
|
|
@@ -49,6 +49,6 @@
|
|
|
49
49
|
-(id _Nullable)getConfigValue:(NSString* _Nonnull)key __deprecated_msg("use getConfig() and access config values using the methods available depending on the type.");
|
|
50
50
|
-(PluginConfig* _Nonnull)getConfig;
|
|
51
51
|
-(void)setCenteredPopover:(UIViewController* _Nonnull)vc;
|
|
52
|
-
-(BOOL)supportsPopover;
|
|
52
|
+
-(BOOL)supportsPopover DEPRECATED_MSG_ATTRIBUTE("All iOS 13+ devices support popover");
|
|
53
53
|
|
|
54
54
|
@end
|
|
@@ -109,6 +109,7 @@
|
|
|
109
109
|
|
|
110
110
|
- (void)removeAllListeners:(CAPPluginCall *)call {
|
|
111
111
|
[self.eventListeners removeAllObjects];
|
|
112
|
+
[call resolve];
|
|
112
113
|
}
|
|
113
114
|
|
|
114
115
|
- (NSArray<CAPPluginCall *>*)getListeners:(NSString *)eventName {
|
|
@@ -145,11 +146,7 @@
|
|
|
145
146
|
}
|
|
146
147
|
|
|
147
148
|
-(BOOL)supportsPopover {
|
|
148
|
-
if (@available(iOS 13, *)) {
|
|
149
149
|
return YES;
|
|
150
|
-
} else {
|
|
151
|
-
return UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad;
|
|
152
|
-
}
|
|
153
150
|
}
|
|
154
151
|
|
|
155
152
|
- (NSNumber*)shouldOverrideLoad:(WKNavigationAction*)navigationAction {
|
|
@@ -97,7 +97,7 @@ internal class JSExport {
|
|
|
97
97
|
let methods = [
|
|
98
98
|
PluginHeaderMethod(name: "addListener", rtype: nil),
|
|
99
99
|
PluginHeaderMethod(name: "removeListener", rtype: nil),
|
|
100
|
-
PluginHeaderMethod(name: "removeAllListeners", rtype:
|
|
100
|
+
PluginHeaderMethod(name: "removeAllListeners", rtype: "promise"),
|
|
101
101
|
PluginHeaderMethod(name: "checkPermissions", rtype: "promise"),
|
|
102
102
|
PluginHeaderMethod(name: "requestPermissions", rtype: "promise")
|
|
103
103
|
]
|
|
@@ -9,39 +9,39 @@ import Foundation
|
|
|
9
9
|
self.config = config
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
public func getString(configKey: String, defaultValue: String? = nil) -> String? {
|
|
12
|
+
@objc public func getString(_ configKey: String, _ defaultValue: String? = nil) -> String? {
|
|
13
13
|
if let val = (self.config)[keyPath: KeyPath(configKey)] as? String {
|
|
14
14
|
return val
|
|
15
15
|
}
|
|
16
16
|
return defaultValue
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
public func getBoolean(configKey: String, defaultValue: Bool) -> Bool {
|
|
19
|
+
@objc public func getBoolean(_ configKey: String, _ defaultValue: Bool) -> Bool {
|
|
20
20
|
if let val = (self.config)[keyPath: KeyPath(configKey)] as? Bool {
|
|
21
21
|
return val
|
|
22
22
|
}
|
|
23
23
|
return defaultValue
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
public func getInt(configKey: String, defaultValue: Int) -> Int {
|
|
26
|
+
@objc public func getInt(_ configKey: String, _ defaultValue: Int) -> Int {
|
|
27
27
|
if let val = (self.config)[keyPath: KeyPath(configKey)] as? Int {
|
|
28
28
|
return val
|
|
29
29
|
}
|
|
30
30
|
return defaultValue
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
public func getArray(configKey: String, defaultValue: JSArray? = nil) -> JSArray? {
|
|
33
|
+
public func getArray(_ configKey: String, _ defaultValue: JSArray? = nil) -> JSArray? {
|
|
34
34
|
if let val = (self.config)[keyPath: KeyPath(configKey)] as? JSArray {
|
|
35
35
|
return val
|
|
36
36
|
}
|
|
37
37
|
return defaultValue
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
public func getObject(configKey: String) -> JSObject? {
|
|
40
|
+
public func getObject(_ configKey: String) -> JSObject? {
|
|
41
41
|
return (self.config)[keyPath: KeyPath(configKey)] as? JSObject
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
public func isEmpty() -> Bool {
|
|
44
|
+
@objc public func isEmpty() -> Bool {
|
|
45
45
|
return self.config.isEmpty
|
|
46
46
|
}
|
|
47
47
|
|
|
@@ -47,8 +47,6 @@ internal class WebViewDelegationHandler: NSObject, WKNavigationDelegate, WKUIDel
|
|
|
47
47
|
bridge?.reset()
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
// TODO: remove once Xcode 12 support is dropped
|
|
51
|
-
#if compiler(>=5.5)
|
|
52
50
|
@available(iOS 15, *)
|
|
53
51
|
func webView(
|
|
54
52
|
_ webView: WKWebView,
|
|
@@ -67,7 +65,6 @@ internal class WebViewDelegationHandler: NSObject, WKNavigationDelegate, WKUIDel
|
|
|
67
65
|
decisionHandler: @escaping (WKPermissionDecision) -> Void) {
|
|
68
66
|
decisionHandler(.grant)
|
|
69
67
|
}
|
|
70
|
-
#endif
|
|
71
68
|
|
|
72
69
|
public func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
|
|
73
70
|
// post a notification for any listeners
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor/ios",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.2",
|
|
4
4
|
"description": "Capacitor: Cross-platform apps with JavaScript and the web",
|
|
5
5
|
"homepage": "https://capacitorjs.com",
|
|
6
6
|
"author": "Ionic Team <hi@ionic.io> (https://ionic.io)",
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"publishConfig": {
|
|
30
30
|
"access": "public"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "5c588d5bd15b2b939c6efc25b7db9d6af29afae0"
|
|
33
33
|
}
|