@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,216 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
or more contributor license agreements. See the NOTICE file
|
|
4
|
+
distributed with this work for additional information
|
|
5
|
+
regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
to you under the Apache License, Version 2.0 (the
|
|
7
|
+
"License"); you may not use this file except in compliance
|
|
8
|
+
with the License. You may obtain a copy of the License at
|
|
9
|
+
|
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
|
|
12
|
+
Unless required by applicable law or agreed to in writing,
|
|
13
|
+
software distributed under the License is distributed on an
|
|
14
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
KIND, either express or implied. See the License for the
|
|
16
|
+
specific language governing permissions and limitations
|
|
17
|
+
under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
#import "CDVPluginResult.h"
|
|
21
|
+
|
|
22
|
+
// This exists to preserve compatibility with early Swift plugins, who are
|
|
23
|
+
// using CDVCommandStatus as ObjC-style constants rather than as Swift enum
|
|
24
|
+
// values.
|
|
25
|
+
// These constants alias the enum values back to their previous names.
|
|
26
|
+
#define SWIFT_ENUM_COMPAT_HACK(enumVal) const CDVCommandStatus SWIFT_##enumVal NS_SWIFT_NAME(enumVal) = enumVal
|
|
27
|
+
SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_NO_RESULT);
|
|
28
|
+
SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_OK);
|
|
29
|
+
SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_CLASS_NOT_FOUND_EXCEPTION);
|
|
30
|
+
SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_ILLEGAL_ACCESS_EXCEPTION);
|
|
31
|
+
SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_INSTANTIATION_EXCEPTION);
|
|
32
|
+
SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_MALFORMED_URL_EXCEPTION);
|
|
33
|
+
SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_IO_EXCEPTION);
|
|
34
|
+
SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_INVALID_ACTION);
|
|
35
|
+
SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_JSON_EXCEPTION);
|
|
36
|
+
SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_ERROR);
|
|
37
|
+
#undef SWIFT_ENUM_COMPAT_HACK
|
|
38
|
+
|
|
39
|
+
@interface CDVPluginResult ()
|
|
40
|
+
|
|
41
|
+
- (CDVPluginResult*)initWithStatus:(CDVCommandStatus)statusOrdinal message:(id)theMessage;
|
|
42
|
+
|
|
43
|
+
@end
|
|
44
|
+
|
|
45
|
+
@implementation CDVPluginResult
|
|
46
|
+
@synthesize status, message, keepCallback, associatedObject;
|
|
47
|
+
|
|
48
|
+
static NSArray* org_apache_cordova_CommandStatusMsgs;
|
|
49
|
+
|
|
50
|
+
id messageFromArrayBuffer(NSData* data)
|
|
51
|
+
{
|
|
52
|
+
return @{
|
|
53
|
+
@"CDVType" : @"ArrayBuffer",
|
|
54
|
+
@"data" :[data base64EncodedStringWithOptions:0]
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
id massageMessage(id message)
|
|
59
|
+
{
|
|
60
|
+
if ([message isKindOfClass:[NSData class]]) {
|
|
61
|
+
return messageFromArrayBuffer(message);
|
|
62
|
+
}
|
|
63
|
+
return message;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
id messageFromMultipart(NSArray* theMessages)
|
|
67
|
+
{
|
|
68
|
+
NSMutableArray* messages = [NSMutableArray arrayWithArray:theMessages];
|
|
69
|
+
|
|
70
|
+
for (NSUInteger i = 0; i < messages.count; ++i) {
|
|
71
|
+
[messages replaceObjectAtIndex:i withObject:massageMessage([messages objectAtIndex:i])];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return @{
|
|
75
|
+
@"CDVType" : @"MultiPart",
|
|
76
|
+
@"messages" : messages
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
+ (void)initialize
|
|
81
|
+
{
|
|
82
|
+
org_apache_cordova_CommandStatusMsgs = [[NSArray alloc] initWithObjects:@"No result",
|
|
83
|
+
@"OK",
|
|
84
|
+
@"Class not found",
|
|
85
|
+
@"Illegal access",
|
|
86
|
+
@"Instantiation error",
|
|
87
|
+
@"Malformed url",
|
|
88
|
+
@"IO error",
|
|
89
|
+
@"Invalid action",
|
|
90
|
+
@"JSON error",
|
|
91
|
+
@"Error",
|
|
92
|
+
nil];
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
- (CDVPluginResult*)init
|
|
96
|
+
{
|
|
97
|
+
return [self initWithStatus:CDVCommandStatus_NO_RESULT message:nil];
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
- (CDVPluginResult*)initWithStatus:(CDVCommandStatus)statusOrdinal message:(id)theMessage
|
|
101
|
+
{
|
|
102
|
+
self = [super init];
|
|
103
|
+
if (self) {
|
|
104
|
+
status = [NSNumber numberWithUnsignedLong:statusOrdinal];
|
|
105
|
+
message = theMessage;
|
|
106
|
+
keepCallback = [NSNumber numberWithBool:NO];
|
|
107
|
+
}
|
|
108
|
+
return self;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal
|
|
112
|
+
{
|
|
113
|
+
return [[self alloc] initWithStatus:statusOrdinal message:nil];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsString:(NSString*)theMessage
|
|
117
|
+
{
|
|
118
|
+
return [[self alloc] initWithStatus:statusOrdinal message:theMessage];
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsArray:(NSArray*)theMessage
|
|
122
|
+
{
|
|
123
|
+
return [[self alloc] initWithStatus:statusOrdinal message:theMessage];
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsInt:(int)theMessage
|
|
127
|
+
{
|
|
128
|
+
return [[self alloc] initWithStatus:statusOrdinal message:[NSNumber numberWithInt:theMessage]];
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsNSInteger:(NSInteger)theMessage
|
|
132
|
+
{
|
|
133
|
+
return [[self alloc] initWithStatus:statusOrdinal message:[NSNumber numberWithInteger:theMessage]];
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsNSUInteger:(NSUInteger)theMessage
|
|
137
|
+
{
|
|
138
|
+
return [[self alloc] initWithStatus:statusOrdinal message:[NSNumber numberWithUnsignedInteger:theMessage]];
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsDouble:(double)theMessage
|
|
142
|
+
{
|
|
143
|
+
return [[self alloc] initWithStatus:statusOrdinal message:[NSNumber numberWithDouble:theMessage]];
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsBool:(BOOL)theMessage
|
|
147
|
+
{
|
|
148
|
+
return [[self alloc] initWithStatus:statusOrdinal message:[NSNumber numberWithBool:theMessage]];
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsDictionary:(NSDictionary*)theMessage
|
|
152
|
+
{
|
|
153
|
+
return [[self alloc] initWithStatus:statusOrdinal message:theMessage];
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsArrayBuffer:(NSData*)theMessage
|
|
157
|
+
{
|
|
158
|
+
return [[self alloc] initWithStatus:statusOrdinal message:messageFromArrayBuffer(theMessage)];
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsMultipart:(NSArray*)theMessages
|
|
162
|
+
{
|
|
163
|
+
return [[self alloc] initWithStatus:statusOrdinal message:messageFromMultipart(theMessages)];
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageToErrorObject:(int)errorCode
|
|
167
|
+
{
|
|
168
|
+
NSDictionary* errDict = @{@"code" :[NSNumber numberWithInt:errorCode]};
|
|
169
|
+
|
|
170
|
+
return [[self alloc] initWithStatus:statusOrdinal message:errDict];
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
- (void)setKeepCallbackAsBool:(BOOL)bKeepCallback
|
|
174
|
+
{
|
|
175
|
+
[self setKeepCallback:[NSNumber numberWithBool:bKeepCallback]];
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
- (NSString*)argumentsAsJSON
|
|
179
|
+
{
|
|
180
|
+
id arguments = (self.message == nil ? [NSNull null] : self.message);
|
|
181
|
+
NSArray* argumentsWrappedInArray = [NSArray arrayWithObject:arguments];
|
|
182
|
+
|
|
183
|
+
NSString* argumentsJSON = [self JSONStringFromArray:argumentsWrappedInArray];
|
|
184
|
+
|
|
185
|
+
argumentsJSON = [argumentsJSON substringWithRange:NSMakeRange(1, [argumentsJSON length] - 2)];
|
|
186
|
+
|
|
187
|
+
return argumentsJSON;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
static BOOL gIsVerbose = NO;
|
|
191
|
+
+ (void)setVerbose:(BOOL)verbose
|
|
192
|
+
{
|
|
193
|
+
gIsVerbose = verbose;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
+ (BOOL)isVerbose
|
|
197
|
+
{
|
|
198
|
+
return gIsVerbose;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
- (NSString*)JSONStringFromArray:(NSArray *) array
|
|
202
|
+
{
|
|
203
|
+
NSError* error = nil;
|
|
204
|
+
NSData* jsonData = [NSJSONSerialization dataWithJSONObject:array
|
|
205
|
+
options:0
|
|
206
|
+
error:&error];
|
|
207
|
+
|
|
208
|
+
if (error != nil) {
|
|
209
|
+
NSLog(@"NSArray JSONString error: %@", [error localizedDescription]);
|
|
210
|
+
return nil;
|
|
211
|
+
} else {
|
|
212
|
+
return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
@end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
or more contributor license agreements. See the NOTICE file
|
|
4
|
+
distributed with this work for additional information
|
|
5
|
+
regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
to you under the Apache License, Version 2.0 (the
|
|
7
|
+
"License"); you may not use this file except in compliance
|
|
8
|
+
with the License. You may obtain a copy of the License at
|
|
9
|
+
|
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
|
|
12
|
+
Unless required by applicable law or agreed to in writing,
|
|
13
|
+
software distributed under the License is distributed on an
|
|
14
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
KIND, either express or implied. See the License for the
|
|
16
|
+
specific language governing permissions and limitations
|
|
17
|
+
under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
#import <Foundation/Foundation.h>
|
|
21
|
+
|
|
22
|
+
@protocol CDVScreenOrientationDelegate <NSObject>
|
|
23
|
+
|
|
24
|
+
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 90000
|
|
25
|
+
- (NSUInteger)supportedInterfaceOrientations;
|
|
26
|
+
#else
|
|
27
|
+
- (UIInterfaceOrientationMask)supportedInterfaceOrientations;
|
|
28
|
+
#endif
|
|
29
|
+
|
|
30
|
+
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation;
|
|
31
|
+
- (BOOL)shouldAutorotate;
|
|
32
|
+
|
|
33
|
+
@end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
or more contributor license agreements. See the NOTICE file
|
|
4
|
+
distributed with this work for additional information
|
|
5
|
+
regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
to you under the Apache License, Version 2.0 (the
|
|
7
|
+
"License"); you may not use this file except in compliance
|
|
8
|
+
with the License. You may obtain a copy of the License at
|
|
9
|
+
|
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
|
|
12
|
+
Unless required by applicable law or agreed to in writing,
|
|
13
|
+
software distributed under the License is distributed on an
|
|
14
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
KIND, either express or implied. See the License for the
|
|
16
|
+
specific language governing permissions and limitations
|
|
17
|
+
under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
#import <Foundation/Foundation.h>
|
|
21
|
+
#import "CDVAvailability.h"
|
|
22
|
+
|
|
23
|
+
@class CDVViewController;
|
|
24
|
+
|
|
25
|
+
@interface CDVURLProtocol : NSURLProtocol {}
|
|
26
|
+
|
|
27
|
+
@end
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
or more contributor license agreements. See the NOTICE file
|
|
4
|
+
distributed with this work for additional information
|
|
5
|
+
regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
to you under the Apache License, Version 2.0 (the
|
|
7
|
+
"License"); you may not use this file except in compliance
|
|
8
|
+
with the License. You may obtain a copy of the License at
|
|
9
|
+
|
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
|
|
12
|
+
Unless required by applicable law or agreed to in writing,
|
|
13
|
+
software distributed under the License is distributed on an
|
|
14
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
KIND, either express or implied. See the License for the
|
|
16
|
+
specific language governing permissions and limitations
|
|
17
|
+
under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
#import <MobileCoreServices/MobileCoreServices.h>
|
|
21
|
+
#import "CDVURLProtocol.h"
|
|
22
|
+
#import "CDVViewController.h"
|
|
23
|
+
|
|
24
|
+
// Contains a set of NSNumbers of addresses of controllers. It doesn't store
|
|
25
|
+
// the actual pointer to avoid retaining.
|
|
26
|
+
static NSMutableSet* gRegisteredControllers = nil;
|
|
27
|
+
|
|
28
|
+
NSString* const kCDVAssetsLibraryPrefixes = @"assets-library://";
|
|
29
|
+
|
|
30
|
+
@implementation CDVURLProtocol
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
+ (BOOL)canInitWithRequest:(NSURLRequest*)theRequest
|
|
34
|
+
{
|
|
35
|
+
return NO;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
+ (NSURLRequest*)canonicalRequestForRequest:(NSURLRequest*)request
|
|
39
|
+
{
|
|
40
|
+
// NSLog(@"%@ received %@", self, NSStringFromSelector(_cmd));
|
|
41
|
+
return request;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
- (void)startLoading
|
|
45
|
+
{
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
- (void)stopLoading
|
|
50
|
+
{
|
|
51
|
+
// do any cleanup here
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
+ (BOOL)requestIsCacheEquivalent:(NSURLRequest*)requestA toRequest:(NSURLRequest*)requestB
|
|
55
|
+
{
|
|
56
|
+
return NO;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
- (void)sendResponseWithResponseCode:(NSInteger)statusCode data:(NSData*)data mimeType:(NSString*)mimeType
|
|
60
|
+
{
|
|
61
|
+
if (mimeType == nil) {
|
|
62
|
+
mimeType = @"text/plain";
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
NSHTTPURLResponse* response = [[NSHTTPURLResponse alloc] initWithURL:[[self request] URL] statusCode:statusCode HTTPVersion:@"HTTP/1.1" headerFields:@{@"Content-Type" : mimeType}];
|
|
66
|
+
|
|
67
|
+
[[self client] URLProtocol:self didReceiveResponse:response cacheStoragePolicy:NSURLCacheStorageNotAllowed];
|
|
68
|
+
if (data != nil) {
|
|
69
|
+
[[self client] URLProtocol:self didLoadData:data];
|
|
70
|
+
}
|
|
71
|
+
[[self client] URLProtocolDidFinishLoading:self];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
@end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
or more contributor license agreements. See the NOTICE file
|
|
4
|
+
distributed with this work for additional information
|
|
5
|
+
regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
to you under the Apache License, Version 2.0 (the
|
|
7
|
+
"License"); you may not use this file except in compliance
|
|
8
|
+
with the License. You may obtain a copy of the License at
|
|
9
|
+
|
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
|
|
12
|
+
Unless required by applicable law or agreed to in writing,
|
|
13
|
+
software distributed under the License is distributed on an
|
|
14
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
KIND, either express or implied. See the License for the
|
|
16
|
+
specific language governing permissions and limitations
|
|
17
|
+
under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
#import <UIKit/UIKit.h>
|
|
21
|
+
|
|
22
|
+
@interface CDVViewController : UIViewController
|
|
23
|
+
|
|
24
|
+
@property (nonatomic, readonly, strong) NSMutableDictionary* pluginObjects;
|
|
25
|
+
@property (nonatomic, readonly, strong) NSMutableDictionary* settings;
|
|
26
|
+
@property (nonatomic, readonly, weak) UIView* webView;
|
|
27
|
+
|
|
28
|
+
- (id) getCommandInstance:(NSString*)className;
|
|
29
|
+
|
|
30
|
+
@end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
or more contributor license agreements. See the NOTICE file
|
|
4
|
+
distributed with this work for additional information
|
|
5
|
+
regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
to you under the Apache License, Version 2.0 (the
|
|
7
|
+
"License"); you may not use this file except in compliance
|
|
8
|
+
with the License. You may obtain a copy of the License at
|
|
9
|
+
|
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
|
|
12
|
+
Unless required by applicable law or agreed to in writing,
|
|
13
|
+
software distributed under the License is distributed on an
|
|
14
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
KIND, either express or implied. See the License for the
|
|
16
|
+
specific language governing permissions and limitations
|
|
17
|
+
under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
#import "CDVViewController.h"
|
|
22
|
+
|
|
23
|
+
@interface CDVViewController () {
|
|
24
|
+
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@property (nonatomic, readwrite, strong) NSMutableDictionary* pluginObjects;
|
|
29
|
+
|
|
30
|
+
@end
|
|
31
|
+
|
|
32
|
+
#pragma clang diagnostic push
|
|
33
|
+
#pragma clang diagnostic ignored "-Wincomplete-implementation"
|
|
34
|
+
@implementation CDVViewController
|
|
35
|
+
|
|
36
|
+
@end
|
|
37
|
+
#pragma clang diagnostic pop
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
or more contributor license agreements. See the NOTICE file
|
|
4
|
+
distributed with this work for additional information
|
|
5
|
+
regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
to you under the Apache License, Version 2.0 (the
|
|
7
|
+
"License"); you may not use this file except in compliance
|
|
8
|
+
with the License. You may obtain a copy of the License at
|
|
9
|
+
|
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
|
|
12
|
+
Unless required by applicable law or agreed to in writing,
|
|
13
|
+
software distributed under the License is distributed on an
|
|
14
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
KIND, either express or implied. See the License for the
|
|
16
|
+
specific language governing permissions and limitations
|
|
17
|
+
under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
#import <WebKit/WebKit.h>
|
|
21
|
+
#import <Cordova/CDVAvailabilityDeprecated.h>
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
@Metadata {
|
|
25
|
+
@Available(Cordova, introduced: "6.2.0", deprecated: "8.0.0")
|
|
26
|
+
}
|
|
27
|
+
*/
|
|
28
|
+
CDV_DEPRECATED(8.0.0, "WebKit WKProcessPool is deprecated in iOS")
|
|
29
|
+
@interface CDVWebViewProcessPoolFactory : NSObject
|
|
30
|
+
@property (nonatomic, retain) WKProcessPool* sharedPool;
|
|
31
|
+
|
|
32
|
+
+(instancetype) sharedFactory;
|
|
33
|
+
-(WKProcessPool*) sharedProcessPool;
|
|
34
|
+
@end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
or more contributor license agreements. See the NOTICE file
|
|
4
|
+
distributed with this work for additional information
|
|
5
|
+
regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
to you under the Apache License, Version 2.0 (the
|
|
7
|
+
"License"); you may not use this file except in compliance
|
|
8
|
+
with the License. You may obtain a copy of the License at
|
|
9
|
+
|
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
|
|
12
|
+
Unless required by applicable law or agreed to in writing,
|
|
13
|
+
software distributed under the License is distributed on an
|
|
14
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
KIND, either express or implied. See the License for the
|
|
16
|
+
specific language governing permissions and limitations
|
|
17
|
+
under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
@import Foundation;
|
|
21
|
+
@import WebKit;
|
|
22
|
+
#import <Cordova/CDVWebViewProcessPoolFactory.h>
|
|
23
|
+
|
|
24
|
+
#pragma clang diagnostic push
|
|
25
|
+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
26
|
+
#pragma clang diagnostic ignored "-Wdeprecated-implementations"
|
|
27
|
+
|
|
28
|
+
static CDVWebViewProcessPoolFactory *factory = nil;
|
|
29
|
+
|
|
30
|
+
@implementation CDVWebViewProcessPoolFactory
|
|
31
|
+
|
|
32
|
+
+ (instancetype)sharedFactory
|
|
33
|
+
{
|
|
34
|
+
static dispatch_once_t onceToken;
|
|
35
|
+
dispatch_once(&onceToken, ^{
|
|
36
|
+
factory = [[CDVWebViewProcessPoolFactory alloc] init];
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
return factory;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
- (instancetype)init
|
|
43
|
+
{
|
|
44
|
+
if (self = [super init]) {
|
|
45
|
+
_sharedPool = [[WKProcessPool alloc] init];
|
|
46
|
+
}
|
|
47
|
+
return self;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
- (WKProcessPool*) sharedProcessPool {
|
|
51
|
+
return _sharedPool;
|
|
52
|
+
}
|
|
53
|
+
@end
|
|
54
|
+
|
|
55
|
+
#pragma clang diagnostic pop
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
or more contributor license agreements. See the NOTICE file
|
|
4
|
+
distributed with this work for additional information
|
|
5
|
+
regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
to you under the Apache License, Version 2.0 (the
|
|
7
|
+
"License"); you may not use this file except in compliance
|
|
8
|
+
with the License. You may obtain a copy of the License at
|
|
9
|
+
|
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
|
|
12
|
+
Unless required by applicable law or agreed to in writing,
|
|
13
|
+
software distributed under the License is distributed on an
|
|
14
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
KIND, either express or implied. See the License for the
|
|
16
|
+
specific language governing permissions and limitations
|
|
17
|
+
under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
#import <Foundation/Foundation.h>
|
|
21
|
+
#import <UIKit/UIKit.h>
|
|
22
|
+
|
|
23
|
+
@interface NSDictionary (CordovaPreferences)
|
|
24
|
+
|
|
25
|
+
- (id)cordovaSettingForKey:(NSString*)key;
|
|
26
|
+
- (BOOL)cordovaBoolSettingForKey:(NSString*)key defaultValue:(BOOL)defaultValue;
|
|
27
|
+
- (CGFloat)cordovaFloatSettingForKey:(NSString*)key defaultValue:(CGFloat)defaultValue;
|
|
28
|
+
|
|
29
|
+
@end
|
|
30
|
+
|
|
31
|
+
@interface NSMutableDictionary (CordovaPreferences)
|
|
32
|
+
|
|
33
|
+
- (void)setCordovaSetting:(id)value forKey:(NSString*)key;
|
|
34
|
+
|
|
35
|
+
@end
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
or more contributor license agreements. See the NOTICE file
|
|
4
|
+
distributed with this work for additional information
|
|
5
|
+
regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
to you under the Apache License, Version 2.0 (the
|
|
7
|
+
"License"); you may not use this file except in compliance
|
|
8
|
+
with the License. You may obtain a copy of the License at
|
|
9
|
+
|
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
|
|
12
|
+
Unless required by applicable law or agreed to in writing,
|
|
13
|
+
software distributed under the License is distributed on an
|
|
14
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
KIND, either express or implied. See the License for the
|
|
16
|
+
specific language governing permissions and limitations
|
|
17
|
+
under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
#import "NSDictionary+CordovaPreferences.h"
|
|
21
|
+
#import <Foundation/Foundation.h>
|
|
22
|
+
|
|
23
|
+
@implementation NSDictionary (CordovaPreferences)
|
|
24
|
+
|
|
25
|
+
- (id)cordovaSettingForKey:(NSString*)key
|
|
26
|
+
{
|
|
27
|
+
return [self objectForKey:[key lowercaseString]];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
- (BOOL)cordovaBoolSettingForKey:(NSString*)key defaultValue:(BOOL)defaultValue
|
|
31
|
+
{
|
|
32
|
+
BOOL value = defaultValue;
|
|
33
|
+
id prefObj = [self cordovaSettingForKey:key];
|
|
34
|
+
|
|
35
|
+
if (prefObj != nil) {
|
|
36
|
+
value = [(NSNumber*)prefObj boolValue];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return value;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
- (CGFloat)cordovaFloatSettingForKey:(NSString*)key defaultValue:(CGFloat)defaultValue
|
|
43
|
+
{
|
|
44
|
+
CGFloat value = defaultValue;
|
|
45
|
+
id prefObj = [self cordovaSettingForKey:key];
|
|
46
|
+
|
|
47
|
+
if (prefObj != nil) {
|
|
48
|
+
value = [prefObj floatValue];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return value;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@end
|
|
55
|
+
|
|
56
|
+
@implementation NSMutableDictionary (CordovaPreferences)
|
|
57
|
+
|
|
58
|
+
- (void)setCordovaSetting:(id)value forKey:(NSString*)key
|
|
59
|
+
{
|
|
60
|
+
[self setObject:value forKey:[key lowercaseString]];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@end
|
|
@@ -0,0 +1,26 @@
|
|
|
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>
|
|
@@ -0,0 +1,14 @@
|
|
|
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>NSPrivacyCollectedDataTypes</key>
|
|
6
|
+
<array/>
|
|
7
|
+
<key>NSPrivacyAccessedAPITypes</key>
|
|
8
|
+
<array/>
|
|
9
|
+
<key>NSPrivacyTrackingDomains</key>
|
|
10
|
+
<array/>
|
|
11
|
+
<key>NSPrivacyTracking</key>
|
|
12
|
+
<false/>
|
|
13
|
+
</dict>
|
|
14
|
+
</plist>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
3
|
+
prefix = if ENV['NATIVE_PUBLISH'] == 'true'
|
|
4
|
+
'ios/'
|
|
5
|
+
else
|
|
6
|
+
''
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
Pod::Spec.new do |s|
|
|
10
|
+
s.name = 'CapacitorCordova'
|
|
11
|
+
s.module_name = 'Cordova'
|
|
12
|
+
s.version = package['version']
|
|
13
|
+
s.summary = 'Capacitor Cordova Compatibility Layer'
|
|
14
|
+
s.homepage = 'https://capacitorjs.com'
|
|
15
|
+
s.license = 'MIT'
|
|
16
|
+
s.authors = { 'Ionic Team' => 'hi@ionicframework.com' }
|
|
17
|
+
s.source = { git: 'https://github.com/ionic-team/capacitor', tag: s.version.to_s }
|
|
18
|
+
s.platform = :ios, 15.0
|
|
19
|
+
s.source_files = "#{prefix}CapacitorCordova/CapacitorCordova/**/*.{h,m}"
|
|
20
|
+
s.public_header_files = "#{prefix}CapacitorCordova/CapacitorCordova/Classes/Public/*.h",
|
|
21
|
+
"#{prefix}CapacitorCordova/CapacitorCordova/CapacitorCordova.h"
|
|
22
|
+
s.module_map = "#{prefix}CapacitorCordova/CapacitorCordova/CapacitorCordova.modulemap"
|
|
23
|
+
s.resources = ["#{prefix}CapacitorCordova/CapacitorCordova/PrivacyInfo.xcprivacy"]
|
|
24
|
+
s.requires_arc = true
|
|
25
|
+
s.framework = 'WebKit'
|
|
26
|
+
end
|