@capgo/capacitor-updater 5.2.9 → 5.2.12

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
@@ -757,6 +757,14 @@ Remove all listeners for this plugin.
757
757
  | **`version`** | <code>string</code> | Emit when a download fail. | 4.0.0 |
758
758
 
759
759
 
760
+ #### AppReadyEvent
761
+
762
+ | Prop | Type | Description | Since |
763
+ | ------------ | ------------------------------------------------- | -------------------------------- | ----- |
764
+ | **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | Emit when a app is ready to use. | 5.2.0 |
765
+ | **`status`** | <code>string</code> | | |
766
+
767
+
760
768
  ### Type Aliases
761
769
 
762
770
 
@@ -812,7 +820,7 @@ Remove all listeners for this plugin.
812
820
 
813
821
  #### AppReadyListener
814
822
 
815
- <code>(state: void): void</code>
823
+ <code>(state: <a href="#appreadyevent">AppReadyEvent</a>): void</code>
816
824
 
817
825
  </docgen-api>
818
826
 
@@ -376,6 +376,7 @@ public class CapacitorUpdater {
376
376
  if (setNext) {
377
377
  if (this.directUpdate) {
378
378
  CapacitorUpdater.this.directUpdateFinish(next);
379
+ this.directUpdate = false;
379
380
  } else {
380
381
  this.setNextBundle(next.getId());
381
382
  }
@@ -41,6 +41,8 @@ import java.util.Date;
41
41
  import java.util.Iterator;
42
42
  import java.util.List;
43
43
  import java.util.UUID;
44
+ import java.util.concurrent.CountDownLatch;
45
+ import java.util.concurrent.TimeUnit;
44
46
  import org.json.JSONException;
45
47
 
46
48
  @CapacitorPlugin(name = "CapacitorUpdater")
@@ -56,7 +58,7 @@ public class CapacitorUpdaterPlugin
56
58
  private static final String channelUrlDefault =
57
59
  "https://api.capgo.app/channel_self";
58
60
 
59
- private final String PLUGIN_VERSION = "5.2.9";
61
+ private final String PLUGIN_VERSION = "5.2.12";
60
62
  private static final String DELAY_CONDITION_PREFERENCES = "";
61
63
 
62
64
  private SharedPreferences.Editor editor;
@@ -78,6 +80,8 @@ public class CapacitorUpdaterPlugin
78
80
 
79
81
  private volatile Thread appReadyCheck;
80
82
 
83
+ private static final CountDownLatch semaphoreReady = new CountDownLatch(1);
84
+
81
85
  @Override
82
86
  public void load() {
83
87
  super.load();
@@ -177,9 +181,22 @@ public class CapacitorUpdaterPlugin
177
181
  private void directUpdateFinish(final BundleInfo latest) {
178
182
  final JSObject ret = new JSObject();
179
183
  ret.put("bundle", latest.toJSON());
184
+ ret.put("status", "update installed");
180
185
  CapacitorUpdaterPlugin.this.implementation.set(latest);
181
186
  CapacitorUpdaterPlugin.this._reload();
182
187
  CapacitorUpdaterPlugin.this.notifyListeners("appReady", ret);
188
+ new Thread(() -> {
189
+ try {
190
+ CapacitorUpdaterPlugin.this.semaphoreReady.await(
191
+ CapacitorUpdaterPlugin.this.appReadyTimeout,
192
+ TimeUnit.SECONDS
193
+ );
194
+ } catch (InterruptedException e) {
195
+ e.printStackTrace();
196
+ }
197
+ CapacitorUpdaterPlugin.this.notifyListeners("appReady", ret);
198
+ })
199
+ .start();
183
200
  }
184
201
 
185
202
  private void cleanupObsoleteVersions() {
@@ -439,6 +456,7 @@ public class CapacitorUpdaterPlugin
439
456
 
440
457
  private boolean _reload() {
441
458
  final String path = this.implementation.getCurrentBundlePath();
459
+ this.semaphoreReady.countDown();
442
460
  Log.i(CapacitorUpdater.TAG, "Reloading: " + path);
443
461
  if (this.implementation.isUsingBuiltin()) {
444
462
  this.bridge.setServerAssetPath(path);
@@ -656,6 +674,7 @@ public class CapacitorUpdaterPlugin
656
674
  "Current bundle loaded successfully. ['notifyAppReady()' was called] " +
657
675
  bundle
658
676
  );
677
+ this.semaphoreReady.countDown();
659
678
  call.resolve();
660
679
  } catch (final Exception e) {
661
680
  Log.e(
@@ -850,6 +869,26 @@ public class CapacitorUpdaterPlugin
850
869
  }
851
870
  }
852
871
 
872
+ private void endBackGroundTaskWithNotif(
873
+ String msg,
874
+ String latestVersionName,
875
+ BundleInfo current,
876
+ Boolean error
877
+ ) {
878
+ if (error) {
879
+ this.implementation.sendStats("download_fail", current.getVersionName());
880
+ final JSObject ret = new JSObject();
881
+ ret.put("version", latestVersionName);
882
+ this.notifyListeners("downloadFailed", ret);
883
+ }
884
+ final JSObject ret = new JSObject();
885
+ ret.put("bundle", current.toJSON());
886
+ this.notifyListeners("noNeedUpdate", ret);
887
+ ret.put("message", msg);
888
+ this.notifyListeners("appReady", ret);
889
+ Log.i(CapacitorUpdater.TAG, "endBackGroundTaskWithNotif " + msg);
890
+ }
891
+
853
892
  private void backgroundDownload() {
854
893
  String messageUpdate = this.implementation.directUpdate
855
894
  ? "Update will occur now."
@@ -885,15 +924,11 @@ public class CapacitorUpdaterPlugin
885
924
  majorAvailable
886
925
  );
887
926
  }
888
- final JSObject retNoNeed = new JSObject();
889
- retNoNeed.put("bundle", current.toJSON());
890
- CapacitorUpdaterPlugin.this.notifyListeners(
891
- "noNeedUpdate",
892
- retNoNeed
893
- );
894
- CapacitorUpdaterPlugin.this.notifyListeners(
895
- "appReady",
896
- retNoNeed
927
+ CapacitorUpdaterPlugin.this.endBackGroundTaskWithNotif(
928
+ res.getString("message"),
929
+ current.getVersionName(),
930
+ current,
931
+ true
897
932
  );
898
933
  return;
899
934
  }
@@ -905,15 +940,11 @@ public class CapacitorUpdaterPlugin
905
940
  )
906
941
  ) {
907
942
  Log.e(CapacitorUpdater.TAG, "Error no url or wrong format");
908
- final JSObject retNoNeed = new JSObject();
909
- retNoNeed.put("bundle", current.toJSON());
910
- CapacitorUpdaterPlugin.this.notifyListeners(
911
- "noNeedUpdate",
912
- retNoNeed
913
- );
914
- CapacitorUpdaterPlugin.this.notifyListeners(
915
- "appReady",
916
- retNoNeed
943
+ CapacitorUpdaterPlugin.this.endBackGroundTaskWithNotif(
944
+ "Error no url or wrong format",
945
+ current.getVersionName(),
946
+ current,
947
+ true
917
948
  );
918
949
  return;
919
950
  }
@@ -936,15 +967,11 @@ public class CapacitorUpdaterPlugin
936
967
  CapacitorUpdater.TAG,
937
968
  "Latest bundle already exists, and is in error state. Aborting update."
938
969
  );
939
- final JSObject retNoNeed = new JSObject();
940
- retNoNeed.put("bundle", current.toJSON());
941
- CapacitorUpdaterPlugin.this.notifyListeners(
942
- "noNeedUpdate",
943
- retNoNeed
944
- );
945
- CapacitorUpdaterPlugin.this.notifyListeners(
946
- "appReady",
947
- ret
970
+ CapacitorUpdaterPlugin.this.endBackGroundTaskWithNotif(
971
+ "Latest bundle already exists, and is in error state. Aborting update.",
972
+ latestVersionName,
973
+ current,
974
+ true
948
975
  );
949
976
  return;
950
977
  }
@@ -961,6 +988,12 @@ public class CapacitorUpdaterPlugin
961
988
  latest
962
989
  );
