-
Notifications
You must be signed in to change notification settings - Fork 1.2k
PoC: Fix external Custom Tab auth callbacks #7399
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
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -108,8 +108,19 @@ class CustomTabActivity : DuckDuckGoActivity() { | |
| } | ||
|
|
||
| companion object { | ||
| fun intent(context: Context, flags: Int, text: String?, toolbarColor: Int, isExternal: Boolean): Intent { | ||
| return Intent(context, CustomTabActivity::class.java).apply { | ||
| fun intent( | ||
| context: Context, | ||
| originalIntent: Intent?, | ||
| flags: Int, | ||
| text: String?, | ||
| toolbarColor: Int, | ||
| isExternal: Boolean, | ||
| ): Intent { | ||
| // Preserve Custom Tabs extras from the original caller intent (e.g., session binder), | ||
| // while still routing to our CustomTabActivity implementation. | ||
| val base = originalIntent?.let { Intent(it) } ?: Intent() | ||
| return base.apply { | ||
| setClass(context, CustomTabActivity::class.java) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Copied intent preserves original flags causing unexpected behaviorWhen creating the Custom Tab intent, Please tell me if this was useful or not with a 👍 or 👎. |
||
| addFlags(flags) | ||
| putExtra(CustomTabsIntent.EXTRA_TOOLBAR_COLOR, toolbarColor) | ||
| putExtra(Intent.EXTRA_TEXT, text) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Missing deferred URL load for new tab scenario
When loading
fallbackUrlinlaunchNonHttpAppLinkFromExternalCustomTab, the code directly callswebView?.loadUrl(fallbackUrl, headers). The originalopenExternalDialogfunction checksviewModel.linkOpenedInNewTab()and useswebView.postto defer the load when true, ensuring the WebView is properly attached. If a new tab is opened within an external Custom Tab (viawindow.openortarget="_blank"),isLinkOpenedInNewTabwould be true, but this new function skips the deferred loading pattern. This could cause a race condition where the URL load is attempted before the WebView is ready.Please tell me if this was useful or not with a 👍 or 👎.