diff --git a/app/build.gradle b/app/build.gradle index cb939b9..c23fc0f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -11,8 +11,8 @@ android { applicationId "io.github.fplus" minSdk 24 targetSdk 33 - versionCode 121 - versionName "1.2.7" + versionCode 122 + versionName "1.2.8" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { diff --git a/app/src/main/assets/update.txt b/app/src/main/assets/update.txt index 10e22a2..5c0bb4a 100644 --- a/app/src/main/assets/update.txt +++ b/app/src/main/assets/update.txt @@ -1,3 +1,7 @@ +v1.2.8 +修复定时、空闲后台重复退出问题 +移除启动时底部提示 + v1.2.7 增加聊天消息防止撤回 增加视频下载自定义编码格式 diff --git a/app/src/main/assets/version b/app/src/main/assets/version index e237dd0..23de760 100644 --- a/app/src/main/assets/version +++ b/app/src/main/assets/version @@ -1 +1 @@ -1.2.7-121 \ No newline at end of file +1.2.8-122 \ No newline at end of file diff --git a/core/src/main/java/io/github/fplus/core/helper/DexkitBuilder.kt b/core/src/main/java/io/github/fplus/core/helper/DexkitBuilder.kt index a98a776..b914f74 100644 --- a/core/src/main/java/io/github/fplus/core/helper/DexkitBuilder.kt +++ b/core/src/main/java/io/github/fplus/core/helper/DexkitBuilder.kt @@ -11,6 +11,7 @@ import com.freegang.ktutils.text.KTextUtils import io.github.fplus.core.config.ConfigV1 import io.github.xpler.core.findClass import io.github.xpler.core.findMethod +import io.github.xpler.core.log.XplerLog import io.github.xpler.core.lpparam import org.json.JSONArray import org.json.JSONObject @@ -631,6 +632,7 @@ object DexkitBuilder { private fun ClassDataList.singleInstance(label: String): Class<*>? { val classData = this.singleOrNull() KLogCat.tagI(TAG, "found-class[$label]: ${classData?.name}") + if (classData == null) XplerLog.d("not found class: $label") classCacheJson.put(label, "${classData?.name}") return classData?.getInstance(lpparam.classLoader) } diff --git a/core/src/main/java/io/github/fplus/core/hook/DouYinMain.kt b/core/src/main/java/io/github/fplus/core/hook/DouYinMain.kt index aa265c8..0ab21ce 100644 --- a/core/src/main/java/io/github/fplus/core/hook/DouYinMain.kt +++ b/core/src/main/java/io/github/fplus/core/hook/DouYinMain.kt @@ -37,6 +37,7 @@ class DouYinMain(private val app: Application) { KActivityUtils.register(app) // 日志工具 + XplerLog.setTag("Freedom+") KLogCat.init(app) // KLogCat.silence() //静默 @@ -55,7 +56,7 @@ class DouYinMain(private val app: Application) { // search and hook DexkitBuilder.running( app = app, - version = 15, + version = 16, searchBefore = { HActivity() HMainActivity() @@ -122,7 +123,11 @@ class DouYinMain(private val app: Application) { timedExitCountDown = object : CountDownTimer(timedExit, 1000) { override fun onTick(millisUntilFinished: Long) { val second = millisUntilFinished / 1000 - // KLogCat.d("定时倒计时: ${second}秒") + KLogCat.d("定时倒计时: ${second}秒") + if (!KAppUtils.isAppInForeground(app)) { + inBackend = true + cancel() + } if (second == 30L) { KToastUtils.show(app, "抖音将在30秒后定时退出") } @@ -144,7 +149,10 @@ class DouYinMain(private val app: Application) { freeExitCountDown = object : CountDownTimer(freeExit, 1000) { override fun onTick(millisUntilFinished: Long) { val second = millisUntilFinished / 1000 - // KLogCat.d("空闲倒计时: ${second}秒") + KLogCat.d("空闲倒计时: ${second}秒") + if (!KAppUtils.isAppInForeground(app)) { + cancel() + } if (second == 30L) { KToastUtils.show(app, "长时间无操作, 抖音将在30秒后空闲退出") } diff --git a/core/src/main/java/io/github/fplus/core/hook/HActivity.kt b/core/src/main/java/io/github/fplus/core/hook/HActivity.kt index 842d2a8..167bf56 100644 --- a/core/src/main/java/io/github/fplus/core/hook/HActivity.kt +++ b/core/src/main/java/io/github/fplus/core/hook/HActivity.kt @@ -12,6 +12,7 @@ import io.github.fplus.core.base.BaseHook import io.github.fplus.core.config.ConfigV1 import io.github.fplus.core.helper.ImmersiveHelper import io.github.fplus.core.ui.activity.FreedomSettingActivity +import io.github.xpler.core.entity.OnAfter import io.github.xpler.core.entity.OnBefore import io.github.xpler.core.hookBlockRunning import io.github.xpler.core.thisActivity @@ -48,29 +49,41 @@ class HActivity : BaseHook() { fun onResumeBefore(params: XC_MethodHook.MethodHookParam) { hookBlockRunning(params) { DouYinMain.freeExitCountDown?.restart() + if (DouYinMain.inBackend) { + DouYinMain.inBackend = false + DouYinMain.timedExitCountDown?.restart() + } + }.onFailure { + KLogCat.tagE(TAG, it) + } + } - if (thisActivity is FreedomSettingActivity) return + @OnAfter("onWindowFocusChanged") + fun onWindowFocusChangedAfter(params: XC_MethodHook.MethodHookParam, boolean: Boolean) { + hookBlockRunning(params) { + launch { + if (thisActivity is FreedomSettingActivity) return@launch - if (config.isImmersive) { - ImmersiveHelper.immersive( - activity = thisActivity, - hideStatusBar = config.systemControllerValue[0], - hideNavigationBars = config.systemControllerValue[1], - ) + if (config.isImmersive) { + ImmersiveHelper.immersive( + activity = thisActivity, + hideStatusBar = config.systemControllerValue[0], + hideNavigationBars = config.systemControllerValue[1], + ) - // 底部三键导航 - val activity = thisObject as Activity - if (activity.navBarInteractionMode == 0 && !config.systemControllerValue[1]) { - activity.contentView.apply { - updatePadding(bottom = context.navigationBarHeight) - } - ImmersiveHelper.systemBarColor(activity, navigationBarColor = null) - } else { + // 底部三键导航 + val activity = thisObject as Activity ImmersiveHelper.systemBarColor(activity) + if (activity.navBarInteractionMode == 0 && !config.systemControllerValue[1]) { + activity.contentView.apply { + updatePadding(bottom = context.navigationBarHeight) + } + ImmersiveHelper.systemBarColor(activity, navigationBarColor = null) + } } } }.onFailure { - KLogCat.tagE(TAG, it) + KLogCat.tagE(HLivePlayActivity.TAG, it) } } } \ No newline at end of file diff --git a/core/src/main/java/io/github/fplus/core/hook/ChatListRecalledHint.kt b/core/src/main/java/io/github/fplus/core/hook/HChatListRecalledHint.kt similarity index 100% rename from core/src/main/java/io/github/fplus/core/hook/ChatListRecalledHint.kt rename to core/src/main/java/io/github/fplus/core/hook/HChatListRecalledHint.kt diff --git a/core/src/main/java/io/github/fplus/core/hook/HLivePlayActivity.kt b/core/src/main/java/io/github/fplus/core/hook/HLivePlayActivity.kt index 63f5300..379679c 100644 --- a/core/src/main/java/io/github/fplus/core/hook/HLivePlayActivity.kt +++ b/core/src/main/java/io/github/fplus/core/hook/HLivePlayActivity.kt @@ -5,7 +5,6 @@ import de.robv.android.xposed.XC_MethodHook import io.github.fplus.core.base.BaseHook import io.github.fplus.core.config.ConfigV1 import io.github.fplus.core.helper.ImmersiveHelper -import io.github.xpler.core.entity.FutureHook import io.github.xpler.core.entity.OnAfter import io.github.xpler.core.entity.OnBefore import io.github.xpler.core.hookBlockRunning @@ -23,7 +22,6 @@ class HLivePlayActivity : BaseHook() { return findClass("com.ss.android.ugc.aweme.live.LivePlayActivity") } - @FutureHook @OnBefore("onWindowFocusChanged") @OnAfter("onWindowFocusChanged") fun onWindowFocusChangedAfter(params: XC_MethodHook.MethodHookParam, boolean: Boolean) { diff --git a/core/src/main/java/io/github/fplus/core/hook/HMainActivity.kt b/core/src/main/java/io/github/fplus/core/hook/HMainActivity.kt index 846acd7..2edb85a 100644 --- a/core/src/main/java/io/github/fplus/core/hook/HMainActivity.kt +++ b/core/src/main/java/io/github/fplus/core/hook/HMainActivity.kt @@ -28,9 +28,11 @@ import io.github.fplus.core.helper.DexkitBuilder import io.github.fplus.core.hook.logic.ClipboardLogic import io.github.fplus.core.hook.logic.DownloadLogic import io.github.fplus.core.ui.activity.FreedomSettingActivity +import io.github.xpler.core.KtXposedHelpers import io.github.xpler.core.entity.OnAfter import io.github.xpler.core.entity.OnBefore import io.github.xpler.core.hookBlockRunning +import io.github.xpler.core.log.XplerLog import io.github.xpler.core.thisActivity import io.github.xpler.core.thisContext import kotlinx.coroutines.delay @@ -84,7 +86,8 @@ class HMainActivity : BaseHook() { @OnAfter("onCreate") fun onCreateAfter(params: XC_MethodHook.MethodHookParam, savedInstanceState: Bundle?) { hookBlockRunning(params) { - showToast(thisContext, "Freedom+ Attach!") + val activity = thisActivity + XplerLog.d("version: ${KtXposedHelpers.moduleVersionName(activity)} - ${activity.appVersionName}(${activity.appVersionCode})") DouYinMain.timedExitCountDown?.restart() }.onFailure { KLogCat.tagE(TAG, it) @@ -94,10 +97,6 @@ class HMainActivity : BaseHook() { @OnAfter("onResume") fun onResume(params: XC_MethodHook.MethodHookParam) { hookBlockRunning(params) { - if (DouYinMain.inBackend) { - DouYinMain.inBackend = false - DouYinMain.timedExitCountDown?.restart() - } addClipboardListener(thisActivity) initView(thisActivity) is32BisTips(thisActivity) diff --git a/core/src/main/java/io/github/fplus/core/hook/logic/DownloadLogic.kt b/core/src/main/java/io/github/fplus/core/hook/logic/DownloadLogic.kt index bdc5db5..ba3b45d 100644 --- a/core/src/main/java/io/github/fplus/core/hook/logic/DownloadLogic.kt +++ b/core/src/main/java/io/github/fplus/core/hook/logic/DownloadLogic.kt @@ -183,9 +183,9 @@ class DownloadLogic( // 构建视频文件名 mPureFileName = mPureFileName.secureFilename(".mp4") if (config.isNotification) { - showDownloadByNotification(videoUrlList, mVideoParent.need(), mPureFileName, isWebDav) + showDownloadByNotification(videoUrlList, mVideoParent, mPureFileName, isWebDav) } else { - showDownloadByDialog(videoUrlList, mVideoParent.need(), mPureFileName, isWebDav) + showDownloadByDialog(videoUrlList, mVideoParent, mPureFileName, isWebDav) } } @@ -202,9 +202,9 @@ class DownloadLogic( // 构建视频文件名 mPureFileName = mPureFileName.secureFilename(".mp3") if (config.isNotification) { - showDownloadByNotification(musicUrlList, mMusicParent.need(), mPureFileName, isWebDav) + showDownloadByNotification(musicUrlList, mMusicParent, mPureFileName, isWebDav) } else { - showDownloadByDialog(musicUrlList, mMusicParent.need(), mPureFileName, isWebDav) + showDownloadByDialog(musicUrlList, mMusicParent, mPureFileName, isWebDav) } } diff --git a/ktutils b/ktutils index 538b3f3..445a5ba 160000 --- a/ktutils +++ b/ktutils @@ -1 +1 @@ -Subproject commit 538b3f3bc37b89904c61c2547ef358939f6c9910 +Subproject commit 445a5baebf0cce90a1538d471efcf5b60729c486