grote / Transportr

Free Public Transport Assistant without Ads or Tracking
https://transportr.app
GNU General Public License v3.0
1.05k stars 189 forks source link

Split calendar exports into 1 item per leg #477

Open katrinleinweber opened 6 years ago

katrinleinweber commented 6 years ago

As a transportr-using traveler who usually has at least one switch-over, I would like the app to push with situationally useful info to the top of exported calendar item(s), so that I have to interact less with the device while on the move.

Currently, it puts trip.from.name + " → " + trip.to.name into the calendar item title and all other details into the item description. In the calendar app (here Thunderbird, but comparably on Android) the item look like this:

transportr-cal-export

Please disregard the unnecessary switch-over in Berlin in this example. Was just the first one that came to my mind.

Unfortunately, info that's needed for the switch-over (such as position & other context) are not easily visible and I usually have to unlock the phone, open the calendar and scroll down within the item to look up the next switch-over's details.

Please consider moving the situationally important details like leg.departure, …Position and leg.line out of the description and into the title field of the item. E.g. like this:

transportr-cal-export-better

This allows my phone to show me a few minutes before the scheduled end of one leg, where I need to go during the switch-over. At a single glance, and people could more easily compare transportr-provided info with the displays at the train station.

grote commented 6 years ago

Thanks for the suggestion. I agree that it makes total sense. The problem is that when I implemented this, there was no standard API to add stuff into people's calendar. You looked into the source already it seems. This is the hack I currently use: https://github.com/grote/Transportr/blob/8c911664ae31338ede1d0209d474ab9c7b2cb8db/app/src/main/java/de/grobox/transportr/trips/detail/TripUtils.kt#L46-L55

IMHO, this doesn't allow for splitting the event up (without the user manually exporting each leg). You could help by researching if there's a better API now that works for most calendars and that allows splitting up the event into legs.

grote commented 6 years ago

Here's the documentation: https://developer.android.com/guide/topics/providers/calendar-provider.html#intent-insert

Looks like CONTENT_URI is part of Android since API 14, so we could use this standard API now. However, this has the same issue as above as it would open several unsaved calendar entries if you have multiple legs.

We could also insert events directly without user interaction, but then we would need the WRITE_CALENDAR permission and we would need to find out which calendar to add the event to ourselves.

katrinleinweber commented 6 years ago

Would the latter be sensibly covered by a new setting a la calendar to save travel connections to? If not set, maybe a prompt could ask the user upon first use of the export option?

grote commented 6 years ago

The latter is preferable, but plus with the permission request it will be two extra dialogs. Also, we would need to find out which calenders the user has. Maybe this needs yet another permission.