@capgo/capacitor-updater 8.47.5 → 8.47.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.
@@ -128,7 +128,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
128
128
  static final int APPLICATION_EXIT_REASON_USER_REQUESTED = 10;
129
129
  static final int APPLICATION_EXIT_REASON_DEPENDENCY_DIED = 12;
130
130
 
131
- private final String pluginVersion = "8.47.5";
131
+ private final String pluginVersion = "8.47.6";
132
132
  private static final String DELAY_CONDITION_PREFERENCES = "";
133
133
 
134
134
  private SharedPreferences.Editor editor;
@@ -159,9 +159,9 @@ public class CapacitorUpdaterPlugin extends Plugin {
159
159
  private volatile boolean onLaunchDirectUpdateUsed = false;
160
160
  Boolean shakeMenuEnabled = false;
161
161
  Boolean shakeChannelSelectorEnabled = false;
162
- Boolean previewSessionEnabled = false;
162
+ volatile Boolean previewSessionEnabled = false;
163
163
  private Boolean previewSessionAlertPending = false;
164
- private Boolean isLeavingPreviewForIncomingLink = false;
164
+ private volatile Boolean isLeavingPreviewForIncomingLink = false;
165
165
  private Boolean allowManualBundleError = false;
166
166
  private Boolean allowPreview = false;
167
167
  Boolean allowSetDefaultChannel = true;
@@ -170,6 +170,30 @@ public class CapacitorUpdaterPlugin extends Plugin {
170
170
  return this.updateUrl;
171
171
  }
172
172
 
173
+ private boolean isPreviewSessionStateActive() {
174
+ return (
175
+ Boolean.TRUE.equals(this.previewSessionEnabled) ||
176
+ Boolean.TRUE.equals(this.isLeavingPreviewForIncomingLink) ||
177
+ (this.implementation != null && this.implementation.previewSession)
178
+ );
179
+ }
180
+
181
+ private boolean shouldBlockAutoUpdateForPreviewSession() {
182
+ if (!this.isPreviewSessionStateActive()) {
183
+ return false;
184
+ }
185
+
186
+ logger.info("Preview session is active. Skipping normal auto-update work.");
187
+ return true;
188
+ }
189
+
190
+ private void clearIncomingPreviewTransition() {
191
+ this.isLeavingPreviewForIncomingLink = false;
192
+ if (!Boolean.TRUE.equals(this.previewSessionEnabled) && this.implementation != null) {
193
+ this.implementation.previewSession = false;
194
+ }
195
+ }
196
+
173
197
  // Used for activity-based foreground/background detection on Android < 14
174
198
  private Boolean isPreviousMainActivity = true;
175
199
 
@@ -1329,9 +1353,10 @@ public class CapacitorUpdaterPlugin extends Plugin {
1329
1353
  );
1330
1354
  }
