fix: lspatch metadata decode crash
Co-Authored-By: o0kam1 <duzhaokun2@outlook.com>
This commit is contained in:
parent
b4d1726708
commit
155a76a43e
|
|
@ -51,10 +51,10 @@ val verCode by extra(commitCount)
|
|||
val verName by extra("0.7.1")
|
||||
val coreVerCode by extra(coreCommitCount)
|
||||
val coreVerName by extra(coreLatestTag)
|
||||
val androidMinSdkVersion by extra(28)
|
||||
val androidMinSdkVersion by extra(27)
|
||||
val androidTargetSdkVersion by extra(36)
|
||||
val androidCompileSdkVersion by extra(36)
|
||||
val androidCompileNdkVersion by extra("29.0.13113456")
|
||||
val androidCompileNdkVersion by extra("29.0.13846066")
|
||||
val androidBuildToolsVersion by extra("36.0.0")
|
||||
val androidSourceCompatibility by extra(JavaVersion.VERSION_21)
|
||||
val androidTargetCompatibility by extra(JavaVersion.VERSION_21)
|
||||
|
|
|
|||
|
|
@ -40,11 +40,14 @@ class AppManageViewModel : ViewModel() {
|
|||
|
||||
val appList: List<Pair<AppInfo, PatchConfig>> by derivedStateOf {
|
||||
LSPPackageManager.appList.mapNotNull { appInfo ->
|
||||
appInfo.app.metaData?.getString("lspatch")?.let {
|
||||
val json = Base64.decode(it, Base64.DEFAULT).toString(Charsets.UTF_8)
|
||||
Log.d(TAG, "Read patched config: $json")
|
||||
appInfo to Gson().fromJson(json, PatchConfig::class.java)
|
||||
}
|
||||
runCatching {
|
||||
appInfo.app.metaData?.getString("lspatch")?.let {
|
||||
val json = Base64.decode(it, Base64.DEFAULT).toString(Charsets.UTF_8)
|
||||
Log.d(TAG, "Read patched config: $json")
|
||||
val config = Gson().fromJson(json, PatchConfig::class.java)
|
||||
if (config?.lspConfig == null) null else appInfo to config
|
||||
}
|
||||
}.getOrNull()
|
||||
}.also {
|
||||
Log.d(TAG, "Loaded ${it.size} patched apps")
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue