pull/21/head
fengyuecanzhu 3 years ago
parent c0ab2323b8
commit 87d7680d46
  1. 3
      app/src/main/assets/updatelog.fy
  2. 6
      app/src/main/java/xyz/fycz/myreader/entity/PluginConfig.kt
  3. 1
      app/src/main/java/xyz/fycz/myreader/ui/activity/SplashActivity.java
  4. 12
      app/src/main/java/xyz/fycz/myreader/util/utils/PluginUtils.kt
  5. 9
      app/src/test/java/Test.java
  6. 2
      app/version_code.properties
  7. 25
      dynamic/src/main/java/xyz/fycz/dynamic/AppLoadImpl.kt

@ -1,6 +1,9 @@
2022.03.29
风月读书v2.4.3
更新内容:
1、修复存在同名章节时后面章节内容加载前面章节的问题
2、修复启动页面加载超时的问题
3、新增动态插件
2022.03.25
风月读书v2.4.2

@ -9,5 +9,9 @@ data class PluginConfig(
val versionCode: Int,
val version: String,
val url: String,
val md5: String,//32位
val changelog: String
)
) {
constructor(name: String, versionCode: Int) :
this(name, versionCode, "", "", "", "")
}

@ -366,6 +366,7 @@ public class SplashActivity extends BaseActivity<ActivitySplashBinding> {
private void adTimeout(int time) {
if (time == 0) {
WAIT_INTERVAL = 0;
SharedPreAdUtils.getInstance().putLong("splashAdTime", System.currentTimeMillis());
startNormal();
} else {
handler.postDelayed(adTimeOutRunnable, 1000);

@ -17,6 +17,7 @@ import xyz.fycz.myreader.model.third3.http.text
import xyz.fycz.myreader.util.SharedPreUtils
import xyz.fycz.myreader.util.ToastUtils
import java.io.File
import java.util.*
/**
@ -38,7 +39,7 @@ object PluginUtils {
config = GSON.fromJsonObject<PluginConfig>(configJson)
val oldConfig = GSON.fromJsonObject<PluginConfig>(
SharedPreUtils.getInstance().getString("pluginConfig")
) ?: PluginConfig("dynamic.dex", 100, "", "", "")
) ?: PluginConfig("dynamic.dex", 100)
if (config != null) {
if (config!!.versionCode > oldConfig.versionCode) {
downloadPlugin(config!!)
@ -47,6 +48,11 @@ object PluginUtils {
} else {
config = oldConfig
}
if (config!!.md5.lowercase(Locale.getDefault())
!= getPluginMD5(config!!)?.lowercase(Locale.getDefault())
) {
downloadPlugin(config!!)
}
}.onSuccess {
loadAppLoader(App.getmContext(), config)
}
@ -60,6 +66,10 @@ object PluginUtils {
.writeBytes(res.byteStream().readBytes())
}
private fun getPluginMD5(config: PluginConfig): String? {
return MD5Utils.getFileMD5s(FileUtils.getFile(APPCONST.PLUGIN_DIR_PATH + config.name), 32)
}
private fun loadAppLoader(context: Context, config: PluginConfig?) {
config?.let {
val pluginPath = APPCONST.PLUGIN_DIR_PATH + it.name

@ -7,6 +7,7 @@ import java.util.List;
import xyz.fycz.myreader.model.sourceAnalyzer.BaseAnalyzer;
import xyz.fycz.myreader.util.utils.FileUtils;
import xyz.fycz.myreader.util.utils.MD5Utils;
import xyz.fycz.myreader.util.utils.NetworkUtils;
/**
@ -114,7 +115,9 @@ public class Test {
//}
}
@org.junit.Test
public void md5(){
File file = new File("D:\\Java\\AndroidSdk\\build-tools\\29.0.3\\dynamic_v1.0.2.dex");
System.out.println(MD5Utils.INSTANCE.getFileMD5s(file, 32));
}
}

@ -1,3 +1,3 @@
#Fri Jun 18 21:45:31 CST 2021
VERSION_CODE=242
VERSION_CODE=243
NEED_CREATE_RELEASE=true

@ -1,5 +1,8 @@
package xyz.fycz.dynamic
import android.app.AlertDialog
import android.content.Context
import android.os.Bundle
import me.fycz.maple.MapleBridge
import me.fycz.maple.MapleUtils
import me.fycz.maple.MethodHook
@ -11,7 +14,7 @@ import me.fycz.maple.MethodReplacement
*/
class AppLoadImpl : IAppLoader {
override fun onLoad(appParam: AppParam) {
try {
/*try {
MapleUtils.findAndHookMethod(
"xyz.fycz.myreader.util.utils.AdUtils",
appParam.classLoader,
@ -34,5 +37,25 @@ class AppLoadImpl : IAppLoader {
e.printStackTrace()
MapleUtils.log(e)
}
try {
MapleUtils.findAndHookMethod(
"xyz.fycz.myreader.ui.activity.MainActivity",
appParam.classLoader,
"onCreate",
Bundle::class.java,
object : MethodHook() {
override fun afterHookedMethod(param: MapleBridge.MethodHookParam) {
AlertDialog.Builder(param.thisObject as Context)
.setTitle("风月读书插件")
.setMessage("此消息由风月读书插件提供")
.create().show()
}
}
)
} catch (e: Exception) {
e.printStackTrace()
MapleUtils.log(e)
}*/
}
}
Loading…
Cancel
Save