@capacitor/ios 6.2.0 → 7.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/Capacitor/Capacitor/CAPBridgeViewController.swift +1 -3
- package/Capacitor/Capacitor/CAPPluginCall.swift +0 -15
- package/Capacitor/Capacitor/CapacitorBridge.swift +2 -2
- package/Capacitor/Capacitor/Codable/JSValueDecoder.swift +58 -41
- package/Capacitor/Capacitor/Codable/JSValueEncoder.swift +8 -2
- package/Capacitor/Capacitor/WebViewAssetHandler.swift +1 -1
- package/Capacitor/Capacitor/assets/native-bridge.js +20 -56
- package/Capacitor.podspec +1 -1
- package/CapacitorCordova.podspec +1 -1
- package/package.json +3 -3
- package/scripts/pods_helpers.rb +3 -3
|
@@ -111,9 +111,7 @@ import Cordova
|
|
|
111
111
|
webViewConfiguration.suppressesIncrementalRendering = false
|
|
112
112
|
webViewConfiguration.allowsAirPlayForMediaPlayback = true
|
|
113
113
|
webViewConfiguration.mediaTypesRequiringUserActionForPlayback = []
|
|
114
|
-
|
|
115
|
-
webViewConfiguration.limitsNavigationsToAppBoundDomains = instanceConfiguration.limitsNavigationsToAppBoundDomains
|
|
116
|
-
}
|
|
114
|
+
webViewConfiguration.limitsNavigationsToAppBoundDomains = instanceConfiguration.limitsNavigationsToAppBoundDomains
|
|
117
115
|
if let appendUserAgent = instanceConfiguration.appendedUserAgentString {
|
|
118
116
|
if let appName = webViewConfiguration.applicationNameForUserAgent {
|
|
119
117
|
webViewConfiguration.applicationNameForUserAgent = "\(appName) \(appendUserAgent)"
|
|
@@ -34,16 +34,6 @@ extension CAPPluginCall: JSValueContainer {
|
|
|
34
34
|
return !(value is NSNull)
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
@available(*, deprecated, renamed: "resolve()")
|
|
38
|
-
func success() {
|
|
39
|
-
successHandler(CAPPluginCallResult([:]), self)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
@available(*, deprecated, renamed: "resolve")
|
|
43
|
-
func success(_ data: PluginCallResultData = [:]) {
|
|
44
|
-
successHandler(CAPPluginCallResult(data), self)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
37
|
func resolve() {
|
|
48
38
|
successHandler(CAPPluginCallResult(nil), self)
|
|
49
39
|
}
|
|
@@ -52,11 +42,6 @@ extension CAPPluginCall: JSValueContainer {
|
|
|
52
42
|
successHandler(CAPPluginCallResult(data), self)
|
|
53
43
|
}
|
|
54
44
|
|
|
55
|
-
@available(*, deprecated, renamed: "reject")
|
|
56
|
-
func error(_ message: String, _ error: Error? = nil, _ data: PluginCallResultData = [:]) {
|
|
57
|
-
errorHandler(CAPPluginCallError(message: message, code: nil, error: error, data: data))
|
|
58
|
-
}
|
|
59
|
-
|
|
60
45
|
func reject(_ message: String, _ code: String? = nil, _ error: Error? = nil, _ data: PluginCallResultData? = nil) {
|
|
61
46
|
errorHandler(CAPPluginCallError(message: message, code: code, error: error, data: data))
|
|
62
47
|
}
|
|
@@ -492,13 +492,13 @@ open class CapacitorBridge: NSObject, CAPBridgeProtocol {
|
|
|
492
492
|
let pluginCall = CAPPluginCall(callbackId: call.callbackId, methodName: call.method,
|
|
493
493
|
options: JSTypes.coerceDictionaryToJSObject(call.options,
|
|
494
494
|
formattingDatesAsStrings: plugin.shouldStringifyDatesInCalls) ?? [:],
|
|
495
|
-
success: {(result: CAPPluginCallResult?, pluginCall: CAPPluginCall?)
|
|
495
|
+
success: {(result: CAPPluginCallResult?, pluginCall: CAPPluginCall?) in
|
|
496
496
|
if let result = result {
|
|
497
497
|
self?.toJs(result: JSResult(call: call, callResult: result), save: pluginCall?.keepAlive ?? false)
|
|
498
498
|
} else {
|
|
499
499
|
self?.toJs(result: JSResult(call: call, result: .dictionary([:])), save: pluginCall?.keepAlive ?? false)
|
|
500
500
|
}
|
|
501
|
-
}, error: {(error: CAPPluginCallError?)
|
|
501
|
+
}, error: {(error: CAPPluginCallError?) in
|
|
502
502
|
if let error = error {
|
|
503
503
|
self?.toJsError(error: JSResultError(call: call, callError: error))
|
|
504
504
|
} else {
|
|
@@ -127,55 +127,72 @@ extension _JSValueDecoder: Decoder {
|
|
|
127
127
|
SingleValueContainer(data: data, codingPath: codingPath, userInfo: userInfo, options: options)
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
+
// force casting is fine becasue we've already determined that T is the type in the case
|
|
131
|
+
// the swift standard library also force casts in their similar functions
|
|
132
|
+
// https://github.com/swiftlang/swift-foundation/blob/da80d51fa3e77f3e7ed57c4300a870689e755713/Sources/FoundationEssentials/JSON/JSONEncoder.swift#L1140
|
|
133
|
+
// swiftlint:disable force_cast
|
|
130
134
|
fileprivate func decodeData<T>(as type: T.Type) throws -> T where T: Decodable {
|
|
131
135
|
switch type {
|
|
132
136
|
case is Date.Type:
|
|
133
|
-
|
|
134
|
-
case .deferredToDate:
|
|
135
|
-
return try T(from: self)
|
|
136
|
-
case .secondsSince1970:
|
|
137
|
-
guard let value = data as? NSNumber else { throw DecodingError.dataCorrupted(data, target: Double.self, codingPath: codingPath) }
|
|
138
|
-
return Date(timeIntervalSince1970: value.doubleValue) as! T
|
|
139
|
-
case .millisecondsSince1970:
|
|
140
|
-
guard let value = data as? NSNumber else { throw DecodingError.dataCorrupted(data, target: Double.self, codingPath: codingPath) }
|
|
141
|
-
return Date(timeIntervalSince1970: value.doubleValue / Double(MSEC_PER_SEC)) as! T
|
|
142
|
-
case .iso8601:
|
|
143
|
-
guard let value = data as? String else { throw DecodingError.dataCorrupted(data, target: String.self, codingPath: codingPath) }
|
|
144
|
-
let formatter = ISO8601DateFormatter()
|
|
145
|
-
guard let date = formatter.date(from: value) else { throw DecodingError.dataCorrupted(value, target: Date.self, codingPath: codingPath) }
|
|
146
|
-
return date as! T
|
|
147
|
-
case .formatted(let formatter):
|
|
148
|
-
guard let value = data as? String else { throw DecodingError.dataCorrupted(data, target: String.self, codingPath: codingPath) }
|
|
149
|
-
guard let date = formatter.date(from: value) else { throw DecodingError.dataCorrupted(value, target: Date.self, codingPath: codingPath) }
|
|
150
|
-
return date as! T
|
|
151
|
-
case .custom(let decode):
|
|
152
|
-
return try decode(self) as! T
|
|
153
|
-
@unknown default:
|
|
154
|
-
return try T(from: self)
|
|
155
|
-
}
|
|
137
|
+
return try decodeDate() as! T
|
|
156
138
|
case is URL.Type:
|
|
157
|
-
|
|
158
|
-
let url = URL(string: str)
|
|
159
|
-
else { throw DecodingError.dataCorrupted(data, target: URL.self, codingPath: codingPath) }
|
|
160
|
-
|
|
161
|
-
return url as! T
|
|
139
|
+
return try decodeUrl() as! T
|
|
162
140
|
case is Data.Type:
|
|
163
|
-
|
|
164
|
-
case .deferredToData:
|
|
165
|
-
return try T(from: self)
|
|
166
|
-
case .base64:
|
|
167
|
-
guard let value = data as? String else { throw DecodingError.dataCorrupted(data, target: String.self, codingPath: codingPath) }
|
|
168
|
-
guard let data = Data(base64Encoded: value) else { throw DecodingError.dataCorrupted(value, target: Data.self, codingPath: codingPath) }
|
|
169
|
-
return data as! T
|
|
170
|
-
case .custom(let decode):
|
|
171
|
-
return try decode(self) as! T
|
|
172
|
-
@unknown default:
|
|
173
|
-
return try T(from: self)
|
|
174
|
-
}
|
|
141
|
+
return try decodeData() as! T
|
|
175
142
|
default:
|
|
176
143
|
return try T(from: self)
|
|
177
144
|
}
|
|
178
145
|
}
|
|
146
|
+
// swiftlint:enable force_cast
|
|
147
|
+
|
|
148
|
+
private func decodeDate() throws -> Date {
|
|
149
|
+
switch options.dateStrategy {
|
|
150
|
+
case .deferredToDate:
|
|
151
|
+
return try Date(from: self)
|
|
152
|
+
case .secondsSince1970:
|
|
153
|
+
guard let value = data as? NSNumber else { throw DecodingError.dataCorrupted(data, target: Double.self, codingPath: codingPath) }
|
|
154
|
+
return Date(timeIntervalSince1970: value.doubleValue)
|
|
155
|
+
case .millisecondsSince1970:
|
|
156
|
+
guard let value = data as? NSNumber else { throw DecodingError.dataCorrupted(data, target: Double.self, codingPath: codingPath) }
|
|
157
|
+
return Date(timeIntervalSince1970: value.doubleValue / Double(MSEC_PER_SEC))
|
|
158
|
+
case .iso8601:
|
|
159
|
+
guard let value = data as? String else { throw DecodingError.dataCorrupted(data, target: String.self, codingPath: codingPath) }
|
|
160
|
+
let formatter = ISO8601DateFormatter()
|
|
161
|
+
guard let date = formatter.date(from: value) else { throw DecodingError.dataCorrupted(value, target: Date.self, codingPath: codingPath) }
|
|
162
|
+
return date
|
|
163
|
+
case .formatted(let formatter):
|
|
164
|
+
guard let value = data as? String else { throw DecodingError.dataCorrupted(data, target: String.self, codingPath: codingPath) }
|
|
165
|
+
guard let date = formatter.date(from: value) else { throw DecodingError.dataCorrupted(value, target: Date.self, codingPath: codingPath) }
|
|
166
|
+
return date
|
|
167
|
+
case .custom(let decode):
|
|
168
|
+
return try decode(self)
|
|
169
|
+
@unknown default:
|
|
170
|
+
return try Date(from: self)
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
private func decodeUrl() throws -> URL {
|
|
175
|
+
guard let str = data as? String,
|
|
176
|
+
let url = URL(string: str)
|
|
177
|
+
else { throw DecodingError.dataCorrupted(data, target: URL.self, codingPath: codingPath) }
|
|
178
|
+
|
|
179
|
+
return url
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
private func decodeData() throws -> Data {
|
|
183
|
+
switch options.dataStrategy {
|
|
184
|
+
case .deferredToData:
|
|
185
|
+
return try Data(from: self)
|
|
186
|
+
case .base64:
|
|
187
|
+
guard let value = data as? String else { throw DecodingError.dataCorrupted(data, target: String.self, codingPath: codingPath) }
|
|
188
|
+
guard let data = Data(base64Encoded: value) else { throw DecodingError.dataCorrupted(value, target: Data.self, codingPath: codingPath) }
|
|
189
|
+
return data
|
|
190
|
+
case .custom(let decode):
|
|
191
|
+
return try decode(self)
|
|
192
|
+
@unknown default:
|
|
193
|
+
return try Data(from: self)
|
|
194
|
+
}
|
|
195
|
+
}
|
|
179
196
|
}
|
|
180
197
|
|
|
181
198
|
private final class KeyedContainer<Key> where Key: CodingKey {
|
|
@@ -354,7 +371,7 @@ extension SingleValueContainer: SingleValueDecodingContainer {
|
|
|
354
371
|
|
|
355
372
|
private func castFloat<N>(to type: N.Type) throws -> N where N: FloatingPoint {
|
|
356
373
|
if let data = data as? String,
|
|
357
|
-
|
|
374
|
+
case let .convertFromString(positiveInfinity: pos, negativeInfinity: neg, nan: nan) = options.nonConformingStrategy {
|
|
358
375
|
switch data {
|
|
359
376
|
case pos:
|
|
360
377
|
return N.infinity
|
|
@@ -79,10 +79,14 @@ public final class JSValueEncoder: TopLevelEncoder {
|
|
|
79
79
|
dataEncodingStrategy: DataEncodingStrategy = .deferredToData,
|
|
80
80
|
nonConformingFloatEncodingStategy: NonConformingFloatEncodingStrategy = .deferred
|
|
81
81
|
) {
|
|
82
|
-
self.options = .init(
|
|
82
|
+
self.options = .init(
|
|
83
|
+
optionalStrategy: optionalEncodingStrategy,
|
|
84
|
+
dateStrategy: dateEncodingStrategy,
|
|
85
|
+
dataStrategy: dataEncodingStrategy,
|
|
86
|
+
nonConformingFloatStrategy: nonConformingFloatEncodingStategy
|
|
87
|
+
)
|
|
83
88
|
}
|
|
84
89
|
|
|
85
|
-
|
|
86
90
|
/// Encodes an `Encodable` value to a ``JSValue``
|
|
87
91
|
/// - Parameter value: The value to encode to ``JSValue``
|
|
88
92
|
/// - Returns: The encoded ``JSValue``
|
|
@@ -591,6 +595,7 @@ extension SingleValueContainer: SingleValueEncodingContainer {
|
|
|
591
595
|
try encodeFloat(value)
|
|
592
596
|
}
|
|
593
597
|
|
|
598
|
+
// swiftlint:disable force_cast
|
|
594
599
|
private func encodeFloat<N>(_ value: N) throws where N: FloatingPoint {
|
|
595
600
|
if value.isFinite {
|
|
596
601
|
data = value as! NSNumber
|
|
@@ -610,6 +615,7 @@ extension SingleValueContainer: SingleValueEncodingContainer {
|
|
|
610
615
|
}
|
|
611
616
|
}
|
|
612
617
|
}
|
|
618
|
+
// swiftlint:enable force_cast
|
|
613
619
|
|
|
614
620
|
func encode(_ value: Float) throws {
|
|
615
621
|
try encodeFloat(value)
|
|
@@ -133,7 +133,7 @@ open class WebViewAssetHandler: NSObject, WKURLSchemeHandler {
|
|
|
133
133
|
func handleCapacitorHttpRequest(_ urlSchemeTask: WKURLSchemeTask, _ localUrl: URL, _ isHttpsRequest: Bool) {
|
|
134
134
|
var urlRequest = urlSchemeTask.request
|
|
135
135
|
guard let url = urlRequest.url else { return }
|
|
136
|
-
|
|
136
|
+
|
|
137
137
|
let urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false)
|
|
138
138
|
if let targetUrl = urlComponents?.queryItems?.first(where: { $0.name == CapacitorBridge.httpInterceptorUrlParam })?.value,
|
|
139
139
|
!targetUrl.isEmpty {
|
|
@@ -142,9 +142,7 @@ var nativeBridge = (function (exports) {
|
|
|
142
142
|
const CAPACITOR_HTTP_INTERCEPTOR = '/_capacitor_http_interceptor_';
|
|
143
143
|
const CAPACITOR_HTTP_INTERCEPTOR_URL_PARAM = 'u';
|
|
144
144
|
// TODO: export as Cap function
|
|
145
|
-
const isRelativeOrProxyUrl = (url) => !url ||
|
|
146
|
-
!(url.startsWith('http:') || url.startsWith('https:')) ||
|
|
147
|
-
url.indexOf(CAPACITOR_HTTP_INTERCEPTOR) > -1;
|
|
145
|
+
const isRelativeOrProxyUrl = (url) => !url || !(url.startsWith('http:') || url.startsWith('https:')) || url.indexOf(CAPACITOR_HTTP_INTERCEPTOR) > -1;
|
|
148
146
|
// TODO: export as Cap function
|
|
149
147
|
const createProxyUrl = (url, win) => {
|
|
150
148
|
var _a, _b;
|
|
@@ -174,11 +172,10 @@ var nativeBridge = (function (exports) {
|
|
|
174
172
|
return webviewServerUrl + '/_capacitor_file_' + filePath;
|
|
175
173
|
}
|
|
176
174
|
else if (filePath.startsWith('file://')) {
|
|
177
|
-
return
|
|
175
|
+
return webviewServerUrl + filePath.replace('file://', '/_capacitor_file_');
|
|
178
176
|
}
|
|
179
177
|
else if (filePath.startsWith('content://')) {
|
|
180
|
-
return
|
|
181
|
-
filePath.replace('content:/', '/_capacitor_content_'));
|
|
178
|
+
return webviewServerUrl + filePath.replace('content:/', '/_capacitor_content_');
|
|
182
179
|
}
|
|
183
180
|
}
|
|
184
181
|
return filePath;
|
|
@@ -289,9 +286,6 @@ var nativeBridge = (function (exports) {
|
|
|
289
286
|
return docAddEventListener.apply(doc, args);
|
|
290
287
|
};
|
|
291
288
|
}
|
|
292
|
-
// deprecated in v3, remove from v4
|
|
293
|
-
cap.platform = cap.getPlatform();
|
|
294
|
-
cap.isNative = cap.isNativePlatform();
|
|
295
289
|
win.Capacitor = cap;
|
|
296
290
|
};
|
|
297
291
|
const initVendor = (win, cap) => {
|
|
@@ -321,27 +315,14 @@ var nativeBridge = (function (exports) {
|
|
|
321
315
|
win.Ionic.WebView = IonicWebView;
|
|
322
316
|
};
|
|
323
317
|
const initLogger = (win, cap) => {
|
|
324
|
-
const BRIDGED_CONSOLE_METHODS = [
|
|
325
|
-
'debug',
|
|
326
|
-
'error',
|
|
327
|
-
'info',
|
|
328
|
-
'log',
|
|
329
|
-
'trace',
|
|
330
|
-
'warn',
|
|
331
|
-
];
|
|
318
|
+
const BRIDGED_CONSOLE_METHODS = ['debug', 'error', 'info', 'log', 'trace', 'warn'];
|
|
332
319
|
const createLogFromNative = (c) => (result) => {
|
|
333
320
|
if (isFullConsole(c)) {
|
|
334
321
|
const success = result.success === true;
|
|
335
322
|
const tagStyles = success
|
|
336
323
|
? 'font-style: italic; font-weight: lighter; color: gray'
|
|
337
324
|
: 'font-style: italic; font-weight: lighter; color: red';
|
|
338
|
-
c.groupCollapsed('%cresult %c' +
|
|
339
|
-
result.pluginId +
|
|
340
|
-
'.' +
|
|
341
|
-
result.methodName +
|
|
342
|
-
' (#' +
|
|
343
|
-
result.callbackId +
|
|
344
|
-
')', tagStyles, 'font-style: italic; font-weight: bold; color: #444');
|
|
325
|
+
c.groupCollapsed('%cresult %c' + result.pluginId + '.' + result.methodName + ' (#' + result.callbackId + ')', tagStyles, 'font-style: italic; font-weight: bold; color: #444');
|
|
345
326
|
if (result.success === false) {
|
|
346
327
|
c.error(result.error);
|
|
347
328
|
}
|
|
@@ -361,13 +342,7 @@ var nativeBridge = (function (exports) {
|
|
|
361
342
|
};
|
|
362
343
|
const createLogToNative = (c) => (call) => {
|
|
363
344
|
if (isFullConsole(c)) {
|
|
364
|
-
c.groupCollapsed('%cnative %c' +
|
|
365
|
-
call.pluginId +
|
|
366
|
-
'.' +
|
|
367
|
-
call.methodName +
|
|
368
|
-
' (#' +
|
|
369
|
-
call.callbackId +
|
|
370
|
-
')', 'font-weight: lighter; color: gray', 'font-weight: bold; color: #000');
|
|
345
|
+
c.groupCollapsed('%cnative %c' + call.pluginId + '.' + call.methodName + ' (#' + call.callbackId + ')', 'font-weight: lighter; color: gray', 'font-weight: bold; color: #000');
|
|
371
346
|
c.dir(call);
|
|
372
347
|
c.groupEnd();
|
|
373
348
|
}
|
|
@@ -379,9 +354,7 @@ var nativeBridge = (function (exports) {
|
|
|
379
354
|
if (!c) {
|
|
380
355
|
return false;
|
|
381
356
|
}
|
|
382
|
-
return
|
|
383
|
-
typeof c.groupEnd === 'function' ||
|
|
384
|
-
typeof c.dir === 'function');
|
|
357
|
+
return typeof c.groupCollapsed === 'function' || typeof c.groupEnd === 'function' || typeof c.dir === 'function';
|
|
385
358
|
};
|
|
386
359
|
const serializeConsoleMessage = (msg) => {
|
|
387
360
|
try {
|
|
@@ -440,9 +413,7 @@ var nativeBridge = (function (exports) {
|
|
|
440
413
|
set: function (val) {
|
|
441
414
|
const cookiePairs = val.split(';');
|
|
442
415
|
const domainSection = val.toLowerCase().split('domain=')[1];
|
|
443
|
-
const domain = cookiePairs.length > 1 &&
|
|
444
|
-
domainSection != null &&
|
|
445
|
-
domainSection.length > 0
|
|
416
|
+
const domain = cookiePairs.length > 1 && domainSection != null && domainSection.length > 0
|
|
446
417
|
? domainSection.split(';')[0].trim()
|
|
447
418
|
: '';
|
|
448
419
|
if (platform === 'ios') {
|
|
@@ -527,8 +498,7 @@ var nativeBridge = (function (exports) {
|
|
|
527
498
|
dataType: type,
|
|
528
499
|
headers: Object.assign(Object.assign({}, headers), optionHeaders),
|
|
529
500
|
});
|
|
530
|
-
const contentType = nativeResponse.headers['Content-Type'] ||
|
|
531
|
-
nativeResponse.headers['content-type'];
|
|
501
|
+
const contentType = nativeResponse.headers['Content-Type'] || nativeResponse.headers['content-type'];
|
|
532
502
|
let data = (contentType === null || contentType === void 0 ? void 0 : contentType.startsWith('application/json'))
|
|
533
503
|
? JSON.stringify(nativeResponse.data)
|
|
534
504
|
: nativeResponse.data;
|
|
@@ -570,8 +540,7 @@ var nativeBridge = (function (exports) {
|
|
|
570
540
|
},
|
|
571
541
|
});
|
|
572
542
|
const prototype = win.CapacitorWebXMLHttpRequest.prototype;
|
|
573
|
-
const isProgressEventAvailable = () => typeof ProgressEvent !== 'undefined' &&
|
|
574
|
-
ProgressEvent.prototype instanceof Event;
|
|
543
|
+
const isProgressEventAvailable = () => typeof ProgressEvent !== 'undefined' && ProgressEvent.prototype instanceof Event;
|
|
575
544
|
// XHR patch abort
|
|
576
545
|
prototype.abort = function () {
|
|
577
546
|
if (isRelativeOrProxyUrl(this._url)) {
|
|
@@ -652,9 +621,7 @@ var nativeBridge = (function (exports) {
|
|
|
652
621
|
},
|
|
653
622
|
});
|
|
654
623
|
convertBody(body).then(({ data, type, headers }) => {
|
|
655
|
-
const otherHeaders = this._headers != null && Object.keys(this._headers).length > 0
|
|
656
|
-
? this._headers
|
|
657
|
-
: undefined;
|
|
624
|
+
const otherHeaders = this._headers != null && Object.keys(this._headers).length > 0 ? this._headers : undefined;
|
|
658
625
|
// intercept request & pass to the bridge
|
|
659
626
|
cap
|
|
660
627
|
.nativePromise('CapacitorHttp', 'request', {
|
|
@@ -678,8 +645,7 @@ var nativeBridge = (function (exports) {
|
|
|
678
645
|
}
|
|
679
646
|
this._headers = nativeResponse.headers;
|
|
680
647
|
this.status = nativeResponse.status;
|
|
681
|
-
if (this.responseType === '' ||
|
|
682
|
-
this.responseType === 'text') {
|
|
648
|
+
if (this.responseType === '' || this.responseType === 'text') {
|
|
683
649
|
this.response =
|
|
684
650
|
typeof nativeResponse.data !== 'string'
|
|
685
651
|
? JSON.stringify(nativeResponse.data)
|
|
@@ -688,8 +654,7 @@ var nativeBridge = (function (exports) {
|
|
|
688
654
|
else {
|
|
689
655
|
this.response = nativeResponse.data;
|
|
690
656
|
}
|
|
691
|
-
this.responseText = ((_a = (nativeResponse.headers['Content-Type'] ||
|
|
692
|
-
nativeResponse.headers['content-type'])) === null || _a === void 0 ? void 0 : _a.startsWith('application/json'))
|
|
657
|
+
this.responseText = ((_a = (nativeResponse.headers['Content-Type'] || nativeResponse.headers['content-type'])) === null || _a === void 0 ? void 0 : _a.startsWith('application/json'))
|
|
693
658
|
? JSON.stringify(nativeResponse.data)
|
|
694
659
|
: nativeResponse.data;
|
|
695
660
|
this.responseURL = nativeResponse.url;
|
|
@@ -805,7 +770,7 @@ var nativeBridge = (function (exports) {
|
|
|
805
770
|
};
|
|
806
771
|
cap.logToNative = createLogToNative(win.console);
|
|
807
772
|
cap.logFromNative = createLogFromNative(win.console);
|
|
808
|
-
cap.handleError = err => win.console.error(err);
|
|
773
|
+
cap.handleError = (err) => win.console.error(err);
|
|
809
774
|
win.Capacitor = cap;
|
|
810
775
|
};
|
|
811
776
|
function initNativeBridge(win) {
|
|
@@ -814,7 +779,7 @@ var nativeBridge = (function (exports) {
|
|
|
814
779
|
const callbacks = new Map();
|
|
815
780
|
const webviewServerUrl = typeof win.WEBVIEW_SERVER_URL === 'string' ? win.WEBVIEW_SERVER_URL : '';
|
|
816
781
|
cap.getServerUrl = () => webviewServerUrl;
|
|
817
|
-
cap.convertFileSrc = filePath => convertFileSrcServerUrl(webviewServerUrl, filePath);
|
|
782
|
+
cap.convertFileSrc = (filePath) => convertFileSrcServerUrl(webviewServerUrl, filePath);
|
|
818
783
|
// Counter of callback ids, randomized to avoid
|
|
819
784
|
// any issues during reloads if a call comes back with
|
|
820
785
|
// an existing callback id from an old session
|
|
@@ -823,12 +788,12 @@ var nativeBridge = (function (exports) {
|
|
|
823
788
|
const isNativePlatform = () => true;
|
|
824
789
|
const getPlatform = () => getPlatformId(win);
|
|
825
790
|
cap.getPlatform = getPlatform;
|
|
826
|
-
cap.isPluginAvailable = name => Object.prototype.hasOwnProperty.call(cap.Plugins, name);
|
|
791
|
+
cap.isPluginAvailable = (name) => Object.prototype.hasOwnProperty.call(cap.Plugins, name);
|
|
827
792
|
cap.isNativePlatform = isNativePlatform;
|
|
828
793
|
// create the postToNative() fn if needed
|
|
829
794
|
if (getPlatformId(win) === 'android') {
|
|
830
795
|
// android platform
|
|
831
|
-
postToNative = data => {
|
|
796
|
+
postToNative = (data) => {
|
|
832
797
|
var _a;
|
|
833
798
|
try {
|
|
834
799
|
win.androidBridge.postMessage(JSON.stringify(data));
|
|
@@ -840,7 +805,7 @@ var nativeBridge = (function (exports) {
|
|
|
840
805
|
}
|
|
841
806
|
else if (getPlatformId(win) === 'ios') {
|
|
842
807
|
// ios platform
|
|
843
|
-
postToNative = data => {
|
|
808
|
+
postToNative = (data) => {
|
|
844
809
|
var _a;
|
|
845
810
|
try {
|
|
846
811
|
data.type = data.type ? data.type : 'message';
|
|
@@ -885,8 +850,7 @@ var nativeBridge = (function (exports) {
|
|
|
885
850
|
if (typeof postToNative === 'function') {
|
|
886
851
|
let callbackId = '-1';
|
|
887
852
|
if (storedCallback &&
|
|
888
|
-
(typeof storedCallback.callback === 'function' ||
|
|
889
|
-
typeof storedCallback.resolve === 'function')) {
|
|
853
|
+
(typeof storedCallback.callback === 'function' || typeof storedCallback.resolve === 'function')) {
|
|
890
854
|
// store the call for later lookup
|
|
891
855
|
callbackId = String(++callbackIdCount);
|
|
892
856
|
callbacks.set(callbackId, storedCallback);
|
|
@@ -921,7 +885,7 @@ var nativeBridge = (function (exports) {
|
|
|
921
885
|
/**
|
|
922
886
|
* Process a response from the native layer.
|
|
923
887
|
*/
|
|
924
|
-
cap.fromNative = result => {
|
|
888
|
+
cap.fromNative = (result) => {
|
|
925
889
|
returnResult(result);
|
|
926
890
|
};
|
|
927
891
|
const returnResult = (result) => {
|
package/Capacitor.podspec
CHANGED
|
@@ -13,7 +13,7 @@ Pod::Spec.new do |s|
|
|
|
13
13
|
s.social_media_url = 'https://twitter.com/capacitorjs'
|
|
14
14
|
s.license = 'MIT'
|
|
15
15
|
s.homepage = 'https://capacitorjs.com/'
|
|
16
|
-
s.ios.deployment_target = '
|
|
16
|
+
s.ios.deployment_target = '14.0'
|
|
17
17
|
s.authors = { 'Ionic Team' => 'hi@ionicframework.com' }
|
|
18
18
|
s.source = { git: 'https://github.com/ionic-team/capacitor.git', tag: package['version'] }
|
|
19
19
|
s.source_files = "#{prefix}Capacitor/Capacitor/**/*.{swift,h,m}"
|
package/CapacitorCordova.podspec
CHANGED
|
@@ -15,7 +15,7 @@ Pod::Spec.new do |s|
|
|
|
15
15
|
s.license = 'MIT'
|
|
16
16
|
s.authors = { 'Ionic Team' => 'hi@ionicframework.com' }
|
|
17
17
|
s.source = { git: 'https://github.com/ionic-team/capacitor', tag: s.version.to_s }
|
|
18
|
-
s.platform = :ios,
|
|
18
|
+
s.platform = :ios, 14.0
|
|
19
19
|
s.source_files = "#{prefix}CapacitorCordova/CapacitorCordova/**/*.{h,m}"
|
|
20
20
|
s.public_header_files = "#{prefix}CapacitorCordova/CapacitorCordova/Classes/Public/*.h",
|
|
21
21
|
"#{prefix}CapacitorCordova/CapacitorCordova/CapacitorCordova.h"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor/ios",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.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)",
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
],
|
|
22
22
|
"scripts": {
|
|
23
23
|
"verify": "npm run xc:build:Capacitor && npm run xc:build:CapacitorCordova",
|
|
24
|
-
"xc:build:Capacitor": "cd Capacitor && xcodebuild -workspace Capacitor.xcworkspace -scheme Capacitor && cd ..",
|
|
24
|
+
"xc:build:Capacitor": "cd Capacitor && xcodebuild clean test -workspace Capacitor.xcworkspace -scheme Capacitor -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.0' && cd ..",
|
|
25
25
|
"xc:build:CapacitorCordova": "cd CapacitorCordova && xcodebuild && cd ..",
|
|
26
26
|
"xc:build:xcframework": "scripts/build.sh xcframework"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@capacitor/core": "^
|
|
29
|
+
"@capacitor/core": "^7.0.0-alpha.2"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|
package/scripts/pods_helpers.rb
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
def assertDeploymentTarget(installer)
|
|
2
2
|
installer.pods_project.targets.each do |target|
|
|
3
3
|
target.build_configurations.each do |config|
|
|
4
|
-
# ensure IPHONEOS_DEPLOYMENT_TARGET is at least
|
|
4
|
+
# ensure IPHONEOS_DEPLOYMENT_TARGET is at least 14.0
|
|
5
5
|
deployment_target = config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f
|
|
6
|
-
should_upgrade = deployment_target <
|
|
6
|
+
should_upgrade = deployment_target < 14.0 && deployment_target != 0.0
|
|
7
7
|
if should_upgrade
|
|
8
|
-
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '
|
|
8
|
+
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '14.0'
|
|
9
9
|
end
|
|
10
10
|
end
|
|
11
11
|
end
|