thunder-app / thunder

Thunder - An open-source cross-platform Lemmy client for iOS and Android built with Flutter
https://thunderapp.dev
GNU Affero General Public License v3.0
779 stars 67 forks source link

Add on option to the in-app browser to open in system browser #37

Closed PcLover2 closed 1 year ago

PcLover2 commented 1 year ago

Describe the solution you'd like The in-app browser should have a top bar with 2 options: an arrow on the left to go back to the app and an open in system browser option. If you have more time (probably not since this app is a sideproject) you could even add a share and a reload option.

Describe alternatives you've considered You could also use the default Chrome WebView

hjiangsu commented 1 year ago

This is definitely a possibility that shouldnt take too long to implement - although probably in a later release after some of the more core features are implemented (unless there are more requests for this!)

nathanloehlein commented 1 year ago

Definitely hoping this gets implemented. It's nearly impossible to share links currently. Or the option to open links in the user's external browser.

vfosnar commented 1 year ago

At least on Android you can open a single web page in the default browser. It's what the "official" Mastodon app does.

I'd much prefer this behavior so my settings and extensions work.

Screenshot_20230623-073409_Mull

hjiangsu commented 1 year ago

This is currently being implemented - to be released in the next version! Heres a preview of the options:

image
vfosnar commented 1 year ago

uh oh, isn't this the embedded webview option?

hjiangsu commented 1 year ago

uh oh, isn't this the embedded webview option?

Hmm, I'm not too sure what you mean. It would be great if you could clarify this!

For some context, this is the current flow:

So for now, if you want to open up a link in an external browser, then technically you would need to perform two actions:

Let me know your thoughts on this!

vfosnar commented 1 year ago

Well, the image I sent here shows a "preview page" provided by Mull (fork of Firefox), my default system browser. This allows for adblock and other extensions to work.

This is the captured intent that opens a link from Mastodon app in the "preview" mode.

intent://[fosny.eu](http://fosny.eu/)?utm_source=mastodon#Intent;scheme=https;[i.android.support](http://i.android.support/).customtabs.extra.TITLE_VISIBILITY=1;[B.android.support](http://b.android.support/).customtabs.extra.EXTRA_ENABLE_INSTANT_APPS=true;i.androidx.browser.customtabs.extra.SHARE_STATE=0;end

Other info about that intent:

ACTION: android.intent.action.VIEW
DATA: [https://fosny.eu?utm_source=mastodon](https://fosny.eu/?utm_source=mastodon)
URI: intent://[fosny.eu](http://fosny.eu/)?utm_source=mastodon#Intent;scheme=https;[i.android.support](http://i.android.support/).customtabs.extra.TITLE_VISIBILITY=1;[B.android.support](http://b.android.support/).customtabs.extra.EXTRA_ENABLE_INSTANT_APPS=true;i.androidx.browser.customtabs.extra.SHARE_STATE=0;end

The flow of this in the thunder app should be smthng like this:

thunder --intent--> Mull preview view --click Open in Mull--> Page loads in the browser with full UI

hjiangsu commented 1 year ago

Just to clarify from what I'm reading, it sounds like the embedded view should use the systems default browser (Mull in your case, but may be something else for another user) rather than the default webview? In addition to that, there should be a button which allows you to open the link in an external browser?

I'm not entirely sure how (or if its possible using flutter alone) to handle this atm, so more research is needed before this can be done

vfosnar commented 1 year ago

Well, it's not an embedded view, the whole "preview page" is provided by the system browser.

I guess this is the equivalent in chromium: https://www.theverge.com/2021/3/11/22324883/chrome-android-link-preview-sneak-peek

hjiangsu commented 1 year ago

I think as a stop-gap to resolve the immediate issue of not being able to open in an external browser, I'll keep the implementation as it currently is.

However, in the future we can revisit this idea as a way to enhance the app!

hjiangsu commented 1 year ago

I'll close this issue since the latest version v0.2.1+6 resolves the issue of opening links in an external browser. However, feel free to create new tickets for enhancements to this feature!

jasperswallen commented 1 year ago

I think using the Flutter plugin for ChromeSafariBrowser would give the most seamless interfacing. At least on iOS, I like the consistency of using SFSafariViewController.

vfosnar commented 1 year ago

It looks like the feature I was talking about is called Custom Tabs: https://android.stackexchange.com/a/219950

edit: I made a new feature request #176