VancedManager/app/src/main/java/com/vanced/manager/core/App.kt

35 lines
1.1 KiB
Kotlin
Raw Normal View History

package com.vanced.manager.core
import android.app.Application
2020-09-25 17:01:24 +00:00
import androidx.preference.PreferenceManager.getDefaultSharedPreferences
2021-10-08 13:31:47 +00:00
import com.topjohnwu.superuser.Shell
import com.vanced.manager.BuildConfig
2021-01-16 17:00:38 +00:00
import com.vanced.manager.utils.loadJson
import com.vanced.manager.utils.managerAccent
import com.vanced.manager.utils.mutableAccentColor
2020-11-15 17:04:23 +00:00
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.launch
2021-10-08 11:19:15 +00:00
class App : Application() {
2020-11-02 15:53:12 +00:00
private val prefs by lazy { getDefaultSharedPreferences(this) }
private val scope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
2020-11-02 15:53:12 +00:00
override fun onCreate() {
scope.launch { loadJson(this@App) }
2020-09-20 14:41:28 +00:00
super.onCreate()
mutableAccentColor.value = prefs.managerAccent
2021-10-08 13:31:47 +00:00
Shell.enableVerboseLogging = BuildConfig.DEBUG
Shell.setDefaultBuilder(
Shell.Builder
.create()
.setFlags(Shell.FLAG_REDIRECT_STDERR)
2021-10-11 11:00:51 +00:00
//.setInitializers(BusyBoxInstaller::class.java) //TODO fix busybox
2021-10-08 13:31:47 +00:00
.setTimeout(10)
)
2020-07-06 11:38:00 +00:00
}
2020-08-12 13:40:13 +00:00
}