1331
1355
  } else {
1332
- final boolean enabled = configuredMode != null
1333
- ? "true".equals(configuredMode)
1334
- : Boolean.TRUE.equals(this.getConfig().getBoolean("autoUpdate", true));
1356
+ final boolean enabled =
1357
+ configuredMode != null
1358
+ ? "true".equals(configuredMode)
1359
+ : Boolean.TRUE.equals(this.getConfig().getBoolean("autoUpdate", true));
1335
1360
  this.autoUpdateMode = enabled
1336
1361
  ? autoUpdateModeForLegacyDirectUpdateMode(this.resolveLegacyDirectUpdateModeFromConfig())
1337
1362
  : AUTO_UPDATE_MODE_OFF;
@@ -1506,6 +1531,12 @@ public class CapacitorUpdaterPlugin extends Plugin {
1506
1531
  void scheduleDirectUpdateFinish(final BundleInfo latest) {
1507
1532
  startNewThread(() -> {
1508
1533
  try {
1534
+ if (this.shouldBlockAutoUpdateForPreviewSession()) {
1535
+ logger.info("Skipping direct update install while preview session state is active");
1536
+ this.implementation.directUpdate = false;
1537
+ this.clearBackgroundDownloadState();
1538
+ return;
1539
+ }
1509
1540
  Activity currentActivity = this.getActivity();
1510
1541
  if (currentActivity != null) {
1511
1542
  this.implementation.activity = currentActivity;
@@ -1520,16 +1551,54 @@ public class CapacitorUpdaterPlugin extends Plugin {
1520
1551
  }
1521
1552
 
1522
1553
  private void directUpdateFinish(final BundleInfo latest) {
1554
+ if (this.shouldBlockAutoUpdateForPreviewSession()) {
1555
+ logger.info("Skipping direct update finish while preview session state is active");
1556
+ this.implementation.directUpdate = false;
1557
+ this.clearBackgroundDownloadState();
1558
+ return;
1559
+ }
1523
1560
  if ("onLaunch".equals(this.directUpdateMode)) {
1524
1561
  this.onLaunchDirectUpdateUsed = true;
1525
1562
  this.implementation.directUpdate = false;
1526
1563
  }
1527
- if (CapacitorUpdaterPlugin.this.implementation.set(latest) && CapacitorUpdaterPlugin.this._reload()) {
1564
+ if (this.applyDownloadedBundleForDirectUpdate(latest)) {
1565
+ this.implementation.setNextBundle(null);
1528
1566
  this.notifyBundleSet(latest);
1529
1567
  sendReadyToJs(latest, "update installed", true);
1568
+ } else {
1569
+ this.implementation.setNextBundle(latest.getId());
1570
+ final JSObject ret = new JSObject();
1571
+ ret.put("bundle", InternalUtils.mapToJSObject(latest.toJSONMap()));
1572
+ this.notifyListeners("updateAvailable", ret);
1573
+ sendReadyToJs(
1574
+ this.implementation.getCurrentBundle(),
1575
+ "Direct update reload failed, update will install next background",
1576
+ false
1577
+ );
1530
1578
  }
1531
1579
  }
1532
1580
 
1581
+ private boolean applyDownloadedBundleForDirectUpdate(final BundleInfo latest) {
1582
+ final CapgoUpdater.ResetState previousState = this.implementation.captureResetState();
1583
+ final String previousBundleName = this.implementation.getCurrentBundle().getVersionName();
1584
+
1585
+ if (!this.implementation.stagePendingReload(latest)) {
1586
+ this.implementation.restoreResetState(previousState);
1587
+ logger.error("Direct update failed to stage downloaded bundle: " + latest.toString());
1588
+ return false;
1589
+ }
1590
+
1591
+ if (this._reload()) {
1592
+ this.implementation.finalizePendingReload(latest, previousBundleName);
1593
+ return true;
1594
+ }
1595
+
1596
+ this.implementation.restoreResetState(previousState);
1597
+ this.restoreLiveBundleStateAfterFailedReload();
1598
+ logger.error("Direct update reload failed after staging bundle: " + latest.toString());
1599
+ return false;
1600
+ }
1601
+
1533
1602
  private void cleanupObsoleteVersions() {
1534
1603
  cleanupThread = startNewThread(() -> {
1535
1604
  synchronized (cleanupLock) {
@@ -2135,6 +2204,15 @@ public class CapacitorUpdaterPlugin extends Plugin {
2135
2204
  return this.semaphoreWait(phase, waitTimeMs);
2136
2205
  }
2137
2206
 
2207
+ protected boolean reloadWithoutWaitingForAppReady() {
2208
+ this.applyCurrentBundleToBridge();
2209
+
2210
+ final long waitTimeMs = this.resolveAppReadyCheckTimeoutMs();
2211
+ this.checkAppReady(waitTimeMs);
2212
+ this.notifyListeners("appReloaded", new JSObject());
2213
+ return true;
2214
+ }
2215
+
2138
2216
  @PluginMethod
2139
2217
  public void reload(final PluginCall call) {
2140
2218
  startNewThread(() -> {
@@ -2142,7 +2220,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
2142
2220
  final BundleInfo current = this.implementation.getCurrentBundle();
2143
2221
  final BundleInfo next = this.implementation.getNextBundle();
2144
2222
 
2145
- if (next != null && !next.isErrorStatus() && !next.getId().equals(current.getId())) {
2223
+ if (!this.isPreviewSessionStateActive() && next != null && !next.isErrorStatus() && !next.getId().equals(current.getId())) {
2146
2224
  final CapgoUpdater.ResetState previousState = this.implementation.captureResetState();
2147
2225
  final String previousBundleName = this.implementation.getCurrentBundle().getVersionName();
2148
2226
  logger.info("Applying pending bundle before reload: " + next.getVersionName());
@@ -2222,6 +2300,12 @@ public class CapacitorUpdaterPlugin extends Plugin {
2222
2300
  if (!this.implementation.set(id)) {
2223
2301
  logger.info("No such bundle " + id);
2224
2302
  call.reject("Update failed, id " + id + " does not exist.");
2303
+ } else if (Boolean.TRUE.equals(this.previewSessionEnabled)) {
2304
+ logger.info("Preview session set active bundle " + id + " without waiting for preview app readiness");
2305
+ this.reloadWithoutWaitingForAppReady();
2306
+ this.notifyBundleSet(this.implementation.getBundleInfo(id));
2307
+ this.showPreviewSessionNoticeIfNeeded();
2308
+ call.resolve();
2225
2309
  } else if (!this._reload()) {
2226
2310
  logger.error("Reload failed after setting bundle " + id);
2227
2311
  call.reject("Reload failed after setting bundle " + id);
@@ -2334,6 +2418,41 @@ public class CapacitorUpdaterPlugin extends Plugin {
2334
2418
  return true;
2335
2419
  }
2336
2420
 
2421
+ private boolean leavePreviewSessionForIncomingPreviewLink() {
2422
+ final BundleInfo previewBundle = this.implementation.getCurrentBundle();
2423
+ final BundleInfo previewFallbackBundle = this.implementation.getPreviewFallbackBundle();
2424
+
2425
+ try {
2426
+ if (previewFallbackBundle == null || previewFallbackBundle.isErrorStatus()) {
2427
+ logger.error("No preview fallback bundle available");
2428
+ return false;
2429
+ }
2430
+ if (!this.implementation.canSet(previewFallbackBundle)) {
2431
+ logger.error("Preview fallback bundle is not installable");
2432
+ return false;
2433
+ }
2434
+
2435
+ final CapgoUpdater.ResetState previousState = this.implementation.captureResetState();
2436
+ if (!this.implementation.stagePreviewFallbackReload(previewFallbackBundle)) {
2437
+ logger.error("Could not stage preview fallback bundle");
2438
+ return false;
2439
+ }
2440
+
2441
+ if (!this._reload()) {
2442
+ this.implementation.restoreResetState(previousState);
2443
+ this.restoreLiveBundleStateAfterFailedReload();
2444
+ return false;
2445
+ }
2446
+
2447
+ this.endPreviewSession(true);
2448
+ final BundleInfo restoredNextBundle = this.implementation.getNextBundle();
2449
+ this.deletePreviewBundleIfUnused(previewBundle, previewFallbackBundle, restoredNextBundle);
2450
+ return true;
2451
+ } finally {
2452
+ this.clearIncomingPreviewTransition();
2453
+ }
2454
+ }
2455
+
2337
2456
  private void leavePreviewSessionForLaunchIntentIfNeeded() {
2338
2457
  final Intent intent = getActivity() == null ? null : getActivity().getIntent();
2339
2458
  if (
@@ -2356,6 +2475,10 @@ public class CapacitorUpdaterPlugin extends Plugin {
2356
2475
  }
2357
2476
 
2358
2477
  private boolean leavePreviewSessionWithoutReload() {
2478
+ return this.leavePreviewSessionWithoutReload(false);
2479
+ }
2480
+
2481
+ private boolean leavePreviewSessionWithoutReload(final boolean keepPreviewGuard) {
2359
2482
  final BundleInfo previewBundle = this.implementation.getCurrentBundle();
2360
2483
  final BundleInfo previewFallbackBundle = this.implementation.getPreviewFallbackBundle();
2361
2484
  if (previewFallbackBundle == null || previewFallbackBundle.isErrorStatus()) {
@@ -2371,7 +2494,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
2371
2494
  return false;
2372
2495
  }
2373
2496
 
2374
- this.endPreviewSession();
2497
+ this.endPreviewSession(keepPreviewGuard);
2375
2498
  final BundleInfo restoredNextBundle = this.implementation.getNextBundle();
2376
2499
  this.deletePreviewBundleIfUnused(previewBundle, previewFallbackBundle, restoredNextBundle);
2377
2500
  return true;
@@ -2401,7 +2524,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
2401
2524
  return this.refreshPreviewSessionFromPayloadUrl(payloadUrl);
2402
2525
  }
2403
2526
 
2404
- return this._reload();
2527
+ return this.reloadWithoutWaitingForAppReady();
2405
2528
  }
2406
2529
 
2407
2530
  public boolean hasActivePreviewSession() {
@@ -2433,6 +2556,10 @@ public class CapacitorUpdaterPlugin extends Plugin {
2433
2556
  }
2434
2557
 
2435
2558
  private void endPreviewSession() {
2559
+ this.endPreviewSession(false);
2560
+ }
2561
+
2562
+ private void endPreviewSession(final boolean keepPreviewGuard) {
2436
2563
  final boolean previousShakeMenuEnabled = this.prefs.getBoolean(
2437
2564
  PREVIEW_PREVIOUS_SHAKE_MENU_PREF_KEY,
2438
2565
  this.getConfig().getBoolean("shakeMenu", false)
@@ -2447,8 +2574,11 @@ public class CapacitorUpdaterPlugin extends Plugin {
2447
2574
 
2448
2575
  this.previewSessionEnabled = false;
2449
2576
  this.previewSessionAlertPending = false;
2450
- this.isLeavingPreviewForIncomingLink = false;
2451
- this.implementation.previewSession = false;
2577
+ if (keepPreviewGuard) {
2578
+ this.implementation.previewSession = true;
2579
+ } else {
2580
+ this.clearIncomingPreviewTransition();
2581
+ }
2452
2582
  this.shakeMenuEnabled = previousShakeMenuEnabled;
2453
2583
  this.shakeChannelSelectorEnabled = previousShakeChannelSelectorEnabled;
2454
2584
  this.implementation.setPreviewFallbackBundle(null);
@@ -2459,9 +2589,8 @@ public class CapacitorUpdaterPlugin extends Plugin {
2459
2589
  private void clearPreviewSessionBecauseDisabled() {
2460
2590
  logger.info("Preview session disabled by config; restoring preview fallback");
2461
2591
  final BundleInfo fallback = this.implementation.getPreviewFallbackBundle();
2462
- final BundleInfo bundleToRestore = fallback == null || fallback.isErrorStatus()
2463
- ? this.implementation.getBundleInfo(BundleInfo.ID_BUILTIN)
2464
- : fallback;
2592
+ final BundleInfo bundleToRestore =
2593
+ fallback == null || fallback.isErrorStatus() ? this.implementation.getBundleInfo(BundleInfo.ID_BUILTIN) : fallback;
2465
2594
 
2466
2595
  if (this.implementation.canSet(bundleToRestore)) {
2467
2596
  this.implementation.stagePreviewFallbackReload(bundleToRestore);
@@ -2670,7 +2799,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
2670
2799
 
2671
2800
  if (version.equals(this.implementation.getCurrentBundle().getVersionName())) {
2672
2801
  logger.info("Preview payload unchanged, reloading current bundle");
2673
- return this._reload();
2802
+ return this.reloadWithoutWaitingForAppReady();
2674
2803
  }
2675
2804
 
2676
2805
  final BundleInfo next = this.downloadPreviewPayloadBundle(payload);
@@ -2682,7 +2811,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
2682
2811
  }
2683
2812
 
2684
2813
  this.notifyBundleSet(next);
2685
- return this._reload();
2814
+ return this.reloadWithoutWaitingForAppReady();
2686
2815
  } catch (final Exception err) {
2687
2816
  logger.error("Could not refresh preview session: " + err.getMessage());
2688
2817
  return false;
@@ -2738,33 +2867,30 @@ public class CapacitorUpdaterPlugin extends Plugin {
2738
2867
  this.editor.putBoolean(PREVIEW_SESSION_ALERT_PENDING_PREF_KEY, false);
2739
2868
  this.editor.apply();
2740
2869
 
2741
- new Handler(Looper.getMainLooper()).postDelayed(
2742
- () -> {
2743
- try {
2744
- if (!Boolean.TRUE.equals(this.previewSessionEnabled)) {
2745
- return;
2746
- }
2747
- if (getActivity() == null || getActivity().isFinishing()) {
2748
- this.previewSessionAlertPending = true;
2749
- this.editor.putBoolean(PREVIEW_SESSION_ALERT_PENDING_PREF_KEY, true);
2750
- this.editor.apply();
2751
- return;
2752
- }
2753
-
2754
- new AlertDialog.Builder(getActivity())
2755
- .setTitle("Preview started")
2756
- .setMessage("Shake your device anytime to reload or leave the test app.")
2757
- .setPositiveButton("Got it", (dialog, which) -> dialog.dismiss())
2758
- .show();
2759
- } catch (final Exception e) {
2870
+ new Handler(Looper.getMainLooper()).postDelayed(() -> {
2871
+ try {
2872
+ if (!Boolean.TRUE.equals(this.previewSessionEnabled)) {
2873
+ return;
2874
+ }
2875
+ if (getActivity() == null || getActivity().isFinishing()) {
2760
2876
  this.previewSessionAlertPending = true;
2761
2877
  this.editor.putBoolean(PREVIEW_SESSION_ALERT_PENDING_PREF_KEY, true);
2762
2878
  this.editor.apply();
2763
- logger.warn("Could not show preview session notice: " + e.getMessage());
2879
+ return;
2764
2880
  }
2765
- },
2766
- 600
2767
- );
2881
+
2882
+ new AlertDialog.Builder(getActivity())
2883
+ .setTitle("Preview started")
2884
+ .setMessage("Shake your device anytime to reload or leave the test app.")
2885
+ .setPositiveButton("Got it", (dialog, which) -> dialog.dismiss())
2886
+ .show();
2887
+ } catch (final Exception e) {
2888
+ this.previewSessionAlertPending = true;
2889
+ this.editor.putBoolean(PREVIEW_SESSION_ALERT_PENDING_PREF_KEY, true);
2890
+ this.editor.apply();
2891
+ logger.warn("Could not show preview session notice: " + e.getMessage());
2892
+ }
2893
+ }, 600);
2768
2894
  }
2769
2895
 
2770
2896
  @PluginMethod
@@ -2970,6 +3096,9 @@ public class CapacitorUpdaterPlugin extends Plugin {
2970
3096
  logger.error("Error no url or wrong format");
2971
3097
  return "unavailable";
2972
3098
  }
3099
+ if (this.shouldBlockAutoUpdateForPreviewSession()) {
3100
+ return "preview_session";
3101
+ }
2973
3102
  if (this.isDownloadStuckOrTimedOut()) {
2974
3103
  logger.info("Download already in progress, skipping duplicate download request");
2975
3104
  return "already_running";
@@ -3138,7 +3267,13 @@ public class CapacitorUpdaterPlugin extends Plugin {
3138
3267
  @Override
3139
3268
  public void run() {
3140
3269
  try {
3270
+ if (CapacitorUpdaterPlugin.this.shouldBlockAutoUpdateForPreviewSession()) {
3271
+ return;
3272
+ }
3141
3273
  CapacitorUpdaterPlugin.this.implementation.getLatest(CapacitorUpdaterPlugin.this.updateUrl, null, (res) -> {
3274
+ if (CapacitorUpdaterPlugin.this.shouldBlockAutoUpdateForPreviewSession()) {
3275
+ return;
3276
+ }
3142
3277
  JSObject jsRes = InternalUtils.mapToJSObject(res);
3143
3278
  if (jsRes.has("error") || jsRes.has("kind")) {
3144
3279
  final BundleInfo current = CapacitorUpdaterPlugin.this.implementation.getCurrentBundle();
@@ -3201,6 +3336,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
3201
3336
  logger.info("semaphoreReady countDown");
3202
3337
  this.semaphoreDown();
3203
3338
  logger.info("semaphoreReady countDown done");
3339
+ this.clearIncomingPreviewTransition();
3204
3340
  final JSObject ret = new JSObject();
3205
3341
  ret.put("bundle", InternalUtils.mapToJSObject(bundle.toJSONMap()));
3206
3342
  call.resolve(ret);
@@ -3248,6 +3384,9 @@ public class CapacitorUpdaterPlugin extends Plugin {
3248
3384
  }
3249
3385
 
3250
3386
  private Boolean _isAutoUpdateEnabled() {
3387
+ if (this.isPreviewSessionStateActive()) {
3388
+ return false;
3389
+ }
3251
3390
  final CapConfig config = CapConfig.loadDefault(this.getActivity());
3252
3391
  String serverUrl = config.getServerUrl();
3253
3392
  if (serverUrl != null && !serverUrl.isEmpty()) {
@@ -3446,6 +3585,11 @@ public class CapacitorUpdaterPlugin extends Plugin {
3446
3585
  logger.info("endBackGroundTaskWithNotif " + msg);
3447
3586
  }
3448
3587
 
3588
+ private void clearBackgroundDownloadState() {
3589
+ this.backgroundDownloadTask = null;
3590
+ this.downloadStartTimeMs = 0;
3591
+ }
3592
+
3449
3593
  private boolean isDownloadStuckOrTimedOut() {
3450
3594
  if (this.backgroundDownloadTask == null || !this.backgroundDownloadTask.isAlive()) {
3451
3595
  return false;
@@ -3472,6 +3616,9 @@ public class CapacitorUpdaterPlugin extends Plugin {
3472
3616
  }
3473
3617
 
3474
3618
  private Thread backgroundDownload() {
3619
+ if (this.shouldBlockAutoUpdateForPreviewSession()) {
3620
+ return null;
3621
+ }
3475
3622
  final boolean plannedDirectUpdate = this.shouldUseDirectUpdate();
3476
3623
  final boolean initialDirectUpdateAllowed = this.isDirectUpdateCurrentlyAllowed(plannedDirectUpdate);
3477
3624
  final String messageUpdate = initialDirectUpdateAllowed
@@ -3482,9 +3629,17 @@ public class CapacitorUpdaterPlugin extends Plugin {
3482
3629
  Thread newTask = startNewThread(() -> {
3483
3630
  // Wait for cleanup to complete before starting download
3484
3631
  waitForCleanupIfNeeded();
3632
+ if (CapacitorUpdaterPlugin.this.shouldBlockAutoUpdateForPreviewSession()) {
3633
+ CapacitorUpdaterPlugin.this.clearBackgroundDownloadState();
3634
+ return;
3635
+ }
3485
3636
  logger.info("Check for update via: " + CapacitorUpdaterPlugin.this.updateUrl);
3486
3637
  try {
3487
3638
  CapacitorUpdaterPlugin.this.implementation.getLatest(CapacitorUpdaterPlugin.this.updateUrl, null, (res) -> {
3639
+ if (CapacitorUpdaterPlugin.this.shouldBlockAutoUpdateForPreviewSession()) {
3640
+ CapacitorUpdaterPlugin.this.clearBackgroundDownloadState();
3641
+ return;
3642
+ }
3488
3643
  JSObject jsRes = InternalUtils.mapToJSObject(res);
3489
3644
  final BundleInfo current = CapacitorUpdaterPlugin.this.implementation.getCurrentBundle();
3490
3645
 
@@ -3709,6 +3864,10 @@ public class CapacitorUpdaterPlugin extends Plugin {
3709
3864
  : initialDirectUpdateAllowed;
3710
3865
  startNewThread(() -> {
3711
3866
  try {
3867
+ if (CapacitorUpdaterPlugin.this.shouldBlockAutoUpdateForPreviewSession()) {
3868
+ CapacitorUpdaterPlugin.this.clearBackgroundDownloadState();
3869
+ return;
3870
+ }
3712
3871
  logger.info(
3713
3872
  "New bundle: " +
3714
3873
  latestVersionName +
@@ -3795,6 +3954,9 @@ public class CapacitorUpdaterPlugin extends Plugin {
3795
3954
 
3796
3955
  private void installNext() {
3797
3956
  try {
3957
+ if (this.shouldBlockAutoUpdateForPreviewSession()) {
3958
+ return;
3959
+ }
3798
3960
  String delayUpdatePreferences = prefs.getString(DelayUpdateUtils.DELAY_CONDITION_PREFERENCES, "[]");
3799
3961
  ArrayList<DelayCondition> delayConditionList = delayUpdateUtils.parseDelayConditions(delayUpdatePreferences);
3800
3962
  if (!delayConditionList.isEmpty()) {
@@ -3830,6 +3992,10 @@ public class CapacitorUpdaterPlugin extends Plugin {
3830
3992
  logger.info("Built-in bundle is active. We skip the check for notifyAppReady.");
3831
3993
  return;
3832
3994
  }
3995
+ if (this.isPreviewSessionStateActive()) {
3996
+ logger.info("Preview session is active. We skip the check for notifyAppReady.");
3997
+ return;
3998
+ }
3833
3999
  logger.debug("Current bundle is: " + current);
3834
4000
 
3835
4001
  if (BundleStatus.SUCCESS != current.getStatus()) {
@@ -4024,7 +4190,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
4024
4190
  }
4025
4191
  logger.info("Preview deeplink received while preview session is active; restoring fallback before routing");
4026
4192
  startNewThread(() -> {
4027
- final boolean didLeave = this.leavePreviewSessionFromShakeMenu();
4193
+ final boolean didLeave = this.leavePreviewSessionForIncomingPreviewLink();
4028
4194
  if (!didLeave) {
4029
4195
  logger.error("Could not leave preview session before routing incoming preview deeplink");
4030
4196
  this.isLeavingPreviewForIncomingLink = false;