Fix AppLock bug (#200, #201, #202)

Fix Managed configuration item ordering (#198)
Remove app from list after uninstall (#205)
This commit is contained in:
BinTianqi
2025-11-26 13:11:33 +08:00
parent a716c4bf2d
commit ed6908a5cd
6 changed files with 43 additions and 15 deletions

View File

@@ -158,10 +158,10 @@ class MyViewModel(application: Application): AndroidViewModel(application) {
return AppLockConfig(passwordHash?.ifEmpty { null }, SP.biometricsUnlock, SP.lockWhenLeaving)
}
fun setAppLockConfig(config: AppLockConfig) {
SP.lockPasswordHash = if (config.password == null) {
""
} else {
config.password.hash()
if (config.password == null) {
SP.lockPasswordHash = ""
} else if (!config.password.isEmpty()) {
SP.lockPasswordHash = config.password.hash()
}
SP.biometricsUnlock = config.biometrics
SP.lockWhenLeaving = config.whenLeaving
@@ -359,8 +359,11 @@ class MyViewModel(application: Application): AndroidViewModel(application) {
context.startActivity(intent.getParcelableExtra(Intent.EXTRA_INTENT) as Intent?)
} else {
context.unregisterReceiver(this)
if(statusExtra == PackageInstaller.STATUS_SUCCESS) {
if (statusExtra == PackageInstaller.STATUS_SUCCESS) {
onComplete(null)
installedPackages.update { pkg ->
pkg.filter { it.name != packageName }
}
} else {
onComplete(parsePackageInstallerMessage(context, intent))
}