@capgo/capacitor-native-market 8.0.42 → 8.0.44
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.
|
@@ -25,7 +25,7 @@ struct APIResult: Codable {
|
|
|
25
25
|
*/
|
|
26
26
|
@objc(NativeMarket)
|
|
27
27
|
public class NativeMarket: CAPPlugin, CAPBridgedPlugin {
|
|
28
|
-
private let pluginVersion: String = "8.0.
|
|
28
|
+
private let pluginVersion: String = "8.0.44"
|
|
29
29
|
public let identifier = "NativeMarketPlugin"
|
|
30
30
|
public let jsName = "NativeMarket"
|
|
31
31
|
public let pluginMethods: [CAPPluginMethod] = [
|
|
@@ -87,19 +87,25 @@ public class NativeMarket: CAPPlugin, CAPBridgedPlugin {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
@objc func search(_ call: CAPPluginCall) {
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
guard let terms = call.getString("terms") else {
|
|
91
|
+
call.reject("terms is missing")
|
|
92
|
+
return
|
|
93
|
+
}
|
|
92
94
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
+
var components = URLComponents()
|
|
96
|
+
components.scheme = "itms-apps"
|
|
97
|
+
components.host = "itunes.apple.com"
|
|
98
|
+
components.path = "/search"
|
|
99
|
+
components.queryItems = [URLQueryItem(name: "term", value: terms)]
|
|
100
|
+
guard let appUrl = components.url else {
|
|
101
|
+
call.reject("Invalid search URL")
|
|
102
|
+
return
|
|
103
|
+
}
|
|
95
104
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
105
|
+
if UIApplication.shared.canOpenURL(appUrl) {
|
|
106
|
+
UIApplication.shared.open(appUrl, options: [:]) { (_) in
|
|
107
|
+
call.resolve()
|
|
100
108
|
}
|
|
101
|
-
} else {
|
|
102
|
-
call.reject("terms is missing")
|
|
103
109
|
}
|
|
104
110
|
}
|
|
105
111
|
|
package/package.json
CHANGED