From 393b123c9f44484d4b8e1de4da54b231276c455f Mon Sep 17 00:00:00 2001 From: fengyuecanzhu <1021300691@qq.com> Date: Thu, 31 Mar 2022 11:10:47 +0800 Subject: [PATCH] fix bug --- app/src/main/assets/updatelog.fy | 6 ++++++ .../sourceAnalyzer/BookSourceManager.java | 1 + .../myreader/ui/activity/SplashActivity.java | 4 +++- .../xyz/fycz/myreader/util/utils/AdUtils.java | 2 ++ .../main/java/xyz/fycz/dynamic/AppLoadImpl.kt | 20 ++++++++++++------- 5 files changed, 25 insertions(+), 8 deletions(-) diff --git a/app/src/main/assets/updatelog.fy b/app/src/main/assets/updatelog.fy index a2dc0d2..ef421d8 100644 --- a/app/src/main/assets/updatelog.fy +++ b/app/src/main/assets/updatelog.fy @@ -1,3 +1,9 @@ +2022.03.31 +风月读书v2.4.4 +更新内容: +1、修复软件无法打开的问题(超时时间为5s) +2、修复DIY书源重复显示订阅书源的问题 + 2022.03.29 风月读书v2.4.3 更新内容: diff --git a/app/src/main/java/xyz/fycz/myreader/model/sourceAnalyzer/BookSourceManager.java b/app/src/main/java/xyz/fycz/myreader/model/sourceAnalyzer/BookSourceManager.java index 0e64cd5..2f33e3b 100644 --- a/app/src/main/java/xyz/fycz/myreader/model/sourceAnalyzer/BookSourceManager.java +++ b/app/src/main/java/xyz/fycz/myreader/model/sourceAnalyzer/BookSourceManager.java @@ -184,6 +184,7 @@ public class BookSourceManager { */ public static List getAllNoLocalSource() { return DbManager.getDaoSession().getBookSourceDao().queryBuilder() + .where(BookSourceDao.Properties.SourceEName.isNull()) .where(BookSourceDao.Properties.SourceType.isNotNull()) .orderAsc(BookSourceDao.Properties.OrderNum) .list(); diff --git a/app/src/main/java/xyz/fycz/myreader/ui/activity/SplashActivity.java b/app/src/main/java/xyz/fycz/myreader/ui/activity/SplashActivity.java index f159d5f..8907205 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/activity/SplashActivity.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/activity/SplashActivity.java @@ -55,7 +55,7 @@ public class SplashActivity extends BaseActivity { private boolean hasStart = false; private boolean startToAd = false; private static final String INTENT_TO_AD = "startToAd"; - private int timeOut = 10; + private int timeOut = 5; private Handler handler = new Handler(); //创建子线程 @@ -225,6 +225,7 @@ public class SplashActivity extends BaseActivity { Log.d(TAG, "广告展示成功"); AdUtils.adRecord("splash", "adShow"); countTodayAd(); + SharedPreAdUtils.getInstance().putBoolean("adTimeOut", false); } // 广告被点击 @@ -368,6 +369,7 @@ public class SplashActivity extends BaseActivity { WAIT_INTERVAL = 0; SharedPreAdUtils.getInstance().putLong("splashAdTime", System.currentTimeMillis()); startNormal(); + SharedPreAdUtils.getInstance().putBoolean("adTimeOut", true); } else { handler.postDelayed(adTimeOutRunnable, 1000); } diff --git a/app/src/main/java/xyz/fycz/myreader/util/utils/AdUtils.java b/app/src/main/java/xyz/fycz/myreader/util/utils/AdUtils.java index 5282aef..e5699b5 100644 --- a/app/src/main/java/xyz/fycz/myreader/util/utils/AdUtils.java +++ b/app/src/main/java/xyz/fycz/myreader/util/utils/AdUtils.java @@ -182,6 +182,8 @@ public class AdUtils { public static boolean backSplashAd() { if (!adConfig.isUserHasAd()) return false; + boolean adTimeout = getSp().getBoolean("adTimeout"); + if (adTimeout) return false; long splashAdTime = getSp().getLong("splashAdTime"); long backTime = getSp().getLong("backTime"); long currentTime = System.currentTimeMillis(); diff --git a/dynamic/src/main/java/xyz/fycz/dynamic/AppLoadImpl.kt b/dynamic/src/main/java/xyz/fycz/dynamic/AppLoadImpl.kt index 7f25fe9..349e4ae 100644 --- a/dynamic/src/main/java/xyz/fycz/dynamic/AppLoadImpl.kt +++ b/dynamic/src/main/java/xyz/fycz/dynamic/AppLoadImpl.kt @@ -7,6 +7,7 @@ import me.fycz.maple.MapleBridge import me.fycz.maple.MapleUtils import me.fycz.maple.MethodHook import xyz.fycz.myreader.application.App +import xyz.fycz.myreader.ui.activity.MainActivity import xyz.fycz.myreader.util.utils.AdUtils /** @@ -20,8 +21,11 @@ class AppLoadImpl : IAppLoader { override fun onLoad(appParam: AppParam) { if (App.getVersionCode() == 243) { val key = "2022-03-31" + var fx1 = false + var fx2 = false try { App243Fix.fixGetAllNoLocalSource() + fx1 = true fixResult(key, "getAllNoLocalSource", true) } catch (e: Exception) { MapleUtils.log(e) @@ -29,19 +33,22 @@ class AppLoadImpl : IAppLoader { } try { App243Fix.fixAdTimeout() + fx2 = true fixResult(key, "adTimeout", true) } catch (e: Exception) { MapleUtils.log(e) fixResult(key, "adTimeout", false) } + val msg = "$key\n更新内容:\n1、修复软件无法打开的问题(超时时间为5s):$fx1\n" + + "2、修复DIY书源重复显示订阅书源的问题:$fx2" + announce("插件更新", msg, key) } } - private fun announce(appParam: AppParam, title: String, msg: String, key: String) { + private fun announce(title: String, msg: String, key: String) { try { MapleUtils.findAndHookMethod( - "xyz.fycz.myreader.ui.activity.MainActivity", - appParam.classLoader, + MainActivity::class.java, "onCreate", Bundle::class.java, object : MethodHook() { @@ -52,14 +59,13 @@ class AppLoadImpl : IAppLoader { AlertDialog.Builder(context) .setTitle(title) .setMessage(msg) - .setPositiveButton("我知道了") { _, _ -> - - }.create().show() + .setPositiveButton("我知道了", null) + .create().show() spu.edit().run { putBoolean(key, true) apply() } - AdUtils.adRecord("plugin", "adSuccess") + AdUtils.adRecord("plugin", "fxRecord") } } }