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

Twitter t.co links don't load directly in new tab #628

Open
gkrishnaks opened this issue Apr 7, 2024 · 7 comments · May be fixed by #629
Open

Twitter t.co links don't load directly in new tab #628

gkrishnaks opened this issue Apr 7, 2024 · 7 comments · May be fixed by #629
Labels
feature New feature or request

Comments

@gkrishnaks
Copy link

gkrishnaks commented Apr 7, 2024

Description

Links posted in tweets become t.co short links. On tap of link and if fulguris is chosen, it fills the t.co link in current tab and expects user to hit enter key which it then loads in new tab.

This behaviour is not seen for other links for example from bluesky app where links are not shortened. For this case the new link intent is directly launched in new tab.

Environment

  • Device: [e.g. F(x)tec Pro¹ - QX1000]
  • OS: [e.g. Android 9]
  • Version: [e.g. 1.1.3]

To reproduce

  1. Install from f-droid. Default settings.
  2. Install Twitter PWA or app and click on a link in a tweet and choose fulguris
  3. Observe t.co link fills current tab address bar and waits for user to click enter key
  4. On tap of enter key in soft keyboard, it loads in a new tab

Expected behaviour

Browser should directly launch incoming links in a new tab and shouldn't wait for user input (enter key)
For comparison, repeat same steps with bluesky app or any other app.

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.

@gkrishnaks gkrishnaks added the bug Something isn't working label Apr 7, 2024
@Slion
Copy link
Owner

Slion commented Apr 7, 2024

Please provide actual links to reproduce your issue without having to guess.
Links to the apps your are using and links to be tested with them. Also device OS, Fulguris and WebView version, thanks.

@Slion Slion added cannot reproduce incomplete Does not contain enough information to be reproduced or acted upon labels Apr 7, 2024
@gkrishnaks
Copy link
Author

Additional details : I am to replicate this behaviour with any link in any tweet, but not if I copy the t.co link in a chat app then click on it, which results in expected behavior what I mentioned in description.

If you open this tweet in twitter PWA or app, https://x.com/HeyPuter/status/1774247524653527041
And the link in this tweet is a t.co shortened link (https://t.co/Mb3h5WJc2n), if you click on it, then the issue is reproducible. I will share a screen recording.

Samsung M51, Android 13, webview version : 123.0.6312.40, Fulguris version 1.9.30 from f-droid.

@gkrishnaks
Copy link
Author

gkrishnaks commented Apr 7, 2024

  1. This is the tweet opened in Twitter PWA (installed PWA using Firefox Android) Shared tweet link in previous comment. To install Twitter PWA, open Firefox Android, go to twitter.com, login then choose to install the app when it pops up in browser. This will install the PWA to home screen. (open any tweet that has link in it)
  2. Long press on the link in a tweet, choose Share link,
    Screenshot_20240407_122214_Firefox Nightly
  3. Choose Share link and in the OS tray, select Fulguris
    Screenshot_20240407_122222_Firefox Nightly
  4. It filled up the address bar and waited till pressing enter key. ( Perhaps the issue is due to long press and share link to Fulguris?)
    Screenshot_20240407_122238_Fulguris

@gkrishnaks
Copy link
Author

gkrishnaks commented Apr 8, 2024

I looked into the code and found the root cause.

In TabsManager.kt, when you long press on a link in another app and share to Fulguris, it is ACTION_SEND Intent and type is text/plain. So it does setAddressBarText and waits for user to hit enter key.

Fix would be to check if 'clue' here is a network URL and load it in a new tab directly. Other webview based browser apps and regular browser apps behave as expected here for this "long press a link and share to browser" case.

fun onNewIntent(intent: Intent?) = doOnceAfterInitialization {
val url = if (intent?.action == Intent.ACTION_WEB_SEARCH) {
extractSearchFromIntent(intent)
}
else if (intent?.action == Intent.ACTION_SEND) {
// User shared text with our app
if ("text/plain" == intent.type) {
// Get shared text
val clue = intent.getStringExtra(Intent.EXTRA_TEXT)
// Put it in the address bar if any
clue?.let { iWebBrowser.setAddressBarText(it) }
}
// Cancel other operation as we won't open a tab here
null
} else {
intent?.dataString
}

gkrishnaks added a commit to gkrishnaks/Fulguris that referenced this issue Apr 9, 2024
gkrishnaks added a commit to gkrishnaks/Fulguris that referenced this issue Apr 9, 2024
gkrishnaks added a commit to gkrishnaks/Fulguris that referenced this issue Apr 9, 2024
@Slion
Copy link
Owner

Slion commented Apr 9, 2024

I see, I'm pretty sure it was intended to work like that so that you can review the URL before loading it.

@gkrishnaks
Copy link
Author

I reported this as other browser apps handle this long press share case, and in the same function 'onNewIntent' there's logic to automatically launch new tab and focus it (this will handle when user tap on link [instead of long press] in another app and choose Fulguris)

If this is an expected behaviour for Fulguris, this bug and the related PR can be closed.

@Slion
Copy link
Owner

Slion commented Apr 10, 2024

Thanks, great work you did on that one. I'll need to take a closer look at that at some point.
One solution could be to have a settings option to toggle between just show URL and open new tab directly.

@Slion Slion added feature New feature or request and removed cannot reproduce incomplete Does not contain enough information to be reproduced or acted upon bug Something isn't working labels Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants