@capgo/capacitor-updater 7.2.21 → 7.3.3

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.
@@ -14,7 +14,6 @@ import android.content.pm.PackageInfo;
14
14
  import android.content.pm.PackageManager;
15
15
  import android.os.Build;
16
16
  import android.os.Looper;
17
- import android.util.Log;
18
17
  import com.getcapacitor.CapConfig;
19
18
  import com.getcapacitor.JSArray;
20
19
  import com.getcapacitor.JSObject;
@@ -55,11 +54,13 @@ import org.json.JSONObject;
55
54
  @CapacitorPlugin(name = "CapacitorUpdater")
56
55
  public class CapacitorUpdaterPlugin extends Plugin {
57
56
 
57
+ private final Logger logger = new Logger("CapgoUpdater");
58
+
58
59
  private static final String updateUrlDefault = "https://plugin.capgo.app/updates";
59
60
  private static final String statsUrlDefault = "https://plugin.capgo.app/stats";
60
61
  private static final String channelUrlDefault = "https://plugin.capgo.app/channel_self";
61
62
 
62
- private final String PLUGIN_VERSION = "7.2.21";
63
+ private final String PLUGIN_VERSION = "7.3.3";
63
64
  private static final String DELAY_CONDITION_PREFERENCES = "";
64
65
 
65
66
  private SharedPreferences.Editor editor;
@@ -125,7 +126,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
125
126
  this.editor = this.prefs.edit();
126
127
 
127
128
  try {
128
- this.implementation = new CapgoUpdater() {
129
+ this.implementation = new CapgoUpdater(logger) {
129
130
  @Override
130
131
  public void notifyDownload(final String id, final int percent) {
131
132
  CapacitorUpdaterPlugin.this.notifyDownload(id, percent);
@@ -159,15 +160,31 @@ public class CapacitorUpdaterPlugin extends Plugin {
159
160
  this.prefs,
160
161
  this.editor,
161
162
  this.currentVersionNative,
162
- CapacitorUpdaterPlugin.this::installNext
163
+ CapacitorUpdaterPlugin.this::installNext,
164
+ logger
163
165
  );
164
166
  } catch (final PackageManager.NameNotFoundException e) {
165
- Log.e(CapgoUpdater.TAG, "Error instantiating implementation", e);
167
+ logger.error("Error instantiating implementation " + e.getMessage());
166
168
  return;
167
169
  } catch (final Exception e) {
168
- Log.e(CapgoUpdater.TAG, "Error getting current native app version", e);
170
+ logger.error("Error getting current native app version " + e.getMessage());
169
171
  return;
170
172
  }
173
+
174
+ boolean disableJSLogging = this.getConfig().getBoolean("disableJSLogging", false);
175
+ // Set the bridge in the Logger when webView is available
176
+ if (this.bridge != null && this.bridge.getWebView() != null && !disableJSLogging) {
177
+ logger.setBridge(this.bridge);
178
+ logger.info("WebView set successfully for logging");
179
+ } else {
180
+ logger.info("WebView not ready yet, will be set later");
181
+ }
182
+
183
+ // Set logger for shared classes
184
+ CryptoCipherV2.setLogger(logger);
185
+ DownloadService.setLogger(logger);
186
+ DownloadWorkerManager.setLogger(logger);
187
+
171
188
  final CapConfig config = CapConfig.loadDefault(this.getActivity());
172
189
  this.implementation.appId = InternalUtils.getPackageName(getContext().getPackageManager(), getContext().getPackageName());
173
190
  this.implementation.appId = config.getString("appId", this.implementation.appId);
@@ -178,7 +195,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
178
195
  "appId is missing in capacitor.config.json or plugin config, and cannot be retrieved from the native app, please add it globally or in the plugin config"
179
196
  );
180
197
  }
181
- Log.i(CapgoUpdater.TAG, "appId: " + implementation.appId);
198
+ logger.info("appId: " + implementation.appId);
182
199
  this.implementation.publicKey = this.getConfig().getString("publicKey", "");
183
200
  this.implementation.statsUrl = this.getConfig().getString("statsUrl", statsUrlDefault);
184
201
  this.implementation.channelUrl = this.getConfig().getString("channelUrl", channelUrlDefault);
@@ -198,8 +215,8 @@ public class CapacitorUpdaterPlugin extends Plugin {
198
215
  this.implementation.deviceID = this.prefs.getString("appUUID", UUID.randomUUID().toString()).toLowerCase();
199
216
  this.editor.putString("appUUID", this.implementation.deviceID);
200
217
  this.editor.commit();
201
- Log.i(CapgoUpdater.TAG, "init for device " + this.implementation.deviceID);
202
- Log.i(CapgoUpdater.TAG, "version native " + this.currentVersionNative.getOriginalString());
218
+ logger.info("init for device " + this.implementation.deviceID);
219
+ logger.info("version native " + this.currentVersionNative.getOriginalString());
203
220
  this.autoDeleteFailed = this.getConfig().getBoolean("autoDeleteFailed", true);
204
221
  this.autoDeletePrevious = this.getConfig().getBoolean("autoDeletePrevious", true);
205
222
  this.updateUrl = this.getConfig().getString("updateUrl", updateUrlDefault);
@@ -217,14 +234,11 @@ public class CapacitorUpdaterPlugin extends Plugin {
217
234
  }
218
235
 
219
236
  private void semaphoreWait(Number waitTime) {
220
- // Log.i(CapgoUpdater.TAG, "semaphoreWait " + waitTime);
221
237
  try {
222
- // Log.i(CapgoUpdater.TAG, "semaphoreReady count " + CapacitorUpdaterPlugin.this.semaphoreReady.getCount());
223
238
  semaphoreReady.awaitAdvanceInterruptibly(semaphoreReady.getPhase(), waitTime.longValue(), TimeUnit.SECONDS);
224
- // Log.i(CapgoUpdater.TAG, "semaphoreReady await " + res);
225
- Log.i(CapgoUpdater.TAG, "semaphoreReady count " + semaphoreReady.getPhase());
239
+ logger.info("semaphoreReady count " + semaphoreReady.getPhase());
226
240
  } catch (InterruptedException e) {
227
- Log.i(CapgoUpdater.TAG, "semaphoreWait InterruptedException");
241
+ logger.info("semaphoreWait InterruptedException");
228
242
  e.printStackTrace();
229
243
  } catch (TimeoutException e) {
230
244
  throw new RuntimeException(e);
@@ -232,25 +246,25 @@ public class CapacitorUpdaterPlugin extends Plugin {
232
246
  }
233
247
 
234
248
  private void semaphoreUp() {
235
- Log.i(CapgoUpdater.TAG, "semaphoreUp");
249
+ logger.info("semaphoreUp");
236
250
  semaphoreReady.register();
237
251
  }
238
252
 
239
253
  private void semaphoreDown() {
240
- Log.i(CapgoUpdater.TAG, "semaphoreDown");
241
- Log.i(CapgoUpdater.TAG, "semaphoreDown count " + semaphoreReady.getPhase());
254
+ logger.info("semaphoreDown");
255
+ logger.info("semaphoreDown count " + semaphoreReady.getPhase());
242
256
  semaphoreReady.arriveAndDeregister();
243
257
  }
244
258
 
245
259
  private void sendReadyToJs(final BundleInfo current, final String msg) {
246
- Log.i(CapgoUpdater.TAG, "sendReadyToJs");
260
+ logger.info("sendReadyToJs");
247
261
  final JSObject ret = new JSObject();
248
262
  ret.put("bundle", mapToJSObject(current.toJSONMap()));
249
263
  ret.put("status", msg);
250
264
  startNewThread(() -> {
251
- Log.i(CapgoUpdater.TAG, "semaphoreReady sendReadyToJs");
265
+ logger.info("semaphoreReady sendReadyToJs");
252
266
  semaphoreWait(CapacitorUpdaterPlugin.this.appReadyTimeout);
253
- Log.i(CapgoUpdater.TAG, "semaphoreReady sendReadyToJs done");
267
+ logger.info("semaphoreReady sendReadyToJs done");
254
268
  CapacitorUpdaterPlugin.this.notifyListeners("appReady", ret);
255
269
  });
256
270
  }
@@ -269,23 +283,23 @@ public class CapacitorUpdaterPlugin extends Plugin {
269
283
  !"".equals(previous.getOriginalString()) &&
270
284
  !Objects.equals(this.currentVersionNative.getOriginalString(), previous.getOriginalString())
271
285
  ) {
272
- Log.i(CapgoUpdater.TAG, "New native version detected: " + this.currentVersionNative);
286
+ logger.info("New native version detected: " + this.currentVersionNative);
273
287
  this.implementation.reset(true);
274
288
  final List<BundleInfo> installed = this.implementation.list(false);
275
289
  for (final BundleInfo bundle : installed) {
276
290
  try {
277
- Log.i(CapgoUpdater.TAG, "Deleting obsolete bundle: " + bundle.getId());
291
+ logger.info("Deleting obsolete bundle: " + bundle.getId());
278
292
  this.implementation.delete(bundle.getId());
279
293
  } catch (final Exception e) {
280
- Log.e(CapgoUpdater.TAG, "Failed to delete: " + bundle.getId(), e);
294
+ logger.error("Failed to delete: " + bundle.getId() + " " + e.getMessage());
281
295
  }
282
296
  }
283
297
  }
284
298
  } catch (final Exception e) {
285
- Log.e(CapgoUpdater.TAG, "Could not determine the current version", e);
299
+ logger.error("Could not determine the current version " + e.getMessage());
286
300
  }
287
301
  } catch (final Exception e) {
288
- Log.e(CapgoUpdater.TAG, "Error calculating previous native version", e);
302
+ logger.error("Error calculating previous native version " + e.getMessage());
289
303
  }
290
304
  this.editor.putString("LatestVersionNative", this.currentVersionNative.toString());
291
305
  this.editor.commit();
@@ -312,20 +326,20 @@ public class CapacitorUpdaterPlugin extends Plugin {
312
326
  }
313
327
  }
314
328
  } catch (final Exception e) {
315
- Log.e(CapgoUpdater.TAG, "Could not notify listeners", e);
329
+ logger.error("Could not notify listeners " + e.getMessage());
316
330
  }
317
331
  }
