Commit Graph

1608 Commits

Author SHA1 Message Date
kyori19 b1eb412970
[append-text] Implement append-text feature 2023-07-29 06:17:54 +09:00
kyori19 e63102712b
[debug] Show toast when network error occurred 2023-06-11 14:28:54 +09:00
kyori19 e0126519e0
[detox] Stop blocking instances 2023-06-10 11:21:53 +09:00
kyori19 c3eb712d6c
[status] Open profile when username clicked 2023-06-10 11:18:10 +09:00
kyori19 957d1aaea4
[brand] `Yuito (by kyori19)` 2023-06-10 11:14:19 +09:00
Nik Clayton 01b3cb3a53
Fetch all outstanding Mastodon notifications when creating Android notifications (#3700)
* Fetch all outstanding Mastodon notifications when creating Android notifications

Previous code fetched the oldest page of unfetched Mastodon notifications.

If you had more than a page of Mastodon notifications you'd get Android notifications for that page, then ~ 15 minutes later Android notifications for the next page, and so on.

This code fetches all the outstanding notifications at once.

If this results in more than 40 total notifications the list is still trimmed so that a maximum of 40 Android notifications is displayed.

Fixes https://github.com/tuskyapp/Tusky/issues/3648

* Build the list using buildList
2023-06-01 19:31:30 +02:00
Nik Clayton 346dabffc5
Write notification account information to the correct account (#3697)
Don't use `accountManager.activeAccount` throughout the code.

Instead, get the active account once, and use that over the life of the viewmodel.

As shown in https://github.com/tuskyapp/Tusky/issues/3689#issuecomment-1567219338 the active account can change before the view model is destroyed, and if that happens account information for the account will be written to the wrong account.
2023-06-01 19:19:18 +02:00
Nik Clayton 34de33220c
Don't overwrite the active account when composing from a notification (#3688)
Fix a bug where the active account can be overwritten.

1. Have two accounts logged in to Tusky, A and B
2. Open Tusky as account A
3. Send a DM to account B (doesn't have to be a DM, just anything that creates a notification for account B)
4. Restart Tusky so the Android notification for the DM is displayed immediately. You are still acting as account A.
5. Drag down the Android notification, you should see two options, "Quick reply" and "Compose"
6. Tap "Compose"
7. ComposeActivity will start. You are now acting as account B. Compose and send a reply
8. You'll be returned to the "Home" tab.

The UI will show you are still account A (i.e., it's account A's avatar at the top of the screen, if you have the "Show username in toolbars" option turned on it will be account A's username in the toolbar).

But you are now seeing the home timeline for account B.

Fix this.

ComposeViewModel
- Do not rely on the active account in sendStatus(), receive the account ID as a parameter

ComposeActivity
- Use either the account ID from the intent, or the current active account. **Do not** change the active account
- Pass the account ID to use in the sendStatus() call
2023-05-29 13:32:56 +02:00
Nik Clayton 57e79b3f00
Save and restore the user's reading position more frequently (#3685)
The previous code gets the user's reading position *once*, when the
viewmodel is created, and uses that whenever it needs to be restored.

This is a problem. Suppose the user is a few days behind on their
notifications, and opens the app.

The reading position is restored, as expected. They scroll up to start
reading newer notifications.

Then they change their notification filters. This causes the
notifications list to change, and when it does their reading position
is set back to what it was when they first switched to the Notifications
tab.

Fix this by:

NotificationsFragment:
- Save the reading position whenever the user stops scrolling.

NotificationsViewModel:
- Use the saved reading position whenever the list of notifications
  can change, not just when the view model is created.
2023-05-23 20:07:39 +02:00
Nik Clayton d644f6e6f3
Save the a copy of the notification marker ID locally (#3672)
Not all servers support the marker API. If they don't the user will
potentially get duplicate Android notifications.

To resolve this, store a copy of the notification marker ID locally as
well. Defer to the remote marker if it exists (and is newer than the
local marker).

Fixes https://github.com/tuskyapp/Tusky/issues/3671
2023-05-18 23:23:42 +02:00
Nik Clayton 158f9b83fb
updateMarkersWithAuth(): Require DOMAIN header (#3660)
Otherwise markers are updated for the wrong account.

Fixes https://github.com/tuskyapp/Tusky/issues/3658
2023-05-16 18:24:38 +02:00
Nik Clayton 92ba53a8c3
Compare notification IDs by length as well as value (#3657) 2023-05-15 23:11:14 +02:00
Nik Clayton 81b15e72f3
Only fetch and display a given notification once (#3626)
When fetching:

- Maintain a marker with the position of the newest fetched notification
- Use the marker to determine which notifications to fetch
- Fetch notifications with min_id to ensure that none are lost
- Update the marker as necessary
- Perform a one-time immediate fetch of notifications on startup

When creating notifications:

- Identify each notification with tag=${MastodonNotificationId}, id=${account.id}
- Remove activeNotifications field, it's no longer necessary
- Use the tag/id tuple to reliably identify existing notifications and avoid creating duplicates
- Cancelling notifications for an account must iterate over all the notifications, and individually remove the notifications that exist for that account.
- Limit notifications to a maximum of 40 (excluding summary notifications)
- Remove notifications (oldest first) to get under this limit
- Rate limit notification creation to 1 per second, so the OS won't drop them

Adjust the summary notification:

- Ensure the summary notification and the child notifications have the same group key
- Dismiss the summary notification if there is only one child notification

NotificationClearBroadcastReceiver is no longer needed, so remove it, and the need for deletePendingIntent.

Fixes #3625, #3539
2023-05-13 16:00:28 +02:00
Konrad Pozniak 74a00c0591
Make links in bios of follow request and follow notifications work (#3646)
* make links in bios of follow request and follow notifications work
* use ClickableSpanTextView to display account notes
2023-05-13 15:32:56 +02:00
Nik Clayton b12e772a0b
FilterResult.status_matches is a List<String>? (#3634)
See https://github.com/mastodon/documentation/pull/1214
2023-05-09 17:56:48 +02:00
Nik Clayton 367240a612
Save the user's reading position in the home timeline (#3614)
- Add a field to AccountEntity to hold the reading position
- Provide a method to save in the viewmodel to save the position
- Save the position when TimelineFragment pauses

Does not restore the position yet.
2023-05-08 13:57:17 +02:00
Konrad Pozniak d2747811be
Fix crash in ViewThreadFragment.removeItem (#3622) 2023-05-05 12:03:42 +02:00
Nik Clayton 7ce5048752
Show the requester's bio in a "wants to follow you" notification (#3284) 2023-05-04 16:00:30 +02:00
UlrichKu 1040358f3c
Ensure text field has focus when reporting statuses 2023-05-04 14:53:27 +02:00
Nik Clayton a7001eecb8
Use the tab's contentDescription as the toolbar title (#3609)
Previous code had an IndexOutOfBoundsException where tab.position could be larger than the tabs array.
2023-05-04 13:19:44 +02:00
Nik Clayton 4da758c1f7
Check for non-empty pages when falling back (#3603)
Requesting a non-existent notification ID will cause the fall-back requests to succeed but return empty lists which stops pagination.

Check for this, and in the worst case, fall back to returning the most recent notifications.
2023-05-04 13:19:28 +02:00
Konrad Pozniak 5abd3dc9fe
fix reporting (#3607) 2023-05-02 18:20:02 +02:00
UlrichKu 5cac17b7a9
#3430: (fix) do not hide the anchor of the FAB (#3561)
On Account preferences > Filters

With the list hidden on an empty view the FAB is erroneouly placed on the top left of the screen.

(Introduced with #3430)
2023-04-30 21:51:36 +02:00
Nik Clayton 0a39ee7ded
Force a layout pass to ensure spans are measured correctly (#3600)
Fixes https://github.com/tuskyapp/Tusky/issues/3596
2023-04-30 21:50:52 +02:00
Konrad Pozniak 11cf93fa55
Remove unused class PairedList (#3602) 2023-04-30 21:49:05 +02:00
Nik Clayton 03031e5716
Set initialLoadSize = pageSize (#3598)
The pageSize is large enough that there's no need for the default 3 x pageSize initialLoadSize value, and this improves performance.

Fixes https://github.com/tuskyapp/Tusky/issues/3578
2023-04-29 19:34:29 +02:00
Nik Clayton 152318ce85
Show filter title instead of filter keywords (#3589)
Avoid showing the user the things they have filtered on when showing a filter placeholder in a timeline.
2023-04-29 18:56:27 +02:00
Nik Clayton 5c28cba57d
Show 0/1/1+ for replies, even if show stats is off (#3590)
Fixes https://github.com/tuskyapp/Tusky/issues/3588
2023-04-29 16:49:04 +02:00
Konrad Pozniak a5578cf765
Check view is non-null before scrolling, fix crash in NotificationsFragment (#3594)
The posted message runs at the end of the message queue, by which time the view may no longer exist.
2023-04-29 16:39:49 +02:00
Nik Clayton 2f512705e8
Fix IndexOutOfBoundsException in onPause (#3581)
Use `getOrNull` instead of `get`, which was occasionally throwing IndexOutOfBoundsException.
2023-04-27 12:59:32 +02:00
Nik Clayton f1b3faf85f
Show the follower's bio/note in a "followed you" notification (#3281)
This makes the notification view for a follow request contain more info about the new follower, and makes the layout (of their name / username) consistent with other notifications that show names/usernames.
2023-04-24 12:09:34 +02:00
UlrichKu 24d7ef7ccb
Always publish image alt text
Previous code would discard the image alt-text if the user finished writing the text before the image had finished uploading.

This code ensures the text is set after the image has completed uploading.
2023-04-24 11:48:40 +02:00
UlrichKu 8de5613b47
3509: Ensure filter edit dialog is scrollable (#3510) 2023-04-23 22:39:19 +02:00
Nik Clayton 73be497bbe
Merge pull request #3513 from Lakoja/fix-relationship-crash
Do not crash on empty relationship response
2023-04-23 18:36:13 +02:00
Nik Clayton b57db0589d
Merge pull request #3514 from Lakoja/fix-edgy-crashes
Do not crash on/avoid index out of bounds
2023-04-21 19:52:45 +02:00
UlrichKu 040268e2d3
3492: Correctly shorten name in drawer and notifications (#3495)
* #3492: Correctly shorten name in drawer and notifications

* Trigger linter again

* 3492: Use a flat ContraintLayout for everything
2023-04-08 16:55:32 +02:00
Lakoja bca98d2f48 Do not crash on/avoid index out of bounds 2023-04-05 15:48:40 +02:00
Lakoja eb52c8ca58 Do not crash on empty relationship response 2023-04-05 10:54:03 +02:00
UlrichKu cf50d0563f
3416: Call the list activity when list list empty (#3426)
* 3416: Call the list activity when empty; show failure on loading

* 3416: Revert include grouping

* 3416: Remove faulty include after merge

* 3416: Added a list loading progress

* 3416: Add proper padding to progress

* 3416: Show a text if there are no lists, do not change dialog title

* 3416: Center things in layout

* 3416: Appease linter (?)

* 3416: Do not hide manage lists button

* 3416: Use ThemeUtils
2023-03-30 21:23:08 +02:00
UlrichKu eee1414aff
#2528: Also clear notifications on refresh in notifications timeline (#3498) 2023-03-30 19:38:44 +02:00
UlrichKu 23381d45d7
3430: Make list refresh/retry consistent (#3474)
* 3430: Make list refresh/retry consistent

* 3430: Add swipe-to-refresh and use states in filter lists
2023-03-30 19:29:42 +02:00
Konrad Pozniak 24dd68c996
distinguish between different error types in ScheduledStatusActivity (#3487) 2023-03-30 18:52:24 +02:00
UlrichKu 9e66ccf4a6
3434: Make description dialog (text field) more usable (#3458)
* 3434: Make description dialog (text field) more usable

* 3434: Close dialog on back button

* 3434: Use a TextInputLayout

* 3434: Adapt German plurals text

* 3434: Remove unused id

* 3434: Disable counter officially
2023-03-24 18:21:56 +01:00
UlrichKu b70e4be305
3469: Do not jump in the list on the (second) refresh (#3471) 2023-03-24 16:26:50 +01:00
Konrad Pozniak 787f88b801
remove Rx from AccountViewModel and ReportViewModel (#3463) 2023-03-22 22:00:03 +01:00
UlrichKu 8c519af611
3408: Only support iconics (get rid of "discouraged api") (#3476)
* 3408: Only support iconics (get rid of "discouraged api")

* 3408: Remove unused import
2023-03-21 22:19:34 +01:00
UlrichKu 182df2bfae
3408 home help message (#3415)
* 3408: First draft of help message on empty home timeline

* 3408: Move image spanning to utils; tweak gui a bit (looks like status)

* 3408: Use proper R again; appease linter

* 3408: Add doc; remove narrow comment

* 3408: null is default

* 3408: Add German text

* 3408: Stack refresh animation on top of help message (reorder)
2023-03-21 19:44:35 +01:00
UlrichKu 0c36b369dd
3159: Correctly refresh timestamps (#3456)
* 3159: Correctly refresh timestamp (of all elements) and refresh all on display options change

* Remove unnecessary import

* 3159: Remove unnecessary semicolon

* 3159: Remove todo question
2023-03-21 19:01:33 +01:00
UlrichKu d754df8f07
3472: Give polls a default duration (#3473) 2023-03-21 18:52:38 +01:00
Nik Clayton 81f725667e
Show better errors when loading notifications fails (#3448)
* Show better errors with notification loading fails

The errors are returned as a JSON object, parse it, and show the error
message it contains.

Handle the cases where there might be no error message, or the JSON may be
malformed.

Add tests.

Fixes #3445

* Lint
2023-03-18 10:25:41 +01:00