-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Duck.ai - support for standalone migration #7046
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?
Conversation
| private val duckChatPixels: DuckChatPixels, | ||
| private val dataStore: DuckChatDataStore, | ||
| ) : DuckChatJSHelper { | ||
| private val migrationItems = mutableListOf<String>() |
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.
@joshliebe is this ok here? the data is not designed to stick around, so this seemed ok - but please let me know otherwise!
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.
@shakyShane what is being stored here? is it a blob?
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.
yep, just a string
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.
What happens in the unhappy case? If the app is killed while this is processing will the user lose all their data?
duckchat/duckchat-impl/src/main/java/com/duckduckgo/duckchat/impl/ui/DuckChatWebViewFragment.kt
Outdated
Show resolved
Hide resolved
malmstein
left a comment
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.
There are too many things that need changing / discussing before this is ready to be merged.
Might be easier to go over all this on Zoom with @joshliebe too and get it sorted.
duckchat/duckchat-impl/src/main/java/com/duckduckgo/duckchat/impl/helper/DuckChatJSHelper.kt
Outdated
Show resolved
Hide resolved
| private val duckChatPixels: DuckChatPixels, | ||
| private val dataStore: DuckChatDataStore, | ||
| ) : DuckChatJSHelper { | ||
| private val migrationItems = mutableListOf<String>() |
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.
@shakyShane what is being stored here? is it a blob?
duckchat/duckchat-impl/src/main/java/com/duckduckgo/duckchat/impl/helper/DuckChatJSHelper.kt
Outdated
Show resolved
Hide resolved
duckchat/duckchat-impl/src/main/java/com/duckduckgo/duckchat/impl/helper/DuckChatJSHelper.kt
Outdated
Show resolved
Hide resolved
duckchat/duckchat-impl/src/main/java/com/duckduckgo/duckchat/impl/ui/DuckChatWebViewFragment.kt
Outdated
Show resolved
Hide resolved
duckchat/duckchat-impl/src/main/java/com/duckduckgo/duckchat/impl/ui/DuckChatWebViewFragment.kt
Outdated
Show resolved
Hide resolved
duckchat/duckchat-impl/src/main/java/com/duckduckgo/duckchat/impl/RealDuckChat.kt
Show resolved
Hide resolved
|
Sounds good, thanks! |
e6cdc3f to
1e6eb00
Compare
1e6eb00 to
58a968e
Compare
| } | ||
|
|
||
| override fun isDuckAiUrl(url: String): Boolean { | ||
| return runCatching { AppUrl.Url.HOST_DUCKAI == url.toHttpUrl().topPrivateDomain() }.getOrElse { false } |
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.
This shouldn’t be here, belongs in duck-chat module
| * This method takes a [url] and returns `true` or `false`. | ||
| * @return `true` if the given [url] belongs to the duck.ai domain (apex or subdomain) and `false` otherwise. | ||
| */ | ||
| fun isDuckAiUrl(url: String): Boolean |
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.
Shouldn’t be in the browser-api
|
|
||
| object Url { | ||
| const val HOST = "duckduckgo.com" | ||
| const val HOST_DUCKAI = "duck.ai" |
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.
ditto
| } | ||
| } | ||
|
|
||
| /** |
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.
These changes are susceptible to race conditions
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.
there's at most 1 caller in the entire applications lifespan per message - that's by design. There's no situation in which 2 of these messages could be processed concurrently.
and if there was, it's easy to put behind a mutex? This is not like other FE features where things can be called at arbitrary times, it's forced to be in sequence
| val newWindowUrl = resultMsg?.data?.getString("url") | ||
| if (newWindowUrl != null) { | ||
| startActivity(browserNav.openInNewTab(requireContext(), newWindowUrl)) | ||
| if (duckDuckGoUrlDetector.isDuckAiUrl(newWindowUrl)) { |
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.
This logic should not be in the Fragment
| /** | ||
| * Returns whether standalone migration is supported. | ||
| */ | ||
| fun isStandaloneMigrationEnabled(): Boolean |
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.
Needs tests
Task/Issue URL: https://app.asana.com/1/137249556945/project/1201141132935289/task/1211793505313505?focus=true
LLM disclosure
Description
standaloneMigrationfeature flag, defaulted tofalseSteps to test this PR
Feature 1
UI changes