@capgo/capacitor-updater 5.2.6 → 5.2.8

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.
@@ -15,6 +15,7 @@ import android.content.pm.PackageInfo;
15
15
  import android.content.pm.PackageManager;
16
16
  import android.os.Build;
17
17
  import android.os.Bundle;
18
+ import android.os.Handler;
18
19
  import android.util.Log;
19
20
  import androidx.annotation.NonNull;
20
21
  import androidx.annotation.Nullable;
@@ -55,7 +56,7 @@ public class CapacitorUpdaterPlugin
55
56
  private static final String channelUrlDefault =
56
57
  "https://api.capgo.app/channel_self";
57
58
 
58
- private final String PLUGIN_VERSION = "5.2.6";
59
+ private final String PLUGIN_VERSION = "5.2.8";
59
60
  private static final String DELAY_CONDITION_PREFERENCES = "";
60
61
 
61
62
  private SharedPreferences.Editor editor;
@@ -870,7 +871,7 @@ public class CapacitorUpdaterPlugin
870
871
  if (res.has("message")) {
871
872
  Log.i(
872
873
  CapacitorUpdater.TAG,
873
- "message " + res.get("message")
874
+ "API message " + res.get("message")
874
875
  );
875
876
  if (
876
877
  res.has("major") &&
@@ -1235,6 +1236,21 @@ public class CapacitorUpdaterPlugin
1235
1236
  this._checkCancelDelay(true);
1236
1237
  if (CapacitorUpdaterPlugin.this._isAutoUpdateEnabled()) {
1237
1238
  this.backgroundDownload();
1239
+ } else {
1240
+ Log.i(CapacitorUpdater.TAG, "Auto update is disabled");
1241
+ // run after 1.5 s to make sure the listeners are registered
1242
+ new Handler()
1243
+ .postDelayed(
1244
+ new Runnable() {
1245
+ @Override
1246
+ public void run() {
1247
+ final JSObject ret = new JSObject();
1248
+ ret.put("bundle", current.toJSON());
1249
+ CapacitorUpdaterPlugin.this.notifyListeners("appReady", ret);
1250
+ }
1251
+ },
1252
+ 1500
1253
+ );
1238
1254
  }
1239
1255
  this.checkAppReady();
1240
1256
  }
@@ -15,7 +15,7 @@ import Version
15
15
  @objc(CapacitorUpdaterPlugin)
16
16
  public class CapacitorUpdaterPlugin: CAPPlugin {
17
17
  private var implementation = CapacitorUpdater()
18
- private let PLUGIN_VERSION: String = "5.2.6"
18
+ private let PLUGIN_VERSION: String = "5.2.8"
19
19
  static let updateUrlDefault = "https://api.capgo.app/updates"
20
20
  static let statsUrlDefault = "https://api.capgo.app/stats"
21
21
  static let channelUrlDefault = "https://api.capgo.app/channel_self"
@@ -511,7 +511,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
511
511
  let current = self.implementation.getCurrentBundle()
512
512
 
513
513
  if (res.message) != nil {
514
- print("\(self.implementation.TAG) message \(res.message ?? "")")
514
+ print("\(self.implementation.TAG) API message \(res.message ?? "")")
515
515
  if res.major == true {
516
516
  self.notifyListeners("majorAvailable", data: ["version": res.version])
517
517
  }
@@ -646,6 +646,10 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
646
646
  self.backgroundDownload()
647
647
  } else {
648
648
  print("\(self.implementation.TAG) Auto update is disabled")
649
+ // run after 1 second to make sure that the app is ready
650
+ DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
651
+ self.notifyListeners("appReady", data: ["bundle": current.toJSON()])
652
+ }
649
653
  }
650
654
  self.checkAppReady()
651
655
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-updater",
3
- "version": "5.2.6",
3
+ "version": "5.2.8",
4
4
  "packageManager": "pnpm@8.6.12",
5
5
  "license": "MPL-2.0",
6
6
  "description": "Live update for capacitor apps",