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

Address Bar/Search Experience improvements #103

Merged
merged 19 commits into from
Apr 30, 2021
Merged

Conversation

mallexxx
Copy link
Collaborator

Task/Issue URL: https://app.asana.com/0/1199237043630360/1200180252402997
Design URL: https://www.figma.com/file/GMASm53B24PF9R0N8MpoDi/Bookmarks-in-Search-Suggestions?node-id=1%3A17757
CC: @tomasstrba @samsymons @brindy

Description:
This PR contains the following changes:

  • First suggested URL (or bookmark) is autocompleted to the Address Bar
  • To bring the URL results to the top, sorting is applied to the Suggestions
  • Favorited Bookmark icon added for Suggestions

Steps to test this PR:

  1. Begin typing a URL/Bookmark in the Address Bar
  2. Ensure the address is autocompleted and search suggestion is higlighted
  3. Ensure if the URL does not match the entered text it won't autocomplete
  4. Ensure arrows/mouse navigation is working correctly
  5. Ensure when backspace/pasteboard/input in the middle is performed then address is not autocompleted

Internal references:

Software Engineering Expectations
Technical Design Template
When ready for review, remember to post the PR in MM

let suggestions = suggestions?.map { suggestion -> Suggestion in
if case .phrase(phrase: let phrase) = suggestion,
let url = phrase.punycodedUrl, url.isValid {
return .website(url: url)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I moved the code converting a suggestion to URL here to make it the single source of truth located in the Model layer

Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest to move it into Suggestion.swift

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure about this one as it would require also bringing the Punycode package dependency into BrowserServicesKit, @samsymons what do you think?

Copy link
Contributor

@tomasstrba tomasstrba left a comment

Choose a reason for hiding this comment

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

Alex, the code looks fine in general, I only found few tiny details to polish.

suggestionContainer.getSuggestions(for: userStringValue)
private(set) var userStringValue: String?

private var userTyped = false
Copy link
Contributor

Choose a reason for hiding this comment

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

Please, is there a more descriptive name for this property? The best is when a reader doesn’t need to look at the algorithm to guess what is the purpose of it

let suggestions = suggestions?.map { suggestion -> Suggestion in
if case .phrase(phrase: let phrase) = suggestion,
let url = phrase.punycodedUrl, url.isValid {
return .website(url: url)
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest to move it into Suggestion.swift

return suggestion
}
.enumerated()
.sorted { lhs, rhs -> Bool in
Copy link
Contributor

@tomasstrba tomasstrba Apr 26, 2021

Choose a reason for hiding this comment

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

Few things here:

  1. Ordering is responsibility of the shared algorithm.
  2. Please, just don’t bother with the ordering of suggestions in this task at all. I’m currently kicking of a project that will add history items and cover ordering. I’ll make the tech design and a product feedback request so we get some feedback before the implementation. (Below, putting websites before phrases is probably not right. The order was set by the remote service and preferring a website before a phrase all the time could make searching experience pretty weird + less profitable for us as a company)

@tomasstrba
Copy link
Contributor

tomasstrba commented Apr 27, 2021

Alex, thanks for edits, works great now! 💯

Do you think we could smooth the experience a bit? Every time user types a new letter, we basically deselect the row and select the row again even when it could stay selected. It makes the experience too blinking I think and it could be fixed pretty easily, for example cache selected row until new suggestions are delivered (but only when it makes sense). Please look at attachment if its not clear what I’m talking about.

safari
ddg

@mallexxx
Copy link
Collaborator Author

@tomasstrba I did the changes we discussed:

  • moved the Suggestion URLs mapping to a factory callback and updated BrowserServicesKit. NOTE: email feature is disabled now and BrowserServicesKit points to my private branch, This will be rolled back when the BrowserServicesKit PR is ready!
  • Fixed the Suggestion blinking when user continues typing
  • Also fixed Suggestions TableView first row selection not being displayed when the Suggestions are reloaded

Copy link
Contributor

@tomasstrba tomasstrba left a comment

Choose a reason for hiding this comment

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

LGTM! This rocks!🤘 👏

@mallexxx mallexxx merged commit cfb8645 into develop Apr 30, 2021
@mallexxx mallexxx deleted the feature/alex/address-bar branch April 30, 2021 16:34
samsymons pushed a commit that referenced this pull request May 25, 2023
Task/Issue URL: https://app.asana.com/0/1203137811378537/1204667932873181/f
CC: @samsymons

Description:

Follow-for to Restore the Developer ID script #103
Set Deploy location for Developer ID build to /Applications/DEBUG
Added extra NetP Debug menu items to uninstall SysEx/Login Items
Moved NetP debug menu items handling methods to AppDelegate to allow their usage when no windows are open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants