@capawesome/capacitor-live-update 6.8.0 → 7.0.0-dev.2633ff2.1765953041

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.
Files changed (54) hide show
  1. package/CapawesomeCapacitorLiveUpdate.podspec +3 -3
  2. package/Package.swift +32 -0
  3. package/README.md +438 -86
  4. package/android/build.gradle +12 -12
  5. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdate.java +754 -279
  6. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdateConfig.java +29 -27
  7. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdateHttpClient.java +40 -7
  8. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdatePlugin.java +210 -67
  9. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdatePreferences.java +52 -3
  10. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/api/GetLatestBundleResponse.java +11 -2
  11. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/events/DownloadBundleProgressEvent.java +32 -0
  12. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/{results/GetBundleResult.java → events/NextBundleSetEvent.java} +9 -7
  13. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/options/SetConfigOptions.java +19 -0
  14. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/options/SyncOptions.java +4 -0
  15. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/FetchLatestBundleResult.java +8 -0
  16. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/GetBlockedBundlesResult.java +27 -0
  17. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/GetConfigResult.java +40 -0
  18. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/GetDownloadedBundlesResult.java +27 -0
  19. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/IsSyncingResult.java +26 -0
  20. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/ReadyResult.java +32 -0
  21. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/interfaces/DownloadProgressCallback.java +5 -0
  22. package/dist/docs.json +597 -102
  23. package/dist/esm/definitions.d.ts +338 -39
  24. package/dist/esm/definitions.js.map +1 -1
  25. package/dist/esm/index.js +1 -1
  26. package/dist/esm/index.js.map +1 -1
  27. package/dist/esm/web.d.ts +9 -2
  28. package/dist/esm/web.js +21 -0
  29. package/dist/esm/web.js.map +1 -1
  30. package/dist/plugin.cjs.js +22 -3
  31. package/dist/plugin.cjs.js.map +1 -1
  32. package/dist/plugin.js +22 -3
  33. package/dist/plugin.js.map +1 -1
  34. package/ios/Plugin/Classes/Events/DownloadBundleProgressEvent.swift +25 -0
  35. package/ios/Plugin/Classes/{Results/GetBundleResult.swift → Events/NextBundleSetEvent.swift} +3 -3
  36. package/ios/Plugin/Classes/Options/SetConfigOptions.swift +14 -0
  37. package/ios/Plugin/Classes/Options/SyncOptions.swift +4 -0
  38. package/ios/Plugin/Classes/Results/{FetchLatestBundle.swift → FetchLatestBundleResult.swift} +6 -1
  39. package/ios/Plugin/Classes/Results/GetBlockedBundlesResult.swift +16 -0
  40. package/ios/Plugin/Classes/Results/GetConfigResult.swift +19 -0
  41. package/ios/Plugin/Classes/Results/GetDownloadedBundlesResult.swift +16 -0
  42. package/ios/Plugin/Classes/Results/IsSyncingResult.swift +16 -0
  43. package/ios/Plugin/Classes/Results/ReadyResult.swift +22 -0
  44. package/ios/Plugin/LiveUpdate.swift +365 -149
  45. package/ios/Plugin/LiveUpdateConfig.swift +4 -4
  46. package/ios/Plugin/LiveUpdateHttpClient.swift +10 -4
  47. package/ios/Plugin/LiveUpdatePlugin.swift +136 -34
  48. package/ios/Plugin/LiveUpdatePreferences.swift +54 -12
  49. package/ios/Plugin/Protocols/Api/GetLatestBundleResponse.swift +1 -0
  50. package/package.json +19 -20
  51. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/options/SetBundleOptions.java +0 -18
  52. package/ios/Plugin/Classes/Options/SetBundleOptions.swift +0 -14
  53. package/ios/Plugin/LiveUpdatePlugin.h +0 -10
  54. package/ios/Plugin/LiveUpdatePlugin.m +0 -27
