Commit Graph

5 Commits

Author SHA1 Message Date
Konrad Pozniak 526f170d51
don't crash on invalid json response for push subscription (#2613) 2022-07-11 18:17:58 +02:00
Konrad Pozniak 9dcb1b666c
show push migration snackbar above floating action button (#2598) 2022-06-30 20:49:27 +02:00
Karmanyaah Malhotra cbc5077b1f
UnifiedPush: FEATURE_BYTES_MESSAGE distributors (#2581)
Only use distributors which are compatible with FEATURE_BYTES_MESSAGE
This is because Mastodon sends notifications that are arbritary bytes,
not UTF-8. This causes issues in older versions of UnifiedPush
distributors and providers that don't support FEATURE_BYTES_MESSAGE
2022-06-09 20:03:27 +02:00
Konrad Pozniak e1c8461423
replace kotlin-result-calladapter with networkresult-calladapter (#2569)
* replace kotlin-result-calladapter with networkresult-calladapter

* fix tests
2022-05-30 20:03:40 +02:00
Peter Cai 9ec5d6e3b0
Push notifications support via UnifiedPush (#2303)
Fixes #793.

This is an implementation for push notifications based on UnifiedPush
for Tusky. No push gateway (other than UP itself) is needed, since
UnifiedPush is simple enough such that it can act as a catch-all
endpoint for WebPush messages. When a UnifiedPush distributor is present
on-device, we will by default register Tusky as a receiver; if no
UnifiedPush distributor is available, then pull notifications are used
as a fallback mechanism.

Because WebPush messages are encrypted, and Mastodon does not send the
keys and IV needed for decryption in the request body, for now the push
handler simply acts as a trigger for the pre-existing NotificationWorker
which is also used for pull notifications. Nevertheless, I have
implemented proper key generation and storage, just in case we would
like to implement full decryption support in the future when Mastodon
upgrades to the latest WebPush encryption scheme that includes all
information in the request body.

For users with existing accounts, push notifications will not be enabled
until all of the accounts have been re-logged in to grant the new push
OAuth scope. A small prompt will be shown (until dismissed) as a
Snackbar to explain to the user about this, and an option is added in
Account Preferences to facilitate re-login without deleting local drafts
and cache.
2022-05-17 19:32:09 +02:00