Commit Graph

5 Commits

Author SHA1 Message Date
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
Konrad Pozniak 16ffcca748
add ktlint plugin to project and apply default code style (#2209)
* add ktlint plugin to project and apply default code style

* some manual adjustments, fix wildcard imports

* update CONTRIBUTING.md

* fix formatting
2021-06-28 21:13:24 +02:00
Conny Duck 36a90d0856 fix crash when cancelling notifications 2018-05-06 13:17:17 +02:00
remi6397 e8c79cce65 Notification tweaks: Grouping and Quick Reply button (#587)
* Added notification grouping and Quick Reply button

* Legal stuff

* Coding style

* Check whether account still exists when sending a quick reply

* Add "compose" button

* Polish translation

* Improve strings

* Code style

* Cancel notification when user hits "compose" button

* Notification counter

* Make sure to open ComposeActivity for notification recipient account

* Add ability to request account switch when starting an activity
2018-05-06 11:07:10 +02:00
Konrad Pozniak b4ba457d89
Dependency injection improvement (#596)
* inject MastodonApi into LoginActivity

* inject AccountManager into MainActivity

* inject AccountManager into SplashActivity, convert to Kotlin

* inject AccountManager into AccountActivity

* inject AccountManager into LoginActivity

* inject AccountManager into NotificationsFragment and NotificationClearBroadcastReceiver, fix MainActivity

* ooops

* use same OkHttpClient for Retrofit & Picasso

* fix ordering of okhttp interceptors

* remove dependencies on TuskyApplication

* bugfix
2018-04-22 17:20:01 +02:00