Add android fallback for background push notifications #102
Reference in New Issue
Block a user
Delete Branch "background-push"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@mplorentz take a quick gander if you would. Fixes #86
My eyes glazed over after a bit of reading this code 😬 but I learned some things. I wish I could test it but I flashed stock android back onto my test device recently. I am expecting another Android phone in the mail soon though that I'm intending to put Graphene on so maybe I can give it a shot then.
@@ -0,0 +68,4 @@val workManager = WorkManager.getInstance(context)val periodic = PeriodicWorkRequest.Builder(Very cool. I know the iOS incantation to do a similar thing if we ever want to support it in the future. It seems less important because there is no version of iOS without APNS but it would be useful for privacy nerds and relays that don't play nicely with a push server. (I forget how the successor to anchor plays with generic NIP-29 relays, but it requires some configuration by someone, I assume).
Yeah, the relay has to support relay push, but that's a pretty low bar for making apns work.
@@ -0,0 +203,4 @@PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE,)val body = "New activity"I've been wondering lately how hard it would be to put some information about the new activity (like author or content) in the notification. But now I see that you've like reimplemented a whole relay service from scratch in Kotlin 😮, so it would not be trivial at all to fetch the authors relay list, then fetch profile metdata to grab the author's name and photo.
Is there no good way to call back into the capacitor javascript to do this relay communication?
No, the non-webview js runtime is very limited, in particular it has no support for websockets. So it was either write native code, or use an http-based relay proxy. I tried the latter briefly but it was a nightmare for AUTH etc. So I went with vibe-coded, nasty kotlin instead.
Adding more information wouldn't be too hard, it would just require a bunch more gross kotlin code. The relay push nip has an
include_eventoption too, which would relay the event to the push server so that it has the content and pubkey too. I left that out for privacy purposes, but it would be easy to turn on.