Refactor to Compose based UI

This commit is contained in:
世界
2025-12-13 20:16:37 +08:00
parent f3763ba71d
commit 19da240d5b
164 changed files with 22460 additions and 1352 deletions
@@ -16,6 +16,7 @@ import io.nekohasekai.libbox.SetupOptions
import io.nekohasekai.sfa.bg.AppChangeReceiver
import io.nekohasekai.sfa.bg.UpdateProfileWork
import io.nekohasekai.sfa.constant.Bugs
import io.nekohasekai.sfa.vendor.Vendor
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
@@ -24,7 +25,6 @@ import java.util.Locale
import io.nekohasekai.sfa.Application as BoxApplication
class Application : Application() {
override fun attachBaseContext(base: Context?) {
super.attachBaseContext(base)
application = this
@@ -42,11 +42,17 @@ class Application : Application() {
UpdateProfileWork.reconfigureUpdater()
}
registerReceiver(AppChangeReceiver(), IntentFilter().apply {
addAction(Intent.ACTION_PACKAGE_ADDED)
addDataScheme("package")
})
// Only register AppChangeReceiver if Per-app Proxy is available
// This receiver needs QUERY_ALL_PACKAGES permission to function
if (Vendor.isPerAppProxyAvailable()) {
registerReceiver(
AppChangeReceiver(),
IntentFilter().apply {
addAction(Intent.ACTION_PACKAGE_ADDED)
addDataScheme("package")
},
)
}
}
private fun initialize() {
@@ -56,12 +62,16 @@ class Application : Application() {
workingDir.mkdirs()
val tempDir = cacheDir
tempDir.mkdirs()
Libbox.setup(SetupOptions().also {
it.basePath = baseDir.path
it.workingPath = workingDir.path
it.tempPath = tempDir.path
it.fixAndroidStack = Bugs.fixAndroidStack
})
Libbox.setup(
SetupOptions().also {
it.basePath = baseDir.path
it.workingPath = workingDir.path
it.tempPath = tempDir.path
it.fixAndroidStack = Bugs.fixAndroidStack
it.logMaxLines = 3000
it.debug = BuildConfig.DEBUG
},
)
Libbox.redirectStderr(File(workingDir, "stderr.log").path)
}
@@ -75,5 +85,4 @@ class Application : Application() {
val wifiManager by lazy { application.getSystemService<WifiManager>()!! }
val clipboard by lazy { application.getSystemService<ClipboardManager>()!! }
}
}
}