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.
This commit is contained in:
parent
20f3ec921f
commit
9ec5d6e3b0
20 changed files with 1490 additions and 24 deletions
|
@ -40,6 +40,7 @@
|
|||
<string name="title_mutes">Muted users</string>
|
||||
<string name="title_blocks">Blocked users</string>
|
||||
<string name="title_domain_mutes">Hidden domains</string>
|
||||
<string name="title_migration_relogin">Re-login for push notifications</string>
|
||||
<string name="title_follow_requests">Follow Requests</string>
|
||||
<string name="title_edit_profile">Edit your profile</string>
|
||||
<string name="title_drafts">Drafts</string>
|
||||
|
@ -147,6 +148,8 @@
|
|||
<string name="action_open_reblogger">Open boost author</string>
|
||||
<string name="action_open_reblogged_by">Show boosts</string>
|
||||
<string name="action_open_faved_by">Show favorites</string>
|
||||
<string name="action_dismiss">Dismiss</string>
|
||||
<string name="action_details">Details</string>
|
||||
|
||||
<string name="title_hashtags_dialog">Hashtags</string>
|
||||
<string name="title_mentions_dialog">Mentions</string>
|
||||
|
@ -642,4 +645,8 @@
|
|||
<string name="tusky_compose_post_quicksetting_label">Compose Post</string>
|
||||
<string name="saving_draft">Saving draft…</string>
|
||||
|
||||
<string name="tips_push_notification_migration">Re-login all accounts to enable push notification support.</string>
|
||||
<string name="dialog_push_notification_migration">In order to use push notifications via UnifiedPush, Tusky needs permission to subscribe to notifications on your Mastodon server. This requires a re-login to change the OAuth scopes granted to Tusky. Using the re-login option here or in Account Preferences will preserve all of your local drafts and cache.</string>
|
||||
<string name="dialog_push_notification_migration_other_accounts">You have re-logged into your current account to grant push subscription permission to Tusky. However, you still have other accounts that have not been migrated this way. Switch to them and re-login one by one in order to enable UnifiedPush notifications support.</string>
|
||||
|
||||
</resources>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue