Traewelldroid / traewelldroid

Android app for @Traewelling public transport check-in service
https://traewelldroid.de
GNU Affero General Public License v3.0
67 stars 9 forks source link

Implement Push messages for notifications #65

Closed ChillLP closed 10 months ago

ChillLP commented 1 year ago

Titel says IT all, If i eg. Check in on the ICE 525 to munich in Düsseldorf Till Frankfurt on the Main Flugh fern. And Simone in Cologne Checks in, i get a Push Message "ICE 525: [Name] is also in Your Connection" or alike

DRSchlaubi commented 1 year ago

I think this currently cannot be implemented rn because of https://github.com/Traewelling/traewelling/issues/647, also we need some work from the @Traewelling guys themselves to implement this.

However, this seems to be already WIP: https://github.com/Traewelling/traewelling/issues/1301

Still something to figure out is how to actually forward these messages to the App, as play store guidelines actually state that it is not permitted to poll notifications

One way to resolve this would be to have a relay service receiving these events from träwelling and uses FCM for forwarding. FCM itself is free; however, it would involve another 3rd party service being required to run the App and would make it further incompatible with #36

/cc @jheubuch @nycodeghg

NyCodeGHG commented 1 year ago

I don't know if there is a nice way for push messaging without firebase, but on the traewelling side, I didn't think of a webhook for notifications, but thats a great i idea and i will write that down on my todo list

DRSchlaubi commented 1 year ago

I don't know if there is a nice way for push messaging without firebase

Yeah me neither, but ig it it was better to ask

I didn't think of a webhook for notifications, but thats a great i idea and i will write that down on my todo list

What would be a good setup-flow for this, ig the best way would be to integrate it into the oauth API, so applications can specify a webhook URL (+ maybe a specific scope) and then users can select on the authorize page whether they want that application to receive webhook events. Or do you have a better suggestion?

NyCodeGHG commented 1 year ago

The current implementation in my draft PR is: Usual OAuth Flow with webhooks scope -> App creates a webhook via POST /api/v1/webhooks -> App receives webhook signature secret in the response

Your solution with a dedicated oauth flow might be better for the user, but because all of the existing stuff runs on laravel passport, this would be more difficult to implement. I think we should discuss that in the draft PR

DRSchlaubi commented 1 year ago

I will comment on the PR

ChillLP commented 1 year ago

i dont have a single idea what is going on here but i like it

Sorunome commented 1 year ago

As for fdroid and FCM, there is UnifiedPush which is an open standard on how to do push notifications without FCM, in a completely open way. This could easily be utilized for push notifs for fdroid (and also for the google play builds, there is an fcm fallback available!)

/cc @DRSchlaubi

DRSchlaubi commented 1 year ago

Ig we can use it if we ever decide publishing on fdroid

jheubuch commented 10 months ago

Implementation was added with @Traewelling webhooks. Looks sth like that then: image

ChillLP commented 10 months ago

🎉🍾