Skip to content

Commit

Permalink
feat: Only list package names once when they appear multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
LunarX committed Jan 7, 2025
1 parent b49fd61 commit b6690eb
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ fun Context.openAppNotificationSettings() {
* email apps using [Intent.EXTRA_INITIAL_INTENTS].
*/
fun Context.openMailApp() {
// Returns the list of package names from the list of ResolveInfo that support the input Intent
fun queryIntentSupportedPackageNames(intent: Intent): List<String> {
return packageManager
// Returns the list of unique package names from the list of ResolveInfo that support the input Intent
fun queryIntentSupportedPackageNames(intent: Intent): Set<String> = buildSet {
packageManager
.queryIntentActivities(intent, 0)
.map { it.activityInfo.packageName }
.forEach { add(it.activityInfo.packageName) }
}

val mainActionIntent = Intent.makeMainSelectorActivity(Intent.ACTION_MAIN, Intent.CATEGORY_APP_EMAIL).apply {
Expand Down

0 comments on commit b6690eb

Please sign in to comment.