963
990
  CapacitorUpdaterPlugin.this._reload();
991
+ CapacitorUpdaterPlugin.this.endBackGroundTaskWithNotif(
992
+ "Update installed",
993
+ latestVersionName,
994
+ latest,
995
+ false
996
+ );
964
997
  } else {
965
998
  CapacitorUpdaterPlugin.this.notifyListeners(
966
999
  "updateAvailable",
@@ -969,11 +1002,13 @@ public class CapacitorUpdaterPlugin
969
1002
  CapacitorUpdaterPlugin.this.implementation.setNextBundle(
970
1003
  latest.getId()
971
1004
  );
1005
+ CapacitorUpdaterPlugin.this.endBackGroundTaskWithNotif(
1006
+ "update downloaded, will install next background",
1007
+ latestVersionName,
1008
+ latest,
1009
+ false
1010
+ );
972
1011
  }
973
- CapacitorUpdaterPlugin.this.notifyListeners(
974
- "appReady",
975
- ret
976
- );
977
1012
  return;
978
1013
  }
979
1014
  if (latest.isDeleted()) {
@@ -1003,10 +1038,6 @@ public class CapacitorUpdaterPlugin
1003
1038
  );
1004
1039
  }
1005
1040
  }
1006
- CapacitorUpdaterPlugin.this.notifyListeners(
1007
- "appReady",
1008
- ret
1009
- );
1010
1041
  }