318
332
 
319
333
  @PluginMethod
320
334
  public void setUpdateUrl(final PluginCall call) {
321
335
  if (!this.getConfig().getBoolean("allowModifyUrl", false)) {
322
- Log.e(CapgoUpdater.TAG, "setUpdateUrl not allowed set allowModifyUrl in your config to true to allow it");
336
+ logger.error("setUpdateUrl not allowed set allowModifyUrl in your config to true to allow it");
323
337
  call.reject("setUpdateUrl not allowed");
324
338
  return;
325
339
  }
326
340
  final String url = call.getString("url");
327
341
  if (url == null) {
328
- Log.e(CapgoUpdater.TAG, "setUpdateUrl called without url");
342
+ logger.error("setUpdateUrl called without url");
329
343
  call.reject("setUpdateUrl called without url");
330
344
  return;
331
345
  }
@@ -336,13 +350,13 @@ public class CapacitorUpdaterPlugin extends Plugin {
336
350
  @PluginMethod
337
351
  public void setStatsUrl(final PluginCall call) {
338
352
  if (!this.getConfig().getBoolean("allowModifyUrl", false)) {
339
- Log.e(CapgoUpdater.TAG, "setStatsUrl not allowed set allowModifyUrl in your config to true to allow it");
353
+ logger.error("setStatsUrl not allowed set allowModifyUrl in your config to true to allow it");
340
354
  call.reject("setStatsUrl not allowed");
341
355
  return;
342
356
  }
343
357
  final String url = call.getString("url");
344
358
  if (url == null) {
345
- Log.e(CapgoUpdater.TAG, "setStatsUrl called without url");
359
+ logger.error("setStatsUrl called without url");
346
360
  call.reject("setStatsUrl called without url");
347
361
  return;
348
362
  }
@@ -353,13 +367,13 @@ public class CapacitorUpdaterPlugin extends Plugin {
353
367
  @PluginMethod
354
368
  public void setChannelUrl(final PluginCall call) {
355
369
  if (!this.getConfig().getBoolean("allowModifyUrl", false)) {
356
- Log.e(CapgoUpdater.TAG, "setChannelUrl not allowed set allowModifyUrl in your config to true to allow it");
370
+ logger.error("setChannelUrl not allowed set allowModifyUrl in your config to true to allow it");
357
371
  call.reject("setChannelUrl not allowed");
358
372
  return;
359
373
  }
360
374
  final String url = call.getString("url");
361
375
  if (url == null) {
362
- Log.e(CapgoUpdater.TAG, "setChannelUrl called without url");
376
+ logger.error("setChannelUrl called without url");
363
377
  call.reject("setChannelUrl called without url");
364
378
  return;
365
379
  }
@@ -374,7 +388,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
374
388
  ret.put("version", this.implementation.versionBuild);
375
389
  call.resolve(ret);
376
390
  } catch (final Exception e) {
377
- Log.e(CapgoUpdater.TAG, "Could not get version", e);
391
+ logger.error("Could not get version " + e.getMessage());
378
392
  call.reject("Could not get version", e);
379
393
  }
380
394
  }
@@ -386,7 +400,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
386
400
  ret.put("deviceId", this.implementation.deviceID);
387
401
  call.resolve(ret);
388
402
  } catch (final Exception e) {
389
- Log.e(CapgoUpdater.TAG, "Could not get device id", e);
403
+ logger.error("Could not get device id " + e.getMessage());
390
404
  call.reject("Could not get device id", e);
391
405
  }
392
406
  }
@@ -395,7 +409,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
395
409
  public void setCustomId(final PluginCall call) {
396
410
  final String customId = call.getString("customId");
397
411
  if (customId == null) {
398
- Log.e(CapgoUpdater.TAG, "setCustomId called without customId");
412
+ logger.error("setCustomId called without customId");
399
413
  call.reject("setCustomId called without customId");
400
414
  return;
401
415
  }
@@ -409,7 +423,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
409
423
  ret.put("version", this.PLUGIN_VERSION);
410
424
  call.resolve(ret);
411
425
  } catch (final Exception e) {
412
- Log.e(CapgoUpdater.TAG, "Could not get plugin version", e);
426
+ logger.error("Could not get plugin version " + e.getMessage());
413
427
  call.reject("Could not get plugin version", e);
414
428
  }
415
429
  }
