File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
app/src/main/java/com/pr0gramm/app/util Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -47,20 +47,22 @@ object BrowserHelper {
47
47
}
48
48
}
49
49
50
- private val firefoxFocusSupported by memorize<Context , Boolean > { context ->
51
- val intent = Intent (Intent .ACTION_VIEW , Uri .parse(" http://www.example.com" ))
52
- intent.`package` = " org.mozilla.focus"
53
- return @memorize context.packageManager.queryIntentActivities(intent, 0 ).size > 0
50
+ private val firefoxFocusPackage by memorize<Context , String ?> { context ->
51
+ return @memorize listOf (" org.mozilla.klar" , " org.mozilla.focus" ).firstOrNull {
52
+ val intent = Intent (Intent .ACTION_VIEW , Uri .parse(" http://www.example.com" ))
53
+ intent.`package` = " org.mozilla.focus"
54
+ context.packageManager.queryIntentActivities(intent, 0 ).size > 0
55
+ }
54
56
}
55
57
56
58
/* *
57
59
* Creates a builder with reasonable defaults to create a webview activity.
58
60
*/
59
61
fun openIncognito (context : Context , url : String ) {
60
62
// if the firefox focus is installed, we'll open the page in this browser.
61
- if (firefoxFocusSupported( context)) {
63
+ firefoxFocusPackage( context)?. let { packageName ->
62
64
val intent = Intent (Intent .ACTION_VIEW , Uri .parse(url))
63
- intent.`package` = " org.mozilla.focus "
65
+ intent.`package` = packageName
64
66
context.startActivity(intent)
65
67
return
66
68
}
You can’t perform that action at this time.
0 commit comments