@capacitor-plus/ios 8.0.7 → 8.3.3
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/CAPBridgeProtocol.swift +2 -0
- package/Capacitor/Capacitor/CAPBridgedJSTypes.h +1 -0
- package/Capacitor/Capacitor/CAPBridgedJSTypes.m +8 -0
- package/Capacitor/Capacitor/CapacitorBridge.swift +4 -15
- package/Capacitor/Capacitor/Plugins/CapacitorUrlRequest.swift +23 -2
- package/Capacitor/Capacitor/assets/native-bridge.js +4 -0
- package/package.json +4 -4
|
@@ -81,7 +81,9 @@ import WebKit
|
|
|
81
81
|
|
|
82
82
|
// MARK: - View Presentation
|
|
83
83
|
func showAlertWith(title: String, message: String, buttonTitle: String)
|
|
84
|
+
@available(*, deprecated, message: "Use self?.bridge?.viewController?.present")
|
|
84
85
|
func presentVC(_ viewControllerToPresent: UIViewController, animated flag: Bool, completion: (() -> Void)?)
|
|
86
|
+
@available(*, deprecated, message: "Use self?.bridge?.viewController?.dismiss")
|
|
85
87
|
func dismissVC(animated flag: Bool, completion: (() -> Void)?)
|
|
86
88
|
}
|
|
87
89
|
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
- (NSString * _Nullable)getString:(NSString * _Nonnull)key defaultValue:(NSString * _Nullable)defaultValue;
|
|
11
11
|
- (NSDate * _Nullable)getDate:(NSString * _Nonnull)key defaultValue:(NSDate * _Nullable)defaultValue;
|
|
12
12
|
- (NSDictionary * _Nullable)getObject:(NSString * _Nonnull)key defaultValue:(NSDictionary * _Nullable)defaultValue;
|
|
13
|
+
- (NSArray * _Nullable)getArray:(NSString * _Nonnull)key defaultValue:(NSArray * _Nullable)defaultValue;
|
|
13
14
|
- (NSNumber * _Nullable)getNumber:(NSString * _Nonnull)key defaultValue:(NSNumber * _Nullable)defaultValue;
|
|
14
15
|
- (BOOL)getBool:(NSString * _Nonnull)key defaultValue:(BOOL)defaultValue;
|
|
15
16
|
@end
|
|
@@ -29,6 +29,14 @@
|
|
|
29
29
|
return defaultValue;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
- (NSArray * _Nullable)getArray:(NSString * _Nonnull)key defaultValue:(NSArray * _Nullable)defaultValue {
|
|
33
|
+
id value = [[self dictionaryRepresentation] objectForKey:key];
|
|
34
|
+
if (value != nil && [value isKindOfClass:[NSArray class]]) {
|
|
35
|
+
return value;
|
|
36
|
+
}
|
|
37
|
+
return defaultValue;
|
|
38
|
+
}
|
|
39
|
+
|
|
32
40
|
- (NSNumber * _Nullable)getNumber:(NSString * _Nonnull)key defaultValue:(NSNumber * _Nullable)defaultValue {
|
|
33
41
|
id value = [[self dictionaryRepresentation] objectForKey:key];
|
|
34
42
|
if (value != nil && [value isKindOfClass:[NSNumber class]]) {
|
|
@@ -93,8 +93,9 @@ open class CapacitorBridge: NSObject, CAPBridgeProtocol {
|
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
|
|
96
|
+
@available(*, deprecated, message: "obsolete")
|
|
97
97
|
var tmpWindow: UIWindow?
|
|
98
|
+
@available(*, deprecated, message: "obsolete")
|
|
98
99
|
static let tmpVCAppeared = Notification(name: Notification.Name(rawValue: "tmpViewControllerAppeared"))
|
|
99
100
|
public static let capacitorSite = "https://capacitorjs.com/"
|
|
100
101
|
public static let fileStartIdentifier = "/_capacitor_file_"
|
|
@@ -747,22 +748,10 @@ open class CapacitorBridge: NSObject, CAPBridgeProtocol {
|
|
|
747
748
|
}
|
|
748
749
|
|
|
749
750
|
@objc open func presentVC(_ viewControllerToPresent: UIViewController, animated flag: Bool, completion: (() -> Void)? = nil) {
|
|
750
|
-
|
|
751
|
-
self.viewController?.present(viewControllerToPresent, animated: flag, completion: completion)
|
|
752
|
-
} else {
|
|
753
|
-
self.tmpWindow = UIWindow.init(frame: UIScreen.main.bounds)
|
|
754
|
-
self.tmpWindow?.rootViewController = TmpViewController.init()
|
|
755
|
-
self.tmpWindow?.makeKeyAndVisible()
|
|
756
|
-
self.tmpWindow?.rootViewController?.present(viewControllerToPresent, animated: flag, completion: completion)
|
|
757
|
-
}
|
|
751
|
+
self.viewController?.present(viewControllerToPresent, animated: flag, completion: completion)
|
|
758
752
|
}
|
|
759
753
|
|
|
760
754
|
@objc open func dismissVC(animated flag: Bool, completion: (() -> Void)? = nil) {
|
|
761
|
-
|
|
762
|
-
self.viewController?.dismiss(animated: flag, completion: completion)
|
|
763
|
-
} else {
|
|
764
|
-
self.tmpWindow?.rootViewController?.dismiss(animated: flag, completion: completion)
|
|
765
|
-
self.tmpWindow = nil
|
|
766
|
-
}
|
|
755
|
+
self.viewController?.dismiss(animated: flag, completion: completion)
|
|
767
756
|
}
|
|
768
757
|
}
|
|
@@ -66,7 +66,7 @@ open class CapacitorUrlRequest: NSObject, URLSessionTaskDelegate {
|
|
|
66
66
|
|
|
67
67
|
var data = Data()
|
|
68
68
|
var boundary = UUID().uuidString
|
|
69
|
-
if contentType.contains("="), let contentBoundary =
|
|
69
|
+
if contentType.contains("boundary="), let contentBoundary = extractBoundary(from: contentType) {
|
|
70
70
|
boundary = contentBoundary
|
|
71
71
|
} else {
|
|
72
72
|
overrideContentType(boundary)
|
|
@@ -87,6 +87,27 @@ open class CapacitorUrlRequest: NSObject, URLSessionTaskDelegate {
|
|
|
87
87
|
headers["Content-Type"] = contentType
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
/**
|
|
91
|
+
Extracts the boundary value of the `content-type` header for multiplart/form-data requests, if provided
|
|
92
|
+
The boundary value might be surrounded by double quotes (") which will be stripped away.
|
|
93
|
+
*/
|
|
94
|
+
private func extractBoundary(from contentType: String) -> String? {
|
|
95
|
+
if let boundaryRange = contentType.range(of: "boundary=") {
|
|
96
|
+
var boundary = contentType[boundaryRange.upperBound...]
|
|
97
|
+
if let endRange = boundary.range(of: ";") {
|
|
98
|
+
boundary = boundary[..<endRange.lowerBound]
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if boundary.hasPrefix("\"") && boundary.hasSuffix("\"") {
|
|
102
|
+
return String(boundary.dropFirst().dropLast())
|
|
103
|
+
} else {
|
|
104
|
+
return String(boundary)
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return nil
|
|
109
|
+
}
|
|
110
|
+
|
|
90
111
|
public func getRequestDataAsString(_ data: JSValue) throws -> Data {
|
|
91
112
|
guard let stringData = data as? String else {
|
|
92
113
|
throw CapacitorUrlRequestError.serializationError("[ data ] argument could not be parsed as string")
|
|
@@ -110,7 +131,7 @@ open class CapacitorUrlRequest: NSObject, URLSessionTaskDelegate {
|
|
|
110
131
|
}
|
|
111
132
|
var data = Data()
|
|
112
133
|
var boundary = UUID().uuidString
|
|
113
|
-
if contentType.contains("="), let contentBoundary =
|
|
134
|
+
if contentType.contains("boundary="), let contentBoundary = extractBoundary(from: contentType) {
|
|
114
135
|
boundary = contentBoundary
|
|
115
136
|
} else {
|
|
116
137
|
overrideContentType(boundary)
|
|
@@ -505,6 +505,10 @@ var nativeBridge = (function (exports) {
|
|
|
505
505
|
if (typeof resource === 'string') {
|
|
506
506
|
return await win.CapacitorWebFetch(createProxyUrl(resource, win), options);
|
|
507
507
|
}
|
|
508
|
+
else if (resource instanceof URL) {
|
|
509
|
+
const modifiedURL = new URL(createProxyUrl(resource.toString(), win));
|
|
510
|
+
return await win.CapacitorWebFetch(modifiedURL, options);
|
|
511
|
+
}
|
|
508
512
|
else if (resource instanceof Request) {
|
|
509
513
|
const modifiedRequest = new Request(createProxyUrl(resource.url, win), resource);
|
|
510
514
|
return await win.CapacitorWebFetch(modifiedRequest, options);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor-plus/ios",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.3.3",
|
|
4
4
|
"description": "Capacitor+: Enhanced Capacitor with automated upstream sync - Cross-platform apps with JavaScript and the web",
|
|
5
5
|
"homepage": "https://capgo.app/docs/plugins/capacitor-plus/",
|
|
6
6
|
"author": "Capgo Team <support@capgo.app> (https://capgo.app)",
|
|
@@ -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 clean test -workspace Capacitor.xcworkspace -scheme Capacitor -destination 'platform=iOS Simulator,name=iPhone
|
|
24
|
+
"xc:build:Capacitor": "cd Capacitor && xcodebuild clean test -workspace Capacitor.xcworkspace -scheme Capacitor -destination 'platform=iOS Simulator,name=iPhone 17,OS=latest' && cd ..",
|
|
25
25
|
"xc:build:CapacitorCordova": "cd CapacitorCordova && xcodebuild && cd .."
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@capacitor-plus/core": "^8.
|
|
29
|
-
"@capacitor/core": "^8.
|
|
28
|
+
"@capacitor-plus/core": "^8.3.0",
|
|
29
|
+
"@capacitor/core": "^8.3.0"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|