@capacitor/ios 5.0.0-beta.1 → 5.0.0-beta.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/CAPInstanceConfiguration.h +1 -0
- package/Capacitor/Capacitor/CAPInstanceConfiguration.m +2 -0
- package/Capacitor/Capacitor/CAPInstanceDescriptor.h +5 -0
- package/Capacitor/Capacitor/CAPInstanceDescriptor.m +1 -0
- package/Capacitor/Capacitor/CAPInstanceDescriptor.swift +7 -0
- package/Capacitor/Capacitor/Capacitor.h +2 -0
- package/Capacitor/Capacitor/CapacitorBridge.swift +11 -0
- package/Capacitor/Capacitor/WKWebView+Capacitor.h +11 -0
- package/Capacitor/Capacitor/WKWebView+Capacitor.m +13 -0
- package/Capacitor/Capacitor/assets/native-bridge.js +11 -4
- package/package.json +3 -3
|
@@ -19,6 +19,7 @@ NS_SWIFT_NAME(InstanceConfiguration)
|
|
|
19
19
|
@property (nonatomic, readonly) BOOL scrollingEnabled;
|
|
20
20
|
@property (nonatomic, readonly) BOOL allowLinkPreviews;
|
|
21
21
|
@property (nonatomic, readonly) BOOL handleApplicationNotifications;
|
|
22
|
+
@property (nonatomic, readonly) BOOL isWebDebuggable;
|
|
22
23
|
@property (nonatomic, readonly) BOOL cordovaDeployDisabled;
|
|
23
24
|
@property (nonatomic, readonly) UIScrollViewContentInsetAdjustmentBehavior contentInsetAdjustmentBehavior;
|
|
24
25
|
@property (nonatomic, readonly, nonnull) NSURL *appLocation;
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
_limitsNavigationsToAppBoundDomains = descriptor.limitsNavigationsToAppBoundDomains;
|
|
38
38
|
_preferredContentMode = descriptor.preferredContentMode;
|
|
39
39
|
_pluginConfigurations = descriptor.pluginConfigurations;
|
|
40
|
+
_isWebDebuggable = descriptor.isWebDebuggable;
|
|
40
41
|
_legacyConfig = descriptor.legacyConfig;
|
|
41
42
|
// construct the necessary URLs
|
|
42
43
|
_localURL = [[NSURL alloc] initWithString:[NSString stringWithFormat:@"%@://%@", descriptor.urlScheme, descriptor.urlHostname]];
|
|
@@ -67,6 +68,7 @@
|
|
|
67
68
|
_scrollingEnabled = configuration.scrollingEnabled;
|
|
68
69
|
_allowLinkPreviews = configuration.allowLinkPreviews;
|
|
69
70
|
_handleApplicationNotifications = configuration.handleApplicationNotifications;
|
|
71
|
+
_isWebDebuggable = configuration.isWebDebuggable;
|
|
70
72
|
_cordovaDeployDisabled = configuration.cordovaDeployDisabled;
|
|
71
73
|
_contentInsetAdjustmentBehavior = configuration.contentInsetAdjustmentBehavior;
|
|
72
74
|
// we don't care about internal usage of deprecated APIs and the framework should build cleanly
|
|
@@ -93,6 +93,11 @@ NS_SWIFT_NAME(InstanceDescriptor)
|
|
|
93
93
|
@discussion Defaults to @c true. Required to be @c true for notification plugins to work correctly. Set to @c false if your application will handle notifications independently.
|
|
94
94
|
*/
|
|
95
95
|
@property (nonatomic, assign) BOOL handleApplicationNotifications;
|
|
96
|
+
/**
|
|
97
|
+
@brief Enables web debugging by setting isInspectable of @c WKWebView to @c true on iOS 16.4 and greater
|
|
98
|
+
@discussion Defaults to true in debug mode and false in production
|
|
99
|
+
*/
|
|
100
|
+
@property (nonatomic, assign) BOOL isWebDebuggable;
|
|
96
101
|
/**
|
|
97
102
|
@brief How the web view will inset its content
|
|
98
103
|
@discussion Set by @c ios.contentInset in the configuration file. Corresponds to @c contentInsetAdjustmentBehavior on WKWebView.
|
|
@@ -39,6 +39,7 @@ NSString* const CAPInstanceDescriptorDefaultHostname = @"localhost";
|
|
|
39
39
|
_scrollingEnabled = YES;
|
|
40
40
|
_allowLinkPreviews = YES;
|
|
41
41
|
_handleApplicationNotifications = YES;
|
|
42
|
+
_isWebDebuggable = NO;
|
|
42
43
|
_contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
|
43
44
|
_appLocation = location;
|
|
44
45
|
_limitsNavigationsToAppBoundDomains = FALSE;
|
|
@@ -134,6 +134,13 @@ internal extension InstanceDescriptor {
|
|
|
134
134
|
if let handleNotifications = config[keyPath: "ios.handleApplicationNotifications"] as? Bool {
|
|
135
135
|
handleApplicationNotifications = handleNotifications
|
|
136
136
|
}
|
|
137
|
+
if let webContentsDebuggingEnabled = config[keyPath: "ios.webContentsDebuggingEnabled"] as? Bool {
|
|
138
|
+
isWebDebuggable = webContentsDebuggingEnabled
|
|
139
|
+
} else {
|
|
140
|
+
#if DEBUG
|
|
141
|
+
isWebDebuggable = true
|
|
142
|
+
#endif
|
|
143
|
+
}
|
|
137
144
|
}
|
|
138
145
|
}
|
|
139
146
|
// swiftlint:enable cyclomatic_complexity
|
|
@@ -209,6 +209,8 @@ internal class CapacitorBridge: NSObject, CAPBridgeProtocol {
|
|
|
209
209
|
observers.append(NotificationCenter.default.addObserver(forName: type(of: self).tmpVCAppeared.name, object: .none, queue: .none) { [weak self] _ in
|
|
210
210
|
self?.tmpWindow = nil
|
|
211
211
|
})
|
|
212
|
+
|
|
213
|
+
self.setupWebDebugging(configuration: configuration)
|
|
212
214
|
}
|
|
213
215
|
|
|
214
216
|
deinit {
|
|
@@ -418,6 +420,15 @@ internal class CapacitorBridge: NSObject, CAPBridgeProtocol {
|
|
|
418
420
|
return "\(type(of: self).capacitorSite)docs/\(url)"
|
|
419
421
|
}
|
|
420
422
|
|
|
423
|
+
private func setupWebDebugging(configuration: InstanceConfiguration) {
|
|
424
|
+
let isWebDebuggable = configuration.isWebDebuggable
|
|
425
|
+
if isWebDebuggable, #unavailable(iOS 16.4) {
|
|
426
|
+
CAPLog.print("⚡️ Warning: isWebDebuggable only functions as intended on iOS 16.4 and above.")
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
self.webView?.setInspectableIfRequired(isWebDebuggable)
|
|
430
|
+
}
|
|
431
|
+
|
|
421
432
|
/**
|
|
422
433
|
Handle a call from JavaScript. First, find the corresponding plugin, construct a selector,
|
|
423
434
|
and perform that selector on the plugin instance.
|
|
@@ -13,3 +13,16 @@
|
|
|
13
13
|
[self _swizzleKeyboardMethods];
|
|
14
14
|
}
|
|
15
15
|
@end
|
|
16
|
+
|
|
17
|
+
// TODO: Remove this after Xcode 14.3 is required
|
|
18
|
+
@implementation WKWebView (CapacitorInspectablity)
|
|
19
|
+
|
|
20
|
+
- (void)setInspectableIfRequired: (BOOL)shouldInspect {
|
|
21
|
+
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 160400
|
|
22
|
+
if (@available(iOS 16.4, *)) {
|
|
23
|
+
self.inspectable = shouldInspect;
|
|
24
|
+
}
|
|
25
|
+
#endif
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@end
|
|
@@ -396,6 +396,14 @@ var nativeBridge = (function (exports) {
|
|
|
396
396
|
headers: nativeResponse.headers,
|
|
397
397
|
status: nativeResponse.status,
|
|
398
398
|
});
|
|
399
|
+
/*
|
|
400
|
+
* copy url to response, `cordova-plugin-ionic` uses this url from the response
|
|
401
|
+
* we need `Object.defineProperty` because url is an inherited getter on the Response
|
|
402
|
+
* see: https://stackoverflow.com/a/57382543
|
|
403
|
+
* */
|
|
404
|
+
Object.defineProperty(response, 'url', {
|
|
405
|
+
value: nativeResponse.url,
|
|
406
|
+
});
|
|
399
407
|
console.timeEnd(tag);
|
|
400
408
|
return response;
|
|
401
409
|
}
|
|
@@ -525,10 +533,9 @@ var nativeBridge = (function (exports) {
|
|
|
525
533
|
this._headers = nativeResponse.headers;
|
|
526
534
|
this.status = nativeResponse.status;
|
|
527
535
|
this.response = nativeResponse.data;
|
|
528
|
-
this.responseText =
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
: JSON.stringify(nativeResponse.data);
|
|
536
|
+
this.responseText = !nativeResponse.headers['Content-Type'].startsWith('application/json')
|
|
537
|
+
? nativeResponse.data
|
|
538
|
+
: JSON.stringify(nativeResponse.data);
|
|
532
539
|
this.responseURL = nativeResponse.url;
|
|
533
540
|
this.readyState = 4;
|
|
534
541
|
this.dispatchEvent(new Event('load'));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor/ios",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.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)",
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"xc:build:CapacitorCordova": "cd CapacitorCordova && xcodebuild && cd .."
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@capacitor/core": "^5.0.0-beta.
|
|
28
|
+
"@capacitor/core": "^5.0.0-beta.1"
|
|
29
29
|
},
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "80b59984c0bf07e0c2d2a6310f7a7ff2679606ab"
|
|
34
34
|
}
|