diff --git a/app/src/test/java/Test.java b/app/src/test/java/Test.java index fed06b6..4a208b0 100644 --- a/app/src/test/java/Test.java +++ b/app/src/test/java/Test.java @@ -135,7 +135,7 @@ public class Test { @org.junit.Test public void md5(){ - File file = new File("D:\\Java\\AndroidSdk\\build-tools\\29.0.3\\dynamic_v1.0.3.dex"); + File file = new File("D:\\Java\\AndroidSdk\\build-tools\\29.0.3\\dynamic_v1.0.4.dex"); System.out.println(MD5Utils.INSTANCE.getFileMD5s(file, 32)); } } diff --git a/dynamic/src/main/java/xyz/fycz/dynamic/AppLoadImpl.kt b/dynamic/src/main/java/xyz/fycz/dynamic/AppLoadImpl.kt index b1ab9cc..9380aa7 100644 --- a/dynamic/src/main/java/xyz/fycz/dynamic/AppLoadImpl.kt +++ b/dynamic/src/main/java/xyz/fycz/dynamic/AppLoadImpl.kt @@ -22,13 +22,13 @@ import android.app.AlertDialog import android.content.Context import android.content.SharedPreferences import android.os.Bundle +import android.util.Log import me.fycz.maple.MapleBridge import me.fycz.maple.MapleUtils import me.fycz.maple.MethodHook import xyz.fycz.dynamic.fix.App243Fix import xyz.fycz.dynamic.fix.App244Fix import xyz.fycz.dynamic.fix.AppFix -import xyz.fycz.dynamic.fix.AppFixHandle import xyz.fycz.myreader.application.App import xyz.fycz.myreader.ui.activity.MainActivity import xyz.fycz.myreader.util.utils.AdUtils @@ -52,27 +52,30 @@ class AppLoadImpl : IAppLoader { override fun onLoad(appParam: AppParam) { val sb = StringBuilder() - var index = 1 fixList.forEach { val annotation = it.getAnnotation(AppFix::class.java)!! - annotation.version.forEach { version -> + for (version in annotation.versions){ if (App.getVersionCode() == version) { val fix = it.newInstance() val fixResult = fix.onFix(annotation.date) if (!spu.getBoolean(annotation.date, false)) { + if (sb.isNotEmpty()) sb.append("\n") + sb.append("${annotation.date}\n") fixResult.forEachIndexed { i, b -> - sb.append("${index++}、${annotation.fixLog[i]}:${if (b) "成功" else "失败"}\n") + sb.append("${i+1}、${annotation.fixLog[i]}:${if (b) "成功" else "失败"}\n") } spu.edit().run { putBoolean(annotation.date, true) apply() } } + break } } } - if (sb.lastIndexOf("\n") > 0) sb.substring(0, sb.length - 1) - announce("插件更新", "2022-04-25更新内容:\n$sb", "fix244") + if (sb.isNotEmpty()) sb.substring(0, sb.length - 1) + Log.i(spuName, "更新内容:$sb") + announce("插件更新", "更新内容:\n$sb", "fix244") } private fun announce(title: String, msg: String, key: String) { @@ -95,7 +98,6 @@ class AppLoadImpl : IAppLoader { putBoolean(key, true) apply() } - AdUtils.adRecord("plugin", "fxRecord") } } } diff --git a/dynamic/src/main/java/xyz/fycz/dynamic/fix/App244Fix.kt b/dynamic/src/main/java/xyz/fycz/dynamic/fix/App244Fix.kt index a403529..7b4d62b 100644 --- a/dynamic/src/main/java/xyz/fycz/dynamic/fix/App244Fix.kt +++ b/dynamic/src/main/java/xyz/fycz/dynamic/fix/App244Fix.kt @@ -18,7 +18,6 @@ package xyz.fycz.dynamic.fix -import android.text.TextUtils import me.fycz.maple.MapleBridge import me.fycz.maple.MapleUtils import me.fycz.maple.MethodReplacement @@ -34,7 +33,7 @@ import java.io.* * @author fengyue * @date 2022/4/25 23:00 */ -@AppFix([243, 244], ["修复书籍无法导出缓存的问题"], "2022-04-25") +@AppFix([243, 244], ["修复书籍无法导出缓存的问题"], "2022-04-26") class App244Fix: AppFixHandle { override fun onFix(key: String): BooleanArray { var fx = false @@ -44,7 +43,7 @@ class App244Fix: AppFixHandle { fixResult(key, "unionChapterCathe", true) } catch (e: Exception) { MapleUtils.log(e) - fixResult(key, "getAllNoLocalSource", false) + fixResult(key, "unionChapterCathe", false) } return booleanArrayOf(fx) } @@ -77,12 +76,12 @@ class App244Fix: AppFixHandle { val filePath = APPCONST.TXT_BOOK_DIR + book.name + (if (book.author.isNullOrEmpty()) "" else " 作者:" + book.author) + ".txt" bw = BufferedWriter(FileWriter(FileUtils.getFile(filePath))) - bw.write("《${book.name}》") + bw.write("《${book.name}》\n") if (!book.author.isNullOrEmpty()) { - bw.write("作者:${book.author}") + bw.write("作者:${book.author}\n") } if (!book.desc.isNullOrEmpty()) { - bw.write("简介:${book.desc}") + bw.write("简介:\n${book.desc}\n") } bw.newLine() for (chapter in chapters) { diff --git a/dynamic/src/main/java/xyz/fycz/dynamic/fix/AppFix.kt b/dynamic/src/main/java/xyz/fycz/dynamic/fix/AppFix.kt index 49b36c5..6302026 100644 --- a/dynamic/src/main/java/xyz/fycz/dynamic/fix/AppFix.kt +++ b/dynamic/src/main/java/xyz/fycz/dynamic/fix/AppFix.kt @@ -23,7 +23,7 @@ package xyz.fycz.dynamic.fix * @date 2022/4/25 22:05 */ annotation class AppFix( - val version: IntArray = [], + val versions: IntArray = [], val fixLog: Array = [], val date: String = "" )