Skip to content

Commit

Permalink
Fix wechat clean
Browse files Browse the repository at this point in the history
Add clean finished toast
  • Loading branch information
KyuubiRan committed Mar 13, 2022
1 parent d2d3e2a commit 0b0b99c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
9 changes: 6 additions & 3 deletions app/src/main/java/me/kyuubiran/qqcleaner/util/CleanManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -46,6 +46,9 @@ object CleanManager {
it.forEach { data ->
execute(data, showToast)
}
pool.execute {
if (showToast) Log.toast(moduleRes.getString(R.string.clean_finished))
}
}
}
}
Expand Down
11 changes: 6 additions & 5 deletions app/src/main/java/me/kyuubiran/qqcleaner/util/path/WeChatPath.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, String> 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<String, String> 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 ?: ""
}
""
}
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,6 @@
<string name="empty">空空如也</string>
<string name="sort_fab_text">添加路径</string>
<string name="sort_icon_tip">文件夹图标</string>
<string name="clean_finished">瘦身完毕!</string>

</resources>

0 comments on commit 0b0b99c

Please sign in to comment.