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.
Previously we simply closed the screen with the login WebView which
could cause confusion. Now we specify that page could not be loaded.
As a side effect it will also show the error message which the server
returns (if any).
* Set TextIsSelectable on the corresponding view holders and remove a longpress listener to let Android select text.
* Revert changes, and make selectable text only in detailed status.
Remove long press listener to copy to clipboard (as it interferes with natural text selection on Android).
* Remove unused string (copy_to_clipboard_success) from all translations.
Co-authored-by: Martin Marconcini <martin.marconcini.rodriguez@nl.abnamro.com>
* make MastodonApi.createStatus suspending
* check if media processing has finished before sending status
* add backoff for retrying processed media check
* Add back the emojiInitCallback and move EmojiCompat init
* Small adjustments
* Make sure that we don't hit the IllegalStateException when EmojiCompat-ing the display names
* Add a TODO for when Material Drawer 9 can be used
* Remove EmojiCompat.process and initcallback
* Update to Emoji2
* Hopefully fix the emoji picker preference
* Switch to released Filemojicompat version
* Filemojicompat version as an own var
* Remove an unused import
* Small cleanup
* Correct onDisplayPreferenceDialog; test TuskyApplication
* Use TextViews instead of EmojiTextViews
* Recreate the Main Activity if the emoji pack is updated
* Enable coreLibraryDesugaring (for Java Streams); update Filemojicompat, downgrade Emoji2
* Update emoji font versions to 14
* Use FilemojiCompat 3.2.0-beta01
* Make ktLint happy again
* Remove coreLibraryDesugaring and a FIXME
* Use EmojiPickerPreference.get()
* Disable emoji pack import
* Update FilemojiCompat to Beta 2
* Update FilemojiCompat to Beta 3
* Update FilemojiCompat to Beta 3.2.0 final
* Update FilemojiCompat to 3.2.1
* guard against the status of a notification being null in rare cases
* improve code, fix bug when payloads is not null
* remove findViewById
* add comments in NotificationsAdapter
* refactor compose & announcements to coroutines
* fix code formatting
* add javadoc to InstanceInfoRepository
* fix comments in ImageDownsizer
* remove unused Either extensions
* add explicit return type for InstanceInfoRepository.getEmojis
* make ComposeViewModel.pickMedia return Result
* cleanup code in ImageDownsizer
* Improve time format of posts when using absolute time
* fix AbsoluteTimeFormatter, add tests
* fix tests
Co-authored-by: Conny Duck <k.pozniak@gmx.at>
* 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
* update Android Image Cropper and get rid of deprecated onActivityResult
* add comment why skipping caches is necessary
* inject application into EditProfileViewModel instead of passing it everytime
* Add data model for instance configuration
* Support instance.configuration.statuses.max_characters
* Support instance.configuration.statuses.characters_reserved_per_url
* Support instance.configuration.polls.max_options and max_characters_per_option
* Pacify ktlint
* Support instance-configured poll durations
* Fixup versions for migration after rebase
* Migrate LinkHelper to kotlin
* Support tags field on statuses
* Use embedded tags list in status instead of text scraping to embed tag click handler.
Fixes#2283
* Make mentions and tags lists nonnullable
* Make LinkHelper.openLink a Context extension method
* Use builtin extension for uri conversion
* More cleanup in LinkHelper
* Add tests for LinkHelper.getDomain
* Unbreak tags in places that don't have a tag list (e.g. profiles)
* Fixup javadoc
* update gradle, kotlin and other dependencies
* fix new warnings
* remove unused import
* update Proguard rules
* add explicit dependency on Gson to get the newest version
* remove debug flag from proguard rules again
* fix typo
* first setup
* network timeline paging / improvements
* rename classes / move to correct package
* remove unused class TimelineAdapter
* some code cleanup
* remove TimelineRepository, put mapper functions in TimelineTypeMappers.kt
* add db migration
* cleanup unused code
* bugfix
* make default timeline settings work again
* fix pinning statuses from timeline
* fix network timeline
* respect account settings in NetworkTimelineRemoteMediator
* respect account settings in NetworkTimelineRemoteMediator
* update license headers
* show error view when an error occurs
* cleanup some todos
* fix db migration
* fix changing mediaPreviewEnabled setting
* fix "load more" button appearing on top of timeline
* fix filtering and other bugs
* cleanup cache after 14 days
* fix TimelineDAOTest
* fix code formatting
* add NetworkTimeline unit tests
* add CachedTimeline unit tests
* fix code formatting
* move TimelineDaoTest to unit tests
* implement removeAllByInstance for CachedTimelineViewModel
* fix code formatting
* fix bug in TimelineDao.deleteAllFromInstance
* improve loading more statuses in NetworkTimelineViewModel
* improve loading more statuses in NetworkTimelineViewModel
* fix bug where empty state was shown too soon
* reload top of cached timeline on app start
* improve CachedTimelineRemoteMediator and Tests
* improve cached timeline tests
* fix some more todos
* implement TimelineFragment.removeItem
* fix ListStatusAccessibilityDelegate
* fix crash in NetworkTimelineViewModel.loadMore
* fix default state of collapsible statuses
* fix default state of collapsible statuses -tests
* fix showing/hiding media in the timeline
* get rid of some not-null assertion operators in TimelineTypeMappers
* fix tests
* error handling in CachedTimelineViewModel.loadMore
* keep local status state when refreshing cached statuses
* keep local status state when refreshing network timeline statuses
* show placeholder loading state in cached timeline
* better comments, some code cleanup
* add TimelineViewModelTest, improve code, fix bug
* fix ktlint
* fix voting in boosted polls
* code improvement
* convert TimelineFragment to Kotlin
* cleanup some code
* migrate to viewbinding
* cleanup even more code
* address review feedback
* improve findStatusOrReblogPositionById
* migrating to ViewBinding part 4: Fragment
* fix imports
* don't use viewBinding extension in ViewImage and ViewVideoFragment
* don't use viewBinding extension in ViewImage and ViewVideoFragment