@capgo/capacitor-updater 4.0.0-alpha.2 → 4.0.0-alpha.20

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
@@ -127,6 +127,8 @@ Capacitor Updator works by unzipping a compiled app bundle to the native device
127
127
  * [`current()`](#current)
128
128
  * [`reload()`](#reload)
129
129
  * [`setDelay(...)`](#setdelay)
130
+ * [`cancelDelay()`](#canceldelay)
131
+ * [`getLatest(...)`](#getlatest)
130
132
  * [`addListener('download', ...)`](#addlistenerdownload)
131
133
  * [`addListener('downloadComplete', ...)`](#addlistenerdownloadcomplete)
132
134
  * [`addListener('majorAvailable', ...)`](#addlistenermajoravailable)
@@ -276,15 +278,49 @@ Reload the view
276
278
  ### setDelay(...)
277
279
 
278
280
  ```typescript
279
- setDelay(options: { delay: boolean; }) => Promise<void>
281
+ setDelay(options: { kind: DelayUntilNext; value?: string; }) => Promise<void>
280
282
  ```
281
283
 
282
284
  Set delay to skip updates in the next time the app goes into the background
283
285
 
286
+ | Param | Type |
287
+ | ------------- | ------------------------------------------------------------------------------------ |
288
+ | **`options`** | <code>{ kind: <a href="#delayuntilnext">DelayUntilNext</a>; value?: string; }</code> |
289
+
290
+ **Since:** 4.0.0
291
+
292
+ --------------------
293
+
294
+
295
+ ### cancelDelay()
296
+
297
+ ```typescript
298
+ cancelDelay() => Promise<void>
299
+ ```
300
+
301
+ Cancel delay to updates as usual
302
+
303
+ **Since:** 4.0.0
304
+
305
+ --------------------
306
+
307
+
308
+ ### getLatest(...)
309
+
310
+ ```typescript
311
+ getLatest(options: { delay: boolean; }) => Promise<latestVersion>
312
+ ```
313
+
314
+ Get Latest version available from update Url
315
+
284
316
  | Param | Type |
285
317
  | ------------- | -------------------------------- |
286
318
  | **`options`** | <code>{ delay: boolean; }</code> |
287
319
 
320
+ **Returns:** <code>Promise&lt;<a href="#latestversion">latestVersion</a>&gt;</code>
321
+
322
+ **Since:** 4.0.0
323
+
288
324
  --------------------
289
325
 
290
326
 
@@ -445,6 +481,17 @@ removeAllListeners() => Promise<void>
445
481
  | **`status`** | <code><a href="#bundlestatus">BundleStatus</a></code> |
446
482
 
447
483
 
484
+ #### latestVersion
485
+
486
+ | Prop | Type | Description | Since |
487
+ | ------------- | -------------------- | ----------------------- | ----- |
488
+ | **`version`** | <code>string</code> | Res of getLatest method | 4.0.0 |
489
+ | **`major`** | <code>boolean</code> | | |
490
+ | **`message`** | <code>string</code> | | |
491
+ | **`old`** | <code>string</code> | | |
492
+ | **`url`** | <code>string</code> | | |
493
+
494
+
448
495
  #### PluginListenerHandle
449
496
 
450
497
  | Prop | Type |
@@ -489,6 +536,11 @@ removeAllListeners() => Promise<void>
489
536
  <code>'success' | 'error' | 'pending' | 'downloading'</code>
490
537
 
491
538
 
539
+ #### DelayUntilNext
540
+
541
+ <code>'background' | 'kill' | 'nativeVersion' | 'date'</code>
542
+
543
+
492
544
  #### DownloadChangeListener
493
545
 
494
546
  <code>(state: <a href="#downloadevent">DownloadEvent</a>): void</code>
@@ -46,7 +46,7 @@ public class CapacitorUpdater {
46
46
  private static final String bundleDirectory = "versions";
47
47
 
48
48
  public static final String TAG = "Capacitor-updater";
49
- public static final String pluginVersion = "4.0.0-alpha.2";
49
+ public static final String pluginVersion = "4.0.0-alpha.20";
50
50
 
51
51
  public SharedPreferences.Editor editor;
52
52
  public SharedPreferences prefs;
@@ -255,7 +255,7 @@ public class CapacitorUpdater {
255
255
  return true;
256
256
  }
257
257
  Log.e(TAG, "Directory not removed: " + bundle.getPath());
258
- this.sendStats("delete", deleted);
258
+ this.sendStats("delete", deleted.getVersionName());
259
259
  return false;
260
260
  }
261
261
 
@@ -263,11 +263,11 @@ public class CapacitorUpdater {
263
263
  return new File(this.documentsDir, bundleDirectory + "/" + id);
264
264
  }
265
265
 
266
- private boolean bundleExists(final File bundle) {
266
+ private boolean bundleExists(final String id) {
267
+ final File bundle = this.getBundleDirectory(id);
267
268
  if(bundle == null || !bundle.exists()) {
268
269
  return false;
269
270
  }
270
-
271
271
  return new File(bundle.getPath(), "/index.html").exists();
272
272
  }
273
273
 
@@ -277,17 +277,17 @@ public class CapacitorUpdater {
277
277
 
278
278
  public Boolean set(final String id) {
279
279
 
280
- final BundleInfo existing = this.getBundleInfo(id);
280
+ final BundleInfo newBundle = this.getBundleInfo(id);
281
281
  final File bundle = this.getBundleDirectory(id);
282
282
 
283
- Log.i(TAG, "Setting next active bundle: " + existing);
284
- if (this.bundleExists(bundle)) {
283
+ Log.i(TAG, "Setting next active bundle: " + id);
284
+ if (this.bundleExists(id)) {
285
285
  this.setCurrentBundle(bundle);
286
286
  this.setBundleStatus(id, BundleStatus.PENDING);
287
- this.sendStats("set", existing);
287
+ this.sendStats("set", newBundle.getVersionName());
288
288
  return true;
289
289
  }
290
- this.sendStats("set_fail", existing);
290
+ this.sendStats("set_fail", newBundle.getVersionName());
291
291
  return false;
292
292
  }
293
293
 
@@ -307,9 +307,9 @@ public class CapacitorUpdater {
307
307
  public void reset(final boolean internal) {
308
308
  this.setCurrentBundle(new File("public"));
309
309
  this.setFallbackVersion(null);
310
- this.setNextVersion(null);
310
+ this.setNext(null);
311
311
  if(!internal) {
312
- this.sendStats("reset", this.getCurrentBundle());
312
+ this.sendStats("reset", this.getCurrentBundle().getVersionName());
313
313
  }
314
314
  }
315
315
 
@@ -356,7 +356,7 @@ public class CapacitorUpdater {
356
356
  }
357
357
  }
358
358
 
359
- public void sendStats(final String action, final BundleInfo bundle) {
359
+ public void sendStats(final String action, final String versionName) {
360
360
  String statsUrl = this.statsUrl;
361
361
  if (statsUrl == null || "".equals(statsUrl) || statsUrl.length() == 0) { return; }
362
362
  try {
@@ -367,7 +367,7 @@ public class CapacitorUpdater {
367
367
  json.put("version_build", this.versionBuild);
368
368
  json.put("version_code", this.versionCode);
369
369
  json.put("version_os", this.versionOs);
370
- json.put("version_name", bundle.getVersionName());
370
+ json.put("version_name", versionName);
371
371
  json.put("plugin_version", pluginVersion);
372
372
  json.put("action", action);
373
373
 
@@ -379,13 +379,13 @@ public class CapacitorUpdater {
379
379
  new Response.Listener<JSONObject>() {
380
380
  @Override
381
381
  public void onResponse(JSONObject response) {
382
- Log.i(TAG, "Stats send for \"" + action + "\", version " + bundle.getVersionName());
382
+ Log.i(TAG, "Stats send for \"" + action + "\", version " + versionName);
383
383
  }
384
384
  },
385
385
  new Response.ErrorListener(){
386
386
  @Override
387
387
  public void onErrorResponse(VolleyError error) {
388
- Log.i(TAG, "Stats send for \"" + action + "\", version " + bundle.getVersionName());
388
+ Log.i(TAG, "Stats send for \"" + action + "\", version " + versionName);
389
389
  }
390
390
  });
391
391
  this.requestQueue.add(request);
@@ -511,15 +511,13 @@ public class CapacitorUpdater {
511
511
  }
512
512
  }
513
513
 
514
- public boolean setNextVersion(final String next) {
514
+ public boolean setNext(final String next) {
515
515
  if (next == null) {
516
516
  this.editor.remove(NEXT_VERSION);
517
517
  } else {
518
- final File bundle = this.getBundleDirectory(next);
519
- if (!this.bundleExists(bundle)) {
518
+ if (!this.bundleExists(next)) {
520
519
  return false;
521
520
  }
522
-
523
521
  this.editor.putString(NEXT_VERSION, next);
524
522
  this.setBundleStatus(next, BundleStatus.PENDING);
525
523
  }
@@ -28,13 +28,17 @@ import io.github.g00fy2.versioncompare.Version;
28
28
  import org.json.JSONException;
29
29
 
30
30
  import java.io.IOException;
31
+ import java.text.SimpleDateFormat;
32
+ import java.util.Date;
33
+ import java.util.Iterator;
31
34
  import java.util.List;
32
35
 
33
36
  @CapacitorPlugin(name = "CapacitorUpdater")
34
37
  public class CapacitorUpdaterPlugin extends Plugin implements Application.ActivityLifecycleCallbacks {
35
- private static final String autoUpdateUrlDefault = "https://xvwzpoazmxkqosrdewyv.functions.supabase.co/updates";
38
+ private static final String updateUrlDefault = "https://xvwzpoazmxkqosrdewyv.functions.supabase.co/updates";
36
39
  private static final String statsUrlDefault = "https://xvwzpoazmxkqosrdewyv.functions.supabase.co/stats";
37
40
  private static final String DELAY_UPDATE = "delayUpdate";
41
+ private static final String DELAY_UPDATE_VAL = "delayUpdateVal";
38
42
 
39
43
  private SharedPreferences.Editor editor;
40
44
  private SharedPreferences prefs;
@@ -44,7 +48,7 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
44
48
  private Boolean autoDeleteFailed = true;
45
49
  private Boolean autoDeletePrevious = true;
46
50
  private Boolean autoUpdate = false;
47
- private String autoUpdateUrl = "";
51
+ private String updateUrl = "";
48
52
  private Version currentVersionNative;
49
53
  private Boolean resetWhenUpdate = true;
50
54
 
@@ -87,7 +91,7 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
87
91
 
88
92
  this.autoDeleteFailed = this.getConfig().getBoolean("autoDeleteFailed", true);
89
93
  this.autoDeletePrevious = this.getConfig().getBoolean("autoDeletePrevious", true);
90
- this.autoUpdateUrl = this.getConfig().getString("autoUpdateUrl", autoUpdateUrlDefault);
94
+ this.updateUrl = this.getConfig().getString("updateUrl", updateUrlDefault);
91
95
  this.autoUpdate = this.getConfig().getBoolean("autoUpdate", false);
92
96
  this.appReadyTimeout = this.getConfig().getInt("appReadyTimeout", 10000);
93
97
  this.resetWhenUpdate = this.getConfig().getBoolean("resetWhenUpdate", true);
@@ -97,8 +101,8 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
97
101
  }
98
102
  final Application application = (Application) this.getContext().getApplicationContext();
99
103
  application.registerActivityLifecycleCallbacks(this);
100
-
101
104
  this.onActivityStarted(this.getActivity());
105
+ this._checkCancelDelay(true);
102
106
  }
103
107
 
104
108
  private void cleanupObsoleteVersions() {
@@ -133,7 +137,7 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
133
137
  try {
134
138
  final JSObject ret = new JSObject();
135
139
  ret.put("percent", percent);
136
- var bundle = this.implementation.getBundleInfo(id).toJSON();
140
+ JSObject bundle = this.implementation.getBundleInfo(id).toJSON();
137
141
  ret.put("bundle", bundle);
138
142
  this.notifyListeners("download", ret);
139
143
  if (percent == 100) {
@@ -146,10 +150,10 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
146
150
 
147
151
 
148
152
  @PluginMethod
149
- public void getId(final PluginCall call) {
153
+ public void getDeviceId(final PluginCall call) {
150
154
  try {
151
155
  final JSObject ret = new JSObject();
152
- ret.put("id", this.implementation.deviceID);
156
+ ret.put("deviceId", this.implementation.deviceID);
153
157
  call.resolve(ret);
154
158
  } catch (final Exception e) {
155
159
  Log.e(CapacitorUpdater.TAG, "Could not get device id", e);
@@ -174,6 +178,7 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
174
178
  final String url = call.getString("url");
175
179
  final String version = call.getString("version");
176
180
  if (url == null || version == null) {
181
+ Log.e(CapacitorUpdater.TAG, "missing url or version");
177
182
  call.reject("missing url or version");
178
183
  return;
179
184
  }
@@ -216,6 +221,7 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
216
221
  if (this._reload()) {
217
222
  call.resolve();
218
223
  } else {
224
+ Log.e(CapacitorUpdater.TAG, "Reload failed");
219
225
  call.reject("Reload failed");
220
226
  }
221
227
  } catch(final Exception e) {
@@ -230,7 +236,8 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
230
236
 
231
237
  try {
232
238
  Log.i(CapacitorUpdater.TAG, "Setting next active id " + id);
233
- if (!this.implementation.setNextVersion(id)) {
239
+ if (!this.implementation.setNext(id)) {
240
+ Log.e(CapacitorUpdater.TAG, "Set next id failed. Bundle " + id + " does not exist.");
234
241
  call.reject("Set next id failed. Bundle " + id + " does not exist.");
235
242
  } else {
236
243
  call.resolve(this.implementation.getBundleInfo(id).toJSON());
@@ -269,6 +276,7 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
269
276
  if (res) {
270
277
  call.resolve();
271
278
  } else {
279
+ Log.e(CapacitorUpdater.TAG, "Delete failed, id " + id + " does not exist");
272
280
  call.reject("Delete failed, id " + id + " does not exist");
273
281
  }
274
282
  } catch(final Exception e) {
@@ -296,6 +304,30 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
296
304
  }
297
305
  }
298
306
 
307
+ @PluginMethod
308
+ public void getLatest(final PluginCall call) {
309
+ new Thread(new Runnable(){
310
+ @Override
311
+ public void run() {
312
+ CapacitorUpdaterPlugin.this.implementation.getLatest(CapacitorUpdaterPlugin.this.updateUrl, (res) -> {
313
+ final JSObject ret = new JSObject();
314
+ Iterator<String> keys = res.keys();
315
+ while(keys.hasNext()) {
316
+ String key = keys.next();
317
+ if (res.has(key)) {
318
+ try {
319
+ ret.put(key, res.get(key));
320
+ } catch (JSONException e) {
321
+ e.printStackTrace();
322
+ }
323
+ }
324
+ }
325
+ call.resolve(ret);
326
+ });
327
+ }
328
+ });
329
+ }
330
+
299
331
  private boolean _reset(final Boolean toLastSuccessful) {
300
332
  final BundleInfo fallback = this.implementation.getFallbackVersion();
301
333
  this.implementation.reset();
@@ -317,6 +349,7 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
317
349
  call.resolve();
318
350
  return;
319
351
  }
352
+ Log.e(CapacitorUpdater.TAG, "Reset failed");
320
353
  call.reject("Reset failed");
321
354
  }
322
355
  catch(final Exception e) {
@@ -357,9 +390,17 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
357
390
  @PluginMethod
358
391
  public void delayUpdate(final PluginCall call) {
359
392
  try {
360
- Log.i(CapacitorUpdater.TAG, "Delay update.");
361
- this.editor.putBoolean(DELAY_UPDATE, true);
393
+ final String kind = call.getString("kind");
394
+ final String value = call.getString("value");
395
+ if (kind == null) {
396
+ Log.e(CapacitorUpdater.TAG, "setDelay called without kind");
397
+ call.reject("setDelay called without kind");
398
+ return;
399
+ }
400
+ this.editor.putString(DELAY_UPDATE, kind);
401
+ this.editor.putString(DELAY_UPDATE_VAL, value);
362
402
  this.editor.commit();
403
+ Log.i(CapacitorUpdater.TAG, "Delay update saved");
363
404
  call.resolve();
364
405
  }
365
406
  catch(final Exception e) {
@@ -368,22 +409,68 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
368
409
  }
369
410
  }
370
411
 
371
- @PluginMethod
372
- public void cancelDelay(final PluginCall call) {
412
+ private boolean _cancelDelay(String source) {
373
413
  try {
374
- Log.i(CapacitorUpdater.TAG, "Cancel update delay.");
375
- this.editor.putBoolean(DELAY_UPDATE, false);
414
+ this.editor.remove(DELAY_UPDATE);
415
+ this.editor.remove(DELAY_UPDATE_VAL);
376
416
  this.editor.commit();
377
- call.resolve();
417
+ Log.i(CapacitorUpdater.TAG, "delay canceled from " + source);
418
+ return true;
378
419
  }
379
420
  catch(final Exception e) {
380
421
  Log.e(CapacitorUpdater.TAG, "Failed to cancel update delay", e);
381
- call.reject("Failed to cancel update delay", e);
422
+ return false;
423
+ }
424
+ }
425
+
426
+ @PluginMethod
427
+ public void cancelDelay(final PluginCall call) {
428
+ if(this._cancelDelay("JS")) {
429
+ call.resolve();
430
+ } else {
431
+ call.reject("Failed to cancel delay");
432
+ }
433
+ }
434
+
435
+ private void _checkCancelDelay(Boolean killed) {
436
+ final String delayUpdate = this.prefs.getString(DELAY_UPDATE, "");
437
+ if ("".equals(delayUpdate)) {
438
+ if ("background".equals(delayUpdate) && !killed) {
439
+ this._cancelDelay("background check");
440
+ } else if ("kill".equals(delayUpdate) && killed) {
441
+ this._cancelDelay("kill check");
442
+ }
443
+ final String delayVal = this.prefs.getString(DELAY_UPDATE_VAL, "");
444
+ if ("".equals(delayVal)) {
445
+ this._cancelDelay("delayVal absent");
446
+ } else if ("date".equals(delayUpdate)) {
447
+ try {
448
+ final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
449
+ Date date = sdf.parse(delayVal);
450
+ if (date.compareTo(new Date()) > 0) {
451
+ this._cancelDelay("date expired");
452
+ }
453
+ }
454
+ catch(final Exception e) {
455
+ this._cancelDelay("date parsing issue");
456
+ }
457
+
458
+ } else if ("nativeVersion".equals(delayUpdate)) {
459
+ try {
460
+ final Version versionLimit = new Version(delayVal);
461
+ if (this.currentVersionNative.isAtLeast(versionLimit)) {
462
+ this._cancelDelay("nativeVersion above limit");
463
+ }
464
+ }
465
+ catch(final Exception e) {
466
+ this._cancelDelay("nativeVersion parsing issue");
467
+ }
468
+ }
382
469
  }
383
470
  }
384
471
 
385
472
  private Boolean _isAutoUpdateEnabled() {
386
- return CapacitorUpdaterPlugin.this.autoUpdate && !"".equals(CapacitorUpdaterPlugin.this.autoUpdateUrl);
473
+ return CapacitorUpdaterPlugin.this.autoUpdate && !"".equals(CapacitorUpdaterPlugin.this.updateUrl);
387
474
  }
388
475
 
389
476
  @PluginMethod
@@ -410,6 +497,8 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
410
497
  }
411
498
  }
412
499
 
500
+
501
+
413
502
  @Override // appMovedToForeground
414
503
  public void onActivityStarted(@NonNull final Activity activity) {
415
504
  if (CapacitorUpdaterPlugin.this._isAutoUpdateEnabled()) {
@@ -417,8 +506,8 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
417
506
  @Override
418
507
  public void run() {
419
508
 
420
- Log.i(CapacitorUpdater.TAG, "Check for update via: " + CapacitorUpdaterPlugin.this.autoUpdateUrl);
421
- CapacitorUpdaterPlugin.this.implementation.getLatest(CapacitorUpdaterPlugin.this.autoUpdateUrl, (res) -> {
509
+ Log.i(CapacitorUpdater.TAG, "Check for update via: " + CapacitorUpdaterPlugin.this.updateUrl);
510
+ CapacitorUpdaterPlugin.this.implementation.getLatest(CapacitorUpdaterPlugin.this.updateUrl, (res) -> {
422
511
  try {
423
512
  if (res.has("message")) {
424
513
  Log.i(CapacitorUpdater.TAG, "message: " + res.get("message"));
@@ -442,7 +531,7 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
442
531
  }
443
532
  if(latest.isDownloaded()){
444
533
  Log.e(CapacitorUpdater.TAG, "Latest bundle already exists and download is NOT required. Update will occur next time app moves to background.");
445
- CapacitorUpdaterPlugin.this.implementation.setNextVersion(latest.getId());
534
+ CapacitorUpdaterPlugin.this.implementation.setNext(latest.getId());
446
535
  return;
447
536
  }
448
537
  }
@@ -457,7 +546,7 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
457
546
  final String url = (String) res.get("url");
458
547
  final BundleInfo next = CapacitorUpdaterPlugin.this.implementation.download(url, latestVersionName);
459
548
 
460
- CapacitorUpdaterPlugin.this.implementation.setNextVersion(next.getId());
549
+ CapacitorUpdaterPlugin.this.implementation.setNext(next.getId());
461
550
  } catch (final Exception e) {
462
551
  Log.e(CapacitorUpdater.TAG, "error downloading file", e);
463
552
  }
@@ -481,15 +570,12 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
481
570
  public void onActivityStopped(@NonNull final Activity activity) {
482
571
  Log.i(CapacitorUpdater.TAG, "Checking for pending update");
483
572
  try {
484
- final Boolean delayUpdate = this.prefs.getBoolean(DELAY_UPDATE, false);
485
- this.editor.putBoolean(DELAY_UPDATE, false);
486
- this.editor.commit();
487
-
488
- if (delayUpdate) {
573
+ final String delayUpdate = this.prefs.getString(DELAY_UPDATE, "");
574
+ this._checkCancelDelay(false);
575
+ if ("".equals(delayUpdate)) {
489
576
  Log.i(CapacitorUpdater.TAG, "Update delayed to next backgrounding");
490
577
  return;
491
578
  }
492
-
493
579
  final BundleInfo fallback = this.implementation.getFallbackVersion();
494
580
  final BundleInfo current = this.implementation.getCurrentBundle();
495
581
  final BundleInfo next = this.implementation.getNextVersion();
@@ -504,7 +590,7 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
504
590
  Log.d(CapacitorUpdater.TAG, "Next bundle is: " + next.getVersionName());
505
591
  if (this.implementation.set(next) && this._reload()) {
506
592
  Log.i(CapacitorUpdater.TAG, "Updated to bundle: " + next.getVersionName());
507
- this.implementation.setNextVersion(null);
593
+ this.implementation.setNext(null);
508
594
  } else {
509
595
  Log.e(CapacitorUpdater.TAG, "Update to bundle: " + next.getVersionName() + " Failed!");
510
596
  }
@@ -523,7 +609,7 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
523
609
  final JSObject ret = new JSObject();
524
610
  ret.put("bundle", current);
525
611
  this.notifyListeners("updateFailed", ret);
526
- this.implementation.sendStats("revert", current);
612
+ this.implementation.sendStats("update_fail", current.getVersionName());
527
613
  if (!fallback.isBuiltin() && !fallback.equals(current)) {
528
614
  final Boolean res = this.implementation.set(fallback);
529
615
  if (res && this._reload()) {