fix plugin bug

pull/21/head
fengyuecanzhu 3 years ago
parent 179c4ffcc5
commit 1d5df732aa
  1. 20
      dynamic/src/main/java/xyz/fycz/dynamic/AppLoadImpl.kt

@ -73,9 +73,18 @@ class AppLoadImpl : IAppLoader {
}
}
}
if (sb.isNotEmpty()) sb.substring(0, sb.length - 1)
Log.i(spuName, "更新内容:$sb")
if (sb.isNotEmpty()) {
if (sb.endsWith("\n")) sb.substring(0, sb.length - 1)
val key = "fix244"
val hasRead = spu.getBoolean(key, false)
if (!hasRead) {
announce("插件更新", "更新内容:\n$sb", "fix244")
spu.edit().run {
putBoolean(key, true)
apply()
}
}
}
}
private fun announce(title: String, msg: String, key: String) {
@ -87,18 +96,11 @@ class AppLoadImpl : IAppLoader {
object : MethodHook() {
override fun afterHookedMethod(param: MapleBridge.MethodHookParam) {
val context = param.thisObject as Context
val hasRead = spu.getBoolean(key, false)
if (!hasRead) {
AlertDialog.Builder(context)
.setTitle(title)
.setMessage(msg)
.setPositiveButton("我知道了", null)
.create().show()
spu.edit().run {
putBoolean(key, true)
apply()
}
}
}
}
)

Loading…
Cancel
Save