-
Notifications
You must be signed in to change notification settings - Fork 891
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
Add RC flag for storing history #4495
Add RC flag for storing history #4495
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @CrisBarreiro and the rest of your teammates on Graphite |
132f86f
to
28322ab
Compare
a311445
to
1c7f509
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.
I'm taking a pass through all PRs, leaving some comments on this one. Just minor comments, overall looks good!
|
||
package com.duckduckgo.history.api | ||
|
||
interface HistoryRCWrapper { |
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 this one in the :api module? Seems only used internally
@@ -90,6 +95,14 @@ class RealHistoryRepository( | |||
} | |||
} | |||
|
|||
override fun isHistoryUserEnabled(default: Boolean): 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.
do we need default
here? could that detail be moved into SharedPreferencesHistoryDataStore
impl instead? I assume you need that value to change based on RC flag, if so maybe we can just have it as dependency there.
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.
Yes, I need the value to change based on the RC flag (If the local value is null, then default to the RC flag value). The reason I added it there is because I'm considering handling that case as part of the business logic. Let me know what you think
history/history-impl/src/main/java/com/duckduckgo/history/impl/RealNavigationHistory.kt
Outdated
Show resolved
Hide resolved
history/history-impl/src/main/java/com/duckduckgo/history/impl/RealNavigationHistory.kt
Outdated
Show resolved
Hide resolved
@@ -57,4 +62,16 @@ class RealNavigationHistory @Inject constructor( | |||
override suspend fun clearOldEntries() { | |||
historyRepository.clearEntriesOlderThan(currentTimeProvider.localDateTimeNow().minusDays(30)) | |||
} | |||
|
|||
override fun isHistoryUserEnabled(): 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.
I was wondering if all these methods that are related to toggle should be part of HistoryFeature
(aka. RealHistoryRCWrapper). So we have repository for storing and dealing with urls, and HistoryFeature for feature state (including user preference)
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.
I don't think so, any feature dealing with history would need access to these methods, so the cleanest the API we give them, the better, IMO. Also, I think that would be a bit confusing, since, as I mentioned on my previous comment, we usually reserve the *Feature
suffix for RC-related stuff. Also note that this method is related to user settings, not RC
history/history-impl/src/main/java/com/duckduckgo/history/impl/store/HistoryDataStore.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/com/duckduckgo/app/privatesearch/PrivateSearchActivity.kt
Show resolved
Hide resolved
app/src/main/java/com/duckduckgo/app/privatesearch/PrivateSearchViewModel.kt
Outdated
Show resolved
Hide resolved
/** | ||
* Returns whether the history RC flag is enabled. | ||
*/ | ||
fun isHistoryRCFlagEnabled(): 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.
What about naming it as isHistoryUserVisible
? just nit to name it based on what we expect rather than what we internally check.
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.
I'd rather change it to isHistoryFeatureAvailable
, userVisible
sounds too close to the UI layer for an API method
1f369f9
to
bdc61b8
Compare
9cbb477
to
c0a8b79
Compare
bdc61b8
to
a59c675
Compare
c0a8b79
to
8d3eaca
Compare
0f2046a
to
5d17569
Compare
8d3eaca
to
a7e5ea0
Compare
5d17569
to
997ab03
Compare
a7e5ea0
to
381d765
Compare
997ab03
to
2b54b39
Compare
381d765
to
6bf6500
Compare
2b54b39
to
1e05eca
Compare
6bf6500
to
27d4ca2
Compare
1e05eca
to
f63eb01
Compare
27d4ca2
to
da291cf
Compare
f63eb01
to
c0349ac
Compare
da291cf
to
c7e0aa5
Compare
c0349ac
to
0490131
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.
LGTM
Task/Issue URL: https://app.asana.com/0/0/1206816228247403/f ### Description Display an in-app message (above auto-complete results. See https://app.asana.com/0/0/1206816228247403/f for rules ### Steps to test this PR Update RC and set `storeHistory` to enabled. Alternatively, update `shouldStoreHistory` in `RealHistoryWrapper` so it returns true _Banner is not shown for new users_ - [ ] Do a clean install - [ ] Perform a search or visit a site - [ ] Repeat the same query again - [ ] Check history-based results are shown but no in-app message appears - [ ] Complete the onboarding - [ ] Repeat the same query again - [ ] Check history-based results are shown but no in-app message appears _Banner is shown for existing users_ - [ ] Update from a previous version of the app with completed onboarding, or update `isExistingUser` in `AutoComplete`so it returns true and do a clean install - [ ] Perform a search or visit a site - [ ] Repeat the same query again - [ ] Check history-based results are shown but and an in-app message appears _Banner isn't shown after being dismissed_ - [ ] Update `isExistingUser` in `AutoComplete`so it returns true and do a clean install - [ ] Perform a search or visit a site - [ ] Repeat the same query again - [ ] Check history-based results are shown but and an in-app message appears - [ ] Close the banner - [ ] Repeat the same query again - [ ] Check history-based results are shown but no in-app message appears _Banner is not shown when there are no history based-results results_ - [ ] Update `isExistingUser` in `AutoComplete`so it returns true and do a clean install - [ ] Visit wikipedia.org and add it to favorites - [ ] Use fire button - [ ] Type _wikipedia_ - [ ] Check no history-based results nor the banner are shown _Banner isn't shown more than 3 times_ Update `isExistingUser` in `AutoComplete`so it returns true and do a clean install - [ ] Perform a search or visit a site - [ ] Repeat the same query again - [ ] Check history-based results are shown but and an in-app message appears - [ ] Repeat previous 3 steps 4 times. Check the fourth time, the banner isn't shown anymore ### UI changes ![banner](https://github.com/duckduckgo/Android/assets/6297834/11f748d9-5131-42a8-a5bc-03330a585180)
fa6922a
into
feature/cbarreiro/autocomplete/delete-old-items
Task/Issue URL: https://app.asana.com/0/0/1206816228247406/f
Description
Add RC flag for storing history
Steps to test this PR
Feature 1
Feature 2
Feature 2
UI changes