@@ -419,7 +433,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
419
433
  final Boolean triggerAutoUpdate = call.getBoolean("triggerAutoUpdate", false);
420
434
 
421
435
  try {
422
- Log.i(CapgoUpdater.TAG, "unsetChannel triggerAutoUpdate: " + triggerAutoUpdate);
436
+ logger.info("unsetChannel triggerAutoUpdate: " + triggerAutoUpdate);
423
437
  startNewThread(() ->
424
438
  CapacitorUpdaterPlugin.this.implementation.unsetChannel(res -> {
425
439
  JSObject jsRes = mapToJSObject(res);
@@ -427,7 +441,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
427
441
  call.reject(jsRes.getString("error"));
428
442
  } else {
429
443
  if (CapacitorUpdaterPlugin.this._isAutoUpdateEnabled() && Boolean.TRUE.equals(triggerAutoUpdate)) {
430
- Log.i(CapgoUpdater.TAG, "Calling autoupdater after channel change!");
444
+ logger.info("Calling autoupdater after channel change!");
431
445
  backgroundDownload();
432
446
  }
433
447
  call.resolve(jsRes);
@@ -435,7 +449,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
435
449
  })
436
450
  );
437
451
  } catch (final Exception e) {
438
- Log.e(CapgoUpdater.TAG, "Failed to unsetChannel: ", e);
452
+ logger.error("Failed to unsetChannel: " + e.getMessage());
439
453
  call.reject("Failed to unsetChannel: ", e);
440
454
  }
441
455
  }
@@ -446,12 +460,12 @@ public class CapacitorUpdaterPlugin extends Plugin {
446
460
  final Boolean triggerAutoUpdate = call.getBoolean("triggerAutoUpdate", false);
447
461
 
448
462
  if (channel == null) {
449
- Log.e(CapgoUpdater.TAG, "setChannel called without channel");
463
+ logger.error("setChannel called without channel");
450
464
  call.reject("setChannel called without channel");
451
465
  return;
452
466
  }
453
467
  try {
454
- Log.i(CapgoUpdater.TAG, "setChannel " + channel + " triggerAutoUpdate: " + triggerAutoUpdate);
468
+ logger.info("setChannel " + channel + " triggerAutoUpdate: " + triggerAutoUpdate);
455
469
  startNewThread(() ->
456
470
  CapacitorUpdaterPlugin.this.implementation.setChannel(channel, res -> {
457
471
  JSObject jsRes = mapToJSObject(res);
@@ -459,7 +473,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
459
473
  call.reject(jsRes.getString("error"));
460
474
  } else {
461
475
  if (CapacitorUpdaterPlugin.this._isAutoUpdateEnabled() && Boolean.TRUE.equals(triggerAutoUpdate)) {
462
- Log.i(CapgoUpdater.TAG, "Calling autoupdater after channel change!");
476
+ logger.info("Calling autoupdater after channel change!");
463
477
  backgroundDownload();
464
478
  }
465
479
  call.resolve(jsRes);
@@ -467,7 +481,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
467
481
  })
468
482
  );
469
483
  } catch (final Exception e) {
470
- Log.e(CapgoUpdater.TAG, "Failed to setChannel: " + channel, e);
484
+ logger.error("Failed to setChannel: " + channel + " " + e.getMessage());
471
485
  call.reject("Failed to setChannel: " + channel, e);
472
486
  }
473
487
  }
@@ -475,7 +489,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
475
489
  @PluginMethod
476
490
  public void getChannel(final PluginCall call) {
477
491
  try {
478
- Log.i(CapgoUpdater.TAG, "getChannel");
492
+ logger.info("getChannel");
479
493
  startNewThread(() ->
480
494
  CapacitorUpdaterPlugin.this.implementation.getChannel(res -> {
481
495
  JSObject jsRes = mapToJSObject(res);
@@ -487,7 +501,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
487
501
  })
488
502
  );
489
503
  } catch (final Exception e) {
490
- Log.e(CapgoUpdater.TAG, "Failed to getChannel", e);
504
+ logger.error("Failed to getChannel " + e.getMessage());
491
505
  call.reject("Failed to getChannel", e);
492
506
  }
493
507
  }
