update plugin

pull/21/head
fengyuecanzhu 3 years ago
parent 3e9a432a09
commit 1459b452e7
  1. 2
      app/src/test/java/Test.java
  2. 16
      dynamic/src/main/java/xyz/fycz/dynamic/AppLoadImpl.kt
  3. 11
      dynamic/src/main/java/xyz/fycz/dynamic/fix/App244Fix.kt
  4. 2
      dynamic/src/main/java/xyz/fycz/dynamic/fix/AppFix.kt

@ -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));
}
}

@ -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")
}
}
}

@ -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) {

@ -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<String> = [],
val date: String = ""
)

Loading…
Cancel
Save