OneBusAway / onebusaway-android

The official Android app for OneBusAway
http://www.onebusaway.org/
Other
463 stars 289 forks source link

Support Shared Trips and Deep Links #715

Open barbeau opened 7 years ago

barbeau commented 7 years ago

Summary:

Allow users to tap on a few buttons in the app to share the trip whey are currently on via SMS/messaging app, so someone else can tap on that URL and open that trip in the app. Work across Android and iOS.

iOS issue - https://github.com/OneBusAway/onebusaway-iphone/issues/833 iOS PR - https://github.com/OneBusAway/onebusaway-iphone/pull/855

From that PR:

Here are the key points of this commit:

  1. Allows users to share the trip they are taking with another person via text message or any other form of communication vended through UIActivityViewController.
  2. Trips are shared via URL. These URLs encode the ID of the region that their trips belong to, which means that they are globally unique. They also do not depend on individual OBA region servers, which means that the iOS app doesn't need region server information hardcoded into it.
  3. People with OneBusAway for iOS are taken to the trip itself when they tap on one of these links.
  4. People without OBA for iOS are taken first to http://onebusaway.co, and then redirected to the appropriate region server's web page for that trip.

See above PR for screenshots on iOS.

URL format on iOS:

~https://www.onebusaway.co/regions/<region_id>/stops/<stop_id>/arrivals~ https://www.onebusaway.co/regions/<region_id>/stops/<stop_id>/trips

with query params:

Example: https://www.onebusaway.co/regions/1/stops/1_29273/arrivals?trip_id1_30938405&service_date=1478156400000&stop_sequence=10

Update Oct 24 2017:

Current URL format on iOS: https://www.onebusaway.co/regions/0/stops/Hillsborough%20Area%20Regional%20Transit_4543/trips?trip_id=Hillsborough%20Area%20Regional%20Transit_300984&service_date=1508817600000&stop_sequence=52

barbeau commented 7 years ago

Good tutorial on deep links: http://search-codelabs.appspot.com/codelabs/android-deep-linking

barbeau commented 7 years ago

After discussion in https://github.com/OneBusAway/onebusaway-iphone/pull/855#issuecomment-258583997, the above path should be changing from /arrivals to /trips - I've edited original post to reflect this.

aaronbrethorst commented 6 years ago

This all looks 👍 to me.

barbeau commented 6 years ago

Thanks @aaronbrethorst!

Here's a screen capture of the current feature on iOS: https://www.dropbox.com/s/zu9k1abjahn0fso/OBA-iOS-trip-sharing.mov?dl=0

swardell commented 6 years ago

Maybe a little more than just a URL? As one of the options for a particular bus at a particular stop, allow doing a share (iOS/Android). This should say something like "I'm on my way on bus and I'll be to in minutes. Follow my ride at " - Going to the URL should load a webpage showing the destination stop, bus route, and that particular bus on the route.

barbeau commented 6 years ago

Sure, it should be pretty straightforward to add a little text too. I'll need to think through the UI a bit surrounding identifying a destination.

Tapping in the URL will launch you straight into the app with a view of that trip - if you look at the Dropbox link above you can see how this currently looks in general on iOS.

barbeau commented 6 years ago

Also, if you click on the URL on desktop, it will take you to the website: https://www.onebusaway.co/regions/0/stops/Hillsborough%20Area%20Regional%20Transit_4543/trips?trip_id=Hillsborough%20Area%20Regional%20Transit_300984&service_date=1508817600000&stop_sequence=52

aaronbrethorst commented 6 years ago

I've written more about how I intend to build out the iOS equivalent feature in https://github.com/OneBusAway/onebusaway-iphone/issues/1213

barbeau commented 4 years ago

Looks like the URL structure changed with OBA 2.0 servers:

For the bus in the screenshot the following link was generated that gives an HTTP 404.

http://alerts.onebusaway.org/regions/1/stops/1_660/trips?trip_id=40_35024798&service_date=1578384000000&stop_sequence=3

The new OBA 2.0 server software apparently changed its link structure for showing trips, and I need to go sort this out.