duckduckgo / ios-search-and-stories

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

Address link does not open native maps app #137

Closed chrismorast closed 8 years ago

chrismorast commented 8 years ago

My guess is there's still an issue with setting the mobile parameter. When I click on an address link from within the app, it opens up bing maps when it should open up apple maps

cc @nilnilnil @sdougbrown @bsstoner

sreilly commented 8 years ago

@chrismorast when tapping on an address the app is getting the following URL load requests: https://duckduckgo.com/l/?kh=-1&uddg=https%3A%2F%2Fbing.com%2Fmaps%2F%3Fobox%3D1%26q%3D135%2520George%2520Street%252C%2520Edinburgh%2520EH2%25204JH%252C%2520UK

https://bing.com/maps/?obox=1&q=135%20George%20Street%2C%20Edinburgh%20EH2%204JH%2C%20UK

https://www.bing.com/maps/?obox=1&q=135%20George%20Street%2C%20Edinburgh%20EH2%204JH%2C%20UK

https://login.live.com/login.srf?wa=wsignin1.0&rpsnv=12&ct=1445199174&rver=6.0.5286.0&wp=MBI&wreply=https:%2F%2Fwww.bing.com%2Fsecure%2FPassport.aspx%3Fpopup%3D1%26ssl%3D1&lc=2057&id=264960&checkda=1

https://www.bing.com/secure/Passport.aspx?popup=1&ssl=1

...etc.

I can't see into the javascript that is loaded from the DDG search results, but it doesn't seem like it's trying to open the Apple Maps URL. Can the results use the user-agent to detect if it's talking to the iOS app and, if so, use the Apple Maps URL format defined at the link below? https://developer.apple.com/library/ios/featuredarticles/iPhoneURLScheme_Reference/MapLinks/MapLinks.html

Would it be helpful if I just changed the user agent set for the client-side javascript to use the default (mobile safari) string with the DDG-iOS+version string appended to it?

chrismorast commented 8 years ago

Going to have to let @nilnilnil or @bsstoner make that call

bsstoner commented 8 years ago

No need to change user agent, we can fix this internally in the JS.

nilnilnil commented 8 years ago

This conflicts directly with #128 from my understanding.

sreilly commented 8 years ago

@bsstoner: @nilnilnil makes a great point there. I think both tickets would be resolved if we simply append the DDG-iOS-version tag to the default (mobile safari) user agent. Then servers/javascript that we don't control such as the imggur gifv stuff would treat us like mobile safari (which would be correct) and the DDG JS could still tell if it was running with the app as opposed to a normal browser.

bsstoner commented 8 years ago

Okay, we can do that. @nilnilnil Does that mean you're cool with changing the user agent? I wasn't sure what other implications there were aside from the device detection on the front-end.

nilnilnil commented 8 years ago

There are web server changes we'll need to make. I expect the best thing to do in #128 is to use the DDG UA for DDG requests and the default for everything else.

sreilly commented 8 years ago

@nilnilnil ok. Although on the app's side we can set the UA at a fine-grained level for http(s) requests, but for the navigator.userAgent setting that is accessed in javascript we can't choose which string that returns for individual pages or hosts.

sreilly commented 8 years ago

@thm This should now be fixed with the latest build!