@capawesome/capacitor-live-update 6.5.0 → 6.7.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/README.md +184 -37
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdate.java +63 -5
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdatePlugin.java +98 -3
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/api/GetLatestBundleResponse.java +3 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/options/DownloadBundleOptions.java +15 -1
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/options/FetchLatestBundleOptions.java +24 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/options/SetNextBundleOptions.java +20 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/options/SyncOptions.java +20 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/FetchLatestBundleResult.java +41 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/GetCurrentBundleResult.java +22 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/GetNextBundleResult.java +22 -0
- package/dist/docs.json +318 -18
- package/dist/esm/definitions.d.ts +159 -14
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +5 -1
- package/dist/esm/web.js +12 -0
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +12 -0
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +12 -0
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/Classes/Options/DownloadBundleOptions.swift +11 -1
- package/ios/Plugin/Classes/Options/FetchLatestBundleOptions.swift +18 -0
- package/ios/Plugin/Classes/Options/SetNextBundleOptions.swift +14 -0
- package/ios/Plugin/Classes/Options/SyncOptions.swift +14 -0
- package/ios/Plugin/Classes/Results/FetchLatestBundle.swift +28 -0
- package/ios/Plugin/Classes/Results/GetCurrentBundleResult.swift +16 -0
- package/ios/Plugin/Classes/Results/GetNextBundleResult.swift +16 -0
- package/ios/Plugin/LiveUpdate.swift +55 -6
- package/ios/Plugin/LiveUpdatePlugin.m +5 -1
- package/ios/Plugin/LiveUpdatePlugin.swift +79 -20
- package/package.json +2 -2
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import Capacitor
|
|
3
|
+
|
|
4
|
+
@objc public class FetchLatestBundleResult: NSObject, Result {
|
|
5
|
+
private let artifactType: ArtifactType?
|
|
6
|
+
private let bundleId: String?
|
|
7
|
+
private let downloadUrl: String?
|
|
8
|
+
|
|
9
|
+
init(artifactType: ArtifactType?, bundleId: String?, downloadUrl: String?) {
|
|
10
|
+
self.artifactType = artifactType
|
|
11
|
+
self.bundleId = bundleId
|
|
12
|
+
self.downloadUrl = downloadUrl
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
public func toJSObject() -> AnyObject {
|
|
16
|
+
var result = JSObject()
|
|
17
|
+
if artifactType == .manifest {
|
|
18
|
+
result["artifactType"] = "manifest"
|
|
19
|
+
} else if artifactType == .zip {
|
|
20
|
+
result["artifactType"] = "zip"
|
|
21
|
+
}
|
|
22
|
+
result["bundleId"] = bundleId == nil ? NSNull() : bundleId
|
|
23
|
+
if let downloadUrl = downloadUrl {
|
|
24
|
+
result["downloadUrl"] = downloadUrl
|
|
25
|
+
}
|
|
26
|
+
return result as AnyObject
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import Capacitor
|
|
3
|
+
|
|
4
|
+
@objc public class GetCurrentBundleResult: NSObject, Result {
|
|
5
|
+
let bundleId: String?
|
|
6
|
+
|
|
7
|
+
init(bundleId: String?) {
|
|
8
|
+
self.bundleId = bundleId
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
public func toJSObject() -> AnyObject {
|
|
12
|
+
var result = JSObject()
|
|
13
|
+
result["bundleId"] = bundleId == nil ? NSNull() : bundleId
|
|
14
|
+
return result as AnyObject
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import Capacitor
|
|
3
|
+
|
|
4
|
+
@objc public class GetNextBundleResult: NSObject, Result {
|
|
5
|
+
let bundleId: String?
|
|
6
|
+
|
|
7
|
+
init(bundleId: String?) {
|
|
8
|
+
self.bundleId = bundleId
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
public func toJSObject() -> AnyObject {
|
|
12
|
+
var result = JSObject()
|
|
13
|
+
result["bundleId"] = bundleId == nil ? NSNull() : bundleId
|
|
14
|
+
return result as AnyObject
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -4,7 +4,7 @@ import SSZipArchive
|
|
|
4
4
|
import Capacitor
|
|
5
5
|
import Alamofire
|
|
6
6
|
import CommonCrypto
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
// swiftlint:disable type_body_length
|
|
9
9
|
@objc public class LiveUpdate: NSObject {
|
|
10
10
|
private let bundlesDirectory = "NoCloud/ionic_built_snapshots" // DO NOT CHANGE! (See https://dub.sh/BLluidt)
|
|
@@ -61,6 +61,7 @@ import CommonCrypto
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
@objc public func downloadBundle(_ options: DownloadBundleOptions) async throws {
|
|
64
|
+
let artifactType = options.getArtifactType()
|
|
64
65
|
let bundleId = options.getBundleId()
|
|
65
66
|
let checksum = options.getChecksum()
|
|
66
67
|
let url = options.getUrl()
|
|
@@ -71,7 +72,16 @@ import CommonCrypto
|
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
// Download the bundle
|
|
74
|
-
|
|
75
|
+
if artifactType == .manifest {
|
|
76
|
+
try await downloadBundleOfTypeManifest(bundleId: bundleId, url: url)
|
|
77
|
+
} else {
|
|
78
|
+
try await downloadBundleOfTypeZip(bundleId: bundleId, url: url, checksum: checksum)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@objc public func fetchLatestBundle(_ options: FetchLatestBundleOptions) async throws -> FetchLatestBundleResult {
|
|
83
|
+
let response: GetLatestBundleResponse? = try await self.fetchLatestBundle(options)
|
|
84
|
+
return FetchLatestBundleResult(artifactType: response?.artifactType, bundleId: response?.bundleId, downloadUrl: response?.url)
|
|
75
85
|
}
|
|
76
86
|
|
|
77
87
|
@objc public func getBundle(completion: @escaping (Result?, Error?) -> Void) {
|
|
@@ -95,6 +105,15 @@ import CommonCrypto
|
|
|
95
105
|
completion(result, nil)
|
|
96
106
|
}
|
|
97
107
|
|
|
108
|
+
@objc public func getCurrentBundle(completion: @escaping (Result?, Error?) -> Void) {
|
|
109
|
+
var bundleId = getCurrentBundleId()
|
|
110
|
+
if bundleId == defaultWebAssetDir {
|
|
111
|
+
bundleId = nil
|
|
112
|
+
}
|
|
113
|
+
let result = GetCurrentBundleResult(bundleId: bundleId)
|
|
114
|
+
completion(result, nil)
|
|
115
|
+
}
|
|
116
|
+
|
|
98
117
|
@objc public func getCustomId(completion: @escaping (Result?, Error?) -> Void) {
|
|
99
118
|
let customId = preferences.getCustomId()
|
|
100
119
|
|
|
@@ -108,6 +127,15 @@ import CommonCrypto
|
|
|
108
127
|
completion(result, nil)
|
|
109
128
|
}
|
|
110
129
|
|
|
130
|
+
@objc public func getNextBundle(completion: @escaping (Result?, Error?) -> Void) {
|
|
131
|
+
var bundleId: String? = getNextBundleId()
|
|
132
|
+
if bundleId == defaultWebAssetDir {
|
|
133
|
+
bundleId = nil
|
|
134
|
+
}
|
|
135
|
+
let result = GetNextBundleResult(bundleId: bundleId)
|
|
136
|
+
completion(result, nil)
|
|
137
|
+
}
|
|
138
|
+
|
|
111
139
|
@objc public func getVersionCode(completion: @escaping (Result?, Error?) -> Void) {
|
|
112
140
|
let versionCode = getVersionCode()
|
|
113
141
|
let result = GetVersionCodeResult(versionCode: versionCode)
|
|
@@ -166,9 +194,29 @@ import CommonCrypto
|
|
|
166
194
|
completion(nil)
|
|
167
195
|
}
|
|
168
196
|
|
|
169
|
-
@objc public func
|
|
197
|
+
@objc public func setNextBundle(_ options: SetNextBundleOptions, completion: @escaping (Error?) -> Void) {
|
|
198
|
+
let bundleId = options.getBundleId()
|
|
199
|
+
|
|
200
|
+
if let bundleId = bundleId {
|
|
201
|
+
if hasBundle(bundleId: bundleId) {
|
|
202
|
+
setNextBundle(bundleId: bundleId)
|
|
203
|
+
} else {
|
|
204
|
+
let error = CustomError.bundleNotFound
|
|
205
|
+
completion(error)
|
|
206
|
+
return
|
|
207
|
+
}
|
|
208
|
+
} else {
|
|
209
|
+
reset()
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
completion(nil)
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
@objc public func sync(_ options: SyncOptions) async throws -> SyncResult {
|
|
216
|
+
let channel = options.getChannel()
|
|
170
217
|
// Fetch the latest bundle
|
|
171
|
-
|
|
218
|
+
let fetchLatestBundleOptions = FetchLatestBundleOptions(channel: channel)
|
|
219
|
+
guard let response = try await fetchLatestBundle(fetchLatestBundleOptions) else {
|
|
172
220
|
CAPLog.print("[", LiveUpdatePlugin.tag, "] ", "No update available.")
|
|
173
221
|
return SyncResult(nextBundleId: nil)
|
|
174
222
|
}
|
|
@@ -394,12 +442,13 @@ import CommonCrypto
|
|
|
394
442
|
try await addBundleOfTypeZip(bundleId: bundleId, zipFile: temporaryZipFileUrl)
|
|
395
443
|
}
|
|
396
444
|
|
|
397
|
-
private func fetchLatestBundle() async throws -> GetLatestBundleResponse? {
|
|
445
|
+
private func fetchLatestBundle(_ options: FetchLatestBundleOptions) async throws -> GetLatestBundleResponse? {
|
|
446
|
+
let channel = options.getChannel() ?? getChannel()
|
|
398
447
|
var parameters = [String: String]()
|
|
399
448
|
parameters["appVersionCode"] = getVersionCode()
|
|
400
449
|
parameters["appVersionName"] = getVersionName()
|
|
401
450
|
parameters["bundleId"] = getCurrentBundleId()
|
|
402
|
-
parameters["channelName"] =
|
|
451
|
+
parameters["channelName"] = channel
|
|
403
452
|
parameters["customId"] = preferences.getCustomId()
|
|
404
453
|
parameters["deviceId"] = getDeviceId()
|
|
405
454
|
parameters["osVersion"] = await UIDevice.current.systemVersion
|
|
@@ -6,11 +6,14 @@
|
|
|
6
6
|
CAP_PLUGIN(LiveUpdatePlugin, "LiveUpdate",
|
|
7
7
|
CAP_PLUGIN_METHOD(deleteBundle, CAPPluginReturnPromise);
|
|
8
8
|
CAP_PLUGIN_METHOD(downloadBundle, CAPPluginReturnPromise);
|
|
9
|
+
CAP_PLUGIN_METHOD(fetchLatestBundle, CAPPluginReturnPromise);
|
|
9
10
|
CAP_PLUGIN_METHOD(getBundle, CAPPluginReturnPromise);
|
|
10
11
|
CAP_PLUGIN_METHOD(getBundles, CAPPluginReturnPromise);
|
|
11
12
|
CAP_PLUGIN_METHOD(getChannel, CAPPluginReturnPromise);
|
|
12
|
-
CAP_PLUGIN_METHOD(
|
|
13
|
+
CAP_PLUGIN_METHOD(getCurrentBundle, CAPPluginReturnPromise);
|
|
13
14
|
CAP_PLUGIN_METHOD(getCustomId, CAPPluginReturnPromise);
|
|
15
|
+
CAP_PLUGIN_METHOD(getDeviceId, CAPPluginReturnPromise);
|
|
16
|
+
CAP_PLUGIN_METHOD(getNextBundle, CAPPluginReturnPromise);
|
|
14
17
|
CAP_PLUGIN_METHOD(getVersionCode, CAPPluginReturnPromise);
|
|
15
18
|
CAP_PLUGIN_METHOD(getVersionName, CAPPluginReturnPromise);
|
|
16
19
|
CAP_PLUGIN_METHOD(ready, CAPPluginReturnPromise);
|
|
@@ -19,5 +22,6 @@ CAP_PLUGIN(LiveUpdatePlugin, "LiveUpdate",
|
|
|
19
22
|
CAP_PLUGIN_METHOD(setBundle, CAPPluginReturnPromise);
|
|
20
23
|
CAP_PLUGIN_METHOD(setChannel, CAPPluginReturnPromise);
|
|
21
24
|
CAP_PLUGIN_METHOD(setCustomId, CAPPluginReturnPromise);
|
|
25
|
+
CAP_PLUGIN_METHOD(setNextBundle, CAPPluginReturnPromise);
|
|
22
26
|
CAP_PLUGIN_METHOD(sync, CAPPluginReturnPromise);
|
|
23
27
|
)
|
|
@@ -8,7 +8,7 @@ import Capacitor
|
|
|
8
8
|
@objc(LiveUpdatePlugin)
|
|
9
9
|
public class LiveUpdatePlugin: CAPPlugin {
|
|
10
10
|
public static let tag = "LiveUpdate"
|
|
11
|
-
public static let version = "6.
|
|
11
|
+
public static let version = "6.6.0"
|
|
12
12
|
public static let userDefaultsPrefix = "CapawesomeLiveUpdate" // DO NOT CHANGE
|
|
13
13
|
|
|
14
14
|
private var config: LiveUpdateConfig?
|
|
@@ -33,13 +33,14 @@ public class LiveUpdatePlugin: CAPPlugin {
|
|
|
33
33
|
self.rejectCall(call, error)
|
|
34
34
|
return
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
self.resolveCall(call)
|
|
37
37
|
})
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
@objc func downloadBundle(_ call: CAPPluginCall) {
|
|
41
41
|
Task {
|
|
42
42
|
do {
|
|
43
|
+
let artifactType = call.getString("artifactType", "zip")
|
|
43
44
|
guard let bundleId = call.getString("bundleId") else {
|
|
44
45
|
call.reject(CustomError.bundleIdMissing.localizedDescription)
|
|
45
46
|
return
|
|
@@ -50,10 +51,24 @@ public class LiveUpdatePlugin: CAPPlugin {
|
|
|
50
51
|
return
|
|
51
52
|
}
|
|
52
53
|
|
|
53
|
-
let options = DownloadBundleOptions(bundleId: bundleId, checksum: checksum, url: url)
|
|
54
|
+
let options = DownloadBundleOptions(artifactType: artifactType, bundleId: bundleId, checksum: checksum, url: url)
|
|
54
55
|
|
|
55
56
|
try await implementation?.downloadBundle(options)
|
|
56
|
-
|
|
57
|
+
self.resolveCall(call)
|
|
58
|
+
} catch {
|
|
59
|
+
rejectCall(call, error)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@objc func fetchLatestBundle(_ call: CAPPluginCall) {
|
|
65
|
+
Task {
|
|
66
|
+
do {
|
|
67
|
+
let options = FetchLatestBundleOptions(call)
|
|
68
|
+
let result = try await implementation?.fetchLatestBundle(options)
|
|
69
|
+
if let result = result?.toJSObject() as? JSObject {
|
|
70
|
+
self.resolveCall(call, result)
|
|
71
|
+
}
|
|
57
72
|
} catch {
|
|
58
73
|
rejectCall(call, error)
|
|
59
74
|
}
|
|
@@ -67,7 +82,7 @@ public class LiveUpdatePlugin: CAPPlugin {
|
|
|
67
82
|
return
|
|
68
83
|
}
|
|
69
84
|
if let result = result?.toJSObject() as? JSObject {
|
|
70
|
-
|
|
85
|
+
self.resolveCall(call, result)
|
|
71
86
|
}
|
|
72
87
|
})
|
|
73
88
|
}
|
|
@@ -79,7 +94,7 @@ public class LiveUpdatePlugin: CAPPlugin {
|
|
|
79
94
|
return
|
|
80
95
|
}
|
|
81
96
|
if let result = result?.toJSObject() as? JSObject {
|
|
82
|
-
|
|
97
|
+
self.resolveCall(call, result)
|
|
83
98
|
}
|
|
84
99
|
})
|
|
85
100
|
}
|
|
@@ -91,7 +106,19 @@ public class LiveUpdatePlugin: CAPPlugin {
|
|
|
91
106
|
return
|
|
92
107
|
}
|
|
93
108
|
if let result = result?.toJSObject() as? JSObject {
|
|
94
|
-
|
|
109
|
+
self.resolveCall(call, result)
|
|
110
|
+
}
|
|
111
|
+
})
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
@objc func getCurrentBundle(_ call: CAPPluginCall) {
|
|
115
|
+
implementation?.getCurrentBundle(completion: { result, error in
|
|
116
|
+
if let error = error {
|
|
117
|
+
self.rejectCall(call, error)
|
|
118
|
+
return
|
|
119
|
+
}
|
|
120
|
+
if let result = result?.toJSObject() as? JSObject {
|
|
121
|
+
self.resolveCall(call, result)
|
|
95
122
|
}
|
|
96
123
|
})
|
|
97
124
|
}
|
|
@@ -103,7 +130,7 @@ public class LiveUpdatePlugin: CAPPlugin {
|
|
|
103
130
|
return
|
|
104
131
|
}
|
|
105
132
|
if let result = result?.toJSObject() as? JSObject {
|
|
106
|
-
|
|
133
|
+
self.resolveCall(call, result)
|
|
107
134
|
}
|
|
108
135
|
})
|
|
109
136
|
}
|
|
@@ -115,7 +142,19 @@ public class LiveUpdatePlugin: CAPPlugin {
|
|
|
115
142
|
return
|
|
116
143
|
}
|
|
117
144
|
if let result = result?.toJSObject() as? JSObject {
|
|
118
|
-
|
|
145
|
+
self.resolveCall(call, result)
|
|
146
|
+
}
|
|
147
|
+
})
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
@objc func getNextBundle(_ call: CAPPluginCall) {
|
|
151
|
+
implementation?.getNextBundle(completion: { result, error in
|
|
152
|
+
if let error = error {
|
|
153
|
+
self.rejectCall(call, error)
|
|
154
|
+
return
|
|
155
|
+
}
|
|
156
|
+
if let result = result?.toJSObject() as? JSObject {
|
|
157
|
+
self.resolveCall(call, result)
|
|
119
158
|
}
|
|
120
159
|
})
|
|
121
160
|
}
|
|
@@ -127,7 +166,7 @@ public class LiveUpdatePlugin: CAPPlugin {
|
|
|
127
166
|
return
|
|
128
167
|
}
|
|
129
168
|
if let result = result?.toJSObject() as? JSObject {
|
|
130
|
-
|
|
169
|
+
self.resolveCall(call, result)
|
|
131
170
|
}
|
|
132
171
|
})
|
|
133
172
|
}
|
|
@@ -139,24 +178,24 @@ public class LiveUpdatePlugin: CAPPlugin {
|
|
|
139
178
|
return
|
|
140
179
|
}
|
|
141
180
|
if let result = result?.toJSObject() as? JSObject {
|
|
142
|
-
|
|
181
|
+
self.resolveCall(call, result)
|
|
143
182
|
}
|
|
144
183
|
})
|
|
145
184
|
}
|
|
146
185
|
|
|
147
186
|
@objc func ready(_ call: CAPPluginCall) {
|
|
148
187
|
implementation?.ready()
|
|
149
|
-
call
|
|
188
|
+
resolveCall(call)
|
|
150
189
|
}
|
|
151
190
|
|
|
152
191
|
@objc func reload(_ call: CAPPluginCall) {
|
|
153
192
|
implementation?.reload()
|
|
154
|
-
call
|
|
193
|
+
resolveCall(call)
|
|
155
194
|
}
|
|
156
195
|
|
|
157
196
|
@objc func reset(_ call: CAPPluginCall) {
|
|
158
197
|
implementation?.reset()
|
|
159
|
-
call
|
|
198
|
+
resolveCall(call)
|
|
160
199
|
}
|
|
161
200
|
|
|
162
201
|
@objc func setBundle(_ call: CAPPluginCall) {
|
|
@@ -172,8 +211,8 @@ public class LiveUpdatePlugin: CAPPlugin {
|
|
|
172
211
|
self.rejectCall(call, error)
|
|
173
212
|
return
|
|
174
213
|
}
|
|
214
|
+
self.resolveCall(call)
|
|
175
215
|
})
|
|
176
|
-
call.resolve()
|
|
177
216
|
}
|
|
178
217
|
|
|
179
218
|
@objc func setChannel(_ call: CAPPluginCall) {
|
|
@@ -186,8 +225,8 @@ public class LiveUpdatePlugin: CAPPlugin {
|
|
|
186
225
|
self.rejectCall(call, error)
|
|
187
226
|
return
|
|
188
227
|
}
|
|
228
|
+
self.resolveCall(call)
|
|
189
229
|
})
|
|
190
|
-
call.resolve()
|
|
191
230
|
}
|
|
192
231
|
|
|
193
232
|
@objc func setCustomId(_ call: CAPPluginCall) {
|
|
@@ -203,14 +242,25 @@ public class LiveUpdatePlugin: CAPPlugin {
|
|
|
203
242
|
self.rejectCall(call, error)
|
|
204
243
|
return
|
|
205
244
|
}
|
|
245
|
+
self.resolveCall(call)
|
|
246
|
+
})
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
@objc func setNextBundle(_ call: CAPPluginCall) {
|
|
250
|
+
let options = SetNextBundleOptions(call)
|
|
251
|
+
|
|
252
|
+
implementation?.setNextBundle(options, completion: { error in
|
|
253
|
+
if let error = error {
|
|
254
|
+
self.rejectCall(call, error)
|
|
255
|
+
return
|
|
256
|
+
}
|
|
257
|
+
self.resolveCall(call)
|
|
206
258
|
})
|
|
207
|
-
call.resolve()
|
|
208
259
|
}
|
|
209
260
|
|
|
210
261
|
@objc func sync(_ call: CAPPluginCall) {
|
|
211
262
|
Task {
|
|
212
263
|
do {
|
|
213
|
-
|
|
214
264
|
guard let _ = config?.appId else {
|
|
215
265
|
call.reject(CustomError.appIdMissing.localizedDescription)
|
|
216
266
|
return
|
|
@@ -222,10 +272,11 @@ public class LiveUpdatePlugin: CAPPlugin {
|
|
|
222
272
|
}
|
|
223
273
|
syncInProgress = true
|
|
224
274
|
|
|
225
|
-
let
|
|
275
|
+
let options = SyncOptions(call)
|
|
276
|
+
let result = try await implementation?.sync(options)
|
|
226
277
|
self.syncInProgress = false
|
|
227
278
|
if let result = result?.toJSObject() as? JSObject {
|
|
228
|
-
call
|
|
279
|
+
resolveCall(call, result)
|
|
229
280
|
}
|
|
230
281
|
} catch {
|
|
231
282
|
self.syncInProgress = false
|
|
@@ -260,4 +311,12 @@ public class LiveUpdatePlugin: CAPPlugin {
|
|
|
260
311
|
}
|
|
261
312
|
call.reject(message)
|
|
262
313
|
}
|
|
314
|
+
|
|
315
|
+
private func resolveCall(_ call: CAPPluginCall) {
|
|
316
|
+
call.resolve()
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
private func resolveCall(_ call: CAPPluginCall, _ result: JSObject) {
|
|
320
|
+
call.resolve(result)
|
|
321
|
+
}
|
|
263
322
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capawesome/capacitor-live-update",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.7.0",
|
|
4
4
|
"description": "Capacitor plugin to update your app remotely in real-time.",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"@capacitor/android": "6.0.0",
|
|
68
68
|
"@capacitor/cli": "6.0.0",
|
|
69
69
|
"@capacitor/core": "6.0.0",
|
|
70
|
-
"@capacitor/docgen": "0.0
|
|
70
|
+
"@capacitor/docgen": "0.3.0",
|
|
71
71
|
"@capacitor/ios": "6.0.0",
|
|
72
72
|
"@ionic/eslint-config": "0.3.0",
|
|
73
73
|
"@ionic/prettier-config": "2.0.0",
|