Open external links in same activity (#3395)

It's common for users to expect that re-opening the app would
allow them to "continue where they left off". This also applies
for the case where they leave the app after opening an
external link. It's natural for them to expect that they would
see the webpage they left open when they re-open the app. This
doesn't happen for our app as we open custom tabs in a separate
activity. As a consequence, this makes the experience
un-intuitive.

Fix this by opening custom tabs in the same activity.

Fixes: #2944

Co-authored-by: Adam Jones <jones_adam@rocketmail.com>
This commit is contained in:
Kaartic Sivaraam 2020-03-02 15:29:26 +05:30 committed by GitHub
parent e68751f0b9
commit 48b6745349
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -145,7 +145,7 @@ public class Utils {
builder.setExitAnimations(context, android.R.anim.slide_in_left, android.R.anim.slide_out_right);
CustomTabsIntent customTabsIntent = builder.build();
// Clear previous browser tasks, so that back/exit buttons work as intended.
customTabsIntent.intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
customTabsIntent.intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
customTabsIntent.launchUrl(context, url);
}