Skip to content
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

Store history #4362

Conversation

CrisBarreiro
Copy link
Contributor

@CrisBarreiro CrisBarreiro commented Mar 27, 2024

Task/Issue URL: https://app.asana.com/0/1205008441501016/1206816228247418/f

Description

Steps to test this PR

Website (not SERP)

  • Visit a page (not SERP)
  • Open the history database using inspector or flipper, and check there's a new entry in history_entries. Take note of the ID. Check the title field contains the same title as the tab, the query field is empty and isSerp is 0
  • Check there's an entry in visits_list with that same historyEntryId
  • Reload the page
  • Check the history_entries table still has only one entry for that site
  • Check the visits_list contains 2 entries for that same historyEntryId

SERP

  • Perform a search
  • Open the history database using inspector or flipper, and check there's a new entry in history_entries. Take note of the ID. Check the title field contains the same title as the tab, the query field contains your query, and isSerp is 0
  • Check there's an entry in visits_list with that same historyEntryId
  • Reload the page
  • Check the history_entries table still has only one entry for that site (In some cases, reload doesn't produce the same exact query params,* in case a second entry is added, check URLs are different)
  • Check the visits_list contains 2 entries for that same historyEntryId

DuckDuckGo URL (not SERP)

Clear app data between tests, fire button doesn't clear history
(yet)

Feature 1

  • Visit wikipedia.org
  • Type wiki
  • Check a history result is shown for wikipedia.org

Feature 2

Feature 3

  • Add a random site as a bookmark
  • Then go to bookmarks and edit it, Set https://wikipedia.org as the
    URL and Wikipedia as the title
  • Type wiki
  • Check wikipedia is shown on the bottom section with a bookmark
    icon, not in top hits
  • Visit wikipedia.org
  • Check now wikipedia is shown in top hits with the bookmark icon

Feature 4

  • Add a random site as a favorite
  • Then go to bookmarks and edit it, Set https://wikipedia.org as the
    URL and Wikipedia as the title
  • Type wiki
  • Check now wikipedia is shown in top hits with the favorite icon

Feature 5

  • Type something on the search bar
  • Check history/bookmark/favorite suggestions aren't shown before
    search suggestions are loaded

Feature 6

  • Type something on the search bar
  • Quickly delete everything
  • Check history/bookmark/favorite suggestions aren't shown before
    search suggestions and no "No suggestions found" message is shown either

UI changes

wikipedia_history.mp4

Copy link
Contributor Author

CrisBarreiro commented Mar 27, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @CrisBarreiro and the rest of your teammates on Graphite Graphite

@CrisBarreiro CrisBarreiro mentioned this pull request Mar 27, 2024
41 tasks
@CrisBarreiro CrisBarreiro force-pushed the feature/cbarreiro/autocomplete/store-history branch 4 times, most recently from 1aa07e2 to 6bddeb1 Compare April 2, 2024 11:28
@CrisBarreiro CrisBarreiro marked this pull request as ready for review April 2, 2024 13:22
@CrisBarreiro CrisBarreiro force-pushed the feature/cbarreiro/autocomplete/store-history branch from 6bddeb1 to 53c1b9d Compare April 2, 2024 13:44
@CrisBarreiro CrisBarreiro force-pushed the feature/cbarreiro/autocomplete/add-pixels branch from 627f283 to ada80bd Compare April 3, 2024 13:29
@CrisBarreiro CrisBarreiro force-pushed the feature/cbarreiro/autocomplete/store-history branch from e89750d to 28fb51f Compare April 3, 2024 13:29
@CrisBarreiro CrisBarreiro force-pushed the feature/cbarreiro/autocomplete/add-pixels branch from ada80bd to 2413b01 Compare April 5, 2024 10:30
@CrisBarreiro CrisBarreiro force-pushed the feature/cbarreiro/autocomplete/store-history branch from 28fb51f to fcb236d Compare April 5, 2024 10:30
Copy link
Contributor

@cmonfortep cmonfortep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments. Focused mainly on the models as discussed. Happy to follow on them via zoom next week.

I'm gonna propose you to consider creating a module for history. TBH, what I see makes me think we should have a module with a public interface. We have our own db, we are defining what the api should be, etc.

The rest looks great to me, and I don't have major comments on the approach. Happy to chat more about this next week. I'm really excited with the feature 💯


data class VisitedSERP(
override val url: Uri,
override val title: String,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it make sense that a search has title? Not sure if it's adding value here or if we are just interested on query and url.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the autocomplete feature, we don't really need a title, but I'm adding it anyways as other features might need it. The query and the title are slightly different. For example, if you search for "cat", query will be "cat", but title will be "cat at DuckDuckGo". I think it's best to keep both


fun HistoryEntryWithVisits.toHistoryEntry(): HistoryEntry {
return when (historyEntry.isSerp) {
true -> VisitedSERP(historyEntry.url.toUri(), historyEntry.title, historyEntry.query ?: "", visits = visits.map { Date(it.date) })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we filter searches that are empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

@CrisBarreiro CrisBarreiro force-pushed the feature/cbarreiro/autocomplete/add-pixels branch from 2413b01 to bfdb2e6 Compare April 10, 2024 13:31
@CrisBarreiro CrisBarreiro force-pushed the feature/cbarreiro/autocomplete/store-history branch from a413c59 to f426d21 Compare April 10, 2024 13:31
@CrisBarreiro CrisBarreiro force-pushed the feature/cbarreiro/autocomplete/add-pixels branch from bfdb2e6 to a3a6ce9 Compare April 10, 2024 17:26
@CrisBarreiro CrisBarreiro force-pushed the feature/cbarreiro/autocomplete/store-history branch from 4a66f1f to 1796663 Compare April 10, 2024 17:26
@CrisBarreiro CrisBarreiro force-pushed the feature/cbarreiro/autocomplete/store-history branch from 1796663 to 379ce03 Compare April 11, 2024 07:54
@CrisBarreiro CrisBarreiro force-pushed the feature/cbarreiro/autocomplete/add-pixels branch from a3a6ce9 to 5b07ffc Compare April 11, 2024 10:49
@CrisBarreiro CrisBarreiro force-pushed the feature/cbarreiro/autocomplete/store-history branch 2 times, most recently from b4d2ae0 to a217bcc Compare April 11, 2024 15:23
@CrisBarreiro CrisBarreiro force-pushed the feature/cbarreiro/autocomplete/add-pixels branch from 5b07ffc to 041a68e Compare April 23, 2024 11:43
@CrisBarreiro CrisBarreiro force-pushed the feature/cbarreiro/autocomplete/store-history branch from 8346892 to e23a098 Compare April 23, 2024 11:43
@CrisBarreiro CrisBarreiro changed the title [WIP] Store history Store history Apr 25, 2024
Extract history to its own module
Task/Issue URL: https://app.asana.com/0/0/1206816228247411/f

### Description

### Steps to test this PR

**Clear app data between tests, fire button doesn't clear history
(yet)**

_Feature 1_
- [ ] Visit wikipedia.org
- [ ] Type wiki
- [ ] Check a history result is shown for wikipedia.org

_Feature 2_
- [ ] Visit https://en.wikipedia.org/wiki/Cat
- [ ] Type wiki
- [ ] Check there's no top hits result for Cat at wikipedia
- [ ] Visit https://en.wikipedia.org/wiki/Cat 3 more times
- [ ] Check there's a top hits result for Cat at wikipedia

_Feature 3_
- [ ] Add a random site as a bookmark
- [ ] Then go to bookmarks and edit it, Set https://wikipedia.org as the
URL and Wikipedia as the title
- [ ] Type wiki
- [ ] Check wikipedia is shown on the bottom section with a bookmark
icon, not in top hits
- [ ] Visit wikipedia.org
- [ ] Check now wikipedia is shown in top hits with the bookmark icon

_Feature 4_
- [ ] Add a random site as a favorite
- [ ] Then go to bookmarks and edit it, Set https://wikipedia.org as the
URL and Wikipedia as the title
- [ ] Type wiki
- [ ] Check now wikipedia is shown in top hits with the favorite icon

_Feature 5_

- [ ] Type something on the search bar
- [ ] Check history/bookmark/favorite suggestions aren't shown before
search suggestions are loaded

_Feature 6_
- [ ] Type something on the search bar
- [ ] Quickly delete everything
- [ ] Check history/bookmark/favorite suggestions aren't shown before
search suggestions and no "No suggestions found" message is shown either

### UI changes


https://github.com/duckduckgo/Android/assets/6297834/645d3666-82a0-490a-9bf6-02901d14a117
@CrisBarreiro CrisBarreiro merged commit 04b8cb6 into feature/cbarreiro/autocomplete/add-pixels Apr 30, 2024
4 checks passed
@CrisBarreiro CrisBarreiro deleted the feature/cbarreiro/autocomplete/store-history branch April 30, 2024 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants