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.
* fix black theme on Android 12
* Revert "fix black theme on Android 12"
This reverts commit 2286706fdb239e15be72ac8943405ffeb2258219.
* bring back SplashActivity
* Improve login process with newer APIs
* Implement login with WebView instead of browser tab or external browser
Oauth process requires us to open login prompt for correct instance and
we need to receive the result back. Usually it is done with redirect
parameter.
Previously we've been using BrowserTabs API and have been falling back
to just opening browser. This mostly worked but is very clumsy:
- It relies on few system mechanisms for opening URLs in both
directions
- Browsers do weird things and tend to break quite a bit
- There's a good chance that the app can die in the process and we need
to recover our state.
So instead we are now using WebView. It has disadvantages (users have
to trust us to show correct page, logins are not shared w/ browser) but
it should be more reliable.
* Changes to login after review
* Move login classes to their own package
* Fix linting issues
* cleanup warnings, reorganize some code
* move ComposeAutoCompleteAdapter to compose package
* composeOptions doesn't need to be a class member
* add DraftsActivity and DraftsViewModel
* drafts
* remove unnecessary Unit in ComposeViewModel
* add schema/25.json
* fix db migration
* drafts
* cleanup code
* fix compose activity rotation bug
* fix media descriptions getting lost when restoring a draft
* improve deleting drafts
* fix ComposeActivityTest
* improve draft layout for almost empty drafts
* reformat code
* show toast when opening reply to deleted toot
* improve item_draft layout
* convert EmojiPreference and EmojiCompatFont to Kotlin
* move preference related to to dedicated preference package
* update proguard-rules.pro
* reformat & add comment
* maintain disposable information in EmojiPreference instead of EmojiCompatFont
* Add support for audio attachments.
Partially addresses #1337
* Register Tusky as a target for audio sharing
* Use icon with textColorTertiary for audio preview
* Convert ComposeActivity to Kotlin
* More ComposeActivity cleanups
* Move ComposeActivity to it's own package
* Remove ComposeActivity.IntentBuilder
* Re-do part of the media downsizing/uploading
* Add sending of status to ViewModel, draft media descriptions
* Allow uploading video, update description after uploading
* Enable camera, enable upload cancelling
* Cleanup of ComposeActivity
* Extract CaptionDialog, extract ComposeActivity methods
* Fix handling of redrafted media
* Add initial state and media uploading out of Activity
* Change ComposeOptions.mentionedUsernames to be Set rather than List
We probably don't want repeated usernames when we are writing a post
and Set provides such guarantee for free plus it tells it to the
callers. The only disadvantage is lack of order but it shouldn't be a
problem.
* Add combineOptionalLiveData. Add docs.
It it useful for nullable LiveData's. I think we cannot differentiate
between value not being set and value being null so I just added the
variant without null check.
* Add poll support to Compose.
* cleanup code
* move more classes into compose package
* cleanup code
* fix button behavior
* add error handling for media upload
* add caching for instance data again
* merge develop
* fix scheduled toots
* delete unused string
* cleanup ComposeActivity
* fix restoring media from drafts
* make media upload code a little bit clearer
* cleanup autocomplete search code
* avoid duplicate object creation in SavedTootActivity
* perf: avoid unnecessary work when initializing ComposeActivity
* add license header to new files
* use small toot button on bigger displays
* fix ComposeActivityTest
* fix bad merge
* use Singles.zip instead of Single.zip
* upgrade api level to Android 10, resolve compile errors
* use androidx.preference.PreferenceManager instead of deprecated platform class
* add hyphenation to important TextViews
* setBottomSheetCallback -> addBottomSheetCallback
* implement new sharing api
* improve TuskyTileService so it shows account picker when multiple accounts are present
* delete unused AccountChooserService
* fix test
* improve ShareShortcutHelper
* remove debug log statement
* improve image loading fallback behavior in ShareShortcutHelper
* improve behavior on foldable devices
* Scheduled toot
* Hide scheduled toot button if version < 2.7.0
* Fix timeline reloading after toot
* Add edit icon to ComposeScheduleView
* Add button to reset scheduled toot
* Close bottom sheet and change button color after time a was selected
* Fix edit icon's size
* List of scheduled toots
* Fix instance version check
* Use MaterialDatePicker
* Set date and time consecutively
* Add licenses
* Implement instance mutes. #1143
* Move new classes to instancemute component
* Add progress bar while instance list loads
* Add undo snackbar for instance unmuting
* Update display text for instance mutes
* upgrade to AndroidX, upgrade libraries
* move to MaterialComponents theme
* make sure the compose button looks good everywhere
* fix tollbar title/button alignment on tablet
* move to new material color theming, consolidate colors and themes
* fix build, fix imports
* set error on TextInputLayout instead of EditText
* fix imports, TootButton when
* improve snackbar style
* fix task description color
* Migrate ImagePagerAdapter to kotlin
* Migrate ViewMediaFragment to kotlin
* Make images and videos share the same activity/pager
* Show descriptions above videos
* Cleanup
* Address code review feedback
* Migrate media fragments to constraint layout