Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Fixes #533 - changing to retain the keyword searched instead final url #1215

Merged
merged 7 commits into from
Aug 20, 2018

Conversation

marchiore
Copy link
Contributor

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.

Copy link
Contributor

@oliviabrown9 oliviabrown9 left a 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.

@@ -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; };
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fix it!

@@ -470,6 +470,8 @@ class URLBar: UIView {
func fillUrlBar(text: String) {
urlText.text = text
}

Copy link
Contributor

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.

Copy link
Contributor Author

@marchiore marchiore Aug 14, 2018

Choose a reason for hiding this comment

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

Fixed

truncatedURL = components?.host
urlText.text = isEditing ? fullUrl : truncatedURL
Copy link
Contributor

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.

Copy link
Contributor Author

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).

return ""
}

// go back
Copy link
Contributor

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.

Copy link
Contributor Author

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!

}
}

// go foward
Copy link
Contributor

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.

Copy link
Contributor Author

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!

}

// go back
static func goFoward() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: should be "goForward"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed!

}
}

return ""
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

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 != "" {
Copy link
Contributor

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 != ""

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed too

// go back
static func goFoward() {
isNavigating = true
var currentStack = [textSearched]()
Copy link
Contributor

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.

Copy link
Contributor Author

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.swiftin line 439.

@@ -1428,7 +1431,7 @@
files = (
742C99D41F3A3AD200717D69 /* Assets.xcassets in Resources */,
16938C0121010C2D00DCD489 /* InfoPlist.strings in Resources */,
A89766DA1F57DCA9008183C5 /* BuildFile in Resources */,
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@marchiore
Copy link
Contributor Author

marchiore commented Aug 14, 2018

@oliviabrown9, Thank You for your notes! I've updated my PR and comment on your notes above.

If something wrong, let me know!

:)

Copy link
Contributor

@oliviabrown9 oliviabrown9 left a 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.

} else {
displayText = truncatedURL
}
urlText.text = isEditing ? fullUrl : displayText
Copy link
Contributor

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.

Example: twitter.com (when using autocomplete)
Expected:
image

Result:
image

@marchiore
Copy link
Contributor Author

@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!

@oliviabrown9
Copy link
Contributor

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.

@oliviabrown9
Copy link
Contributor

@marchiore Can you merge in the latest v7.0-dev and ping me when ready for review again?

@marchiore
Copy link
Contributor Author

@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.

@oliviabrown9
Copy link
Contributor

@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.

Copy link
Contributor

@oliviabrown9 oliviabrown9 left a 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!

@oliviabrown9 oliviabrown9 merged commit cf1c3ec into mozilla-mobile:v7.0-dev Aug 20, 2018
isabelrios pushed a commit to isabelrios/firefox-ios that referenced this pull request Feb 14, 2024
…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
isabelrios pushed a commit to isabelrios/firefox-ios that referenced this pull request Feb 20, 2024
…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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants