@capacitor/ios 3.4.1 → 4.0.1-alpha.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/CHANGELOG.md +11 -0
- package/Capacitor/Capacitor/CAPInstanceConfiguration.swift +8 -0
- package/Capacitor/Capacitor/CAPPlugin.h +4 -1
- package/Capacitor/Capacitor/CAPPlugin.m +5 -1
- package/Capacitor/Capacitor/PluginConfig.swift +56 -0
- package/Capacitor.podspec +1 -1
- package/CapacitorCordova.podspec +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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.1-alpha.0](https://github.com/ionic-team/capacitor/compare/3.4.1...4.0.1-alpha.0) (2022-03-25)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **ios:** add getConfig to CAPPlugin ([#5495](https://github.com/ionic-team/capacitor/issues/5495)) ([224a9d0](https://github.com/ionic-team/capacitor/commit/224a9d075629d9c9da9ddc658eb282617fc46d09))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [3.4.1](https://github.com/ionic-team/capacitor/compare/3.4.0...3.4.1) (2022-02-09)
|
|
7
18
|
|
|
8
19
|
|
|
@@ -15,10 +15,18 @@ extension InstanceConfiguration {
|
|
|
15
15
|
return serverURL
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
@available(*, deprecated, message: "Use getPluginConfig")
|
|
18
19
|
@objc public func getPluginConfigValue(_ pluginId: String, _ configKey: String) -> Any? {
|
|
19
20
|
return (pluginConfigurations as? JSObject)?[keyPath: KeyPath("\(pluginId).\(configKey)")]
|
|
20
21
|
}
|
|
21
22
|
|
|
23
|
+
@objc public func getPluginConfig(_ pluginId: String) -> PluginConfig {
|
|
24
|
+
if let cfg = (pluginConfigurations as? JSObject)?[keyPath: KeyPath("\(pluginId)")] as? JSObject {
|
|
25
|
+
return PluginConfig(config: cfg)
|
|
26
|
+
}
|
|
27
|
+
return PluginConfig(config: JSObject())
|
|
28
|
+
}
|
|
29
|
+
|
|
22
30
|
@objc public func shouldAllowNavigation(to host: String) -> Bool {
|
|
23
31
|
for hostname in allowedNavigationHostnames {
|
|
24
32
|
if doesHost(host, match: hostname) {
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
@protocol CAPBridgeProtocol;
|
|
5
5
|
@class CAPPluginCall;
|
|
6
6
|
|
|
7
|
+
@class PluginConfig;
|
|
8
|
+
|
|
7
9
|
@interface CAPPlugin : NSObject
|
|
8
10
|
|
|
9
11
|
@property (nonatomic, weak, nullable) WKWebView *webView;
|
|
@@ -44,7 +46,8 @@
|
|
|
44
46
|
-(NSString* _Nonnull)getId;
|
|
45
47
|
-(BOOL)getBool:(CAPPluginCall* _Nonnull) call field:(NSString* _Nonnull)field defaultValue:(BOOL)defaultValue DEPRECATED_MSG_ATTRIBUTE("Use accessors on CAPPluginCall instead. See CAPBridgedJSTypes.h for Obj-C implementations.");
|
|
46
48
|
-(NSString* _Nullable)getString:(CAPPluginCall* _Nonnull)call field:(NSString* _Nonnull)field defaultValue:(NSString* _Nonnull)defaultValue DEPRECATED_MSG_ATTRIBUTE("Use accessors on CAPPluginCall instead. See CAPBridgedJSTypes.h for Obj-C implementations.");
|
|
47
|
-
-(id _Nullable)getConfigValue:(NSString* _Nonnull)key;
|
|
49
|
+
-(id _Nullable)getConfigValue:(NSString* _Nonnull)key __deprecated_msg("use getConfig() and access config values using the methods available depending on the type.");
|
|
50
|
+
-(PluginConfig* _Nonnull)getConfig;
|
|
48
51
|
-(void)setCenteredPopover:(UIViewController* _Nonnull)vc;
|
|
49
52
|
-(BOOL)supportsPopover;
|
|
50
53
|
|
|
@@ -29,10 +29,14 @@
|
|
|
29
29
|
return [call getString:field defaultValue:defaultValue];
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
-(id)getConfigValue:(NSString *)key {
|
|
32
|
+
-(id)getConfigValue:(NSString *)key __deprecated {
|
|
33
33
|
return [self.bridge.config getPluginConfigValue:self.pluginName :key];
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
-(PluginConfig*)getConfig {
|
|
37
|
+
return [self.bridge.config getPluginConfig:self.pluginName];
|
|
38
|
+
}
|
|
39
|
+
|
|
36
40
|
-(void)load {}
|
|
37
41
|
|
|
38
42
|
- (void)addEventListener:(NSString *)eventName listener:(CAPPluginCall *)listener {
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
|
|
3
|
+
@objc public class PluginConfig: NSObject {
|
|
4
|
+
|
|
5
|
+
// The object containing the plugin config values
|
|
6
|
+
private var config: JSObject
|
|
7
|
+
|
|
8
|
+
init(config: JSObject) {
|
|
9
|
+
self.config = config
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
public func getString(configKey: String, defaultValue: String? = nil) -> String? {
|
|
13
|
+
if let val = (self.config)[keyPath: KeyPath(configKey)] as? String {
|
|
14
|
+
return val
|
|
15
|
+
}
|
|
16
|
+
return defaultValue
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public func getBoolean(configKey: String, defaultValue: Bool) -> Bool {
|
|
20
|
+
if let val = (self.config)[keyPath: KeyPath(configKey)] as? Bool {
|
|
21
|
+
return val
|
|
22
|
+
}
|
|
23
|
+
return defaultValue
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public func getInt(configKey: String, defaultValue: Int) -> Int {
|
|
27
|
+
if let val = (self.config)[keyPath: KeyPath(configKey)] as? Int {
|
|
28
|
+
return val
|
|
29
|
+
}
|
|
30
|
+
return defaultValue
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
public func getArray(configKey: String, defaultValue: JSArray? = nil) -> JSArray? {
|
|
34
|
+
if let val = (self.config)[keyPath: KeyPath(configKey)] as? JSArray {
|
|
35
|
+
return val
|
|
36
|
+
}
|
|
37
|
+
return defaultValue
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public func getObject(configKey: String) -> JSObject? {
|
|
41
|
+
return (self.config)[keyPath: KeyPath(configKey)] as? JSObject
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public func isEmpty() -> Bool {
|
|
45
|
+
return self.config.isEmpty
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Gets the JSObject containing the config of the the provided plugin ID.
|
|
50
|
+
*
|
|
51
|
+
* @return The config for that plugin
|
|
52
|
+
*/
|
|
53
|
+
public func getConfigJSON() -> JSObject {
|
|
54
|
+
return self.config
|
|
55
|
+
}
|
|
56
|
+
}
|
package/Capacitor.podspec
CHANGED
|
@@ -7,7 +7,7 @@ Pod::Spec.new do |s|
|
|
|
7
7
|
s.social_media_url = 'https://twitter.com/capacitorjs'
|
|
8
8
|
s.license = 'MIT'
|
|
9
9
|
s.homepage = 'https://capacitorjs.com/'
|
|
10
|
-
s.ios.deployment_target = '
|
|
10
|
+
s.ios.deployment_target = '13.0'
|
|
11
11
|
s.authors = { 'Ionic Team' => 'hi@ionicframework.com' }
|
|
12
12
|
s.source = { :git => 'https://github.com/ionic-team/capacitor.git', :branch => "portals-dev" }
|
|
13
13
|
s.source_files = 'Capacitor/Capacitor/*.{swift,h,m}', 'Capacitor/Capacitor/Plugins/*.{swift,h,m}', 'Capacitor/Capacitor/Plugins/**/*.{swift,h,m}'
|
package/CapacitorCordova.podspec
CHANGED
|
@@ -9,7 +9,7 @@ Pod::Spec.new do |s|
|
|
|
9
9
|
s.license = 'MIT'
|
|
10
10
|
s.authors = { 'Ionic Team' => 'hi@ionicframework.com' }
|
|
11
11
|
s.source = { :git => 'https://github.com/ionic-team/capacitor', :tag => s.version.to_s }
|
|
12
|
-
s.platform = :ios,
|
|
12
|
+
s.platform = :ios, 13.0
|
|
13
13
|
s.source_files = 'CapacitorCordova/CapacitorCordova/**/*.{h,m}'
|
|
14
14
|
s.public_header_files = 'CapacitorCordova/CapacitorCordova/Classes/Public/*.h', 'CapacitorCordova/CapacitorCordova/CapacitorCordova.h'
|
|
15
15
|
s.module_map = 'CapacitorCordova/CapacitorCordova/CapacitorCordova.modulemap'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor/ios",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.1-alpha.0",
|
|
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": "7faec09fd724a0af7436f3d30c83856b7bb5ce51"
|
|
33
33
|
}
|