From 0b0b99c84778dee2f71831cfede139d35af8825a Mon Sep 17 00:00:00 2001 From: Kitsune Date: Sun, 13 Mar 2022 13:54:36 +0800 Subject: [PATCH] Fix wechat clean Add clean finished toast --- .../java/me/kyuubiran/qqcleaner/util/CleanManager.kt | 9 ++++++--- .../me/kyuubiran/qqcleaner/util/path/WeChatPath.kt | 11 ++++++----- app/src/main/res/values/strings.xml | 1 + 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/me/kyuubiran/qqcleaner/util/CleanManager.kt b/app/src/main/java/me/kyuubiran/qqcleaner/util/CleanManager.kt index c3d10a7..84b08d7 100644 --- a/app/src/main/java/me/kyuubiran/qqcleaner/util/CleanManager.kt +++ b/app/src/main/java/me/kyuubiran/qqcleaner/util/CleanManager.kt @@ -18,10 +18,10 @@ object CleanManager { fun execute(data: CleanData, showToast: Boolean = true, forceExec: Boolean = false) { if (!data.valid) return if (!data.enable && !forceExec) return - if (showToast) Log.toast( - moduleRes.getString(R.string.executing_config).format(data.title) - ) pool.execute e@{ + if (showToast) Log.toast( + moduleRes.getString(R.string.executing_config).format(data.title) + ) runCatching { data.content.forEach { data -> if (!data.enable) return@forEach @@ -46,6 +46,9 @@ object CleanManager { it.forEach { data -> execute(data, showToast) } + pool.execute { + if (showToast) Log.toast(moduleRes.getString(R.string.clean_finished)) + } } } } diff --git a/app/src/main/java/me/kyuubiran/qqcleaner/util/path/WeChatPath.kt b/app/src/main/java/me/kyuubiran/qqcleaner/util/path/WeChatPath.kt index 4692b35..37ad2c5 100644 --- a/app/src/main/java/me/kyuubiran/qqcleaner/util/path/WeChatPath.kt +++ b/app/src/main/java/me/kyuubiran/qqcleaner/util/path/WeChatPath.kt @@ -4,25 +4,26 @@ import java.io.File object WeChatPath { //P: storage/emulated/0/Android/data/com.tencent.mm/MicroMsg/${UserDataDirName} - val publicUserData by lazy { + val publicUserData: Pair by lazy { "!PublicUserDataDir" to run { val dirs = File("${CommonPath.publicData.second}/MicroMsg").listFiles() if (dirs != null && dirs.isNotEmpty()) { - dirs.firstOrNull { it.name.length == 32 && it.isDirectory }?.absolutePath + return@run dirs.firstOrNull { it.name.length == 32 && it.isDirectory }?.absolutePath + ?: "" } "" } } //P: data/user/0/com.tencent.mm/MicroMsg/${UserDataDirName} - val privateUserData by lazy { + val privateUserData: Pair by lazy { "!PrivateUserDataDir" to run { val dirs = File("${CommonPath.privateData.second}/MicroMsg").listFiles() if (dirs != null && dirs.isNotEmpty()) { - dirs.firstOrNull { + return@run dirs.firstOrNull { it.name.length == 32 && it.isDirectory && File("${it.absolutePath}/account.bin").exists() - }?.absolutePath + }?.absolutePath ?: "" } "" } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index eb39877..ad8661f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -90,5 +90,6 @@ 空空如也 添加路径 文件夹图标 + 瘦身完毕!