From 466625ea899e324cc0604d8ab5fd15fb26082f24 Mon Sep 17 00:00:00 2001 From: aAbed <39409020+TheAabedKhan@users.noreply.github.com> Date: Thu, 16 Nov 2023 11:54:53 +0545 Subject: [PATCH 1/2] fix(app-selector): show patchable installed apps first --- app/src/main/java/app/revanced/manager/util/PM.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/app/revanced/manager/util/PM.kt b/app/src/main/java/app/revanced/manager/util/PM.kt index 12a91a6c1c..ba80201a98 100644 --- a/app/src/main/java/app/revanced/manager/util/PM.kt +++ b/app/src/main/java/app/revanced/manager/util/PM.kt @@ -80,7 +80,9 @@ class PM( (compatibleApps.await() + installedApps.await()) .distinctBy { it.packageName } .sortedWith( - compareByDescending { + compareBy{ + it.packageInfo == null || it.patches == 0 + }.thenByDescending{ it.patches }.thenBy { it.packageInfo?.label() From 8ba31cf54d62c7d6c311478d949555fbeca74a5d Mon Sep 17 00:00:00 2001 From: aAbed Date: Sat, 2 Dec 2023 19:24:11 +0545 Subject: [PATCH 2/2] refactor: apply changes from suggestion --- app/src/main/java/app/revanced/manager/util/PM.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/app/revanced/manager/util/PM.kt b/app/src/main/java/app/revanced/manager/util/PM.kt index ba80201a98..21a60b97c2 100644 --- a/app/src/main/java/app/revanced/manager/util/PM.kt +++ b/app/src/main/java/app/revanced/manager/util/PM.kt @@ -80,9 +80,9 @@ class PM( (compatibleApps.await() + installedApps.await()) .distinctBy { it.packageName } .sortedWith( - compareBy{ - it.packageInfo == null || it.patches == 0 - }.thenByDescending{ + compareByDescending{ + it.packageInfo != null && (it.patches ?: 0) > 0 + }.thenByDescending { it.patches }.thenBy { it.packageInfo?.label()