@capacitor/ios 9.0.0-alpha.6 → 9.0.0-alpha.7
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.podspec +10 -4
- package/CapacitorCordova.podspec +6 -5
- package/{Capacitor → Sources}/Capacitor/CAPApplicationDelegateProxy.swift +1 -1
- package/{Capacitor → Sources}/Capacitor/CAPBridgeProtocol.swift +0 -57
- package/{Capacitor → Sources}/Capacitor/CAPInstanceConfiguration.swift +0 -15
- package/{Capacitor → Sources}/Capacitor/CAPNotifications.swift +8 -36
- package/Sources/Capacitor/CAPPlugin+Bridge.swift +108 -0
- package/{Capacitor → Sources}/Capacitor/CAPPluginCall.swift +0 -13
- package/Sources/Capacitor/CAPSceneDelegateProxy.swift +204 -0
- package/{Capacitor → Sources}/Capacitor/CapacitorBridge.swift +37 -78
- package/Sources/Capacitor/CapacitorObjCExports.swift +11 -0
- package/{Capacitor → Sources}/Capacitor/JS.swift +9 -20
- package/{Capacitor → Sources}/Capacitor/JSExport.swift +6 -2
- package/Sources/Capacitor/JSResultSerialization.swift +56 -0
- package/{Capacitor → Sources}/Capacitor/NotificationRouter.swift +9 -0
- package/Sources/Capacitor/PluginCallResult.swift +17 -0
- package/{Capacitor → Sources}/Capacitor/Plugins/CapacitorUrlRequest.swift +2 -11
- package/{Capacitor → Sources}/Capacitor/WebViewAssetHandler.swift +17 -5
- package/{Capacitor → Sources}/Capacitor/WebViewDelegationHandler.swift +7 -1
- package/{Capacitor → Sources}/Capacitor/assets/native-bridge.js +0 -6
- package/{CapacitorCordova/CapacitorCordova/Classes/Public → Sources/CapacitorCordova}/Plugin.swift +5 -0
- package/{Capacitor/Capacitor → Sources/CapacitorObjC}/CAPInstanceConfiguration.m +9 -1
- package/{Capacitor/Capacitor → Sources/CapacitorObjC}/CAPInstanceDescriptor.m +0 -1
- package/Sources/CapacitorObjC/CAPPlugin.m +100 -0
- package/Sources/CapacitorObjC/CAPPluginCallResult.m +29 -0
- package/{Capacitor/Capacitor → Sources/CapacitorObjC}/CAPPluginMethod.m +0 -1
- package/{Capacitor → Sources/CapacitorObjC/include}/Capacitor/CAPPlugin.h +3 -20
- package/{Capacitor → Sources/CapacitorObjC/include}/Capacitor/CAPPluginCall.h +1 -2
- package/Sources/CapacitorObjC/include/Capacitor/CAPPluginCallResult.h +28 -0
- package/Sources/CapacitorObjCShims/include/Capacitor/Capacitor-Swift.h +9 -0
- package/{Capacitor → Sources/CapacitorObjCShims/include}/Capacitor/Capacitor.h +8 -0
- package/package.json +6 -7
- package/Capacitor/Capacitor/CAPBridge.swift +0 -25
- package/Capacitor/Capacitor/CAPFile.swift +0 -14
- package/Capacitor/Capacitor/CAPPlugin.m +0 -180
- package/Capacitor/Capacitor/Info.plist +0 -24
- package/Capacitor/Capacitor/PluginCallResult.swift +0 -106
- package/CapacitorCordova/CapacitorCordova/Info.plist +0 -26
- /package/{Capacitor → Sources}/Capacitor/AppUUID.swift +0 -0
- /package/{Capacitor → Sources}/Capacitor/Array+Capacitor.swift +0 -0
- /package/{Capacitor → Sources}/Capacitor/CAPBridgeDelegate.swift +0 -0
- /package/{Capacitor → Sources}/Capacitor/CAPBridgeViewController.swift +0 -0
- /package/{Capacitor → Sources}/Capacitor/CAPBridgedPlugin+getMethod.swift +0 -0
- /package/{Capacitor → Sources}/Capacitor/CAPInstanceDescriptor.swift +0 -0
- /package/{Capacitor → Sources}/Capacitor/CAPInstancePlugin.swift +0 -0
- /package/{Capacitor → Sources}/Capacitor/CAPLog.swift +0 -0
- /package/{Capacitor → Sources}/Capacitor/CAPPlugin+LoadInstance.swift +0 -0
- /package/{Capacitor → Sources}/Capacitor/CAPPluginMethod.swift +0 -0
- /package/{Capacitor → Sources}/Capacitor/CapacitorExtension.swift +0 -0
- /package/{Capacitor → Sources}/Capacitor/Codable/JSValueDecoder.swift +0 -0
- /package/{Capacitor → Sources}/Capacitor/Codable/JSValueEncoder.swift +0 -0
- /package/{Capacitor → Sources}/Capacitor/Data+Capacitor.swift +0 -0
- /package/{Capacitor → Sources}/Capacitor/DocLinks.swift +0 -0
- /package/{Capacitor → Sources}/Capacitor/JSTypes.swift +0 -0
- /package/{Capacitor → Sources}/Capacitor/KeyPath.swift +0 -0
- /package/{Capacitor → Sources}/Capacitor/KeyValueStore.swift +0 -0
- /package/{Capacitor → Sources}/Capacitor/NotificationHandlerProtocol.swift +0 -0
- /package/{Capacitor → Sources}/Capacitor/PluginConfig.swift +0 -0
- /package/{Capacitor → Sources}/Capacitor/Plugins/CapacitorCookieManager.swift +0 -0
- /package/{Capacitor → Sources}/Capacitor/Plugins/CapacitorCookies.swift +0 -0
- /package/{Capacitor → Sources}/Capacitor/Plugins/CapacitorHttp.swift +0 -0
- /package/{Capacitor → Sources}/Capacitor/Plugins/Console.swift +0 -0
- /package/{Capacitor → Sources}/Capacitor/Plugins/HttpRequestHandler.swift +0 -0
- /package/{Capacitor → Sources}/Capacitor/Plugins/SystemBars.swift +0 -0
- /package/{Capacitor → Sources}/Capacitor/Plugins/WebView.swift +0 -0
- /package/{Capacitor → Sources}/Capacitor/PrivacyInfo.xcprivacy +0 -0
- /package/{Capacitor → Sources}/Capacitor/Router.swift +0 -0
- /package/{Capacitor → Sources}/Capacitor/UIColor.swift +0 -0
- /package/{Capacitor → Sources}/Capacitor/WKWebView+Capacitor.swift +0 -0
- /package/{Capacitor/Capacitor → Sources/CapacitorObjC}/CAPPluginCall.m +0 -0
- /package/{Capacitor → Sources/CapacitorObjC/include}/Capacitor/CAPBridgedPlugin.h +0 -0
- /package/{Capacitor → Sources/CapacitorObjC/include}/Capacitor/CAPInstanceConfiguration.h +0 -0
- /package/{Capacitor → Sources/CapacitorObjC/include}/Capacitor/CAPInstanceDescriptor.h +0 -0
- /package/{Capacitor → Sources/CapacitorObjC/include}/Capacitor/CAPPluginMethod.h +0 -0
- /package/{Capacitor/Capacitor → Sources/CapacitorObjCShims}/CAPBridgedJSTypes.m +0 -0
- /package/{Capacitor/Capacitor → Sources/CapacitorObjCShims}/Capacitor.modulemap +0 -0
- /package/{Capacitor/Capacitor → Sources/CapacitorObjCShims}/UIStatusBarManager+CAPHandleTapAction.m +0 -0
- /package/{Capacitor/Capacitor → Sources/CapacitorObjCShims}/WKWebView+Capacitor.m +0 -0
- /package/{Capacitor → Sources/CapacitorObjCShims/include}/Capacitor/CAPBridgedJSTypes.h +0 -0
- /package/{CapacitorCordova/CapacitorCordova/Classes/Public → Sources/Cordova}/AppDelegate.m +0 -0
- /package/{CapacitorCordova/CapacitorCordova/Classes/Public → Sources/Cordova}/CDVCommandDelegateImpl.m +0 -0
- /package/{CapacitorCordova/CapacitorCordova/Classes/Public → Sources/Cordova}/CDVConfigParser.m +0 -0
- /package/{CapacitorCordova/CapacitorCordova/Classes/Public → Sources/Cordova}/CDVInvokedUrlCommand.m +0 -0
- /package/{CapacitorCordova/CapacitorCordova/Classes/Public → Sources/Cordova}/CDVPlugin+Resources.m +0 -0
- /package/{CapacitorCordova/CapacitorCordova/Classes/Public → Sources/Cordova}/CDVPlugin.m +0 -0
- /package/{CapacitorCordova/CapacitorCordova/Classes/Public → Sources/Cordova}/CDVPluginManager.m +0 -0
- /package/{CapacitorCordova/CapacitorCordova/Classes/Public → Sources/Cordova}/CDVPluginResult.m +0 -0
- /package/{CapacitorCordova/CapacitorCordova/Classes/Public → Sources/Cordova}/CDVURLProtocol.m +0 -0
- /package/{CapacitorCordova/CapacitorCordova/Classes/Public → Sources/Cordova}/CDVViewController.m +0 -0
- /package/{CapacitorCordova/CapacitorCordova/Classes/Public → Sources/Cordova}/CDVWebViewProcessPoolFactory.m +0 -0
- /package/{CapacitorCordova/CapacitorCordova → Sources/Cordova}/CapacitorCordova.h +0 -0
- /package/{CapacitorCordova/CapacitorCordova → Sources/Cordova}/CapacitorCordova.modulemap +0 -0
- /package/{CapacitorCordova/CapacitorCordova/Classes/Public → Sources/Cordova}/NSDictionary+CordovaPreferences.m +0 -0
- /package/{CapacitorCordova/CapacitorCordova → Sources/Cordova}/PrivacyInfo.xcprivacy +0 -0
- /package/{CapacitorCordova/CapacitorCordova/Classes/Public → Sources/Cordova/include/Cordova}/AppDelegate.h +0 -0
- /package/{CapacitorCordova/CapacitorCordova/Classes/Public → Sources/Cordova/include/Cordova}/CDV.h +0 -0
- /package/{CapacitorCordova/CapacitorCordova/Classes/Public → Sources/Cordova/include/Cordova}/CDVAvailability.h +0 -0
- /package/{CapacitorCordova/CapacitorCordova/Classes/Public → Sources/Cordova/include/Cordova}/CDVAvailabilityDeprecated.h +0 -0
- /package/{CapacitorCordova/CapacitorCordova/Classes/Public → Sources/Cordova/include/Cordova}/CDVCommandDelegate.h +0 -0
- /package/{CapacitorCordova/CapacitorCordova/Classes/Public → Sources/Cordova/include/Cordova}/CDVCommandDelegateImpl.h +0 -0
- /package/{CapacitorCordova/CapacitorCordova/Classes/Public → Sources/Cordova/include/Cordova}/CDVConfigParser.h +0 -0
- /package/{CapacitorCordova/CapacitorCordova/Classes/Public → Sources/Cordova/include/Cordova}/CDVInvokedUrlCommand.h +0 -0
- /package/{CapacitorCordova/CapacitorCordova/Classes/Public → Sources/Cordova/include/Cordova}/CDVPlugin+Resources.h +0 -0
- /package/{CapacitorCordova/CapacitorCordova/Classes/Public → Sources/Cordova/include/Cordova}/CDVPlugin.h +0 -0
- /package/{CapacitorCordova/CapacitorCordova/Classes/Public → Sources/Cordova/include/Cordova}/CDVPluginManager.h +0 -0
- /package/{CapacitorCordova/CapacitorCordova/Classes/Public → Sources/Cordova/include/Cordova}/CDVPluginResult.h +0 -0
- /package/{CapacitorCordova/CapacitorCordova/Classes/Public → Sources/Cordova/include/Cordova}/CDVScreenOrientationDelegate.h +0 -0
- /package/{CapacitorCordova/CapacitorCordova/Classes/Public → Sources/Cordova/include/Cordova}/CDVURLProtocol.h +0 -0
- /package/{CapacitorCordova/CapacitorCordova/Classes/Public → Sources/Cordova/include/Cordova}/CDVViewController.h +0 -0
- /package/{CapacitorCordova/CapacitorCordova/Classes/Public → Sources/Cordova/include/Cordova}/CDVWebViewProcessPoolFactory.h +0 -0
- /package/{CapacitorCordova/CapacitorCordova/Classes/Public → Sources/Cordova/include/Cordova}/NSDictionary+CordovaPreferences.h +0 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#import "CAPPluginCallResult.h"
|
|
2
|
+
|
|
3
|
+
@implementation CAPPluginCallResult
|
|
4
|
+
|
|
5
|
+
- (instancetype)init:(NSDictionary<NSString *, id> *)data {
|
|
6
|
+
if ((self = [super init])) {
|
|
7
|
+
_data = data;
|
|
8
|
+
}
|
|
9
|
+
return self;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@end
|
|
13
|
+
|
|
14
|
+
@implementation CAPPluginCallError
|
|
15
|
+
|
|
16
|
+
- (instancetype)init:(NSString *)message
|
|
17
|
+
code:(NSString *)code
|
|
18
|
+
error:(NSError *)error
|
|
19
|
+
data:(NSDictionary<NSString *, id> *)data {
|
|
20
|
+
if ((self = [super init])) {
|
|
21
|
+
_message = message;
|
|
22
|
+
_code = code;
|
|
23
|
+
_error = error;
|
|
24
|
+
_data = data ? @{@"data": data} : nil;
|
|
25
|
+
}
|
|
26
|
+
return self;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@end
|
|
@@ -1,36 +1,25 @@
|
|
|
1
1
|
#import <Foundation/Foundation.h>
|
|
2
2
|
#import <WebKit/WebKit.h>
|
|
3
3
|
|
|
4
|
-
@protocol CAPBridgeProtocol;
|
|
5
4
|
@class CAPPluginCall;
|
|
6
5
|
|
|
7
|
-
@class PluginConfig;
|
|
8
|
-
|
|
9
6
|
@interface CAPPlugin : NSObject
|
|
10
7
|
|
|
11
8
|
@property (nonatomic, weak, nullable) WKWebView *webView;
|
|
12
|
-
|
|
9
|
+
// Untyped backing storage for the bridge. The typed `bridge` accessor (`id<CAPBridgeProtocol>`) is
|
|
10
|
+
// vended from Swift, so this target never has to reference the Swift-defined CAPBridgeProtocol.
|
|
11
|
+
@property (nonatomic, weak, nullable) NSObject *bridgeRef;
|
|
13
12
|
@property (nonatomic, strong, nonnull) NSString *pluginId;
|
|
14
13
|
@property (nonatomic, strong, nonnull) NSString *pluginName;
|
|
15
14
|
@property (nonatomic, strong, nullable) NSMutableDictionary<NSString *, NSMutableArray<CAPPluginCall *>*> *eventListeners;
|
|
16
15
|
@property (nonatomic, strong, nullable) NSMutableDictionary<NSString *, NSMutableArray<id> *> *retainedEventArguments;
|
|
17
16
|
@property (nonatomic, assign) BOOL shouldStringifyDatesInCalls;
|
|
18
17
|
|
|
19
|
-
- (instancetype _Nonnull) initWithBridge:(id<CAPBridgeProtocol> _Nonnull) bridge pluginId:(NSString* _Nonnull) pluginId pluginName:(NSString* _Nonnull) pluginName DEPRECATED_MSG_ATTRIBUTE("This initializer is deprecated and is not suggested for use. Any data set through this init method will be overridden when it is loaded on the bridge.");
|
|
20
18
|
- (void)addEventListener:(NSString* _Nonnull)eventName listener:(CAPPluginCall* _Nonnull)listener;
|
|
21
19
|
- (void)removeEventListener:(NSString* _Nonnull)eventName listener:(CAPPluginCall* _Nonnull)listener;
|
|
22
|
-
- (void)notifyListeners:(NSString* _Nonnull)eventName data:(NSDictionary<NSString *, id>* _Nullable)data;
|
|
23
|
-
- (void)notifyListeners:(NSString* _Nonnull)eventName data:(NSDictionary<NSString *, id>* _Nullable)data retainUntilConsumed:(BOOL)retain;
|
|
24
20
|
- (NSArray<CAPPluginCall *>* _Nullable)getListeners:(NSString* _Nonnull)eventName;
|
|
25
21
|
- (BOOL)hasListeners:(NSString* _Nonnull)eventName;
|
|
26
22
|
- (void)addListener:(CAPPluginCall* _Nonnull)call;
|
|
27
|
-
- (void)removeListener:(CAPPluginCall* _Nonnull)call;
|
|
28
|
-
- (void)removeAllListeners:(CAPPluginCall* _Nonnull)call;
|
|
29
|
-
/**
|
|
30
|
-
* Default implementation of the capacitor 3.0 permission pattern
|
|
31
|
-
*/
|
|
32
|
-
- (void)checkPermissions:(CAPPluginCall* _Nonnull)call;
|
|
33
|
-
- (void)requestPermissions:(CAPPluginCall* _Nonnull)call;
|
|
34
23
|
/**
|
|
35
24
|
* Give the plugins a chance to take control when a URL is about to be loaded in the WebView.
|
|
36
25
|
* Returning true causes the WebView to abort loading the URL.
|
|
@@ -49,12 +38,6 @@
|
|
|
49
38
|
// need to override init()
|
|
50
39
|
-(void)load;
|
|
51
40
|
-(NSString* _Nonnull)getId;
|
|
52
|
-
-(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.");
|
|
53
|
-
-(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.");
|
|
54
|
-
-(id _Nullable)getConfigValue:(NSString* _Nonnull)key __deprecated_msg("use getConfig() and access config values using the methods available depending on the type.");
|
|
55
|
-
-(PluginConfig* _Nonnull)getConfig;
|
|
56
|
-
-(void)setCenteredPopover:(UIViewController* _Nonnull) vc;
|
|
57
|
-
-(void)setCenteredPopover:(UIViewController* _Nonnull) vc size:(CGSize) size;
|
|
58
41
|
-(BOOL)supportsPopover DEPRECATED_MSG_ATTRIBUTE("All iOS 13+ devices support popover");
|
|
59
42
|
|
|
60
43
|
@end
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
#import <Foundation/Foundation.h>
|
|
2
|
+
#import "CAPPluginCallResult.h"
|
|
2
3
|
|
|
3
4
|
@class CAPPluginCall;
|
|
4
|
-
@class CAPPluginCallResult;
|
|
5
|
-
@class CAPPluginCallError;
|
|
6
5
|
|
|
7
6
|
typedef void(^CAPPluginCallSuccessHandler)(CAPPluginCallResult *result, CAPPluginCall* call);
|
|
8
7
|
typedef void(^CAPPluginCallErrorHandler)(CAPPluginCallError *error);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// These carriers are Objective-C rather than Swift because CAPPluginCall's successHandler /
|
|
2
|
+
// errorHandler are block-typed properties that take them as parameters. A forward declaration is
|
|
3
|
+
// not enough for Swift to import a block type, and Swift cannot resolve one against a class it is
|
|
4
|
+
// itself in the middle of defining, so the concrete definitions must precede the Swift module.
|
|
5
|
+
#import <Foundation/Foundation.h>
|
|
6
|
+
|
|
7
|
+
@interface CAPPluginCallResult : NSObject
|
|
8
|
+
|
|
9
|
+
@property (nonatomic, readonly, nullable) NSDictionary<NSString *, id> *data;
|
|
10
|
+
|
|
11
|
+
- (nonnull instancetype)init:(nullable NSDictionary<NSString *, id> *)data;
|
|
12
|
+
|
|
13
|
+
@end
|
|
14
|
+
|
|
15
|
+
@interface CAPPluginCallError : NSObject
|
|
16
|
+
|
|
17
|
+
@property (nonatomic, readonly, nonnull) NSString *message;
|
|
18
|
+
@property (nonatomic, readonly, nullable) NSString *code;
|
|
19
|
+
@property (nonatomic, readonly, nullable) NSError *error;
|
|
20
|
+
@property (nonatomic, readonly, nullable) NSDictionary<NSString *, id> *data;
|
|
21
|
+
|
|
22
|
+
- (nonnull instancetype)init:(nonnull NSString *)message
|
|
23
|
+
code:(nullable NSString *)code
|
|
24
|
+
error:(nullable NSError *)error
|
|
25
|
+
data:(nullable NSDictionary<NSString *, id> *)data
|
|
26
|
+
NS_SWIFT_NAME(init(message:code:error:data:));
|
|
27
|
+
|
|
28
|
+
@end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// SPM-only shim. Under CocoaPods, Capacitor is one mixed-language module and the compiler
|
|
2
|
+
// generates a real <Capacitor/Capacitor-Swift.h> exposing the Swift interface to Objective-C; this
|
|
3
|
+
// file is excluded from the pod so it can't clobber it (see Capacitor.podspec).
|
|
4
|
+
//
|
|
5
|
+
// Under SPM the Swift module is separate and its generated header is not reachable at that path, so
|
|
6
|
+
// this shim provides the import path and surfaces the same interface via a module import.
|
|
7
|
+
#if !__building_module(Capacitor)
|
|
8
|
+
@import Capacitor;
|
|
9
|
+
#endif
|
|
@@ -13,3 +13,11 @@ FOUNDATION_EXPORT const unsigned char CapacitorVersionString[];
|
|
|
13
13
|
#import <Capacitor/CAPInstanceDescriptor.h>
|
|
14
14
|
#import <Capacitor/CAPInstanceConfiguration.h>
|
|
15
15
|
|
|
16
|
+
// Several CAPPlugin members (bridge, getConfig, notifyListeners:, checkPermissions:, ...) are vended
|
|
17
|
+
// from Swift, so importing the module here keeps the umbrella a complete view of CAPPlugin for
|
|
18
|
+
// Objective-C plugin authors. Skipped while the module itself is being built, which is the only
|
|
19
|
+
// case where this would be circular.
|
|
20
|
+
#if !__building_module(Capacitor)
|
|
21
|
+
@import Capacitor;
|
|
22
|
+
#endif
|
|
23
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor/ios",
|
|
3
|
-
"version": "9.0.0-alpha.
|
|
3
|
+
"version": "9.0.0-alpha.7",
|
|
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)",
|
|
@@ -13,19 +13,18 @@
|
|
|
13
13
|
"url": "https://github.com/ionic-team/capacitor/issues"
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
|
-
"
|
|
17
|
-
"CapacitorCordova/CapacitorCordova/",
|
|
16
|
+
"Sources/",
|
|
18
17
|
"Capacitor.podspec",
|
|
19
18
|
"CapacitorCordova.podspec",
|
|
20
19
|
"scripts/pods_helpers.rb"
|
|
21
20
|
],
|
|
22
21
|
"scripts": {
|
|
23
|
-
"verify": "npm run xc:build
|
|
24
|
-
"xc:build
|
|
25
|
-
"xc:
|
|
22
|
+
"verify": "npm run xc:build && npm run xc:test",
|
|
23
|
+
"xc:build": "cd .. && xcodebuild build -scheme Capacitor-Package -destination 'generic/platform=iOS Simulator'",
|
|
24
|
+
"xc:test": "cd .. && xcodebuild test -scheme Capacitor-Package -destination 'platform=iOS Simulator,name=iPhone 17,OS=26.5' -collect-test-diagnostics never"
|
|
26
25
|
},
|
|
27
26
|
"peerDependencies": {
|
|
28
|
-
"@capacitor/core": "^9.0.0-alpha.
|
|
27
|
+
"@capacitor/core": "^9.0.0-alpha.7"
|
|
29
28
|
},
|
|
30
29
|
"publishConfig": {
|
|
31
30
|
"access": "public"
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import Foundation
|
|
2
|
-
|
|
3
|
-
// the @available compiler directive does not provide an easy way to split apart string literals, so ignore the line length
|
|
4
|
-
// swiftlint:disable line_length
|
|
5
|
-
@available(*, deprecated, message: "'statusBarTappedNotification' has been moved to Notification.Name.capacitorStatusBarTapped. 'getLastUrl' and application delegate methods have been moved to ApplicationDelegateProxy.")
|
|
6
|
-
// swiftlint:enable line_length
|
|
7
|
-
@objc public class CAPBridge: NSObject {
|
|
8
|
-
@objc public static let statusBarTappedNotification = Notification(name: .capacitorStatusBarTapped)
|
|
9
|
-
|
|
10
|
-
public static func getLastUrl() -> URL? {
|
|
11
|
-
return ApplicationDelegateProxy.shared.lastURL
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
public static func handleOpenUrl(_ url: URL, _ options: [UIApplication.OpenURLOptionsKey: Any]) -> Bool {
|
|
15
|
-
return ApplicationDelegateProxy.shared.application(UIApplication.shared, open: url, options: options)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
public static func handleContinueActivity(_ userActivity: NSUserActivity, _ restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
|
|
19
|
-
return ApplicationDelegateProxy.shared.application(UIApplication.shared, continue: userActivity, restorationHandler: restorationHandler)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
public static func handleAppBecameActive(_ application: UIApplication) {
|
|
23
|
-
// no-op for now
|
|
24
|
-
}
|
|
25
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CAPFileManager helps map file schemes to physical files, whether they are on
|
|
3
|
-
* disk, in a bundle, or in another location.
|
|
4
|
-
*/
|
|
5
|
-
@objc public class CAPFileManager: NSObject {
|
|
6
|
-
@available(*, deprecated, message: "Use portablePath(fromLocalURL:) on the Bridge")
|
|
7
|
-
public static func getPortablePath(host: String, uri: URL?) -> String? {
|
|
8
|
-
if let uri = uri {
|
|
9
|
-
let uriWithoutFile = uri.absoluteString.replacingOccurrences(of: "file://", with: "")
|
|
10
|
-
return host + CapacitorBridge.fileStartIdentifier + uriWithoutFile
|
|
11
|
-
}
|
|
12
|
-
return nil
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
#import "CAPPlugin.h"
|
|
2
|
-
#import "CAPBridgedJSTypes.h"
|
|
3
|
-
#import <Capacitor/Capacitor-Swift.h>
|
|
4
|
-
#import <Foundation/Foundation.h>
|
|
5
|
-
|
|
6
|
-
@implementation CAPPlugin
|
|
7
|
-
|
|
8
|
-
-(instancetype) initWithBridge:(id<CAPBridgeProtocol>)bridge pluginId:(NSString *)pluginId pluginName:(NSString *)pluginName {
|
|
9
|
-
self.bridge = bridge;
|
|
10
|
-
self.webView = bridge.webView;
|
|
11
|
-
self.pluginId = pluginId;
|
|
12
|
-
self.pluginName = pluginName;
|
|
13
|
-
self.eventListeners = [[NSMutableDictionary alloc] init];
|
|
14
|
-
self.retainedEventArguments = [[NSMutableDictionary alloc] init];
|
|
15
|
-
self.shouldStringifyDatesInCalls = true;
|
|
16
|
-
return self;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
-(NSString *) getId {
|
|
20
|
-
return self.pluginName;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
- (BOOL)getBool:(CAPPluginCall *)call field:(NSString *)field defaultValue:(BOOL)defaultValue {
|
|
24
|
-
NSNumber* value = [call getNumber:field defaultValue:[NSNumber numberWithBool:defaultValue]];
|
|
25
|
-
return [value boolValue];
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
- (NSString *) getString:(CAPPluginCall *)call field:(NSString *)field defaultValue:(NSString *)defaultValue {
|
|
29
|
-
return [call getString:field defaultValue:defaultValue];
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
-(id)getConfigValue:(NSString *)key __deprecated {
|
|
33
|
-
return [self.bridge.config getPluginConfigValue:self.pluginName :key];
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
-(PluginConfig*)getConfig {
|
|
37
|
-
return [self.bridge.config getPluginConfig:self.pluginName];
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
-(void)load {}
|
|
41
|
-
|
|
42
|
-
- (void)addEventListener:(NSString *)eventName listener:(CAPPluginCall *)listener {
|
|
43
|
-
NSMutableArray *listenersForEvent = [self.eventListeners objectForKey:eventName];
|
|
44
|
-
if(listenersForEvent == nil || [listenersForEvent count] == 0) {
|
|
45
|
-
listenersForEvent = [[NSMutableArray alloc] initWithObjects:listener, nil];
|
|
46
|
-
[self.eventListeners setValue:listenersForEvent forKey:eventName];
|
|
47
|
-
|
|
48
|
-
[self sendRetainedArgumentsForEvent:eventName];
|
|
49
|
-
} else {
|
|
50
|
-
[listenersForEvent addObject:listener];
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
- (void)sendRetainedArgumentsForEvent:(NSString *)eventName {
|
|
55
|
-
// copy retained args and null source to prevent potential race conditions
|
|
56
|
-
NSMutableArray *retained = [self.retainedEventArguments objectForKey:eventName];
|
|
57
|
-
if (retained == nil) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
[self.retainedEventArguments removeObjectForKey:eventName];
|
|
62
|
-
|
|
63
|
-
for(id data in retained) {
|
|
64
|
-
[self notifyListeners:eventName data:data];
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
- (void)removeEventListener:(NSString *)eventName listener:(CAPPluginCall *)listener {
|
|
69
|
-
NSMutableArray *listenersForEvent = [self.eventListeners objectForKey:eventName];
|
|
70
|
-
if(!listenersForEvent) { return; }
|
|
71
|
-
NSUInteger listenerIndex = [listenersForEvent indexOfObject:listener];
|
|
72
|
-
if(listenerIndex == NSNotFound) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
[listenersForEvent removeObjectAtIndex:listenerIndex];
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
- (void)notifyListeners:(NSString *)eventName data:(NSDictionary<NSString *,id> *)data {
|
|
79
|
-
[self notifyListeners:eventName data:data retainUntilConsumed:NO];
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
- (void)notifyListeners:(NSString *)eventName data:(NSDictionary<NSString *,id> *)data retainUntilConsumed:(BOOL)retain {
|
|
83
|
-
NSArray<CAPPluginCall *> *listenersForEvent = [self.eventListeners objectForKey:eventName];
|
|
84
|
-
if(listenersForEvent == nil || [listenersForEvent count] == 0) {
|
|
85
|
-
if (retain == YES) {
|
|
86
|
-
|
|
87
|
-
if ([self.retainedEventArguments objectForKey:eventName] == nil) {
|
|
88
|
-
[self.retainedEventArguments setObject:[[NSMutableArray alloc] init] forKey:eventName];
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
[[self.retainedEventArguments objectForKey:eventName] addObject:data];
|
|
92
|
-
}
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
for (int i=0; i < listenersForEvent.count; i++) {
|
|
97
|
-
CAPPluginCall *call = listenersForEvent[i];
|
|
98
|
-
if (call != nil) {
|
|
99
|
-
CAPPluginCallResult *result = [[CAPPluginCallResult alloc] init:data];
|
|
100
|
-
call.successHandler(result, call);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
- (void)addListener:(CAPPluginCall *)call {
|
|
106
|
-
NSString *eventName = [call.options objectForKey:@"eventName"];
|
|
107
|
-
[call setKeepAlive:TRUE];
|
|
108
|
-
[self addEventListener:eventName listener:call];
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
- (void)removeListener:(CAPPluginCall *)call {
|
|
112
|
-
NSString *eventName = [call.options objectForKey:@"eventName"];
|
|
113
|
-
NSString *callbackId = [call.options objectForKey:@"callbackId"];
|
|
114
|
-
CAPPluginCall *storedCall = [self.bridge savedCallWithID:callbackId];
|
|
115
|
-
[self removeEventListener:eventName listener:storedCall];
|
|
116
|
-
[self.bridge releaseCallWithID:callbackId];
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
- (void)removeAllListeners:(CAPPluginCall *)call {
|
|
120
|
-
[self.eventListeners removeAllObjects];
|
|
121
|
-
[call resolve];
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
- (NSArray<CAPPluginCall *>*)getListeners:(NSString *)eventName {
|
|
125
|
-
NSArray<CAPPluginCall *>* listeners = [self.eventListeners objectForKey:eventName];
|
|
126
|
-
return listeners;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
- (BOOL)hasListeners:(NSString *)eventName {
|
|
130
|
-
NSArray<CAPPluginCall *>* listeners = [self.eventListeners objectForKey:eventName];
|
|
131
|
-
|
|
132
|
-
if (listeners == nil) {
|
|
133
|
-
return false;
|
|
134
|
-
}
|
|
135
|
-
return [listeners count] > 0;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
- (void)checkPermissions:(CAPPluginCall *)call {
|
|
139
|
-
[call resolve];
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
- (void)requestPermissions:(CAPPluginCall *)call {
|
|
143
|
-
[call resolve];
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Configure popover sourceRect, sourceView and permittedArrowDirections to show it centered
|
|
148
|
-
*/
|
|
149
|
-
-(void)setCenteredPopover:(UIViewController *) vc {
|
|
150
|
-
if (self.bridge.viewController != nil) {
|
|
151
|
-
vc.popoverPresentationController.sourceRect = CGRectMake(self.bridge.viewController.view.center.x, self.bridge.viewController.view.center.y, 0, 0);
|
|
152
|
-
vc.popoverPresentationController.sourceView = self.bridge.viewController.view;
|
|
153
|
-
vc.popoverPresentationController.permittedArrowDirections = 0;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
-(void)setCenteredPopover:(UIViewController* _Nonnull) vc size:(CGSize) size {
|
|
158
|
-
if (self.bridge.viewController != nil) {
|
|
159
|
-
vc.popoverPresentationController.sourceRect = CGRectMake(self.bridge.viewController.view.center.x, self.bridge.viewController.view.center.y, 0, 0);
|
|
160
|
-
vc.preferredContentSize = size;
|
|
161
|
-
vc.popoverPresentationController.sourceView = self.bridge.viewController.view;
|
|
162
|
-
vc.popoverPresentationController.permittedArrowDirections = 0;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
-(BOOL)supportsPopover {
|
|
167
|
-
return YES;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
- (NSNumber*)shouldOverrideLoad:(WKNavigationAction*)navigationAction {
|
|
171
|
-
return nil;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
- (BOOL)handleWKWebViewURLAuthenticationChallenge:(NSURLAuthenticationChallenge* _Nonnull)challenge completionHandler:(void (^_Nonnull)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential * _Nullable credential))completionHandler {
|
|
175
|
-
return NO;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
@end
|
|
180
|
-
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
-
<plist version="1.0">
|
|
4
|
-
<dict>
|
|
5
|
-
<key>CFBundleDevelopmentRegion</key>
|
|
6
|
-
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
|
7
|
-
<key>CFBundleExecutable</key>
|
|
8
|
-
<string>$(EXECUTABLE_NAME)</string>
|
|
9
|
-
<key>CFBundleIdentifier</key>
|
|
10
|
-
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
|
11
|
-
<key>CFBundleInfoDictionaryVersion</key>
|
|
12
|
-
<string>6.0</string>
|
|
13
|
-
<key>CFBundleName</key>
|
|
14
|
-
<string>$(PRODUCT_NAME)</string>
|
|
15
|
-
<key>CFBundlePackageType</key>
|
|
16
|
-
<string>FMWK</string>
|
|
17
|
-
<key>CFBundleShortVersionString</key>
|
|
18
|
-
<string>1.0</string>
|
|
19
|
-
<key>CFBundleVersion</key>
|
|
20
|
-
<string>$(CURRENT_PROJECT_VERSION)</string>
|
|
21
|
-
<key>NSPrincipalClass</key>
|
|
22
|
-
<string></string>
|
|
23
|
-
</dict>
|
|
24
|
-
</plist>
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import Foundation
|
|
2
|
-
|
|
3
|
-
public typealias PluginCallResultData = [String: Any]
|
|
4
|
-
|
|
5
|
-
public enum PluginCallResult {
|
|
6
|
-
case dictionary(PluginCallResultData)
|
|
7
|
-
|
|
8
|
-
enum SerializationError: Error {
|
|
9
|
-
case invalidObject
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
func jsonRepresentation(includingFields: PluginCallResultData? = nil) throws -> String? {
|
|
13
|
-
switch self {
|
|
14
|
-
case .dictionary(var dictionary):
|
|
15
|
-
if let fields = includingFields {
|
|
16
|
-
dictionary.merge(fields) { (current, _) in current }
|
|
17
|
-
}
|
|
18
|
-
dictionary = prepare(dictionary: dictionary)
|
|
19
|
-
guard JSONSerialization.isValidJSONObject(dictionary) else {
|
|
20
|
-
throw SerializationError.invalidObject
|
|
21
|
-
}
|
|
22
|
-
let data = try JSONSerialization.data(withJSONObject: dictionary, options: [])
|
|
23
|
-
return String(data: data, encoding: .utf8)
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
private static let formatter = ISO8601DateFormatter()
|
|
28
|
-
|
|
29
|
-
private func prepare(dictionary: PluginCallResultData) -> PluginCallResultData {
|
|
30
|
-
return dictionary.mapValues { (value) -> Any in
|
|
31
|
-
if let date = value as? Date {
|
|
32
|
-
return PluginCallResult.formatter.string(from: date)
|
|
33
|
-
} else if let aDictionary = value as? PluginCallResultData {
|
|
34
|
-
return prepare(dictionary: aDictionary)
|
|
35
|
-
} else if let anArray = value as? [Any] {
|
|
36
|
-
return prepare(array: anArray)
|
|
37
|
-
}
|
|
38
|
-
return value
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
private func prepare(array: [Any]) -> [Any] {
|
|
43
|
-
return array.map { (value) -> Any in
|
|
44
|
-
if let date = value as? Date {
|
|
45
|
-
return PluginCallResult.formatter.string(from: date)
|
|
46
|
-
} else if let aDictionary = value as? PluginCallResultData {
|
|
47
|
-
return prepare(dictionary: aDictionary)
|
|
48
|
-
} else if let anArray = value as? [Any] {
|
|
49
|
-
return prepare(array: anArray)
|
|
50
|
-
}
|
|
51
|
-
return value
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
@objc public class CAPPluginCallResult: NSObject {
|
|
57
|
-
public let resultData: PluginCallResult?
|
|
58
|
-
|
|
59
|
-
@objc public var data: PluginCallResultData? {
|
|
60
|
-
guard let result = resultData else {
|
|
61
|
-
return nil
|
|
62
|
-
}
|
|
63
|
-
switch result {
|
|
64
|
-
case .dictionary(let data):
|
|
65
|
-
return data
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
@objc(init:)
|
|
70
|
-
public init(_ data: PluginCallResultData?) {
|
|
71
|
-
if let data = data {
|
|
72
|
-
resultData = .dictionary(data)
|
|
73
|
-
} else {
|
|
74
|
-
resultData = nil
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
@objc public class CAPPluginCallError: NSObject {
|
|
80
|
-
@objc public let message: String
|
|
81
|
-
@objc public let code: String?
|
|
82
|
-
@objc public let error: Error?
|
|
83
|
-
public let resultData: PluginCallResult?
|
|
84
|
-
|
|
85
|
-
@objc public var data: PluginCallResultData? {
|
|
86
|
-
guard let result = resultData else {
|
|
87
|
-
return nil
|
|
88
|
-
}
|
|
89
|
-
switch result {
|
|
90
|
-
case .dictionary(let data):
|
|
91
|
-
return data
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
@objc(init:code:error:data:)
|
|
96
|
-
public init(message: String, code: String?, error: Error?, data: PluginCallResultData?) {
|
|
97
|
-
self.message = message
|
|
98
|
-
self.code = code
|
|
99
|
-
self.error = error
|
|
100
|
-
if let data = data {
|
|
101
|
-
resultData = .dictionary(["data": data])
|
|
102
|
-
} else {
|
|
103
|
-
resultData = nil
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
-
<plist version="1.0">
|
|
4
|
-
<dict>
|
|
5
|
-
<key>CFBundleDevelopmentRegion</key>
|
|
6
|
-
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
|
7
|
-
<key>CFBundleDisplayName</key>
|
|
8
|
-
<string>Cordova</string>
|
|
9
|
-
<key>CFBundleExecutable</key>
|
|
10
|
-
<string>$(EXECUTABLE_NAME)</string>
|
|
11
|
-
<key>CFBundleIdentifier</key>
|
|
12
|
-
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
|
13
|
-
<key>CFBundleInfoDictionaryVersion</key>
|
|
14
|
-
<string>6.0</string>
|
|
15
|
-
<key>CFBundleName</key>
|
|
16
|
-
<string>$(PRODUCT_NAME)</string>
|
|
17
|
-
<key>CFBundlePackageType</key>
|
|
18
|
-
<string>FMWK</string>
|
|
19
|
-
<key>CFBundleShortVersionString</key>
|
|
20
|
-
<string>1.0</string>
|
|
21
|
-
<key>CFBundleVersion</key>
|
|
22
|
-
<string>$(CURRENT_PROJECT_VERSION)</string>
|
|
23
|
-
<key>NSPrincipalClass</key>
|
|
24
|
-
<string></string>
|
|
25
|
-
</dict>
|
|
26
|
-
</plist>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|