Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor code order of navigateToNativeApp #1038

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,14 @@ private class ExternalNavController(
): Boolean {
val pm = context.packageManager

// Get all apps that resolve the specific Url
val specializedActivityIntent = Intent(Intent.ACTION_VIEW, uri)
.addCategory(Intent.CATEGORY_BROWSABLE)
val resolvedSpecializedList: MutableSet<String> =
pm.queryIntentActivities(specializedActivityIntent, 0)
.map { it.activityInfo.packageName }
.toMutableSet()

// Get all Apps that resolve a generic url
val browserActivityIntent = Intent()
.setAction(Intent.ACTION_VIEW)
Expand All @@ -404,14 +412,6 @@ private class ExternalNavController(
.map { it.activityInfo.packageName }
.toSet()

// Get all apps that resolve the specific Url
val specializedActivityIntent = Intent(Intent.ACTION_VIEW, uri)
.addCategory(Intent.CATEGORY_BROWSABLE)
val resolvedSpecializedList: MutableSet<String> =
pm.queryIntentActivities(specializedActivityIntent, 0)
.map { it.activityInfo.packageName }
.toMutableSet()

// Keep only the Urls that resolve the specific, but not the generic urls.
resolvedSpecializedList.removeAll(genericResolvedList)

Expand Down
Loading