-
Notifications
You must be signed in to change notification settings - Fork 260
Fixes #533 - changing to retain the keyword searched instead final url #1215
Conversation
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.
Overall looks good. Two major things to change: the functionality of display vs. truncated URL when editing regresses with this PR, and I think we should erase the search stack when the user presses erase.
Blockzilla.xcodeproj/project.pbxproj
Outdated
@@ -53,7 +54,7 @@ | |||
747ADA181FC38EFC00970132 /* IntroViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 747ADA171FC38EFC00970132 /* IntroViewController.swift */; }; | |||
74F94FF21FD9CA070047E629 /* Intro.strings in Resources */ = {isa = PBXBuildFile; fileRef = 74F94FF41FD9CA070047E629 /* Intro.strings */; }; | |||
A57245250F88CCA4993E55B2 /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F4C4943B406FCA9B74B4E186 /* CoreText.framework */; }; | |||
A89766DA1F57DCA9008183C5 /* BuildFile in Resources */ = {isa = PBXBuildFile; }; | |||
A89766DA1F57DCA9008183C5 /* (null) in Resources */ = {isa = PBXBuildFile; }; |
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 a little bit confused by why/where this change is coming from.
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.
Fix it!
Blockzilla/URLBar.swift
Outdated
@@ -470,6 +470,8 @@ class URLBar: UIView { | |||
func fillUrlBar(text: String) { | |||
urlText.text = text | |||
} | |||
|
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.
Nit: remove unnecessary whitespace changes.
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.
Fixed
Blockzilla/URLBar.swift
Outdated
truncatedURL = components?.host | ||
urlText.text = isEditing ? fullUrl : truncatedURL |
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 reverts one of the 7.0 PRs that displays a truncated version of the URL except when editing. We now need to have three states (search query if a search, full URL when editing, truncated url otherwise). All URLs should still display and act exactly the same as before, only search queries changing.
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've changed it to check if the value on my stack has a prefix like http://
or https://
, so now i can check if it has to show the truncated url or my searched keyword.
One thing i've noticed, is that the isEditing
value, is never getting the true
value, so i made a clean clone from the project (without my changes) and noticed that this happens in there too. I don't know if it's a bug or not (or if someone is working on this in parallel).
Blockzilla/SearchHistoryUtils.swift
Outdated
return "" | ||
} | ||
|
||
// go back |
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 this comment adds anything.
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.
Yeah, agree with you. Fixed!
Blockzilla/SearchHistoryUtils.swift
Outdated
} | ||
} | ||
|
||
// go foward |
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 this comment adds anything.
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.
Yeah, agree with you. Fixed!
Blockzilla/SearchHistoryUtils.swift
Outdated
} | ||
|
||
// go back | ||
static func goFoward() { |
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.
Nit: should be "goForward"
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.
Fixed!
Blockzilla/SearchHistoryUtils.swift
Outdated
} | ||
} | ||
|
||
return "" |
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.
Should return nil since it's optional.
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.
Fixed
Blockzilla/URLBar.swift
Outdated
var truncatedURL: String? = nil | ||
|
||
if let url = url { | ||
// Strip the username/password to prevent domain spoofing. | ||
var components = URLComponents(url: url, resolvingAgainstBaseURL: false) | ||
components?.user = nil | ||
components?.password = nil | ||
fullUrl = components?.url?.absoluteString | ||
|
||
if let searchedText = SearchHistoryUtils.pullSearchFromStack(), searchedText != "" { |
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.
After you change the function to return nil, you should be able to remove the check for != ""
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.
Fixed too
Blockzilla/SearchHistoryUtils.swift
Outdated
// go back | ||
static func goFoward() { | ||
isNavigating = true | ||
var currentStack = [textSearched]() |
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 you clarify that this will effectively "erase" the stack on each new session? I might be more comfortable having an explicit clear of the stack when the user presses erase -> I think it goes along with the idea that we clear everything we have on the user when they press erase.
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 cleaning the stack on BrowserViewController.swift
in line 439
.
Blockzilla.xcodeproj/project.pbxproj
Outdated
@@ -1428,7 +1431,7 @@ | |||
files = ( | |||
742C99D41F3A3AD200717D69 /* Assets.xcassets in Resources */, | |||
16938C0121010C2D00DCD489 /* InfoPlist.strings in Resources */, | |||
A89766DA1F57DCA9008183C5 /* BuildFile in Resources */, |
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 a little bit confused by why/where this change is coming from.
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.
Fixed
@oliviabrown9, Thank You for your notes! I've updated my PR and comment on your notes above. If something wrong, let me know! :) |
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.
Good progress! Still looks like the truncated URLs are not displaying correctly.
Blockzilla/URLBar.swift
Outdated
} else { | ||
displayText = truncatedURL | ||
} | ||
urlText.text = isEditing ? fullUrl : displayText |
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 like this still isn't working as expected. Rather than checking for http/https (which isn't always a given), you might want to check if it can be a URL. You can verify that your solution works by comparing it to the urls currently displayed when you run v7.0-dev.
@oliviabrown9, i've changed the validation to check if the string it's a URL, as you suggested, and i've updated my PR, can you check this out? Thanks again for helping me out to solve this issue! |
The URL bar is still displaying the incorrect full/truncated URL, but I realized that's actually a 7.0 issue rather than specific to this PR. I'm going to wait on #1248 to land to see how that affects this one and see if it all comes together. |
@marchiore Can you merge in the latest v7.0-dev and ping me when ready for review again? |
@oliviabrown9 merged! I've noticed a problem on Autocomplete, where it sometimes put a '/' at the begging of type. Is there someting the team is working on? P.S.: i've checked on a clean branch and the problem persists. |
@marchiore I haven't heard about or seen this issue before. Would you mind reproducing and uploading a photo/gif for us to investigate separately from this PR since it sounds unrelated. |
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 great! Thanks for all your work on this!
…earched instead final url (mozilla-mobile/focus-ios#1215) * Storing the Searched Keyword to show in the URLBar * Adding a validation to URLBar to check what's correct info to display * Adding a validation to check if the value on the stack is a url
…he keyword searched instead final url (mozilla-mobile/focus-ios#1215) * Storing the Searched Keyword to show in the URLBar * Adding a validation to URLBar to check what's correct info to display * Adding a validation to check if the value on the stack is a url
This PR is a continuation of an old PR (#544) and it fixes #533.
@oliviabrown9 can you check if everything is ok now? if you find something wrong i'll be glad in adjust it.