From 359d210c6bfc92f6e0a34ff2e3341364670276bb Mon Sep 17 00:00:00 2001 From: fengyuecanzhu <1021300691@qq.com> Date: Sun, 22 May 2022 22:07:44 +0800 Subject: [PATCH 1/5] fix build --- .github/workflows/build.yml | 2 +- app/version_code.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ccfb6dd..5c3695c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,7 +37,7 @@ jobs: echo need_create_release=$CREATE_RELEASE echo version_name=$versionN - if [ $NEED_CREATE_RELEASE == 'true' -a ${{ github.ref }} == 'refs/heads/master' ];then + if [ $CREATE_RELEASE == 'true' -a ${{ github.ref }} == 'refs/heads/master' ];then echo ::set-output name=lanzou_folder_id::"1608604" echo ::set-output name=lanzou_share_url::"https://fycz.lanzoui.com/b00ngso7e" else diff --git a/app/version_code.properties b/app/version_code.properties index a50cefc..6e84c85 100644 --- a/app/version_code.properties +++ b/app/version_code.properties @@ -18,4 +18,4 @@ #Fri Jun 18 21:45:31 CST 2021 VERSION_CODE=245 -CREATE_RELEASE=true \ No newline at end of file +CREATE_RELEASE=false \ No newline at end of file From 56ffb9ce9c43dfc97e735341632a848c66c760d3 Mon Sep 17 00:00:00 2001 From: fengyuecanzhu <1021300691@qq.com> Date: Mon, 23 May 2022 18:46:18 +0800 Subject: [PATCH 2/5] change makeAuth --- .gitignore | 1 + .idea/gradle.xml | 1 + .idea/modules.xml | 4 + .../fycz/myreader/model/user/UserService.kt | 3 +- build.gradle | 4 + .../main/java/xyz/fycz/dynamic/AppLoadImpl.kt | 6 +- .../java/xyz/fycz/dynamic/fix/App245Fix.kt | 81 +++++++++++++++++++ settings.gradle | 1 + 8 files changed, 96 insertions(+), 5 deletions(-) create mode 100644 dynamic/src/main/java/xyz/fycz/dynamic/fix/App245Fix.kt diff --git a/.gitignore b/.gitignore index ba63cba..1d39116 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ .DS_Store /build /captures +/user .externalNativeBuild keystore # Compiled class file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 2818960..d16e683 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -14,6 +14,7 @@ diff --git a/.idea/modules.xml b/.idea/modules.xml index 8bd560e..a847a9a 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -15,6 +15,10 @@ + + + + \ No newline at end of file diff --git a/app/src/main/java/xyz/fycz/myreader/model/user/UserService.kt b/app/src/main/java/xyz/fycz/myreader/model/user/UserService.kt index b4a5baf..7aceaf4 100644 --- a/app/src/main/java/xyz/fycz/myreader/model/user/UserService.kt +++ b/app/src/main/java/xyz/fycz/myreader/model/user/UserService.kt @@ -266,6 +266,7 @@ object UserService { App.getApplication().packageName, AppInfoUtils.SHA1 ) + "&appVersion=" + App.getVersionCode() + - "&deviceId=" + getUUID() + "&isDebug=" + App.isDebug() + "&isDebug=" + App.isDebug() + + "&deviceId=" + getUUID() } } \ No newline at end of file diff --git a/build.gradle b/build.gradle index e372b7b..c0a5b9e 100644 --- a/build.gradle +++ b/build.gradle @@ -34,6 +34,10 @@ buildscript { classpath 'org.greenrobot:greendao-gradle-plugin:3.3.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' + + classpath 'com.github.megatronking.stringfog:gradle-plugin:3.0.0' + // 选用加解密算法库,默认实现了xor算法,也可以使用自己的加解密库。 + classpath 'com.github.megatronking.stringfog:xor:3.0.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } diff --git a/dynamic/src/main/java/xyz/fycz/dynamic/AppLoadImpl.kt b/dynamic/src/main/java/xyz/fycz/dynamic/AppLoadImpl.kt index b3d299c..69f485a 100644 --- a/dynamic/src/main/java/xyz/fycz/dynamic/AppLoadImpl.kt +++ b/dynamic/src/main/java/xyz/fycz/dynamic/AppLoadImpl.kt @@ -26,10 +26,7 @@ import com.kongzue.dialogx.dialogs.BottomDialog 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.App244Fix2 -import xyz.fycz.dynamic.fix.AppFix +import xyz.fycz.dynamic.fix.* import xyz.fycz.myreader.application.App import xyz.fycz.myreader.ui.activity.MainActivity @@ -49,6 +46,7 @@ class AppLoadImpl : IAppLoader { App243Fix::class.java, App244Fix::class.java, App244Fix2::class.java, + App245Fix::class.java, ) override fun onLoad(appParam: AppParam) { diff --git a/dynamic/src/main/java/xyz/fycz/dynamic/fix/App245Fix.kt b/dynamic/src/main/java/xyz/fycz/dynamic/fix/App245Fix.kt new file mode 100644 index 0000000..16b986f --- /dev/null +++ b/dynamic/src/main/java/xyz/fycz/dynamic/fix/App245Fix.kt @@ -0,0 +1,81 @@ +/* + * This file is part of FYReader. + * FYReader is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * FYReader is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with FYReader. If not, see . + * + * Copyright (C) 2020 - 2022 fengyuecanzhu + */ + +package xyz.fycz.dynamic.fix + +import me.fycz.maple.MapleBridge +import me.fycz.maple.MapleUtils +import me.fycz.maple.MethodReplacement +import xyz.fycz.myreader.application.App +import xyz.fycz.myreader.model.user.UserService +import xyz.fycz.myreader.util.AppInfoUtils +import xyz.fycz.myreader.util.utils.EncoderUtils + +/** + * @author fengyue + * @date 2022/5/23 18:20 + */ +@AppFix([243, 244, 245], ["修改用户服务验证机制(beta)"], "2022-05-23") +class App245Fix : AppFixHandle { + + override fun onFix(key: String): BooleanArray { + val result = try { + fixMakeAuth() + true + } catch (e: Exception) { + MapleUtils.log(e) + false + } + fixResult(key, "makeAuth", result) + return booleanArrayOf(result) + } + + private fun fixMakeAuth() { + MapleUtils.findAndHookMethod( + UserService::class.java, + "makeAuth", + object : MethodReplacement() { + override fun replaceHookedMethod(param: MapleBridge.MethodHookParam): Any { + return makeAuth() + } + } + ) + } + + fun makeAuth(): String { + var auth = "signal=" + AppInfoUtils.getSingInfo( + App.getmContext(), + App.getApplication().packageName, + AppInfoUtils.SHA1 + ) + "&appVersion=" + App.getVersionCode() + auth = try { + EncoderUtils.encryptAES2Base64( + auth.toByteArray(), DO_FILTER_KEY, + "AES/ECB/PKCS5Padding" + )?.let { String(it) }.toString() + } catch (e: Exception) { + "" + } + return "&auth=$auth" + + "&deviceId=" + UserService.getUUID() + + "&isDebug=" + App.isDebug() + } + + val DO_FILTER_KEY = "79qdunN8534y44T3".toByteArray() + +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 896738c..7c5b224 100644 --- a/settings.gradle +++ b/settings.gradle @@ -19,3 +19,4 @@ include ':app' include ':DialogX' include ':dynamic' +include ':user' From ac4bdde1b90a07a76a0a5ed45ab6ce7831f3d593 Mon Sep 17 00:00:00 2001 From: fengyuecanzhu <1021300691@qq.com> Date: Sat, 28 May 2022 21:51:14 +0800 Subject: [PATCH 3/5] fix search --- .../ui/activity/SearchBookActivity.java | 43 +++++++++---------- .../fycz/myreader/ui/adapter/SearchAdapter.kt | 31 ++++++------- build.gradle | 3 ++ 3 files changed, 40 insertions(+), 37 deletions(-) diff --git a/app/src/main/java/xyz/fycz/myreader/ui/activity/SearchBookActivity.java b/app/src/main/java/xyz/fycz/myreader/ui/activity/SearchBookActivity.java index 18cb0de..44d5d96 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/activity/SearchBookActivity.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/activity/SearchBookActivity.java @@ -156,6 +156,25 @@ public class SearchBookActivity extends BaseActivity } } + @Override + protected void onStop() { + if (mSearchBookAdapter != null) { + mSearchBookAdapter.setStop(true); + } + super.onStop(); + } + + @Override + protected void onStart() { + super.onStart(); + if (mSearchBookAdapter != null) { + mSearchBookAdapter.setStop(false); + if (showBooks) { + mSearchBookAdapter.addAll(new ArrayList<>(), searchKey); + } + } + } + @Override protected void initData(Bundle savedInstanceState) { super.initData(savedInstanceState); @@ -757,28 +776,8 @@ public class SearchBookActivity extends BaseActivity /*for (ReadCrawler readCrawler : readCrawlers) { searchBookByCrawler(readCrawler, readCrawler.getSearchCharset()); }*/ - if (readCrawlers.size() > 2000 && !SharedPreUtils.getInstance().getBoolean("searchBookWarning")) { - DialogCreator.createThreeButtonDialog(this, "书源过多警告", - "当前搜索书源数量超过2000(建议1000以内),继续搜索可能会导致软件异常(如搜索时前往阅读页返回后将会导致卡死黑屏),确定要继续搜索吗?", - true, "继续搜索并不再提示", "书源管理", "继续搜索", - (dialog, which) -> { - SharedPreUtils.getInstance().putBoolean("searchBookWarning", true); - searchEngine.initSearchEngine(readCrawlers); - searchEngine.search(searchKey); - }, (dialog, which) -> { - startActivityForResult(new Intent(this, BookSourceActivity.class), - APPCONST.REQUEST_BOOK_SOURCE); - }, - (dialog, which) -> { - searchEngine.initSearchEngine(readCrawlers); - searchEngine.search(searchKey); - } - ); - } else { - searchEngine.initSearchEngine(readCrawlers); - searchEngine.search(searchKey); - } - + searchEngine.initSearchEngine(readCrawlers); + searchEngine.search(searchKey); } /** diff --git a/app/src/main/java/xyz/fycz/myreader/ui/adapter/SearchAdapter.kt b/app/src/main/java/xyz/fycz/myreader/ui/adapter/SearchAdapter.kt index 6b6db5f..d081a45 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/adapter/SearchAdapter.kt +++ b/app/src/main/java/xyz/fycz/myreader/ui/adapter/SearchAdapter.kt @@ -52,11 +52,12 @@ class SearchAdapter( val keyword: String ) : DiffRecyclerAdapter(context) { private val mBooks: ConMVMap = ConMVMap() - private lateinit var mList: List + private var mList: MutableList = ArrayList() private val tagList: MutableList = ArrayList() private val handler = Handler(Looper.getMainLooper()) private var postTime = 0L private val sendRunnable = Runnable { upAdapter() } + var isStop = false override val diffItemCallback: DiffUtil.ItemCallback get() = object : DiffUtil.ItemCallback() { @@ -300,7 +301,7 @@ class SearchAdapter( } fun addAll(newDataS: List, keyWord: String?) { - val copyDataS: MutableList = ArrayList(getItems()) + val copyData: MutableList = ArrayList(mList) val filterDataS: MutableList = ArrayList() when (SysManager.getSetting().searchFilter) { 0 -> filterDataS.addAll(newDataS) @@ -328,16 +329,16 @@ class SearchAdapter( } if (filterDataS.size > 0) { val searchBookBeansAdd: MutableList = ArrayList() - if (copyDataS.size == 0) { - copyDataS.addAll(filterDataS) + if (mList.size == 0) { + mList.addAll(filterDataS) } else { //存在 for (temp in filterDataS) { var hasSame = false var i = 0 - val size = copyDataS.size + val size = copyData.size while (i < size) { - val searchBook = copyDataS[i] + val searchBook = copyData[i] if (TextUtils.equals(temp.name, searchBook.name) && TextUtils.equals(temp.author, searchBook.author) ) { @@ -353,30 +354,30 @@ class SearchAdapter( //添加 for (temp in searchBookBeansAdd) { if (TextUtils.equals(keyWord, temp.name)) { - for (i in copyDataS.indices) { - val searchBook = copyDataS[i] + for (i in copyData.indices) { + val searchBook = copyData[i] if (!TextUtils.equals(keyWord, searchBook.name)) { - copyDataS.add(i, temp) + mList.add(i, temp) break } } } else if (TextUtils.equals(keyWord, temp.author)) { - for (i in copyDataS.indices) { - val searchBook = copyDataS[i] + for (i in copyData.indices) { + val searchBook = copyData[i] if (!TextUtils.equals(keyWord, searchBook.name) && !TextUtils.equals(keyWord, searchBook.author) ) { - copyDataS.add(i, temp) + mList.add(i, temp) break } } } else { - copyDataS.add(temp) + mList.add(temp) } } } - mList = copyDataS - upAdapter() + if (!isStop) + upAdapter() } } diff --git a/build.gradle b/build.gradle index c0a5b9e..bc8b29f 100644 --- a/build.gradle +++ b/build.gradle @@ -28,6 +28,7 @@ buildscript { maven { url 'https://s3.amazonaws.com/fabric-artifacts/public' } maven { url 'https://plugins.gradle.org/m2/' } maven { url "https://maven.java.net/content/groups/public/" } + maven { url 'https://jitpack.io' } } dependencies { classpath 'com.android.tools.build:gradle:4.1.3' @@ -38,6 +39,8 @@ buildscript { classpath 'com.github.megatronking.stringfog:gradle-plugin:3.0.0' // 选用加解密算法库,默认实现了xor算法,也可以使用自己的加解密库。 classpath 'com.github.megatronking.stringfog:xor:3.0.0' + + classpath "com.github.CodingGay:BlackObfuscator-ASPlugin:3.7" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } From 86cea87b6c21bddee4447c8e0e135091699d09aa Mon Sep 17 00:00:00 2001 From: fengyuecanzhu <1021300691@qq.com> Date: Sat, 28 May 2022 22:12:35 +0800 Subject: [PATCH 4/5] fix search --- .../main/java/xyz/fycz/myreader/ui/adapter/SearchAdapter.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/xyz/fycz/myreader/ui/adapter/SearchAdapter.kt b/app/src/main/java/xyz/fycz/myreader/ui/adapter/SearchAdapter.kt index d081a45..8e9c0fa 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/adapter/SearchAdapter.kt +++ b/app/src/main/java/xyz/fycz/myreader/ui/adapter/SearchAdapter.kt @@ -24,6 +24,7 @@ import android.os.Bundle import android.os.Handler import android.os.Looper import android.text.TextUtils +import android.util.Log import android.view.View import android.view.ViewGroup import androidx.recyclerview.widget.DiffUtil @@ -386,7 +387,7 @@ class SearchAdapter( if (System.currentTimeMillis() >= postTime + 500) { handler.removeCallbacks(sendRunnable) postTime = System.currentTimeMillis() - setItems(mList) + setItems(ArrayList(mList)) } else { handler.removeCallbacks(sendRunnable) handler.postDelayed(sendRunnable, 500 - System.currentTimeMillis() + postTime) From 94267db59b186c9c1d6a919b690f4ffd72551c9d Mon Sep 17 00:00:00 2001 From: fengyuecanzhu <1021300691@qq.com> Date: Sat, 28 May 2022 22:20:47 +0800 Subject: [PATCH 5/5] v2.4.6 --- .github/workflows/build.yml | 6 +----- app/release.md | 7 +------ app/version_code.properties | 4 ++-- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5c3695c..c57cb32 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,11 +25,7 @@ jobs: echo "读取配置" source ${{ github.workspace }}/app/version_code.properties version=$VERSION_CODE - hun=$(expr ${version} / 100) - ten=$(expr ${version} / 10) - ten=$(expr ${ten} % 10) - one=$(expr ${version} % 10) - versionN=v$hun.$ten.$one + versionN=v${version:0:1}.${version:1:1}.${version:2:1} echo ::set-output name=need_create_release::"$CREATE_RELEASE" echo ::set-output name=version_name::"$versionN" diff --git a/app/release.md b/app/release.md index b36dc1f..e4ad621 100644 --- a/app/release.md +++ b/app/release.md @@ -1,6 +1 @@ -* 1、新增部分提示 -* 2、修复书籍无法导出缓存的问题 -* 3、修复部分书源bug -* 4、修复同名书籍详情页加载bug -* 5、修复搜索时当前分组不存在时无法搜索的问题 -* 6、Cookie支持备份&恢复 \ No newline at end of file +* 1、修复书源过多时搜索界面卡死的问题 \ No newline at end of file diff --git a/app/version_code.properties b/app/version_code.properties index 6e84c85..64df2c5 100644 --- a/app/version_code.properties +++ b/app/version_code.properties @@ -17,5 +17,5 @@ # #Fri Jun 18 21:45:31 CST 2021 -VERSION_CODE=245 -CREATE_RELEASE=false \ No newline at end of file +VERSION_CODE=246 +CREATE_RELEASE=true \ No newline at end of file