Optimize code

New Privilege object, which follows Application lifecycle.
Add Privilege.DPM and Privilege.DAR variable, instead of creating DPM and DAR instance every time.
This commit is contained in:
BinTianqi
2025-08-29 20:58:39 +08:00
parent 10ac570818
commit 6f54bf576f
22 changed files with 496 additions and 687 deletions

View File

@@ -125,7 +125,6 @@ private fun AppInstaller(
result: Intent? = null,
onResultDialogClose: () -> Unit = {}
) {
val context = LocalContext.current
var appLockDialog by rememberSaveable { mutableStateOf(false) }
val coroutine = rememberCoroutineScope()
Scaffold(
@@ -142,7 +141,7 @@ private fun AppInstaller(
else Icon(Icons.Default.PlayArrow, null)
},
onClick = {
if(SharedPrefs(context).lockPasswordHash.isNullOrEmpty()) onStartInstall() else appLockDialog = true
if(SP.lockPasswordHash.isNullOrEmpty()) onStartInstall() else appLockDialog = true
},
expanded = !installing
)