umts / pvta-multiplatform

Transit realtime app for mobile devices
Other
6 stars 5 forks source link

"Remind Me" #396

Open akaplo opened 7 years ago

akaplo commented 7 years ago

Feature proposition: On the Stop and Schedule pages, we provide an option to send the user a local notification to remind them to catch their bus.

I recommend rolling out this feature in stages:

  1. Use Ionic Native's LocalNotification plugin to send delayed notifications for each scheduled departure on the stop page.

    The user will click a button on the departure and be presented with a dialog asking how far in advance of the departure they'd like to be notified. When the notification is tapped, the user will be brought back to the page for the stop (or route?) they set it on.

  2. Use the same Cordova plugin on the Schedule page. A user plans a trip and clicks a button to be reminded. The same dialog for delay time could be used. Clicking the notification gets them what page though?

  3. Use the Web Notification API and our service worker to enable desktop browsers to participate in Stop page notifications?

  4. Use the same to enable desktop browsers to participate in Schedule page notifications?

@sherson @werebus @mboneil10 @petermarathas @dfaulken thoughts? I'd expect this to take a few weeks for all steps including testing and rollout, but a good scaffold plus step 1 could be written up in about 2 days.

mboneil10 commented 7 years ago

I think this is a reasonable and doable feature. Probably not top priority, but I like the idea. It would be helpful to those of us who miss the bus... 🚌

werebus commented 7 years ago

This seems to be a valuable addition. I can definitely see why scheduled departures are a drastically easier target, and it's 100% where we should start. But, just out of curiosity, how arduous would estimated departures be? I assume it would require some sort of background service.

Some other thoughts:

sherson commented 7 years ago

I have mixed feelings about sending notifications based only on schedule data. Currently, the schedule (aka plan-trip) section is useful for planning something later in the day (or on another day). But once we get close to a desired departure time, I (as a passenger) want real-time.

That written, if it behaved as @werebus suggested ("tapping the notification in part 1. would open the stop page with the specific route expanded"), I think it'd be fine.

Side note in case we ever decide to implement notifications based on estimated departures: we have open issues with Avail regarding improving feed behavior when buses go into voice fallback (or have non-functioning Avail equipment). Until that's dealt with, it'd probably be better not to implement notifications based on real-time.

In any case, my initial inclination is to hibernate this (we have other things to work on).

akaplo commented 7 years ago

I've spent a few hours on this in the last month - it's actually a pretty easy implementation. But, turns out the Cordova plugin is actually quite bad - it doesn't support multi-line notifications and (on newer versions of Android, at least), I'm unable to set the notification icon to be non-default.

It'd be an OK experience for our users though; I'll add a gif shortly and I'll be interested in your opinions.

akaplo commented 7 years ago

Perhaps a better approach would be to use PhoneGap's plugin, which is an implementation of W3C's Web Notifications API for Cordova projects. MDN has a good overview.