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

External browser support #902

Open
Parbler opened this issue Nov 23, 2024 · 3 comments
Open

External browser support #902

Parbler opened this issue Nov 23, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@Parbler
Copy link

Parbler commented Nov 23, 2024

1. Environment

  • Device: [Pixel 6]
  • OS: [Android 13]
  • APP: [0.9.6]

2. Describe the feature request

_(I may not respond in a timely manner, but you will be notified when this issue is resolved or refused to be resolved.)_Hi there, is it possible to add external browser?

@Parbler Parbler added the enhancement New feature or request label Nov 23, 2024
@Scridgeon
Copy link

I'm not sure what the OP is asking since the app supports external browsers so I'm to assume they are having the same issue I am.
One of browsers (Firefox Focus) does not show up in the list of External Browsers. How do I add it/get it supported?

@wasu-code
Copy link

fun Context.getBrowserAppList(): List<ResolveInfo> {
    val pm: PackageManager = packageManager
    val intent = Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_APP_BROWSER)
    val appInfoList = pm.run {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
            queryIntentActivities(intent, PackageManager.ResolveInfoFlags.of(0))
        } else {
            queryIntentActivities(intent, 0)
        }
    }
    return appInfoList.sortedBy { it.loadLabel(pm).toString() }
}

Here it filters apps that match the CATEGORY_APP_BROWSER (are explicitly categorized as browsers). But for some reason a lot of browsers don't declare themselves as such in their manifest.
Using Intent.ACTION_VIEW instead of relaying on category should solve the issue and show all apps able to handle opening links.

val intent = Intent(Intent.ACTION_VIEW).apply {
    data = Uri.parse("http://example.com") // Example link as it's necessary to add somet link here
} 

@wasu-code
Copy link

I'm not sure what OP meant (not enough details in the issue)

In case OP just didn't know where to find the settings for external browsers, it can be changed in Settings » Interaction » App when link is clicked. Just change it to "Always Ask" or "Force specific browser"
It will make links inside posts open in the browser of your choice.

If OP wanted to open the article itself in external browser... I don't know of any way to do that, but I would love to see it implemented (maybe long-pressing article icon in bottom-right, or a new icon next to share icon on top)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants