crackededed / Xtra

Xtra is a Twitch player and browser for Android.
GNU Affero General Public License v3.0
1.18k stars 46 forks source link

Push notifications #82

Open CrazyWolf13 opened 2 years ago

CrazyWolf13 commented 2 years ago

Uhhmm why don't i get push notification? Is there no such setting? Or am i just blind lol Otherwise would be a very nice feature request.

crackededed commented 2 years ago

there's no notifications yet

CrazyWolf13 commented 2 years ago

Okay, would maybe be a nice feature

ghost commented 1 year ago

I would really like to have this. I currently rely on a Nitter RSS because the streamer publishes the streams on their Twitter, but sometimes that's unreliable and other streamers might not do that. So this would be really great to have.

CrazyWolf13 commented 1 year ago

I would really like to have this. I currently rely on a Nitter RSS because the streamer publishes the streams on their Twitter, but sometimes that's unreliable and other streamers might not do that. So this would be really great to have.

Thank you for your reply. Yes, i'd love to see this, because currently i use the bttv android app just for notifications lmao but this is a bit odd to always have two twitch apps.

CrazyWolf13 commented 12 months ago

@crackededed any news on this?

crackededed commented 12 months ago

i don't know how to do this

CrazyWolf13 commented 12 months ago

i don't know how to do this

Ohh I see, sorry did not know that.

Maybe this repo is helpful?

https://github.com/bttv-android/bttv

yoshimo commented 6 months ago

I have found the Graphql part where you can subscribe to notifications of various kinds and per channel. Usually an android app subscribes to Googles Firebase Cloud Messaging FCM and gets notified that way. I haven't seen the registration and connection yet as the FCM part is hard to properly intercept.

codenyte commented 6 months ago

Perhaps we could use Webhooks for this? I found this Twitch documentation: https://dev.twitch.tv/docs/eventsub/manage-subscriptions/

codenyte commented 6 months ago

I also thought about somehow integrating this with UnifiedPush, but this would require some kind of 3rd party API, as this approach is impossible with the normal Twitch API. Maybe something that translates the Webhook event into a UnifiedPush notification. Similar to mollysocket, which allows you to get Signal notifications via UnifiedPush. UnifiedPush would be better than just using Webhooks/WebSocket, as it would decrease battery consumption, if the user already uses UnifiedPush for other apps. Not sure if FCM could be implemented, but many users don't like proprietary Google services anyway. The app could also not be released on F-Droid, if it used the proprietary FCM library.

crackededed commented 6 months ago

i think WorkManager could be used to ping the api periodically but that can only be done every 15 minutes and not any faster

codenyte commented 6 months ago

That wouldn't be a proper implementation of Push notifications

KaKi87 commented 3 months ago

Hello, Any news on this ? Thanks

CrazyWolf13 commented 1 month ago

@crackededed Maybe the people on here can help you? https://matrix.to/#/#unifiedpush:matrix.org

crackededed commented 1 month ago

wouldn't you need to host your own server for unifiedpush? idk if anyone wants to do that

CrazyWolf13 commented 1 month ago

Well at least something, so I can just get push notifications without using apps like bttv/twitch 😂

KaKi87 commented 1 month ago

Maybe there are shared instances ?

codenyte commented 1 month ago

There are. Some examples are ntfy.adminforge.de and ntfy.rollenspiel.monster

CrazyWolf13 commented 1 month ago

Also the official ntfy.sh ?

ubergeek77 commented 1 month ago

I wouldn't mind hosting my own notification infrastructure, but that might be a bit hacky and cumbersome.

Another option: I remember some third party Reddit clients used to get clever and read the official Reddit app's incoming notifications, and use that information to display its own. The third party app would request access to system notifications in order to read them (there is a permission for this).

You could mute the notifications from the Reddit app and never see them, but still have the third party client display them correctly. You essentially piggyback off the notifications from the official app without needing your own notification infrastructure. Not ideal but possibly the best option here. If this is what is done, I would humbly request that the bttv mod's package name also be included (tv.twitch.bttvandroid.app).

Alternatively, you could keep the app awake in the background to poll manually. Would impact battery life. The above notification copying approach above might also require some level of running in the background.

CrazyWolf13 commented 1 month ago

@ubergeek77 Yes!

However I think a mechanic to read notifications from the official / BTTV app is really not neccessary, because it gives a user absolutelty NO benefit, only a lot of work for the dev. One would still need both apps, and still needs to be signed into both of them.

ChaosNicro commented 1 month ago

Twitch side does webhook-handlers and websocket-handlers for notifications. This needs a dev-key iirc. Which would either be held by cracked, or if rate-limits are to low, you could ask each user to create their own.

UP requires POST requests to be sent to the (ntfy) endpoint. This would need a middleware server to hold the handler and send out the POSTs. Not sure if the webhooks could be mangled into POSTs directly using a rewrite.

A polling sulution would let the client maintain the handler directly.

Take this with a grain of salt, I'm not up-to-date with the docs.

crackededed commented 2 days ago

i've added notifications using workmanager now. it refreshes every 15 minutes

KaKi87 commented 2 days ago

Is that included in the latest release ? GitHub doesn't give a number for the latest release, is it 2.36.0 ? The app didn't ask for the notification permission, is there a setting to enable ? Thanks

crackededed commented 1 day ago

it's near the bottom in settings

CrazyWolf13 commented 17 hours ago

@crackededed I0ve just tried again, to find the setting, however as @KaKi87 described the app did not ask for permission, and I could not find a setting for the notifications. I've verified, I have the latest released two days ago via froid.

Would you mind sharing the full path in settings or a screenshot? I really cannot seem to find the corresponding setting. Thanks!

crackededed commented 14 hours ago

latest version is not in fdroid yet

KaKi87 commented 13 hours ago

I, however, am using the latest GitHub APK.

crackededed commented 13 hours ago

latest is 2.37.0

KaKi87 commented 7 hours ago

Oh, I'm using Obtainium, which, for some reason, was convinced the app was up to date even though it wasn't.

So, I enabled in-app update checks to prevent this confusion, and I now see the setting which I enabled, the app then asked for the notification permission.

Thanks !