1011
1042
 
1012
1043
  new Thread(
@@ -1043,27 +1074,13 @@ public class CapacitorUpdaterPlugin
1043
1074
  "error downloading file",
1044
1075
  e
1045
1076
  );
1046
- final JSObject ret = new JSObject();
1047
- ret.put("version", latestVersionName);
1048
- CapacitorUpdaterPlugin.this.notifyListeners(
1049
- "downloadFailed",
1050
- ret
1051
- );
1052
1077
  final BundleInfo current =
1053
1078
  CapacitorUpdaterPlugin.this.implementation.getCurrentBundle();
1054
- CapacitorUpdaterPlugin.this.implementation.sendStats(
1055
- "download_fail",
1056
- current.getVersionName()
1057
- );
1058
- final JSObject retNoNeed = new JSObject();
1059
- retNoNeed.put("bundle", current.toJSON());
1060
- CapacitorUpdaterPlugin.this.notifyListeners(
1061
- "noNeedUpdate",
1062
- retNoNeed
1063
- );
1064
- CapacitorUpdaterPlugin.this.notifyListeners(
1065
- "appReady",
1066
- ret
1079
+ CapacitorUpdaterPlugin.this.endBackGroundTaskWithNotif(
1080
+ "Error downloading file",
1081
+ latestVersionName,
1082
+ current,
1083
+ true
1067
1084
  );
1068
1085
  }
1069
1086
  }
@@ -1077,20 +1094,20 @@ public class CapacitorUpdaterPlugin
1077
1094
  current.getId() +
1078
1095
  " is the latest bundle."
1079
1096
  );
1080
- final JSObject retNoNeed = new JSObject();
1081
- retNoNeed.put("bundle", current.toJSON());
1082
- CapacitorUpdaterPlugin.this.notifyListeners(
1083
- "noNeedUpdate",
1084
- retNoNeed
1097
+ CapacitorUpdaterPlugin.this.endBackGroundTaskWithNotif(
1098
+ "No need to update",
1099
+ latestVersionName,
1100
+ current,
1101
+ false
1085
1102
  );
1086
1103
  }
1087
1104
  } catch (final JSONException e) {
1088
1105
  Log.e(CapacitorUpdater.TAG, "error parsing JSON", e);
1089
- final JSObject retNoNeed = new JSObject();
1090
- retNoNeed.put("bundle", current.toJSON());
1091
- CapacitorUpdaterPlugin.this.notifyListeners(
1092
- "noNeedUpdate",
1093
- retNoNeed
1106
+ CapacitorUpdaterPlugin.this.endBackGroundTaskWithNotif(
1107
+ "Error parsing JSON",
1108
+ current.getVersionName(),
1109
+ current,
1110
+ true
1094
1111
  );
1095
1112
  }
1096
1113
  }
