Skip to content

Commit

Permalink
Sort apps by app's names in bullet screen notification settings
Browse files Browse the repository at this point in the history
  • Loading branch information
YifePlayte committed May 2, 2024
1 parent 61e2c6f commit f52d234
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ android {
dependencies {
compileOnly("de.robv.android.xposed:api:82")
implementation("com.github.kyuubiran:EzXHelper:2.1.1")
implementation("io.github.ranlee1:jpinyin:1.0.1")
implementation("org.luckypray:dexkit:2.0.0")
implementation(project(":blockmiui"))
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import com.github.kyuubiran.ezxhelper.ObjectUtils.getObjectOrNullAs
import com.github.kyuubiran.ezxhelper.finders.MethodFinder.`-Static`.methodFinder
import com.yifeplayte.wommo.hook.hooks.BaseMultiHook
import com.yifeplayte.wommo.hook.utils.DexKit.dexKitBridge
import io.github.ranlee1.jpinyin.PinyinFormat.WITHOUT_TONE
import io.github.ranlee1.jpinyin.PinyinHelper.convertToPinyinString

@Suppress("unused")
object ForceSupportBarrage : BaseMultiHook() {
Expand All @@ -35,12 +37,14 @@ object ForceSupportBarrage : BaseMultiHook() {
}.single().getMethodInstance(safeClassLoader).createHook {
after { param ->
val barragePackageList = appContext.packageManager.getInstalledApplications(0)
.filter { (it.flags and ApplicationInfo.FLAG_SYSTEM) != 1 }
.map { it.packageName }.filter {
.filter { (it.flags and ApplicationInfo.FLAG_SYSTEM) != 1 }.filter {
methodAreNotificationsEnabled.invoke(
clazzNotificationFilterHelper, appContext, it
clazzNotificationFilterHelper, appContext, it.packageName
) == true
}
}.associateWith {
val label = it.loadLabel(appContext.packageManager).toString()
convertToPinyinString(label, "", WITHOUT_TONE).lowercase()
}.entries.sortedBy { it.value }.map { it.key.packageName }
@Suppress("UNCHECKED_CAST") val supportedList = param.result as MutableList<String>
for (s in barragePackageList) {
if (!supportedList.contains(s)) supportedList.add(s)
Expand Down

0 comments on commit f52d234

Please sign in to comment.