-
Notifications
You must be signed in to change notification settings - Fork 919
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
Android: Migrate auto-complete to Flow and Coroutines #5123
Android: Migrate auto-complete to Flow and Coroutines #5123
Conversation
418720f
to
cabd77b
Compare
60cab4e
to
c3e69d7
Compare
cabd77b
to
16012e8
Compare
c3e69d7
to
6ec2529
Compare
16012e8
to
ed1fee2
Compare
6ec2529
to
37a6efa
Compare
ed1fee2
to
f679db7
Compare
e412c4c
to
b33504d
Compare
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.
Looks good and works as expected. Left a coupe of small comments, but great work! 🎉
Now that we aren't using Rx for autocomplete anymore, can we remove the rxjava dependencies somewhere? I believe we should be able to remove them from at least the history modules
.sortedByDescending { it.score } | ||
.map { it.suggestion } | ||
} | ||
val savedSites = getAutoCompleteBookmarkResults(query) |
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.
For simplicity, can we just combine all flows in one single operation?
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.
Thanks for the suggestion 👍 Updated.
|
||
return savedSitesObservable.zipWith(getAutoCompleteSearchResults(query)) { bookmarksAndTabsAndHistory, searchResults -> | ||
val topHits = (searchResults + bookmarksAndTabsAndHistory).filter { | ||
savedSites.collect { (bookmarksAndFavoritesAndTabsAndHistory, searchResults) -> |
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.
Can't we just map
instead of collect
and emit
?
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.
Thanks for the suggestion 👍 Updated.
@@ -468,3 +466,15 @@ class AutoCompleteApi @Inject constructor( | |||
val score: Int = DEFAULT_SCORE, | |||
) | |||
} | |||
|
|||
@VisibleForTesting |
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.
Do we need the annotation since this is internal?
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.
The annotation is there to mark the fact that this function should be private, but the visibility was changed for testing purposes. I didn't add what the visibility should have been. By default, if not mentioned, is private (as in this case).
@VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
@@ -1681,6 +1681,9 @@ class BrowserTabFragment : | |||
duckPlayerScripts.sendSubscriptionEvent(it.duckPlayerData) | |||
} | |||
is Command.SwitchToTab -> { | |||
binding.focusedView.gone() |
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.
Curious why we need this, since it doesn't seem to be related to the migration
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 code was added to cover the scenario where the Switch to tab
suggestion matches the current tab. In this case we need to close the suggestions and have the UI in a state similar as when opening a different tab.
4b8c8a2
to
e5b9a08
Compare
cc552b6
to
03a8d05
Compare
…losed suggestions when only one tab is open.
…f flow of mutable list.
…s on each section.
e5b9a08
to
bb5d02d
Compare
03a8d05
to
7a4e8c7
Compare
val testObserver = TestObserver.create<String>() | ||
testee.resultsPublishSubject.subscribe(testObserver) | ||
// val testObserver = TestObserver.create<String>() | ||
// testee.resultsStateFlow.subscribe(testObserver) |
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.
You can delete the commented-out lines in this file
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.
Thanks! Removed :)
Task/Issue URL: https://app.asana.com/0/0/1208581391309609/f ### Description Fixed autocomplete flow and pixels. ### Steps to test this PR Steps to repro: - [x] Install from branch `feature/ana/android_migrate_auto_complete_to_flow_and_coroutines` - [x] Visit a site in a new tab - [x] Open ... menu - [x] Click add bookmark - [x] Observe that autocomplete pixels are firing (they should not): m_autocomplete_displayed_bookmark m_autocomplete_displayed_switch_to_tab Test the fix: - [x] Install from this branch - [x] Visit a site in a new tab - [x] Open ... menu - [x] Click add bookmark - [x] Autocomplete pixels are not firing (check for "m_autocomplete" in logs) ### NO UI changes
92090e4
into
feature/ana/address_the_tasks_in_the_meta_section
…ggest (#5018) Task/Issue URL: https://app.asana.com/0/1200581511062568/1208260875798966/f ### Description The full implementation will span across a few tasks. This is the main task for the implementation of [Android: Include existing open tabs in search autosuggest](https://app.asana.com/0/715106103902962/1208040193300233/f) ### Steps to test this PR See: - #5019 - #5042 - #5063 - #5064 - #5065 - #5105 - #5123 See scenarios and screenshots in https://app.asana.com/0/1200581511062568/1208264037618741/f --------- Co-authored-by: Dax The Translator <[email protected]>
…ggest (#5018) Task/Issue URL: https://app.asana.com/0/1200581511062568/1208260875798966/f ### Description The full implementation will span across a few tasks. This is the main task for the implementation of [Android: Include existing open tabs in search autosuggest](https://app.asana.com/0/715106103902962/1208040193300233/f) ### Steps to test this PR See: - #5019 - #5042 - #5063 - #5064 - #5065 - #5105 - #5123 See scenarios and screenshots in https://app.asana.com/0/1200581511062568/1208264037618741/f --------- Co-authored-by: Dax The Translator <[email protected]>
Task/Issue URL: https://app.asana.com/0/1200581511062568/1208040472309277/f
Description
Removed rxjava from autosuggest.
Steps to test this PR
Smoke test the autosuggest. There should be no user facing changes.
This is the final PR. See scenarios and screenshots in https://app.asana.com/0/1200581511062568/1208264037618741/f
NO UI changes