@@ -499,17 +513,17 @@ public class CapacitorUpdaterPlugin extends Plugin {
499
513
  final String sessionKey = call.getString("sessionKey", "");
500
514
  final String checksum = call.getString("checksum", "");
501
515
  if (url == null) {
502
- Log.e(CapgoUpdater.TAG, "Download called without url");
516
+ logger.error("Download called without url");
503
517
  call.reject("Download called without url");
504
518
  return;
505
519
  }
506
520
  if (version == null) {
507
- Log.e(CapgoUpdater.TAG, "Download called without version");
521
+ logger.error("Download called without version");
508
522
  call.reject("Download called without version");
509
523
  return;
510
524
  }
511
525
  try {
512
- Log.i(CapgoUpdater.TAG, "Downloading " + url);
526
+ logger.info("Downloading " + url);
513
527
  startNewThread(() -> {
514
528
  try {
515
529
  final BundleInfo downloaded = CapacitorUpdaterPlugin.this.implementation.download(url, version, sessionKey, checksum);
@@ -519,7 +533,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
519
533
  call.resolve(mapToJSObject(downloaded.toJSONMap()));
520
534
  }
521
535
  } catch (final Exception e) {
522
- Log.e(CapgoUpdater.TAG, "Failed to download from: " + url, e);
536
+ logger.error("Failed to download from: " + url + " " + e.getMessage());
523
537
  call.reject("Failed to download from: " + url, e);
524
538
  final JSObject ret = new JSObject();
525
539
  ret.put("version", version);
@@ -529,7 +543,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
529
543
  }
530
544
  });
531
545
  } catch (final Exception e) {
532
- Log.e(CapgoUpdater.TAG, "Failed to download from: " + url, e);
546
+ logger.error("Failed to download from: " + url + " " + e.getMessage());
533
547
  call.reject("Failed to download from: " + url, e);
534
548
  final JSObject ret = new JSObject();
535
549
  ret.put("version", version);
@@ -542,7 +556,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
542
556
  protected boolean _reload() {
543
557
  final String path = this.implementation.getCurrentBundlePath();
544
558
  this.semaphoreUp();
545
- Log.i(CapgoUpdater.TAG, "Reloading: " + path);
559
+ logger.info("Reloading: " + path);
546
560
 
547
561
  AtomicReference<URL> url = new AtomicReference<>();
548
562
  if (this.keepUrlPathAfterReload) {
@@ -553,7 +567,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
553
567
  try {
554
568
  url.set(new URL(this.bridge.getWebView().getUrl()));
555
569
  } catch (Exception e) {
556
- Log.e(CapgoUpdater.TAG, "Error executing on main thread", e);
570
+ logger.error("Error executing on main thread " + e.getMessage());
557
571
  }
558
572
  mainThreadSemaphore.release();
559
573
  });
@@ -562,11 +576,11 @@ public class CapacitorUpdaterPlugin extends Plugin {
562
576
  try {
563
577
  url.set(new URL(this.bridge.getWebView().getUrl()));
564
578
  } catch (Exception e) {
565
- Log.e(CapgoUpdater.TAG, "Error executing on main thread", e);
579
+ logger.error("Error executing on main thread " + e.getMessage());
566
580
  }
567
581
  }
568
582
  } catch (InterruptedException e) {
569
- Log.e(CapgoUpdater.TAG, "Error waiting for main thread or getting the current URL from webview", e);
583
+ logger.error("Error waiting for main thread or getting the current URL from webview " + e.getMessage());
570
584
  }
571
585
  }
572
586
 
@@ -588,7 +602,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
588
602
  this.bridge.getWebView().clearHistory();
589
603
  });
590
604
  } catch (MalformedURLException e) {
591
- Log.e(CapgoUpdater.TAG, "Cannot get finalUrl from capacitor bridge", e);
605
+ logger.error("Cannot get finalUrl from capacitor bridge " + e.getMessage());
592
606
 
593
607
  if (this.implementation.isUsingBuiltin()) {
594
608
  this.bridge.setServerAssetPath(path);
@@ -615,11 +629,11 @@ public class CapacitorUpdaterPlugin extends Plugin {
615
629
  if (this._reload()) {
616
630
  call.resolve();
617
631
  } else {
618
- Log.e(CapgoUpdater.TAG, "Reload failed");
632
+ logger.error("Reload failed");
619
633
  call.reject("Reload failed");
620
634
  }
621
635
  } catch (final Exception e) {
622
- Log.e(CapgoUpdater.TAG, "Could not reload", e);
636
+ logger.error("Could not reload " + e.getMessage());
623
637
  call.reject("Could not reload", e);
624
638
  }
625
639
  }
@@ -628,20 +642,20 @@ public class CapacitorUpdaterPlugin extends Plugin {
628
642
  public void next(final PluginCall call) {
629
643
  final String id = call.getString("id");
630
644
  if (id == null) {
631
- Log.e(CapgoUpdater.TAG, "Next called without id");
645
+ logger.error("Next called without id");
632
646
  call.reject("Next called without id");
633
647
  return;
634
648
  }
635
649
  try {
636
- Log.i(CapgoUpdater.TAG, "Setting next active id " + id);
650
+ logger.info("Setting next active id " + id);
637
651
  if (!this.implementation.setNextBundle(id)) {
638
- Log.e(CapgoUpdater.TAG, "Set next id failed. Bundle " + id + " does not exist.");
652
+ logger.error("Set next id failed. Bundle " + id + " does not exist.");
639
653
  call.reject("Set next id failed. Bundle " + id + " does not exist.");
640
654
  } else {
641
655
  call.resolve(mapToJSObject(this.implementation.getBundleInfo(id).toJSONMap()));
642
656
  }
643
657
  } catch (final Exception e) {
644
- Log.e(CapgoUpdater.TAG, "Could not set next id " + id, e);
658
+ logger.error("Could not set next id " + id + " " + e.getMessage());
645
659
  call.reject("Could not set next id: " + id, e);
646
660
  }
647
661
  }
@@ -650,21 +664,21 @@ public class CapacitorUpdaterPlugin extends Plugin {
650
664
  public void set(final PluginCall call) {
651
665
  final String id = call.getString("id");
652
666
  if (id == null) {
653
- Log.e(CapgoUpdater.TAG, "Set called without id");
667
+ logger.error("Set called without id");
654
668
  call.reject("Set called without id");
655
669
  return;
656
670
  }
657
671
  try {
658
- Log.i(CapgoUpdater.TAG, "Setting active bundle " + id);
672
+ logger.info("Setting active bundle " + id);
659
673
  if (!this.implementation.set(id)) {
660
- Log.i(CapgoUpdater.TAG, "No such bundle " + id);
674
+ logger.info("No such bundle " + id);
661
675
  call.reject("Update failed, id " + id + " does not exist.");
662
676
  } else {
663
- Log.i(CapgoUpdater.TAG, "Bundle successfully set to " + id);
677
+ logger.info("Bundle successfully set to " + id);
664
678
  this.reload(call);
665
679
  }
666
680
  } catch (final Exception e) {
667
- Log.e(CapgoUpdater.TAG, "Could not set id " + id, e);
681
+ logger.error("Could not set id " + id + " " + e.getMessage());
668
682
  call.reject("Could not set id " + id, e);
669
683
  }
670
684
  }
@@ -673,21 +687,21 @@ public class CapacitorUpdaterPlugin extends Plugin {
673
687
  public void delete(final PluginCall call) {
674
688
  final String id = call.getString("id");
675
689
  if (id == null) {
676
- Log.e(CapgoUpdater.TAG, "missing id");
690
+ logger.error("missing id");
677
691
  call.reject("missing id");
678
692
  return;
679
693
  }
680
- Log.i(CapgoUpdater.TAG, "Deleting id " + id);
694
+ logger.info("Deleting id " + id);
681
695
  try {
682
696
  final Boolean res = this.implementation.delete(id);
683
697
  if (res) {
684
698
  call.resolve();
685
699
  } else {
686
- Log.e(CapgoUpdater.TAG, "Delete failed, id " + id + " does not exist");
700
+ logger.error("Delete failed, id " + id + " does not exist");
687
701
  call.reject("Delete failed, id " + id + " does not exist or it cannot be deleted (perhaps it is the 'next' bundle)");
688
702
  }
689
703
  } catch (final Exception e) {
690
- Log.e(CapgoUpdater.TAG, "Could not delete id " + id, e);
704
+ logger.error("Could not delete id " + id + " " + e.getMessage());
691
705
  call.reject("Could not delete id " + id, e);
692
706
  }
693
707
  }
@@ -704,7 +718,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
704
718
  ret.put("bundles", values);
705
719
  call.resolve(ret);
706
720
  } catch (final Exception e) {
707
- Log.e(CapgoUpdater.TAG, "Could not list bundles", e);
721
+ logger.error("Could not list bundles " + e.getMessage());
708
722
  call.reject("Could not list bundles", e);
709
723
  }
710
724
  }
@@ -733,11 +747,11 @@ public class CapacitorUpdaterPlugin extends Plugin {
733
747
  this.implementation.reset();
734
748
 
735
749
  if (toLastSuccessful && !fallback.isBuiltin()) {
736
- Log.i(CapgoUpdater.TAG, "Resetting to: " + fallback);
750
+ logger.info("Resetting to: " + fallback);
737
751
  return this.implementation.set(fallback) && this._reload();
738
752
  }
739
753
 
740
- Log.i(CapgoUpdater.TAG, "Resetting to native.");
754
+ logger.info("Resetting to native.");
741
755
  return this._reload();
742
756
  }
743
757
 
@@ -749,16 +763,17 @@ public class CapacitorUpdaterPlugin extends Plugin {
749
763
  call.resolve();
750
764
  return;
751
765
  }
752
- Log.e(CapgoUpdater.TAG, "Reset failed");
766
+ logger.error("Reset failed");
753
767
  call.reject("Reset failed");
754
768
  } catch (final Exception e) {
755
- Log.e(CapgoUpdater.TAG, "Reset failed", e);
769
+ logger.error("Reset failed " + e.getMessage());
756
770
  call.reject("Reset failed", e);
757
771
  }
758
772
  }
