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

Loading…
Cancel
Save