From 0ad7fd81965ac8d5420674c3d38e6732ca91d2e3 Mon Sep 17 00:00:00 2001 From: s mz <69295615+smz202000@users.noreply.github.com> Date: Fri, 17 Jul 2026 15:28:04 +0800 Subject: [PATCH] Move delayed update trigger from onPause to onDestroy Previously, delayed APK updates were triggered in onPause(), which also fires when entering PiP mode or switching activities (e.g., Manage Accounts). This caused unexpected update installations. Moved the trigger to onDestroy() so updates only install when the activity is actually being destroyed (e.g., user exits the app), avoiding the inconsistent behavior. Fixes #1282 --- .../main/java/com/lagradost/cloudstream3/MainActivity.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt b/app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt index 5d39f6554cd..b050a9d2006 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt @@ -653,10 +653,6 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener, BiometricCa override fun onPause() { super.onPause() - // Start any delayed updates - if (ApkInstaller.delayedInstaller?.startInstallation() == true) { - Toast.makeText(this, R.string.update_started, Toast.LENGTH_LONG).show() - } try { if (isCastApiAvailable()) { mSessionManager?.removeSessionManagerListener(mSessionManagerListener) @@ -711,6 +707,11 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener, BiometricCa } override fun onDestroy() { + // Start any delayed updates + if (ApkInstaller.delayedInstaller?.startInstallation() == true) { + Toast.makeText(this, R.string.update_started, Toast.LENGTH_LONG).show() + } + filesToDelete.forEach { path -> val result = File(path).deleteRecursively() if (result) {