759
773
 
760
774
  @PluginMethod
761
775
  public void current(final PluginCall call) {
776
+ ensureBridgeSet();
762
777
  try {
763
778
  final JSObject ret = new JSObject();
764
779
  final BundleInfo bundle = this.implementation.getCurrentBundle();
@@ -766,7 +781,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
766
781
  ret.put("native", this.currentVersionNative);
767
782
  call.resolve(ret);
768
783
  } catch (final Exception e) {
769
- Log.e(CapgoUpdater.TAG, "Could not get current bundle", e);
784
+ logger.error("Could not get current bundle " + e.getMessage());
770
785
  call.reject("Could not get current bundle", e);
771
786
  }
772
787
  }
@@ -782,7 +797,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
782
797
 
783
798
  call.resolve(mapToJSObject(bundle.toJSONMap()));
784
799
  } catch (final Exception e) {
785
- Log.e(CapgoUpdater.TAG, "Could not get next bundle", e);
800
+ logger.error("Could not get next bundle " + e.getMessage());
786
801
  call.reject("Could not get next bundle", e);
787
802
  }
788
803
  }
@@ -800,18 +815,18 @@ public class CapacitorUpdaterPlugin extends Plugin {
800
815
  CapacitorUpdaterPlugin.this.implementation.getLatest(CapacitorUpdaterPlugin.this.updateUrl, null, res -> {
801
816
  JSObject jsRes = mapToJSObject(res);
802
817
  if (jsRes.has("error")) {
803
- Log.e(CapgoUpdater.TAG, Objects.requireNonNull(jsRes.getString("error")));
818
+ logger.error(Objects.requireNonNull(jsRes.getString("error")));
804
819
  } else if (jsRes.has("version")) {
805
820
  String newVersion = jsRes.getString("version");
806
821
  String currentVersion = String.valueOf(CapacitorUpdaterPlugin.this.implementation.getCurrentBundle());
807
822
  if (!Objects.equals(newVersion, currentVersion)) {
808
- Log.i(CapgoUpdater.TAG, "New version found: " + newVersion);
823
+ logger.info("New version found: " + newVersion);
809
824
  CapacitorUpdaterPlugin.this.backgroundDownload();
810
825
  }
811
826
  }
812
827
  });
813
828
  } catch (final Exception e) {
814
- Log.e(CapgoUpdater.TAG, "Failed to check for update", e);
829
+ logger.error("Failed to check for update " + e.getMessage());
815
830
  }
816
831
  }
817
832
  },
@@ -822,18 +837,19 @@ public class CapacitorUpdaterPlugin extends Plugin {
822
837
 
823
838
  @PluginMethod
824
839
  public void notifyAppReady(final PluginCall call) {
840
+ ensureBridgeSet();
825
841
  try {
826
842
  final BundleInfo bundle = this.implementation.getCurrentBundle();
827
843
  this.implementation.setSuccess(bundle, this.autoDeletePrevious);
828
- Log.i(CapgoUpdater.TAG, "Current bundle loaded successfully. ['notifyAppReady()' was called] " + bundle);
829
- Log.i(CapgoUpdater.TAG, "semaphoreReady countDown");
844
+ logger.info("Current bundle loaded successfully. ['notifyAppReady()' was called] " + bundle);
845
+ logger.info("semaphoreReady countDown");
830
846
  this.semaphoreDown();
831
- Log.i(CapgoUpdater.TAG, "semaphoreReady countDown done");
847
+ logger.info("semaphoreReady countDown done");
832
848
  final JSObject ret = new JSObject();
833
849
  ret.put("bundle", mapToJSObject(bundle.toJSONMap()));
834
850
  call.resolve(ret);
835
851
  } catch (final Exception e) {
836
- Log.e(CapgoUpdater.TAG, "Failed to notify app ready state. [Error calling 'notifyAppReady()']", e);
852
+ logger.error("Failed to notify app ready state. [Error calling 'notifyAppReady()'] " + e.getMessage());
837
853
  call.reject("Failed to commit app ready state.", e);
838
854
  }
839
855
  }
@@ -843,7 +859,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
843
859
  try {
844
860
  final JSONArray delayConditions = call.getData().optJSONArray("delayConditions");
845
861
  if (delayConditions == null) {
846
- Log.e(CapgoUpdater.TAG, "setMultiDelay called without delayCondition");
862
+ logger.error("setMultiDelay called without delayCondition");
847
863
  call.reject("setMultiDelay called without delayCondition");
848
864
  return;
849
865
  }
@@ -861,7 +877,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
861
877
  call.reject("Failed to delay update");
862
878
  }
863
879
  } catch (final Exception e) {
864
- Log.e(CapgoUpdater.TAG, "Failed to delay update, [Error calling 'setMultiDelay()']", e);
880
+ logger.error("Failed to delay update, [Error calling 'setMultiDelay()'] " + e.getMessage());
865
881
  call.reject("Failed to delay update", e);
866
882
  }
