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 3, 2025
1 parent ce72f55 commit 59fd52e
Showing 1 changed file with 3 additions and 3 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> {
// Returns the list of unique package names from the list of ResolveInfo that support the input Intent
fun queryIntentSupportedPackageNames(intent: Intent): MutableSet<String> {
return packageManager
.queryIntentActivities(intent, 0)
.map { it.activityInfo.packageName }
.mapTo(mutableSetOf()) { it.activityInfo.packageName }
}

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

0 comments on commit 59fd52e

Please sign in to comment.