Skip to content

Commit

Permalink
Add WeChat clean path
Browse files Browse the repository at this point in the history
  • Loading branch information
KyuubiRan committed Mar 10, 2021
1 parent 0c1127e commit 73d8b91
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 50 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
applicationId "me.kyuubiran.qqcleaner"
minSdkVersion 21
targetSdkVersion 30
versionCode 25
versionName "1.4.2"
versionCode 26
versionName "1.4.3"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
16 changes: 7 additions & 9 deletions app/src/main/java/me/kyuubiran/qqcleaner/utils/clean/CleanQQ.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package me.kyuubiran.qqcleaner.utils.clean

import com.alibaba.fastjson.JSONArray
import me.kyuubiran.qqcleaner.utils.ConfigManager
import me.kyuubiran.qqcleaner.utils.appContext
import java.io.File

Expand Down Expand Up @@ -31,25 +29,25 @@ object CleanQQ {
private const val OTHERS = "others"

// storage/emulated/0/Android/data/com.tencent.mobileqq
private var rootDataDir: String? = appContext?.externalCacheDir?.parentFile?.path
private val rootDataDir: String? = appContext?.externalCacheDir?.parentFile?.path

// storage/emulated/0/
private var rootDir: String? = appContext?.obbDir?.parentFile?.parentFile?.parentFile?.path
private val rootDir: String? = appContext?.obbDir?.parentFile?.parentFile?.parentFile?.path

// storage/emulated/0/tencent
private var rootTencentDir = "$rootDir/tencent"
private val rootTencentDir = "$rootDir/tencent"

// storage/emulated/0/Android/data/com.tencent.mobileqq/Tencent
private var TencentDir = "$rootDataDir/Tencent"
private val TencentDir = "$rootDataDir/Tencent"

// storage/emulated/0/Android/data/com.tencent.mobileqq/Tencent/MobileQQ
private var MobileQQDir = "$TencentDir/MobileQQ"
private val MobileQQDir = "$TencentDir/MobileQQ"

// storage/emulated/0/Android/data/com.tencent.mobileqq/QQ_Images
private var QQ_Images = "$rootDataDir/QQ_Images"
private val QQ_Images = "$rootDataDir/QQ_Images"

// storage/emulated/0/Android/data/com.tencent.mobileqq/Tencent/QQfile_recv
private var QQfile_recv = "$TencentDir/QQfile_recv"
private val QQfile_recv = "$TencentDir/QQfile_recv"

/**
* 根据tag获取文件列表
Expand Down
109 changes: 79 additions & 30 deletions app/src/main/java/me/kyuubiran/qqcleaner/utils/clean/CleanWeChat.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,46 @@ import java.io.File
object CleanWeChat {
//瘦身目录 键值请于arrays.xml里的we_chat_customer_clean_list_values相同
private const val CACHES = "caches"
private const val CARD = "card"
private const val PICTURE = "picture"
private const val AVATAR = "avatar"
private const val VIDEO = "video"
private const val GAME = "game"
private const val MINI = "mini"
private const val LUCKY_MONEY = "lucky_money"
private const val LOG = "log"
private const val RES_UPDATE = "res_update"
private const val X5_CORE = "x5_core"

// storage/emulated/0/Android/data/com.tencent.mm
private var rootDataDir: String? = appContext?.externalCacheDir?.parentFile?.path
private val aDataDir: String? = appContext?.externalCacheDir?.parentFile?.path

// storage/emulated/0/Android/data/com.tencent.mm/cache
private var cacheDir: String? = "${rootDataDir}/cache"
private val aCacheDir: String = "${aDataDir}/cache"

// storage/emulated/0/Android/data/com.tencent.mm/files
private var filesDir: String? = "${rootDataDir}/files"
private val aFilesDir: String = "${aDataDir}/files"

// storage/emulated/0/Android/data/com.tencent.mm/files
private var microMsgDir: String? = "${rootDataDir}/MicroMsg"
private val aMicroMsgDir: String = "${aDataDir}/MicroMsg"

private var userDataDirName: String? = null
// data/data/com.tencent.mm
private val dDataDir: String? = appContext?.filesDir?.parentFile?.path

// data/data/com.tencent.mm/cache
private val dCache: String = "${dDataDir}/cache"

// data/data/com.tencent.mm/MicroMsg
private val dMicroMsgDir: String = "${dDataDir}/MicroMsg"

private var aUserDataDirName: String? = null
get() {
if (field == null) {
val dir = File(microMsgDir!!)
val dir = File(aMicroMsgDir)
val child = dir.listFiles()
if (child != null && child.isNotEmpty()) {
for (file in child) {
if (file.name.length == 32 && file.isDirectory) {
field = file.name
break
}
}
}
Expand All @@ -42,6 +54,25 @@ object CleanWeChat {
return field
}

private var dUserDataDirName: String? = null
get() {
if (field == null) {
val dir = File(dMicroMsgDir)
val child = dir.listFiles()
if (child != null && child.isNotEmpty()) {
for (file in child) {
if (file.name.length == 32 && file.isDirectory) {
if (File("${file.path}/account.bin").exists()) {
field = file.name
break
}
}
}
}
}
return field
}


/**
* 根据tag获取文件列表
Expand All @@ -53,50 +84,68 @@ object CleanWeChat {
when (item) {
CACHES -> {
arr.apply {
add(File("$cacheDir"))
add(File("${microMsgDir}/CDNTemp"))
add(File("${microMsgDir}/FailMsgFileCache"))
add(File("${microMsgDir}/${userDataDirName}/webcanvascache"))
add(File(aCacheDir))
add(File("${aMicroMsgDir}/CDNTemp"))
add(File("${aMicroMsgDir}/FailMsgFileCache"))
add(File("${aMicroMsgDir}/${aUserDataDirName}/webcanvascache"))
add(File("${dCache}/temp"))
}
}
CARD -> {
PICTURE -> {
arr.apply {
add(File("${microMsgDir}/card"))
add(File("${dMicroMsgDir}/${dUserDataDirName}/image2"))
add(File("${dMicroMsgDir}/tmpScanLicense"))
}

}
AVATAR -> {
arr.apply {
add(File("${dMicroMsgDir}/${dUserDataDirName}/avatar"))
}
}
VIDEO -> {
arr.apply {
add(File("${microMsgDir}/${userDataDirName}/video"))
add(File("${aMicroMsgDir}/${aUserDataDirName}/video"))
add(File("${dCache}/mv_video"))
}
}
MINI -> {
arr.apply {
add(File("${dMicroMsgDir}/${dUserDataDirName}/appbrand/pkg"))
add(File("${dMicroMsgDir}/appbrand"))
}
}
GAME -> {
LUCKY_MONEY -> {
arr.apply {
add(File("${microMsgDir}/Game"))
add(File("${microMsgDir}/wagamefiles"))
add(File("${dMicroMsgDir}/luckymoney"))
}
}
LOG -> {
arr.apply {
add(File("${microMsgDir}/crash"))
add(File("${microMsgDir}/xlog"))
add(File("${filesDir}/onelog"))
add(File("${filesDir}/tbslog"))
add(File("${filesDir}/Tencent/tbs_common_log"))
add(File("${filesDir}/Tencent/tbs_live_log"))
add(File("${aMicroMsgDir}/crash"))
add(File("${dMicroMsgDir}/crash"))
add(File("${aMicroMsgDir}/xlog"))
add(File("${dDataDir}/files/xlog"))
add(File("${aFilesDir}/onelog"))
add(File("${aFilesDir}/tbslog"))
add(File("${aFilesDir}/Tencent/tbs_common_log"))
add(File("${aFilesDir}/Tencent/tbs_live_log"))
}

}
RES_UPDATE -> {
arr.apply {
add(File("${microMsgDir}/CheckResUpdate"))
add(File("${aMicroMsgDir}/CheckResUpdate"))
}
}
X5_CORE -> {
arr.apply {
add(File("${rootDataDir}/app_tbs"))
add(File("${rootDataDir}/app_tbs_64"))
add(File("${rootDataDir}/app_x5webview"))
add(File("${aDataDir}/app_tbs"))
add(File("${dDataDir}/app_tbs"))
add(File("${aDataDir}/app_tbs_64"))
add(File("${dDataDir}/app_tbs_64"))
add(File("${aDataDir}/app_x5webview"))
add(File("${dDataDir}/app_x5webview"))
}
}
}
Expand All @@ -117,9 +166,9 @@ object CleanWeChat {
*/
fun getFullList() = ArrayList<File>().apply {
addAll(getFiles(CACHES))
addAll(getFiles(CARD))
addAll(getFiles(PICTURE))
addAll(getFiles(VIDEO))
addAll(getFiles(GAME))
addAll(getFiles(MINI))
addAll(getFiles(LOG))
addAll(getFiles(RES_UPDATE))
addAll(getFiles(X5_CORE))
Expand Down
12 changes: 8 additions & 4 deletions app/src/main/res/values/arrays.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,11 @@
<!--微信 清理列表 请与下方的key的index一一对应-->
<string-array name="we_chat_customer_clean_list">
<item>各类缓存</item>
<item>卡片</item>
<item>图片缓存</item>
<item>头像缓存</item>
<item>视频缓存</item>
<item>游戏</item>
<item>小程序</item>
<item>红包皮肤</item>
<item>日志</item>
<item>更新缓存</item>
<item>X5内核</item>
Expand All @@ -88,9 +90,11 @@
<!--微信 清理列表的键值 请务必务必与CleanTim下定义的常量的值相同-->
<string-array name="we_chat_customer_clean_list_values">
<item>caches</item>
<item>card</item>
<item>picture</item>
<item>avatar</item>
<item>video</item>
<item>game</item>
<item>mini</item>
<item>lucky_money</item>
<item>log</item>
<item>res_update</item>
<item>x5_core</item>
Expand Down
8 changes: 3 additions & 5 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,9 @@
<string name="about">公告</string>
<string name="about_hint">注意:本模块不会清理聊天记录、接收文件、保存的图片、表情收藏等重要东西\n
[更新日志]\n
-1.4.2(25)\n
1.修复微信瘦身入口各种错误问题\n
-1.4.1(24)\n
1.解决微信处于英文环境下点击关于会崩溃的问题\n
2.添加加入Telegram按钮 频道: @QQCleanerCh
-1.4.3(26)\n
1.微信瘦身超级加强 可以腾出更多的空间啦\n
注意:微信瘦身包含根目录文件夹 请谨慎清理
</string>
<string name="join_qq_group">点击加入QQ群</string>
<string name="join_qq_group_hint">有问题可以来群里反馈哦~</string>
Expand Down

0 comments on commit 73d8b91

Please sign in to comment.