867
883
  }
@@ -880,7 +896,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
880
896
  String serverUrl = config.getServerUrl();
881
897
  if (serverUrl != null && !serverUrl.isEmpty()) {
882
898
  // log warning autoupdate disabled when serverUrl is set
883
- Log.w(CapgoUpdater.TAG, "AutoUpdate is automatic disabled when serverUrl is set.");
899
+ logger.warn("AutoUpdate is automatic disabled when serverUrl is set.");
884
900
  }
885
901
  return (
886
902
  CapacitorUpdaterPlugin.this.autoUpdate &&
@@ -896,7 +912,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
896
912
  ret.put("enabled", this._isAutoUpdateEnabled());
897
913
  call.resolve(ret);
898
914
  } catch (final Exception e) {
899
- Log.e(CapgoUpdater.TAG, "Could not get autoUpdate status", e);
915
+ logger.error("Could not get autoUpdate status " + e.getMessage());
900
916
  call.reject("Could not get autoUpdate status", e);
901
917
  }
902
918
  }
@@ -910,7 +926,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
910
926
  ret.put("available", serverUrl == null || serverUrl.isEmpty());
911
927
  call.resolve(ret);
912
928
  } catch (final Exception e) {
913
- Log.e(CapgoUpdater.TAG, "Could not get autoUpdate availability", e);
929
+ logger.error("Could not get autoUpdate availability " + e.getMessage());
914
930
  call.reject("Could not get autoUpdate availability", e);
915
931
  }
916
932
  }
@@ -922,7 +938,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
922
938
  }
923
939
  this.appReadyCheck = startNewThread(new DeferredNotifyAppReadyCheck());
924
940
  } catch (final Exception e) {
925
- Log.e(CapgoUpdater.TAG, "Failed to start " + DeferredNotifyAppReadyCheck.class.getName(), e);
941
+ logger.error("Failed to start " + DeferredNotifyAppReadyCheck.class.getName() + " " + e.getMessage());
926
942
  }
927
943
  }
928
944
 
@@ -935,10 +951,15 @@ public class CapacitorUpdaterPlugin extends Plugin {
935
951
  }
936
952
  }
937
953
 
