@capawesome/capacitor-live-update 6.0.5 → 6.0.7

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 CHANGED
@@ -11,6 +11,7 @@ Capacitor plugin to update your app remotely in real-time.
11
11
  - 📺 **Channel Support**: Set a channel for the app to manage different versions.
12
12
  - 🔄 **Auto Update**: Automatically download and set the latest bundle for the app.
13
13
  - 🛟 **Rollback**: Reset the app to the default bundle if an incompatible bundle has been set.
14
+ - 🚀 **Rollout**: Gradually roll out new bundles to gather valuable feedback.
14
15
 
15
16
  ## Installation
16
17
 
@@ -116,6 +117,13 @@ export default config;
116
117
 
117
118
  A working example can be found here: [robingenz/capacitor-plugin-demo](https://github.com/robingenz/capacitor-plugin-demo)
118
119
 
120
+ ## Starter templates
121
+
122
+ The following starter templates are available:
123
+
124
+ - [Ionstarter Angular Firebase](https://ionstarter.dev/)
125
+ - [Ionstarter Angular SQLite](https://ionstarter.dev/)
126
+
119
127
  ## Guides
120
128
 
121
129
  - [Announcing the Capacitor Live Update Plugin](https://capawesome.io/blog/announcing-the-capacitor-live-update-plugin/)
@@ -185,6 +185,7 @@ public class LiveUpdate {
185
185
  }
186
186
 
187
187
  setNextBundle(bundleId);
188
+ callback.success();
188
189
  }
189
190
 
190
191
  public void setChannel(@NonNull SetChannelOptions options, @NonNull EmptyCallback callback) {
@@ -19,7 +19,7 @@ import io.capawesome.capacitorjs.plugins.liveupdate.interfaces.Result;
19
19
  public class LiveUpdatePlugin extends Plugin {
20
20
 
21
21
  public static final String TAG = "LiveUpdate";
22
- public static final String VERSION = "6.0.5";
22
+ public static final String VERSION = "6.0.7";
23
23
  public static final String SHARED_PREFERENCES_NAME = "CapawesomeLiveUpdate"; // DO NOT CHANGE
24
24
  public static final String ERROR_APP_ID_MISSING = "appId must be configured.";
25
25
  public static final String ERROR_BUNDLE_EXISTS = "bundle already exists.";
@@ -21,7 +21,6 @@ import Alamofire
21
21
  self.plugin = plugin
22
22
  self.preferences = LiveUpdatePreferences()
23
23
  super.init()
24
- createBundlesDirectory()
25
24
 
26
25
  if config.enabled {
27
26
  if wasUpdated() && config.resetOnUpdate {
@@ -154,6 +153,7 @@ import Alamofire
154
153
  }
155
154
 
156
155
  setNextBundle(bundleId: bundleId)
156
+ completion(nil)
157
157
  }
158
158
 
159
159
  @objc public func setChannel(_ options: SetChannelOptions, completion: @escaping (Error?) -> Void) {
@@ -218,6 +218,10 @@ import Alamofire
218
218
  completion(CustomError.bundleIndexHtmlMissing)
219
219
  return
220
220
  }
221
+
222
+ // Create the bundles directory if it does not exist
223
+ self.createBundlesDirectory()
224
+
221
225
  // Move the unzipped files to the bundles directory
222
226
  let bundlePath = self.buildBundlePathFor(bundleId: bundleId)
223
227
  do {
@@ -398,7 +402,7 @@ import Alamofire
398
402
  }
399
403
 
400
404
  private func getNextCapacitorServerPath() -> String? {
401
- if let path = UserDefaults.standard.string(forKey: self.defaultServerPathKey) {
405
+ if let path = KeyValueStore.standard[self.defaultServerPathKey, as: String.self] {
402
406
  return path.isEmpty ? nil : path
403
407
  }
404
408
  return nil
@@ -456,12 +460,11 @@ import Alamofire
456
460
  private func setNextCapacitorServerPath(path: String) {
457
461
  if path.hasSuffix("/public") {
458
462
  // Reset the custom server base path
459
- UserDefaults.standard.set("", forKey: self.defaultServerPathKey)
463
+ KeyValueStore.standard[self.defaultServerPathKey] = ""
460
464
  } else {
461
465
  // Attention: Only the lastPathComponent is used (see https://dub.sh/BLluidt)
462
- UserDefaults.standard.set(path, forKey: self.defaultServerPathKey)
466
+ KeyValueStore.standard[self.defaultServerPathKey] = path
463
467
  }
464
- UserDefaults.standard.synchronize()
465
468
  }
466
469
 
467
470
  private func setNextCapacitorServerPathToDefaultWebAssetDir() {
@@ -509,7 +512,7 @@ import Alamofire
509
512
 
510
513
  extension DispatchQueue {
511
514
  static func background(background: (() -> Void)? = nil, completion: (() -> Void)? = nil) {
512
- DispatchQueue.global(qos: .background).async {
515
+ DispatchQueue.global(qos: .userInitiated).async {
513
516
  background?()
514
517
  if let completion = completion {
515
518
  DispatchQueue.main.async {
@@ -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.0.5"
11
+ public static let version = "6.0.7"
12
12
  public static let userDefaultsPrefix = "CapawesomeLiveUpdate" // DO NOT CHANGE
13
13
 
14
14
  private var config: LiveUpdateConfig?
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capawesome/capacitor-live-update",
3
- "version": "6.0.5",
3
+ "version": "6.0.7",
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",