From 2cd84538770f4d42727d86c008994868bcc8c399 Mon Sep 17 00:00:00 2001 From: Rifat Azad Date: Thu, 26 Jun 2025 23:25:37 +0600 Subject: [PATCH] Revert "manager: move the wx platform init to the Application class so it starts as soon as the app process launches" This reverts commit d5c4f85d73c9d3c5d2b4b4a01fbc966fc47e09a0. --- .../java/com/rifsxd/ksunext/KernelSUApplication.kt | 13 ------------- .../main/java/com/rifsxd/ksunext/ui/MainActivity.kt | 6 ++++++ 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/manager/app/src/main/java/com/rifsxd/ksunext/KernelSUApplication.kt b/manager/app/src/main/java/com/rifsxd/ksunext/KernelSUApplication.kt index 95a700ef..acdaa507 100644 --- a/manager/app/src/main/java/com/rifsxd/ksunext/KernelSUApplication.kt +++ b/manager/app/src/main/java/com/rifsxd/ksunext/KernelSUApplication.kt @@ -11,10 +11,6 @@ import okhttp3.Cache import okhttp3.OkHttpClient import java.io.File import java.util.Locale -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.GlobalScope -import kotlinx.coroutines.launch -import com.rifsxd.ksunext.ui.webui.initPlatform lateinit var ksuApp: KernelSUApplication @@ -28,9 +24,6 @@ class KernelSUApplication : Application() { Platform.setHiddenApiExemptions() - // Pre-initialize WX Platform as early as possible - launchPlatformInit() - val context = this val iconSize = resources.getDimensionPixelSize(android.R.dimen.app_icon_size) Coil.setImageLoader( @@ -61,11 +54,5 @@ class KernelSUApplication : Application() { }.build() } - private fun launchPlatformInit() { - // Use a coroutine to avoid blocking the main thread - GlobalScope.launch(Dispatchers.IO) { - initPlatform() - } - } } diff --git a/manager/app/src/main/java/com/rifsxd/ksunext/ui/MainActivity.kt b/manager/app/src/main/java/com/rifsxd/ksunext/ui/MainActivity.kt index 2551cb66..f54029b3 100644 --- a/manager/app/src/main/java/com/rifsxd/ksunext/ui/MainActivity.kt +++ b/manager/app/src/main/java/com/rifsxd/ksunext/ui/MainActivity.kt @@ -63,6 +63,7 @@ import com.rifsxd.ksunext.ui.util.install import com.rifsxd.ksunext.ui.util.isSuCompatDisabled import com.rifsxd.ksunext.ui.screen.FlashIt import com.rifsxd.ksunext.ui.viewmodel.ModuleViewModel +import com.rifsxd.ksunext.ui.webui.initPlatform class MainActivity : ComponentActivity() { @@ -139,6 +140,11 @@ class MainActivity : ComponentActivity() { else -> true } + // pre-init platform to faster start WebUI X activities + LaunchedEffect(Unit) { + initPlatform() + } + Scaffold( bottomBar = { AnimatedVisibility(