954
+ private void ensureBridgeSet() {
955
+ if (this.bridge != null && this.bridge.getWebView() != null) {
956
+ logger.setBridge(this.bridge);
957
+ }
958
+ }
959
+
938
960
  private void endBackGroundTaskWithNotif(String msg, String latestVersionName, BundleInfo current, Boolean error) {
939
961
  if (error) {
940
- Log.i(
941
- CapgoUpdater.TAG,
962
+ logger.info(
942
963
  "endBackGroundTaskWithNotif error: " +
943
964
  error +
944
965
  " current: " +
@@ -956,7 +977,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
956
977
  this.notifyListeners("noNeedUpdate", ret);
957
978
  this.sendReadyToJs(current, msg);
958
979
  this.backgroundDownloadTask = null;
959
- Log.i(CapgoUpdater.TAG, "endBackGroundTaskWithNotif " + msg);
980
+ logger.info("endBackGroundTaskWithNotif " + msg);
960
981
  }
961
982
 
962
983
  private Thread backgroundDownload() {
@@ -964,13 +985,13 @@ public class CapacitorUpdaterPlugin extends Plugin {
964
985
  ? "Update will occur now."
965
986
  : "Update will occur next time app moves to background.";
966
987
  return startNewThread(() -> {
967
- Log.i(CapgoUpdater.TAG, "Check for update via: " + CapacitorUpdaterPlugin.this.updateUrl);
988
+ logger.info("Check for update via: " + CapacitorUpdaterPlugin.this.updateUrl);
968
989
  CapacitorUpdaterPlugin.this.implementation.getLatest(CapacitorUpdaterPlugin.this.updateUrl, null, res -> {
969
990
  JSObject jsRes = mapToJSObject(res);
970
991
  final BundleInfo current = CapacitorUpdaterPlugin.this.implementation.getCurrentBundle();
971
992
  try {
972
993
  if (jsRes.has("message")) {
973
- Log.i(CapgoUpdater.TAG, "API message: " + jsRes.get("message"));
994
+ logger.info("API message: " + jsRes.get("message"));
974
995
  if (jsRes.has("major") && jsRes.getBoolean("major") && jsRes.has("version")) {
975
996
  final JSObject majorAvailable = new JSObject();
976
997
  majorAvailable.put("version", jsRes.getString("version"));
@@ -988,9 +1009,9 @@ public class CapacitorUpdaterPlugin extends Plugin {
988
1009
  final String latestVersionName = jsRes.getString("version");
989
1010
 
990
1011
  if ("builtin".equals(latestVersionName)) {
991
- Log.i(CapgoUpdater.TAG, "Latest version is builtin");
1012
+ logger.info("Latest version is builtin");
992
1013
  if (CapacitorUpdaterPlugin.this.implementation.directUpdate) {
993
- Log.i(CapgoUpdater.TAG, "Direct update to builtin version");
1014
+ logger.info("Direct update to builtin version");
994
1015
  this._reset(false);
995
1016
  CapacitorUpdaterPlugin.this.endBackGroundTaskWithNotif(
996
1017
  "Updated to builtin version",
@@ -999,7 +1020,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
999
1020
  false
1000
1021
  );
1001
1022
  } else {
1002
- Log.i(CapgoUpdater.TAG, "Setting next bundle to builtin");
1023
+ logger.info("Setting next bundle to builtin");
1003
1024
  CapacitorUpdaterPlugin.this.implementation.setNextBundle(BundleInfo.ID_BUILTIN);
1004
1025
  CapacitorUpdaterPlugin.this.endBackGroundTaskWithNotif(
1005
1026
  "Next update will be to builtin version",
@@ -1012,7 +1033,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
1012
1033
  }
1013
1034
 
1014
1035
  if (!jsRes.has("url") || !CapacitorUpdaterPlugin.this.isValidURL(jsRes.getString("url"))) {
1015
- Log.e(CapgoUpdater.TAG, "Error no url or wrong format");
1036
+ logger.error("Error no url or wrong format");
1016
1037
  CapacitorUpdaterPlugin.this.endBackGroundTaskWithNotif(
1017
1038
  "Error no url or wrong format",
1018
1039
  current.getVersionName(),
@@ -1030,7 +1051,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
1030
1051
  final JSObject ret = new JSObject();
1031
1052
  ret.put("bundle", mapToJSObject(latest.toJSONMap()));
1032
1053
  if (latest.isErrorStatus()) {
1033
- Log.e(CapgoUpdater.TAG, "Latest bundle already exists, and is in error state. Aborting update.");
1054
+ logger.error("Latest bundle already exists, and is in error state. Aborting update.");
1034
1055
  CapacitorUpdaterPlugin.this.endBackGroundTaskWithNotif(
1035
1056
  "Latest bundle already exists, and is in error state. Aborting update.",
1036
1057
  latestVersionName,
@@ -1040,14 +1061,14 @@ public class CapacitorUpdaterPlugin extends Plugin {
1040
1061
  return;
1041
1062
  }
1042
1063
  if (latest.isDownloaded()) {
1043
- Log.i(CapgoUpdater.TAG, "Latest bundle already exists and download is NOT required. " + messageUpdate);
1064
+ logger.info("Latest bundle already exists and download is NOT required. " + messageUpdate);
1044
1065
  if (CapacitorUpdaterPlugin.this.implementation.directUpdate) {
1045
1066
  Gson gson = new Gson();
1046
1067
  String delayUpdatePreferences = prefs.getString(DelayUpdateUtils.DELAY_CONDITION_PREFERENCES, "[]");
1047
1068
  Type type = new TypeToken<ArrayList<DelayCondition>>() {}.getType();
1048
1069
  ArrayList<DelayCondition> delayConditionList = gson.fromJson(delayUpdatePreferences, type);
1049
1070
  if (delayConditionList != null && !delayConditionList.isEmpty()) {
1050
- Log.i(CapgoUpdater.TAG, "Update delayed until delay conditions met");
1071
+ logger.info("Update delayed until delay conditions met");
1051
1072
  CapacitorUpdaterPlugin.this.endBackGroundTaskWithNotif(
1052
1073
  "Update delayed until delay conditions met",
1053
1074
  latestVersionName,
@@ -1077,24 +1098,20 @@ public class CapacitorUpdaterPlugin extends Plugin {
1077
1098
  return;
1078
1099
  }
1079
1100
  if (latest.isDeleted()) {
1080
- Log.i(
1081
- CapgoUpdater.TAG,
1082
- "Latest bundle already exists and will be deleted, download will overwrite it."
1083
- );
1101
+ logger.info("Latest bundle already exists and will be deleted, download will overwrite it.");
1084
1102
  try {
1085
1103
  final Boolean deleted = CapacitorUpdaterPlugin.this.implementation.delete(latest.getId(), true);
1086
1104
  if (deleted) {
1087
- Log.i(CapgoUpdater.TAG, "Failed bundle deleted: " + latest.getVersionName());
1105
+ logger.info("Failed bundle deleted: " + latest.getVersionName());
1088
1106
  }
1089
1107
  } catch (final IOException e) {
1090
- Log.e(CapgoUpdater.TAG, "Failed to delete failed bundle: " + latest.getVersionName(), e);
1108
+ logger.error("Failed to delete failed bundle: " + latest.getVersionName() + " " + e.getMessage());
1091
1109
  }
1092
1110
  }
1093
1111
  }
1094
1112
  startNewThread(() -> {
1095
1113
  try {
1096
- Log.i(
1097
- CapgoUpdater.TAG,
1114
+ logger.info(
1098
1115
  "New bundle: " +
1099
1116
  latestVersionName +
1100
1117
  " found. Current is: " +
@@ -1128,7 +1145,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
1128
1145
  );
1129
1146
  }
1130
1147
  } catch (final Exception e) {
1131
- Log.e(CapgoUpdater.TAG, "error downloading file", e);
1148
+ logger.error("error downloading file " + e.getMessage());
1132
1149
  CapacitorUpdaterPlugin.this.endBackGroundTaskWithNotif(
1133
1150
  "Error downloading file",
1134
1151
  latestVersionName,
@@ -1138,11 +1155,11 @@ public class CapacitorUpdaterPlugin extends Plugin {
1138
1155
  }
1139
1156
  });
1140
1157
  } else {
1141
- Log.i(CapgoUpdater.TAG, "No need to update, " + current.getId() + " is the latest bundle.");
1158
+ logger.info("No need to update, " + current.getId() + " is the latest bundle.");
1142
1159
  CapacitorUpdaterPlugin.this.endBackGroundTaskWithNotif("No need to update", latestVersionName, current, false);
1143
1160
  }
1144
1161
  } catch (final JSONException e) {
1145
- Log.e(CapgoUpdater.TAG, "error parsing JSON", e);
1162
+ logger.error("error parsing JSON " + e.getMessage());
1146
1163
  CapacitorUpdaterPlugin.this.endBackGroundTaskWithNotif(
1147
1164
  "Error parsing JSON",
1148
1165
  current.getVersionName(),
@@ -1161,7 +1178,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
1161
1178
  Type type = new TypeToken<ArrayList<DelayCondition>>() {}.getType();
1162
1179
  ArrayList<DelayCondition> delayConditionList = gson.fromJson(delayUpdatePreferences, type);
1163
1180
  if (delayConditionList != null && !delayConditionList.isEmpty()) {
1164
- Log.i(CapgoUpdater.TAG, "Update delayed until delay conditions met");
1181
+ logger.info("Update delayed until delay conditions met");
1165
1182
  return;
1166
1183
  }
1167
1184
  final BundleInfo current = this.implementation.getCurrentBundle();
@@ -1169,16 +1186,16 @@ public class CapacitorUpdaterPlugin extends Plugin {
1169
1186
 
1170
1187
  if (next != null && !next.isErrorStatus() && !next.getId().equals(current.getId())) {
1171
1188
  // There is a next bundle waiting for activation
1172
- Log.d(CapgoUpdater.TAG, "Next bundle is: " + next.getVersionName());
1189
+ logger.debug("Next bundle is: " + next.getVersionName());
1173
1190
  if (this.implementation.set(next) && this._reload()) {
1174
- Log.i(CapgoUpdater.TAG, "Updated to bundle: " + next.getVersionName());
1191
+ logger.info("Updated to bundle: " + next.getVersionName());
1175
1192
  this.implementation.setNextBundle(null);
1176
1193
  } else {
1177
- Log.e(CapgoUpdater.TAG, "Update to bundle: " + next.getVersionName() + " Failed!");
1194
+ logger.error("Update to bundle: " + next.getVersionName() + " Failed!");
1178
1195
  }
1179
1196
  }
1180
1197
  } catch (final Exception e) {
1181
- Log.e(CapgoUpdater.TAG, "Error during onActivityStopped", e);
1198
+ logger.error("Error during onActivityStopped " + e.getMessage());
1182
1199
  }
1183
1200
  }
1184
1201
 
@@ -1187,14 +1204,14 @@ public class CapacitorUpdaterPlugin extends Plugin {
1187
1204
  final BundleInfo current = this.implementation.getCurrentBundle();
1188
1205
 
1189
1206
  if (current.isBuiltin()) {
1190
- Log.i(CapgoUpdater.TAG, "Built-in bundle is active. We skip the check for notifyAppReady.");
1207
+ logger.info("Built-in bundle is active. We skip the check for notifyAppReady.");
1191
1208
  return;
1192
1209
  }
1193
- Log.d(CapgoUpdater.TAG, "Current bundle is: " + current);
1210
+ logger.debug("Current bundle is: " + current);
1194
1211
 
1195
1212
  if (BundleStatus.SUCCESS != current.getStatus()) {
1196
- Log.e(CapgoUpdater.TAG, "notifyAppReady was not called, roll back current bundle: " + current.getId());
1197
- Log.i(CapgoUpdater.TAG, "Did you forget to call 'notifyAppReady()' in your Capacitor App code?");
1213
+ logger.error("notifyAppReady was not called, roll back current bundle: " + current.getId());
1214
+ logger.info("Did you forget to call 'notifyAppReady()' in your Capacitor App code?");
1198
1215
  final JSObject ret = new JSObject();
1199
1216
  ret.put("bundle", mapToJSObject(current.toJSONMap()));
1200
1217
  this.notifyListeners("updateFailed", ret);
@@ -1202,18 +1219,18 @@ public class CapacitorUpdaterPlugin extends Plugin {
1202
1219
  this.implementation.setError(current);
1203
1220
  this._reset(true);
1204
1221
  if (CapacitorUpdaterPlugin.this.autoDeleteFailed && !current.isBuiltin()) {
1205
- Log.i(CapgoUpdater.TAG, "Deleting failing bundle: " + current.getVersionName());
1222
+ logger.info("Deleting failing bundle: " + current.getVersionName());
1206
1223
  try {
1207
1224
  final Boolean res = this.implementation.delete(current.getId(), false);
1208
1225
  if (res) {
1209
- Log.i(CapgoUpdater.TAG, "Failed bundle deleted: " + current.getVersionName());
1226
+ logger.info("Failed bundle deleted: " + current.getVersionName());
1210
1227
  }
1211
1228
  } catch (final IOException e) {
1212
- Log.e(CapgoUpdater.TAG, "Failed to delete failed bundle: " + current.getVersionName(), e);
1229
+ logger.error("Failed to delete failed bundle: " + current.getVersionName() + " " + e.getMessage());
1213
1230
  }
1214
1231
  }
1215
1232
  } else {
1216
- Log.i(CapgoUpdater.TAG, "notifyAppReady was called. This is fine: " + current.getId());
1233
+ logger.info("notifyAppReady was called. This is fine: " + current.getId());
1217
1234
  }
1218
1235
  }
1219
1236
 
@@ -1222,12 +1239,12 @@ public class CapacitorUpdaterPlugin extends Plugin {
1222
1239
  @Override
1223
1240
  public void run() {
1224
1241
  try {
1225
- Log.i(CapgoUpdater.TAG, "Wait for " + CapacitorUpdaterPlugin.this.appReadyTimeout + "ms, then check for notifyAppReady");
1242
+ logger.info("Wait for " + CapacitorUpdaterPlugin.this.appReadyTimeout + "ms, then check for notifyAppReady");
1226
1243
  Thread.sleep(CapacitorUpdaterPlugin.this.appReadyTimeout);
1227
1244
  CapacitorUpdaterPlugin.this.checkRevert();
1228
1245
  CapacitorUpdaterPlugin.this.appReadyCheck = null;
1229
1246
  } catch (final InterruptedException e) {
1230
- Log.i(CapgoUpdater.TAG, DeferredNotifyAppReadyCheck.class.getName() + " was interrupted.");
1247
+ logger.info(DeferredNotifyAppReadyCheck.class.getName() + " was interrupted.");
1231
1248
  }
1232
1249
  }
1233
1250
  }
@@ -1243,7 +1260,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
1243
1260
  ) {
1244
1261
  this.backgroundDownloadTask = this.backgroundDownload();
1245
1262
  } else {
1246
- Log.i(CapgoUpdater.TAG, "Auto update is disabled");
1263
+ logger.info("Auto update is disabled");
1247
1264
  this.sendReadyToJs(current, "disabled");
1248
1265
  }
1249
1266
  this.checkAppReady();
@@ -1252,14 +1269,14 @@ public class CapacitorUpdaterPlugin extends Plugin {
1252
1269
  public void appMovedToBackground() {
1253
1270
  final BundleInfo current = CapacitorUpdaterPlugin.this.implementation.getCurrentBundle();
1254
1271
  CapacitorUpdaterPlugin.this.implementation.sendStats("app_moved_to_background", current.getVersionName());
1255
- Log.i(CapgoUpdater.TAG, "Checking for pending update");
1272
+ logger.info("Checking for pending update");
1256
1273
  try {
1257
1274
  // We need to set "backgrounded time"
1258
1275
  this.delayUpdateUtils.setBackgroundTimestamp(System.currentTimeMillis());
1259
1276
  this.delayUpdateUtils.checkCancelDelay(DelayUpdateUtils.CancelDelaySource.BACKGROUND);
1260
1277
  this.installNext();
1261
1278
  } catch (final Exception e) {
1262
- Log.e(CapgoUpdater.TAG, "Error during onActivityStopped", e);
1279
+ logger.error("Error during onActivityStopped " + e.getMessage());
1263
1280
  }
1264
1281
  }
1265
1282
 
@@ -1287,7 +1304,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
1287
1304
  }
1288
1305
 
1289
1306
  private void appKilled() {
1290
- Log.d(CapgoUpdater.TAG, "onActivityDestroyed: all activity destroyed");
1307
+ logger.debug("onActivityDestroyed: all activity destroyed");
1291
1308
  this.delayUpdateUtils.checkCancelDelay(DelayUpdateUtils.CancelDelaySource.KILLED);
1292
1309
  }
1293
1310
 
@@ -1296,7 +1313,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
1296
1313
  if (isPreviousMainActivity) {
1297
1314
  this.appMovedToForeground();
1298
1315
  }
1299
- Log.i(CapgoUpdater.TAG, "onActivityStarted " + getActivity().getClass().getName());
1316
+ logger.info("onActivityStarted " + getActivity().getClass().getName());
1300
1317
  isPreviousMainActivity = true;
1301
1318
  }
1302
1319
 
@@ -1323,7 +1340,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
1323
1340
 
1324
1341
  @Override
1325
1342
  public void handleOnDestroy() {
1326
- Log.i(CapgoUpdater.TAG, "onActivityDestroyed " + getActivity().getClass().getName());
1343
+ logger.info("onActivityDestroyed " + getActivity().getClass().getName());
1327
1344
  this.implementation.activity = getActivity();
1328
1345
  counterActivityCreate--;
1329
1346
  if (counterActivityCreate == 0) {