Revert "manager: move the wx platform init to the Application class so it starts as soon as the app process launches"

This reverts commit d5c4f85d73.
This commit is contained in:
Rifat Azad
2025-06-26 23:25:37 +06:00
parent b7300b0525
commit 2cd8453877
2 changed files with 6 additions and 13 deletions

View File

@@ -11,10 +11,6 @@ import okhttp3.Cache
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import java.io.File import java.io.File
import java.util.Locale 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 lateinit var ksuApp: KernelSUApplication
@@ -28,9 +24,6 @@ class KernelSUApplication : Application() {
Platform.setHiddenApiExemptions() Platform.setHiddenApiExemptions()
// Pre-initialize WX Platform as early as possible
launchPlatformInit()
val context = this val context = this
val iconSize = resources.getDimensionPixelSize(android.R.dimen.app_icon_size) val iconSize = resources.getDimensionPixelSize(android.R.dimen.app_icon_size)
Coil.setImageLoader( Coil.setImageLoader(
@@ -61,11 +54,5 @@ class KernelSUApplication : Application() {
}.build() }.build()
} }
private fun launchPlatformInit() {
// Use a coroutine to avoid blocking the main thread
GlobalScope.launch(Dispatchers.IO) {
initPlatform()
}
}
} }

View File

@@ -63,6 +63,7 @@ import com.rifsxd.ksunext.ui.util.install
import com.rifsxd.ksunext.ui.util.isSuCompatDisabled import com.rifsxd.ksunext.ui.util.isSuCompatDisabled
import com.rifsxd.ksunext.ui.screen.FlashIt import com.rifsxd.ksunext.ui.screen.FlashIt
import com.rifsxd.ksunext.ui.viewmodel.ModuleViewModel import com.rifsxd.ksunext.ui.viewmodel.ModuleViewModel
import com.rifsxd.ksunext.ui.webui.initPlatform
class MainActivity : ComponentActivity() { class MainActivity : ComponentActivity() {
@@ -139,6 +140,11 @@ class MainActivity : ComponentActivity() {
else -> true else -> true
} }
// pre-init platform to faster start WebUI X activities
LaunchedEffect(Unit) {
initPlatform()
}
Scaffold( Scaffold(
bottomBar = { bottomBar = {
AnimatedVisibility( AnimatedVisibility(