@@ -1238,19 +1255,21 @@ public class CapacitorUpdaterPlugin
1238
1255
  this.backgroundDownload();
1239
1256
  } else {
1240
1257
  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
- );
1258
+ new Thread(() -> {
1259
+ try {
1260
+ CapacitorUpdaterPlugin.this.semaphoreReady.await(
1261
+ CapacitorUpdaterPlugin.this.appReadyTimeout,
1262
+ TimeUnit.SECONDS
1263
+ );
1264
+ } catch (InterruptedException e) {
1265
+ e.printStackTrace();
1266
+ }
1267
+ final JSObject ret = new JSObject();
1268
+ ret.put("bundle", current.toJSON());
1269
+ ret.put("status", "disabled");
1270
+ CapacitorUpdaterPlugin.this.notifyListeners("appReady", ret);
1271
+ })
1272
+ .start();
1254
1273
  }
1255
1274
  this.checkAppReady();
1256
1275
  }
package/dist/docs.json CHANGED
@@ -1225,6 +1225,36 @@
1225
1225
  "type": "string"
1226
1226
  }
1227
1227
  ]
1228
+ },
1229
+ {
1230
+ "name": "AppReadyEvent",
1231
+ "slug": "appreadyevent",
1232
+ "docs": "",
1233
+ "tags": [],
1234
+ "methods": [],
1235
+ "properties": [
1236
+ {
1237
+ "name": "bundle",
1238
+ "tags": [
1239
+ {
1240
+ "text": "5.2.0",
1241
+ "name": "since"
1242
+ }
1243
+ ],
1244
+ "docs": "Emit when a app is ready to use.",
1245
+ "complexTypes": [
1246
+ "BundleInfo"
1247
+ ],
1248
+ "type": "BundleInfo"
1249
+ },
1250
+ {
1251
+ "name": "status",
1252
+ "tags": [],
1253
+ "docs": "",
1254
+ "complexTypes": [],
1255
+ "type": "string"
1256
+ }
1257
+ ]
1228
1258
  }
1229
1259
  ],
1230
1260
  "enums": [],
@@ -1383,8 +1413,10 @@
1383
1413
  "docs": "",
1384
1414
  "types": [
1385
1415
  {
1386
- "text": "(state: void): void",
1387
- "complexTypes": []
1416
+ "text": "(state: AppReadyEvent): void",
1417
+ "complexTypes": [
1418
+ "AppReadyEvent"
1419
+ ]
1388
1420
  }
1389
1421
  ]
1390
1422
  }
@@ -177,6 +177,15 @@ export interface UpdateFailedEvent {
177
177
  */
178
178
  bundle: BundleInfo;
179
179
  }
