@capgo/capacitor-updater 5.2.5 → 5.2.6

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.
@@ -144,6 +144,10 @@ public class CapacitorUpdater {
144
144
  return;
145
145
  }
146
146
 
147
+ void directUpdateFinish(final BundleInfo latest) {
148
+ return;
149
+ }
150
+
147
151
  void notifyListeners(final String id, final JSObject res) {
148
152
  return;
149
153
  }
@@ -371,7 +375,7 @@ public class CapacitorUpdater {
371
375
  CapacitorUpdater.this.notifyListeners("updateAvailable", ret);
372
376
  if (setNext) {
373
377
  if (this.directUpdate) {
374
- this.set(next);
378
+ CapacitorUpdater.this.directUpdateFinish(next);
375
379
  } else {
376
380
  this.setNextBundle(next.getId());
377
381
  }
@@ -55,7 +55,7 @@ public class CapacitorUpdaterPlugin
55
55
  private static final String channelUrlDefault =
56
56
  "https://api.capgo.app/channel_self";
57
57
 
58
- private final String PLUGIN_VERSION = "5.2.5";
58
+ private final String PLUGIN_VERSION = "5.2.6";
59
59
  private static final String DELAY_CONDITION_PREFERENCES = "";
60
60
 
61
61
  private SharedPreferences.Editor editor;
@@ -96,6 +96,11 @@ public class CapacitorUpdaterPlugin
96
96
  CapacitorUpdaterPlugin.this.notifyDownload(id, percent);
97
97
  }
98
98
 
99
+ @Override
100
+ public void directUpdateFinish(final BundleInfo latest) {
101
+ CapacitorUpdaterPlugin.this.directUpdateFinish(latest);
102
+ }
103
+
99
104
  @Override
100
105
  public void notifyListeners(final String id, final JSObject res) {
101
106
  CapacitorUpdaterPlugin.this.notifyListeners(id, res);
@@ -168,6 +173,14 @@ public class CapacitorUpdaterPlugin
168
173
  application.registerActivityLifecycleCallbacks(this);
169
174
  }
170
175
 
176
+ private void directUpdateFinish(final BundleInfo latest) {
177
+ final JSObject ret = new JSObject();
178
+ ret.put("bundle", latest.toJSON());
179
+ CapacitorUpdaterPlugin.this.implementation.set(latest);
180
+ CapacitorUpdaterPlugin.this._reload();
181
+ CapacitorUpdaterPlugin.this.notifyListeners("appReady", ret);
182
+ }
183
+
171
184
  private void cleanupObsoleteVersions() {
172
185
  try {
173
186
  final Version previous = new Version(
@@ -877,6 +890,10 @@ public class CapacitorUpdaterPlugin
877
890
  "noNeedUpdate",
878
891
  retNoNeed
879
892
  );
893
+ CapacitorUpdaterPlugin.this.notifyListeners(
894
+ "appReady",
895
+ retNoNeed
896
+ );
880
897
  return;
881
898
  }
882
899
 
@@ -893,6 +910,11 @@ public class CapacitorUpdaterPlugin
893
910
  "noNeedUpdate",
894
911
  retNoNeed
895
912
  );
913
+ CapacitorUpdaterPlugin.this.notifyListeners(
914
+ "appReady",
915
+ retNoNeed
916
+ );
917
+ return;
896
918
  }
897
919
  final String latestVersionName = res.getString("version");
898
920
 
@@ -906,6 +928,8 @@ public class CapacitorUpdaterPlugin
906
928
  latestVersionName
907
929
  );
908
930
  if (latest != null) {
931
+ final JSObject ret = new JSObject();
932
+ ret.put("bundle", latest.toJSON());
909
933
  if (latest.isErrorStatus()) {
910
934
  Log.e(
911
935
  CapacitorUpdater.TAG,
@@ -917,6 +941,10 @@ public class CapacitorUpdaterPlugin
917
941
  "noNeedUpdate",
918
942
  retNoNeed
919
943
  );
944
+ CapacitorUpdaterPlugin.this.notifyListeners(
945
+ "appReady",
946
+ ret
947
+ );
920
948
  return;
921
949
  }
922
950
  if (latest.isDownloaded()) {
@@ -932,15 +960,7 @@ public class CapacitorUpdaterPlugin
932
960
  latest
933
961
  );
934
962
  CapacitorUpdaterPlugin.this._reload();
935
- final JSObject ret = new JSObject();
936
- ret.put("bundle", latest.toJSON());
937
- CapacitorUpdaterPlugin.this.notifyListeners(
938
- "appReady",
939
- ret
940
- );
941
963
  } else {
942
- final JSObject ret = new JSObject();
943
- ret.put("bundle", latest.toJSON());
944
964
  CapacitorUpdaterPlugin.this.notifyListeners(
945
965
  "updateAvailable",
946
966
  ret
@@ -949,6 +969,10 @@ public class CapacitorUpdaterPlugin
949
969
  latest.getId()
950
970
  );
951
971
  }
972
+ CapacitorUpdaterPlugin.this.notifyListeners(
973
+ "appReady",
974
+ ret
975
+ );
952
976
  return;
953
977
  }
954
978
  if (latest.isDeleted()) {
@@ -978,6 +1002,10 @@ public class CapacitorUpdaterPlugin
978
1002
  );
979
1003
  }
980
1004
  }
1005
+ CapacitorUpdaterPlugin.this.notifyListeners(
1006
+ "appReady",
1007
+ ret
1008
+ );
981
1009
  }
982
1010
 
983
1011
  new Thread(
@@ -1032,6 +1060,10 @@ public class CapacitorUpdaterPlugin
1032
1060
  "noNeedUpdate",
1033
1061
  retNoNeed
1034
1062
  );
1063
+ CapacitorUpdaterPlugin.this.notifyListeners(
1064
+ "appReady",
1065
+ ret
1066
+ );
1035
1067
  }
1036
1068
  }
1037
1069
  }
@@ -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.5"
18
+ private let PLUGIN_VERSION: String = "5.2.6"
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"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-updater",
3
- "version": "5.2.5",
3
+ "version": "5.2.6",
4
4
  "packageManager": "pnpm@8.6.12",
5
5
  "license": "MPL-2.0",
6
6
  "description": "Live update for capacitor apps",