@@ -1,11 +1,11 @@
1
1
  public struct LiveUpdateConfig {
2
2
  var appId: String?
3
+ var autoBlockRolledBackBundles = false
3
4
  var autoDeleteBundles = false
5
+ var autoUpdateStrategy = "none"
4
6
  var defaultChannel: String?
5
- var enabled = true
6
7
  var httpTimeout = 60000
7
- var location: String?
8
8
  var publicKey: String?
9
- var readyTimeout = 10000
10
- var resetOnUpdate = true
9
+ var readyTimeout = 0
10
+ var serverDomain = "api.cloud.capawesome.io"
11
11
  }
@@ -7,23 +7,29 @@ public class LiveUpdateHttpClient: NSObject {
7
7
  private let config: LiveUpdateConfig
8
8
 
9
9
  public static func getChecksumFromResponse(response: HTTPURLResponse) -> String? {
10
- return response.allHeaderFields["x-checksum"] as? String // Must be lowercase!
10
+ guard let headers = response.allHeaderFields as? [String: String] else { return nil }
11
+ return headers.first(where: { $0.key.lowercased() == "x-checksum" })?.value
11
12
  }
12
13
 
13
14
  public static func getSignatureFromResponse(response: HTTPURLResponse) -> String? {
14
- return response.allHeaderFields["x-signature"] as? String // Must be lowercase!
15
+ guard let headers = response.allHeaderFields as? [String: String] else { return nil }
16
+ return headers.first(where: { $0.key.lowercased() == "x-signature" })?.value
15
17
  }
16
18
 
17
19
  init(config: LiveUpdateConfig) {
18
20
  self.config = config
19
21
  }
20
22
 
21
- public func download(url: URL, destination: @escaping DownloadRequest.Destination) async throws -> AFDownloadResponse<Data> {
23
+ public func download(url: URL, destination: @escaping DownloadRequest.Destination, callback: ((Progress) -> Void)?) async throws -> AFDownloadResponse<Data> {
22
24
  var request = URLRequest(url: url)
23
25
  request.httpMethod = HTTPMethod.get.rawValue
24
26
  request.timeoutInterval = Double(config.httpTimeout) / 1000.0
25
27
  return try await withCheckedThrowingContinuation { continuation in
26
- AF.download(request, to: destination).responseData { response in
28
+ AF.download(request, to: destination).downloadProgress { progress in
29
+ if let callback = callback {
30
+ callback(progress)
31
+ }
32
+ }.responseData(emptyResponseCodes: [200, 204, 205]) { response in
27
33
  continuation.resume(returning: response)
28
34
  }
29
35
  }
@@ -6,18 +6,67 @@ import Capacitor
6
6
  * here: https://capacitorjs.com/docs/plugins/ios
7
7
  */
8
8
  @objc(LiveUpdatePlugin)
9
- public class LiveUpdatePlugin: CAPPlugin {
9
+ public class LiveUpdatePlugin: CAPPlugin, CAPBridgedPlugin {
10
10
  public static let tag = "LiveUpdate"
11
- public static let version = "6.8.0"
11
+ public static let version = "7.4.0"
12
12
  public static let userDefaultsPrefix = "CapawesomeLiveUpdate" // DO NOT CHANGE
13
13
 
14
+ public let identifier = "LiveUpdatePlugin"
15
+ public let jsName = "LiveUpdate"
16
+ public let pluginMethods: [CAPPluginMethod] = [
17
+ CAPPluginMethod(name: "clearBlockedBundles", returnType: CAPPluginReturnPromise),
18
+ CAPPluginMethod(name: "deleteBundle", returnType: CAPPluginReturnPromise),
19
+ CAPPluginMethod(name: "downloadBundle", returnType: CAPPluginReturnPromise),
20
+ CAPPluginMethod(name: "fetchLatestBundle", returnType: CAPPluginReturnPromise),
21
+ CAPPluginMethod(name: "getBlockedBundles", returnType: CAPPluginReturnPromise),
22
+ CAPPluginMethod(name: "getBundles", returnType: CAPPluginReturnPromise),
23
+ CAPPluginMethod(name: "getChannel", returnType: CAPPluginReturnPromise),
24
+ CAPPluginMethod(name: "getConfig", returnType: CAPPluginReturnPromise),
25
+ CAPPluginMethod(name: "getDownloadedBundles", returnType: CAPPluginReturnPromise),
26
+ CAPPluginMethod(name: "getCurrentBundle", returnType: CAPPluginReturnPromise),
27
+ CAPPluginMethod(name: "getCustomId", returnType: CAPPluginReturnPromise),
28
+ CAPPluginMethod(name: "getDeviceId", returnType: CAPPluginReturnPromise),
29
+ CAPPluginMethod(name: "getNextBundle", returnType: CAPPluginReturnPromise),
30
+ CAPPluginMethod(name: "getVersionCode", returnType: CAPPluginReturnPromise),
31
+ CAPPluginMethod(name: "getVersionName", returnType: CAPPluginReturnPromise),
32
+ CAPPluginMethod(name: "isSyncing", returnType: CAPPluginReturnPromise),
33
+ CAPPluginMethod(name: "ready", returnType: CAPPluginReturnPromise),
34
+ CAPPluginMethod(name: "reload", returnType: CAPPluginReturnPromise),
35
+ CAPPluginMethod(name: "reset", returnType: CAPPluginReturnPromise),
36
+ CAPPluginMethod(name: "resetConfig", returnType: CAPPluginReturnPromise),
37
+ CAPPluginMethod(name: "setChannel", returnType: CAPPluginReturnPromise),
38
+ CAPPluginMethod(name: "setConfig", returnType: CAPPluginReturnPromise),
39
+ CAPPluginMethod(name: "setCustomId", returnType: CAPPluginReturnPromise),
40
+ CAPPluginMethod(name: "setNextBundle", returnType: CAPPluginReturnPromise),
41
+ CAPPluginMethod(name: "sync", returnType: CAPPluginReturnPromise)
42
+ ]
43
+
44
+ private let eventDownloadBundleProgess = "downloadBundleProgress"
45
+ private let eventNextBundleSet = "nextBundleSet"
46
+ private let eventReloaded = "reloaded"
47
+
14
48
  private var config: LiveUpdateConfig?
15
49
  private var implementation: LiveUpdate?
16
- private var syncInProgress = false
17
50
 
18
51
  override public func load() {
19
52
  self.config = liveUpdateConfig()
20
53
  self.implementation = LiveUpdate(config: config!, plugin: self)
54
+
55
+ // Notify implementation about load
56
+ implementation?.handleLoad()
57
+
58
+ // Register for app resume notifications
59
+ NotificationCenter.default.addObserver(
60
+ self,
61
+ selector: #selector(handleAppWillEnterForeground),
62
+ name: UIApplication.willEnterForegroundNotification,
63
+ object: nil
64
+ )
65
+ }
66
+
67
+ @objc func clearBlockedBundles(_ call: CAPPluginCall) {
68
+ implementation?.clearBlockedBundles()
69
+ resolveCall(call)
21
70
  }
22
71
 
23
72
  @objc func deleteBundle(_ call: CAPPluginCall) {
@@ -65,6 +114,11 @@ public class LiveUpdatePlugin: CAPPlugin {
65
114
  @objc func fetchLatestBundle(_ call: CAPPluginCall) {
66
115
  Task {
67
116
  do {
117
+ guard let appId = config?.appId, !appId.isEmpty else {
118
+ call.reject(CustomError.appIdMissing.localizedDescription)
119
+ return
120
+ }
121
+
68
122
  let options = FetchLatestBundleOptions(call)
69
123
  let result = try await implementation?.fetchLatestBundle(options)
70
124
  if let result = result?.toJSObject() as? JSObject {
@@ -76,8 +130,8 @@ public class LiveUpdatePlugin: CAPPlugin {
76
130
  }
77
131
  }
78
132
 
79
- @objc func getBundle(_ call: CAPPluginCall) {
80
- implementation?.getBundle(completion: { result, error in
133
+ @objc func getBlockedBundles(_ call: CAPPluginCall) {
134
+ implementation?.getBlockedBundles(completion: { result, error in
81
135
  if let error = error {
82
136
  self.rejectCall(call, error)
83
137
  return
@@ -100,6 +154,18 @@ public class LiveUpdatePlugin: CAPPlugin {
100
154
  })
101
155
  }
102
156
 
157
+ @objc func getDownloadedBundles(_ call: CAPPluginCall) {
158
+ implementation?.getDownloadedBundles(completion: { result, error in
159
+ if let error = error {
160
+ self.rejectCall(call, error)
161
+ return
162
+ }
163
+ if let result = result?.toJSObject() as? JSObject {
164
+ self.resolveCall(call, result)
165
+ }
166
+ })
167
+ }
168
+
103
169
  @objc func getChannel(_ call: CAPPluginCall) {
104
170
  implementation?.getChannel(completion: { result, error in
105
171
  if let error = error {
@@ -112,6 +178,18 @@ public class LiveUpdatePlugin: CAPPlugin {
112
178
  })
113
179
  }
114
180
 
181
+ @objc func getConfig(_ call: CAPPluginCall) {
182
+ implementation?.getConfig(completion: { result, error in
183
+ if let error = error {
184
+ self.rejectCall(call, error)
185
+ return
186
+ }
187
+ if let result = result?.toJSObject() as? JSObject {
188
+ self.resolveCall(call, result)
189
+ }
190
+ })
191
+ }
192
+
115
193
  @objc func getCurrentBundle(_ call: CAPPluginCall) {
116
194
  implementation?.getCurrentBundle(completion: { result, error in
117
195
  if let error = error {
@@ -184,9 +262,28 @@ public class LiveUpdatePlugin: CAPPlugin {
184
262
  })
185
263
  }
186
264
 
265
+ @objc func isSyncing(_ call: CAPPluginCall) {
266
+ implementation?.isSyncing(completion: { result, error in
267
+ if let error = error {
268
+ self.rejectCall(call, error)
269
+ return
270
+ }
271
+ if let result = result?.toJSObject() as? JSObject {
272
+ self.resolveCall(call, result)
273
+ }
274
+ })
275
+ }
276
+
187
277
  @objc func ready(_ call: CAPPluginCall) {
188
- implementation?.ready()
189
- resolveCall(call)
278
+ implementation?.ready(completion: { result, error in
279
+ if let error = error {
280
+ self.rejectCall(call, error)
281
+ return
282
+ }
283
+ if let result = result?.toJSObject() as? JSObject {
284
+ self.resolveCall(call, result)
285
+ }
286
+ })
190
287
  }
191
288
 
192
289
  @objc func reload(_ call: CAPPluginCall) {
@@ -199,21 +296,9 @@ public class LiveUpdatePlugin: CAPPlugin {
199
296
  resolveCall(call)
200
297
  }
201
298
 
202
- @objc func setBundle(_ call: CAPPluginCall) {
203
- guard let bundleId = call.getString("bundleId") else {
204
- call.reject(CustomError.bundleIdMissing.localizedDescription)
205
- return
206
- }
207
-
208
- let options = SetBundleOptions(bundleId: bundleId)
209
-
210
- implementation?.setBundle(options, completion: { error in
211
- if let error = error {
212
- self.rejectCall(call, error)
213
- return
214
- }
215
- self.resolveCall(call)
216
- })
299
+ @objc func resetConfig(_ call: CAPPluginCall) {
300
+ implementation?.resetConfig()
301
+ resolveCall(call)
217
302
  }
218
303
 
219
304
  @objc func setChannel(_ call: CAPPluginCall) {
@@ -230,6 +315,12 @@ public class LiveUpdatePlugin: CAPPlugin {
230
315
  })
231
316
  }
232
317
 
318
+ @objc func setConfig(_ call: CAPPluginCall) {
319
+ let options = SetConfigOptions(call)
320
+ implementation?.setConfig(options)
321
+ resolveCall(call)
322
+ }
323
+
233
324
  @objc func setCustomId(_ call: CAPPluginCall) {
234
325
  guard let customId = call.getString("customId") else {
235
326
  call.reject(CustomError.customIdMissing.localizedDescription)
@@ -262,42 +353,53 @@ public class LiveUpdatePlugin: CAPPlugin {
262
353
  @objc func sync(_ call: CAPPluginCall) {
263
354
  Task {
264
355
  do {
265
- guard let _ = config?.appId else {
356
+ guard let appId = config?.appId, !appId.isEmpty else {
266
357
  call.reject(CustomError.appIdMissing.localizedDescription)
267
358
  return
268
359
  }
269
360
 
270
- guard !syncInProgress else {
271
- call.reject(CustomError.syncInProgress.localizedDescription)
272
- return
273
- }
274
- syncInProgress = true
275
-
276
361
  let options = SyncOptions(call)
277
362
  let result = try await implementation?.sync(options)
278
- self.syncInProgress = false
279
363
  if let result = result?.toJSObject() as? JSObject {
280
364
  resolveCall(call, result)
281
365
  }
282
366
  } catch {
283
- self.syncInProgress = false
284
367
  rejectCall(call, error)
285
368
  }
286
369
  }
287
370
  }
288
371
 
372
+ func notifyDownloadBundleProgressListeners(_ event: DownloadBundleProgressEvent) {
373
+ if let event = event.toJSObject() as? JSObject {
374
+ notifyListeners(eventDownloadBundleProgess, data: event, retainUntilConsumed: false)
375
+ }
376
+ }
377
+
378
+ func notifyNextBundleSetListeners(_ event: NextBundleSetEvent) {
379
+ notifyListeners(eventNextBundleSet, data: event.toJSObject(), retainUntilConsumed: false)
380
+ }
381
+
382
+ func notifyReloadedListeners() {
383
+ let event = JSObject()
384
+ notifyListeners(eventReloaded, data: event, retainUntilConsumed: true)
385
+ }
386
+
387
+ @objc private func handleAppWillEnterForeground() {
388
+ implementation?.handleAppWillEnterForeground()
389
+ }
390
+
289
391
  private func liveUpdateConfig() -> LiveUpdateConfig {
290
392
  var config = LiveUpdateConfig()
291
393
 
292
394
  config.appId = getConfig().getString("appId", config.appId)
395
+ config.autoBlockRolledBackBundles = getConfig().getBoolean("autoBlockRolledBackBundles", config.autoBlockRolledBackBundles)
293
396
  config.autoDeleteBundles = getConfig().getBoolean("autoDeleteBundles", config.autoDeleteBundles)
397
+ config.autoUpdateStrategy = getConfig().getString("autoUpdateStrategy", config.autoUpdateStrategy) ?? config.autoUpdateStrategy
294
398
  config.defaultChannel = getConfig().getString("defaultChannel", config.defaultChannel)
295
- config.enabled = getConfig().getBoolean("enabled", config.enabled)
296
399
  config.httpTimeout = getConfig().getInt("httpTimeout", config.httpTimeout)
297
- config.location = getConfig().getString("location", config.location)
298
400
  config.publicKey = getConfig().getString("publicKey", config.publicKey)
299
401
  config.readyTimeout = getConfig().getInt("readyTimeout", config.readyTimeout)
300
- config.resetOnUpdate = getConfig().getBoolean("resetOnUpdate", config.resetOnUpdate)
402
+ config.serverDomain = getConfig().getString("serverDomain", config.serverDomain) ?? config.serverDomain
301
403
 
302
404
  return config
303
405
  }
@@ -1,10 +1,21 @@
1
1
  import Foundation
2
2
 
3
3
  public class LiveUpdatePreferences: NSObject {
4
+ private let appIdKey = "appId" // DO NOT CHANGE
5
+ private let blockedBundleIdsKey = "blockedBundleIds" // DO NOT CHANGE
4
6
  private let channelKey = "channel" // DO NOT CHANGE
5
7
  private let customIdKey = "customId" // DO NOT CHANGE
6
- private let lastBundleShortVersionStringKey = "lastBundleShortVersionString" // DO NOT CHANGE
7
- private let lastBundleVersionKey = "lastBundleVersion" // DO NOT CHANGE
8
+ private let lastVersionCodeKey = "lastVersionCode" // DO NOT CHANGE
9
+ private let lastVersionNameKey = "lastVersionName" // DO NOT CHANGE
10
+ private let previousBundleIdKey = "previousBundleIdKey" // DO NOT CHANGE
11
+
12
+ public func getAppId() -> String? {
13
+ return UserDefaults.standard.string(forKey: applyPrefix(to: appIdKey))
14
+ }
15
+
16
+ public func getBlockedBundleIds() -> String? {
17
+ return UserDefaults.standard.string(forKey: applyPrefix(to: blockedBundleIdsKey))
18
+ }
8
19
 
9
20
  public func getChannel() -> String? {
10
21
  return UserDefaults.standard.string(forKey: applyPrefix(to: channelKey))
@@ -14,12 +25,34 @@ public class LiveUpdatePreferences: NSObject {
14
25
  return UserDefaults.standard.string(forKey: applyPrefix(to: customIdKey))
15
26
  }
16
27
 
17
- public func getLastBundleShortVersionString() -> String? {
18
- return UserDefaults.standard.string(forKey: applyPrefix(to: lastBundleShortVersionStringKey))
28
+ public func getLastVersionCode() -> String? {
29
+ return UserDefaults.standard.string(forKey: applyPrefix(to: lastVersionCodeKey))
30
+ }
31
+
32
+ public func getLastVersionName() -> String? {
33
+ return UserDefaults.standard.string(forKey: applyPrefix(to: lastVersionNameKey))
34
+ }
35
+
36
+ public func getPreviousBundleId() -> String? {
37
+ return UserDefaults.standard.string(forKey: applyPrefix(to: previousBundleIdKey))
38
+ }
39
+
40
+ public func setAppId(_ value: String?) {
41
+ if let value = value {
42
+ UserDefaults.standard.set(value, forKey: applyPrefix(to: appIdKey))
43
+ } else {
44
+ UserDefaults.standard.removeObject(forKey: applyPrefix(to: appIdKey))
45
+ }
46
+ UserDefaults.standard.synchronize()
19
47
  }
20
48
 
21
- public func getLastBundleVersion() -> String? {
22
- return UserDefaults.standard.string(forKey: applyPrefix(to: lastBundleVersionKey))
49
+ public func setBlockedBundleIds(_ value: String?) {
50
+ if let value = value {
51
+ UserDefaults.standard.set(value, forKey: applyPrefix(to: blockedBundleIdsKey))
52
+ } else {
53
+ UserDefaults.standard.removeObject(forKey: applyPrefix(to: blockedBundleIdsKey))
54
+ }
55
+ UserDefaults.standard.synchronize()
23
56
  }
24
57
 
25
58
  public func setChannel(_ value: String?) {
@@ -36,20 +69,29 @@ public class LiveUpdatePreferences: NSObject {
36
69
  UserDefaults.standard.synchronize()
37
70
  }
38
71
 
39
- public func setLastBundleShortVersionString(_ value: String?) {
72
+ public func setLastVersionCode(_ value: String?) {
73
+ if let value = value {
74
+ UserDefaults.standard.set(value, forKey: applyPrefix(to: lastVersionCodeKey))
75
+ } else {
76
+ UserDefaults.standard.removeObject(forKey: applyPrefix(to: lastVersionCodeKey))
77
+ }
78
+ UserDefaults.standard.synchronize()
79
+ }
80
+
81
+ public func setLastVersionName(_ value: String?) {
40
82
  if let value = value {
41
- UserDefaults.standard.set(value, forKey: applyPrefix(to: lastBundleShortVersionStringKey))
83
+ UserDefaults.standard.set(value, forKey: applyPrefix(to: lastVersionNameKey))
42
84
  } else {
43
- UserDefaults.standard.removeObject(forKey: applyPrefix(to: lastBundleShortVersionStringKey))
85
+ UserDefaults.standard.removeObject(forKey: applyPrefix(to: lastVersionNameKey))
44
86
  }
45
87
  UserDefaults.standard.synchronize()
46
88
  }
47
89
 
48
- public func setLastBundleVersion(_ value: String?) {
90
+ public func setPreviousBundleId(_ value: String?) {
49
91
  if let value = value {
50
- UserDefaults.standard.set(value, forKey: applyPrefix(to: lastBundleVersionKey))
92
+ UserDefaults.standard.set(value, forKey: applyPrefix(to: previousBundleIdKey))
51
93
  } else {
52
- UserDefaults.standard.removeObject(forKey: applyPrefix(to: lastBundleVersionKey))
94
+ UserDefaults.standard.removeObject(forKey: applyPrefix(to: previousBundleIdKey))
53
95
  }
54
96
  UserDefaults.standard.synchronize()
55
97
  }
@@ -2,6 +2,7 @@ public struct GetLatestBundleResponse: Codable {
2
2
  var artifactType: ArtifactType
3
3
  var bundleId: String
4
4
  var checksum: String?
5
+ var customProperties: [String: String]?
5
6
  var signature: String?
6
7
  var url: String
7
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capawesome/capacitor-live-update",
3
- "version": "6.8.0",
3
+ "version": "7.0.0-dev.2633ff2.1765953041",
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",
@@ -11,7 +11,8 @@
11
11
  "android/build.gradle",
12
12
  "dist/",
13
13
  "ios/Plugin/",
14
- "CapawesomeCapacitorLiveUpdate.podspec"
14
+ "CapawesomeCapacitorLiveUpdate.podspec",
15
+ "Package.swift"
15
16
  ],
16
17
  "author": "Robin Genz <mail@robingenz.dev>",
17
18
  "license": "MIT",
@@ -56,7 +57,7 @@
56
57
  "prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
57
58
  "swiftlint": "node-swiftlint",
58
59
  "docgen": "docgen --api LiveUpdatePlugin --output-readme README.md --output-json dist/docs.json",
59
- "build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.js",
60
+ "build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
60
61
  "clean": "rimraf ./dist",
61
62
  "watch": "tsc --watch",
62
63
  "version": "node scripts/sync-plugin-version.mjs",
@@ -64,26 +65,24 @@
64
65
  "prepublishOnly": "npm run build"
65
66
  },
66
67
  "devDependencies": {
67
- "@capacitor/android": "6.0.0",
68
- "@capacitor/cli": "6.0.0",
69
- "@capacitor/core": "6.0.0",
70
- "@capacitor/docgen": "0.3.0",
71
- "@capacitor/ios": "6.0.0",
72
- "@ionic/eslint-config": "0.3.0",
73
- "@ionic/prettier-config": "2.0.0",
74
- "@ionic/swiftlint-config": "1.1.2",
75
- "eslint": "7.32.0",
76
- "prettier": "2.6.2",
77
- "prettier-plugin-java": "1.6.1",
78
- "rimraf": "3.0.2",
79
- "rollup": "2.77.2",
80
- "swiftlint": "1.0.1",
81
- "typescript": "4.1.5"
68
+ "@capacitor/android": "8.0.0",
69
+ "@capacitor/cli": "8.0.0",
70
+ "@capacitor/core": "8.0.0",
71
+ "@capacitor/docgen": "0.3.1",
72
+ "@capacitor/ios": "8.0.0",
73
+ "@ionic/eslint-config": "0.4.0",
74
+ "@ionic/swiftlint-config": "2.0.0",
75
+ "eslint": "8.57.0",
76
+ "prettier": "3.4.2",
77
+ "prettier-plugin-java": "2.6.7",
78
+ "rimraf": "6.1.2",
79
+ "rollup": "4.53.3",
80
+ "swiftlint": "2.0.0",
81
+ "typescript": "5.9.3"
82
82
  },
83
83
  "peerDependencies": {
84
- "@capacitor/core": "^6.0.0"
84
+ "@capacitor/core": ">=8.0.0"
85
85
  },
86
- "prettier": "@ionic/prettier-config",
87
86
  "swiftlint": "@ionic/swiftlint-config",
88
87
  "eslintConfig": {
89
88
  "extends": "@ionic/eslint-config/recommended"
@@ -1,18 +0,0 @@
1
- package io.capawesome.capacitorjs.plugins.liveupdate.classes.options;
2
-
3
- import androidx.annotation.NonNull;
4
-
5
- public class SetBundleOptions {
6
-
7
- @NonNull
8
- private String bundleId;
9
-
10
- public SetBundleOptions(@NonNull String bundleId) {
11
- this.bundleId = bundleId;
12
- }
13
-
14
- @NonNull
15
- public String getBundleId() {
16
- return bundleId;
17
- }
18
- }
@@ -1,14 +0,0 @@
1
- import Foundation
2
- import Capacitor
3
-
4
- @objc public class SetBundleOptions: NSObject {
5
- private var bundleId: String
6
-
7
- init(bundleId: String) {
8
- self.bundleId = bundleId
9
- }
10
-
11
- func getBundleId() -> String {
12
- return bundleId
13
- }
14
- }
@@ -1,10 +0,0 @@
1
- #import <UIKit/UIKit.h>
2
-
3
- //! Project version number for Plugin.
4
- FOUNDATION_EXPORT double PluginVersionNumber;
5
-
6
- //! Project version string for Plugin.
7
- FOUNDATION_EXPORT const unsigned char PluginVersionString[];
8
-
9
- // In this header, you should import all the public headers of your framework using statements like #import <Plugin/PublicHeader.h>
10
-
@@ -1,27 +0,0 @@
1
- #import <Foundation/Foundation.h>
2
- #import <Capacitor/Capacitor.h>
3
-
4
- // Define the plugin using the CAP_PLUGIN Macro, and
5
- // each method the plugin supports using the CAP_PLUGIN_METHOD macro.
6
- CAP_PLUGIN(LiveUpdatePlugin, "LiveUpdate",
7
- CAP_PLUGIN_METHOD(deleteBundle, CAPPluginReturnPromise);
8
- CAP_PLUGIN_METHOD(downloadBundle, CAPPluginReturnPromise);
9
- CAP_PLUGIN_METHOD(fetchLatestBundle, CAPPluginReturnPromise);
10
- CAP_PLUGIN_METHOD(getBundle, CAPPluginReturnPromise);
11
- CAP_PLUGIN_METHOD(getBundles, CAPPluginReturnPromise);
12
- CAP_PLUGIN_METHOD(getChannel, CAPPluginReturnPromise);
13
- CAP_PLUGIN_METHOD(getCurrentBundle, CAPPluginReturnPromise);
14
- CAP_PLUGIN_METHOD(getCustomId, CAPPluginReturnPromise);
15
- CAP_PLUGIN_METHOD(getDeviceId, CAPPluginReturnPromise);
16
- CAP_PLUGIN_METHOD(getNextBundle, CAPPluginReturnPromise);
17
- CAP_PLUGIN_METHOD(getVersionCode, CAPPluginReturnPromise);
18
- CAP_PLUGIN_METHOD(getVersionName, CAPPluginReturnPromise);
19
- CAP_PLUGIN_METHOD(ready, CAPPluginReturnPromise);
20
- CAP_PLUGIN_METHOD(reload, CAPPluginReturnPromise);
21
- CAP_PLUGIN_METHOD(reset, CAPPluginReturnPromise);
22
- CAP_PLUGIN_METHOD(setBundle, CAPPluginReturnPromise);
23
- CAP_PLUGIN_METHOD(setChannel, CAPPluginReturnPromise);
24
- CAP_PLUGIN_METHOD(setCustomId, CAPPluginReturnPromise);
25
- CAP_PLUGIN_METHOD(setNextBundle, CAPPluginReturnPromise);
26
- CAP_PLUGIN_METHOD(sync, CAPPluginReturnPromise);
27
- )