180
+ export interface AppReadyEvent {
181
+ /**
182
+ * Emit when a app is ready to use.
183
+ *
184
+ * @since 5.2.0
185
+ */
186
+ bundle: BundleInfo;
187
+ status: string;
188
+ }
180
189
  export interface latestVersion {
181
190
  /**
182
191
  * Res of getLatest method
@@ -222,7 +231,7 @@ export type DownloadCompleteListener = (state: DownloadCompleteEvent) => void;
222
231
  export type MajorAvailableListener = (state: MajorAvailableEvent) => void;
223
232
  export type UpdateFailedListener = (state: UpdateFailedEvent) => void;
224
233
  export type AppReloadedListener = (state: void) => void;
225
- export type AppReadyListener = (state: void) => void;
234
+ export type AppReadyListener = (state: AppReadyEvent) => void;
226
235
  export interface CapacitorUpdaterPlugin {
227
236
  /**
228
237
  * Notify Capacitor Updater that the current bundle is working (a rollback will occur of this method is not called on every app launch)
@@ -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.9"
18
+ private let PLUGIN_VERSION: String = "5.2.12"
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"
@@ -34,8 +34,10 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
34
34
  private var autoDeletePrevious = false
35
35
  private var backgroundWork: DispatchWorkItem?
36
36
  private var taskRunning = false
37
+ let semaphoreReady = DispatchSemaphore(value: 0)
37
38
 
38
39
  override public func load() {
40
+ _ = semaphoreReady.wait(timeout: .now())
39
41
  print("\(self.implementation.TAG) init for device \(self.implementation.deviceID)")
40
42
  do {
41
43
  currentVersionNative = try Version(getConfig().getString("version", Bundle.main.versionName ?? "0.0.0")!)
@@ -158,6 +160,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
158
160
 
159
161
  private func _reload() -> Bool {
160
162
  guard let bridge = self.bridge else { return false }
163
+ _ = self.semaphoreReady.wait(timeout: .now())
161
164
  let id = self.implementation.getCurrentBundleId()
162
165
  let destHot = self.implementation.getPathHot(id: id)
163
166
  print("\(self.implementation.TAG) Reloading \(id)")
@@ -326,6 +329,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
326
329
  }
327
330
 
328
331
  @objc func notifyAppReady(_ call: CAPPluginCall) {
332
+ self.semaphoreReady.signal()
329
333
  let version = self.implementation.getCurrentBundle()
330
334
  self.implementation.setSuccess(bundle: version, autoDeletePrevious: self.autoDeletePrevious)
331
335
  print("\(self.implementation.TAG) Current bundle loaded successfully. ['notifyAppReady()' was called] \(version.toString())")
@@ -498,6 +502,21 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
498
502
  self.backgroundTaskID = UIBackgroundTaskIdentifier.invalid
499
503
  }
500
504
 
505
+ func endBackGroundTaskWithNotif(msg: String, latestVersionName: String, current: BundleInfo, error: Bool = true) {
506
+ if error {
507
+ self.implementation.sendStats(action: "download_fail", versionName: current.getVersionName())
508
+ self.notifyListeners("downloadFailed", data: ["version": latestVersionName])
509
+ }
510
+ self.notifyListeners("noNeedUpdate", data: ["bundle": current.toJSON()])
511
+
512
+ DispatchQueue.global().async {
513
+ _ = self.semaphoreReady.wait(timeout: .now() + .milliseconds(self.appReadyTimeout))
514
+ self.notifyListeners("appReady", data: ["bundle": current.toJSON(), "message": msg])
515
+ }
516
+ print("\(self.implementation.TAG) endBackGroundTaskWithNotif \(msg)")
517
+ self.endBackGroundTask()
518
+ }
519
+
501
520
  func backgroundDownload() {
502
521
  let messageUpdate = self.directUpdate ? "Update will occur now." : "Update will occur next time app moves to background."
503
522
  DispatchQueue.global(qos: .background).async {
@@ -515,17 +534,13 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
515
534
  if res.major == true {
516
535
  self.notifyListeners("majorAvailable", data: ["version": res.version])
517
536
  }
518
- self.notifyListeners("noNeedUpdate", data: ["bundle": current.toJSON()])
519
- self.notifyListeners("appReady", data: ["bundle": current.toJSON()])
520
- self.endBackGroundTask()
537
+ self.endBackGroundTaskWithNotif(msg: res.message ?? "", latestVersionName: res.version, current: current)
521
538
  return
522
539
  }
523
540
  let sessionKey = res.sessionKey ?? ""
524
541
  guard let downloadUrl = URL(string: res.url) else {
525
542
  print("\(self.implementation.TAG) Error no url or wrong format")
526
- self.notifyListeners("noNeedUpdate", data: ["bundle": current.toJSON()])
527
- self.notifyListeners("appReady", data: ["bundle": current.toJSON()])
528
- self.endBackGroundTask()
543
+ self.endBackGroundTaskWithNotif(msg: "Error no url or wrong format", latestVersionName: res.version, current: current)
529
544
  return
530
545
  }
531
546
  let latestVersionName = res.version
@@ -547,17 +562,12 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
547
562
  }
548
563
  guard let next = nextImpl else {
549
564
  print("\(self.implementation.TAG) Error downloading file")
550
- self.notifyListeners("downloadFailed", data: ["version": latestVersionName])
551
- self.notifyListeners("noNeedUpdate", data: ["bundle": current.toJSON()])
552
- self.notifyListeners("appReady", data: ["bundle": current.toJSON()])
553
- self.endBackGroundTask()
565
+ self.endBackGroundTaskWithNotif(msg: "Error downloading file", latestVersionName: latestVersionName, current: current)
554
566
  return
555
567
  }
556
568
  if next.isErrorStatus() {
557
569
  print("\(self.implementation.TAG) Latest version is in error state. Aborting update.")
558
- self.notifyListeners("noNeedUpdate", data: ["bundle": current.toJSON()])
559
- self.notifyListeners("appReady", data: ["bundle": current.toJSON()])
560
- self.endBackGroundTask()
570
+ self.endBackGroundTaskWithNotif(msg: "Latest version is in error state. Aborting update.", latestVersionName: latestVersionName, current: current)
561
571
  return
562
572
  }
563
573
  if res.checksum != "" && next.getChecksum() != res.checksum {
@@ -568,28 +578,31 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
568
578
  if !resDel {
569
579
  print("\(self.implementation.TAG) Delete failed, id \(id) doesn't exist")
570
580
  }
571
- throw ObjectSavableError.checksum
581
+ self.endBackGroundTaskWithNotif(msg: "Error checksum", latestVersionName: latestVersionName, current: current)
582
+ return
572
583
  }
573
584
  if self.directUpdate {
574
585
  _ = self.implementation.set(bundle: next)
575
586
  _ = self._reload()
587
+ self.directUpdate = false
588
+ self.endBackGroundTaskWithNotif(msg: "update installed", latestVersionName: latestVersionName, current: current)
576
589
  } else {
577
590
  self.notifyListeners("updateAvailable", data: ["bundle": next.toJSON()])
578
591
  _ = self.implementation.setNextBundle(next: next.getId())
592
+ self.endBackGroundTaskWithNotif(msg: "update downloaded, will install next background", latestVersionName: latestVersionName, current: current)
579
593
  }
594
+ return
580
595
  } catch {
581
596
  print("\(self.implementation.TAG) Error downloading file", error.localizedDescription)
582
597
  let current: BundleInfo = self.implementation.getCurrentBundle()
583
- self.implementation.sendStats(action: "download_fail", versionName: current.getVersionName())
584
- self.notifyListeners("downloadFailed", data: ["version": latestVersionName])
585
- self.notifyListeners("noNeedUpdate", data: ["bundle": current.toJSON()])
598
+ self.endBackGroundTaskWithNotif(msg: "Error downloading file", latestVersionName: latestVersionName, current: current)
599
+ return
586
600
  }
587
601
  } else {
588
602
  print("\(self.implementation.TAG) No need to update, \(current.getId()) is the latest bundle.")
589
- self.notifyListeners("noNeedUpdate", data: ["bundle": current.toJSON()])
603
+ self.endBackGroundTaskWithNotif(msg: "No need to update, \(current.getId()) is the latest bundle.", latestVersionName: latestVersionName, current: current, error: false)
604
+ return
590
605
  }
591
- self.notifyListeners("appReady", data: ["bundle": current.toJSON()])
592
- self.endBackGroundTask()
593
606
  }
594
607
  }
595
608
 
@@ -650,9 +663,9 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
650
663
  self.backgroundDownload()
651
664
  } else {
652
665
  print("\(self.implementation.TAG) Auto update is disabled")
653
- // run after 1 second to make sure that the app is ready
654
- DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
655
- self.notifyListeners("appReady", data: ["bundle": current.toJSON()])
666
+ DispatchQueue.global().async {
667
+ _ = self.semaphoreReady.wait(timeout: .now() + .milliseconds(self.appReadyTimeout))
668
+ self.notifyListeners("appReady", data: ["bundle": current.toJSON(), "status": "disabled"])
656
669
  }
657
670
  }
658
671
  self.checkAppReady()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-updater",
3
- "version": "5.2.9",
3
+ "version": "5.2.12",
4
4
  "packageManager": "pnpm@8.6.12",
5
5
  "license": "MPL-2.0",
6
6
  "description": "Live update for capacitor apps",