duckduckgo / ios-search-and-stories

DuckDuckGo Search & Stories for iOS
Other
176 stars 79 forks source link

Orange border at top of SERP is still being displayed #112

Closed chrismorast closed 9 years ago

chrismorast commented 9 years ago

Hey @sreilly ,

We should have a string that gets sent with the queries from within our app that allows our code to detect it came from the app so we can turn off visibility of the orange border at the top of out SERP.

It should look something like this:

if ($data->{user_agent} =~ /^DDG/i) {
 $header_class .= ' is-app';
 }

so what that means is if the user_agent string starts with 'DDG' then the class is added and the border should disappear.

Our best guess is that this is added in the wrong spot and our code isn't detecting it.

Adding @sdougbrown incase you need any additional info.

screen shot 2015-09-23 at 12 27 26 pm

sreilly commented 9 years ago

@chrismorast is the user-agent being evaluated on the server side or in the javascript? I remember that we have been setting the user agent in HTTP requests to "DDG-iOS-" but I doubt that would be set in the javascript in-page code

bsstoner commented 9 years ago

Hi @sreilly! I think the user agent is being sent to the server with DDG-iOS-, but for some reason it's not getting passed through to the UIWebView? We parse the UA string (from navigator.userAgent) in the JS and assign a .is-app class to the top level html element. That logic should hide the red bar.

sreilly commented 9 years ago

Hi @bsstoner, Ah I see. I've just pushed an update that will make sure the web viewer also sets the navigator.userAgent string. When I tried it just now I confirmed that the value was being set but was still seeing the orange line, but maybe the js code isn't in place yet?

bsstoner commented 9 years ago

@sreilly nice, thank you! We separately had to make a change to the CSS to update how the red bar hides. If you are able to point to bttf.duckduckgo.com (our internal integration server) you should see the red bar go away (assuming we did everything correctly).

sdougbrown commented 9 years ago

I thought that I replied to this yesterday, but I just found my comment still sitting here. (Not necessary now - @bsstoner explained the issue very well.) Sorry about the delayed response, guys.

sreilly commented 9 years ago

@bsstoner can you try the current build (652) from testflight? I've confirmed that the navigator.userAgent string is set to the DDG-iOS- test. Thanks!

thm commented 9 years ago

@sreilly Reassigning to myself to confirm this once bttf is synced to production, as the red bar still seems to appear. Thanks @bsstoner!

sreilly commented 9 years ago

it should be possible to type the bttf query URL into the search field to test it. I don't think the app does anything special with the built-in queries that can't be reproduced by entering the URL manually.