Commit Graph

20 Commits

Author SHA1 Message Date
sanao ff39f9b3c2
feat: Hide self-boosts (#3534) (#4101)
# Overview
Some Mastodon posters have a annoying habit of boosting their own posts
some time after they've posted them.
 No need to see the same toot over and over again.

# Changes made
- Add an additional option to the "Filters > Tabs" preference to show
these self-boosts (default: on)
- If "Show boosts" is turned off, self-boosts are automatically hidden.
    
# Screenshot
***screen of "Filters > Tabs" preference***
before | after
:--: | :--:
| <image
src="https://github.com/tuskyapp/Tusky/assets/62137820/16ed2f4a-0776-4f60-afe6-29827acf5bbd"
width="300"> |<image
src="https://github.com/tuskyapp/Tusky/assets/62137820/9d4e1457-f71d-440c-959f-b91f7433b29a"
width="300" />

***screen of Home Timeline***
***switch-on(self-boosts are displayed)*** | ***swith-off(self-boosts
are not displayed)***
:--: | :--:
| <image
src="https://github.com/tuskyapp/Tusky/assets/62137820/3bb80791-a81f-4cbc-98ad-8a14602e53a4"
width="300" />|<image
src="https://github.com/tuskyapp/Tusky/assets/62137820/a7964da8-d106-4209-b911-460ef8988831"
width="300" />

# Related issue
 Fixes #3534
2023-11-13 10:04:39 +01:00
Levi Bard 131ebabe85
Add support for v2/instance (#4062)
…with fallback to v1
2023-10-25 12:53:10 +02:00
Levi Bard 1badf68531
Refresh timelines when filters are added/edited/removed (#3552)
Fixes #3546
2023-09-28 20:01:44 +02:00
Konrad Pozniak 54e92b2156
improve local status updates (#3480)
The idea here is: Everytime we get hold of a new version of a post, we
update everything about that post everywhere.
This makes the distincion between different event types unnecessary, as
everythng is just a `StatusChangedEvent`.
The main benefit is that posts should be up-to-date more often, which is
important considering there is now editing and #3413
2023-09-26 09:08:58 +02:00
Angelo Suzuki fa80a0123a
Add "Trending posts" (statuses) feed (#4007)
Add "Trending posts" (statuses) feed.

This feed is a good source of interesting accounts to follow and,
personally, a sort of "Front page of the Fediverse".

Since #3908 and #3910 (which would provide a more thorough, albeit
complex, access to trending things) won't get merged, I'd like to
address this missing feed by simply adding another tab/feed.

~~If desired, I can move the second commit (fixing lint) to another
PR.~~

## Screenshots
### Tab
<img
src="https://github.com/tuskyapp/Tusky/assets/1063155/6a71a97e-673e-44c7-b67d-9b1df0bed4f5"
width=320 /> <img
src="https://github.com/tuskyapp/Tusky/assets/1063155/9bf60b23-d2f3-4dd8-8af6-e96647b02121"
width=320 />

### Activity
<img
src="https://github.com/tuskyapp/Tusky/assets/1063155/4e07dea3-d97f-42c6-8551-492a3116fcfa"
width=320 /> <img
src="https://github.com/tuskyapp/Tusky/assets/1063155/ad00a134-d622-43f4-8305-84cfa7fed706"
width=320 />
2023-09-14 22:37:41 +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 321d17f5de
Remove Rx from EventHub and TimelineCases (#3446)
* remove Rx from EventHub and TimelineCases

* fix tests

* fix AccountViewModel.unblockDomain

* remove debug logging
2023-03-18 10:11:47 +01:00
Konrad Pozniak d839f18267
update ktlint plugin to 11.3.1, format code (#3442) 2023-03-13 13:16:39 +01:00
Levi Bard ff8dd37855
Support the mastodon 4 filter api (#3188)
* Replace "warn"-filtered posts in timelines and thread view with placeholders

* Adapt hashtag muting interface

* Rework filter UI

* Add icon for account preferences

* Clean up UI

* WIP: Use chips instead of a list. Adjust padding

* Scroll the filter edit activity

Nested scrolling views (e.g., an activity that scrolls with an embedded list
that also scrolls) can be difficult UI.

Since the list of contexts is fixed, replace it with a fixed collection of
switches, so there's no need to scroll the list.

Since the list of actions is only two (warn, hide), and are mutually
exclusive, replace the spinner with two radio buttons.

Use the accent colour and title styles on the different heading titles in
the layout, to match the presentation in Preferences.

Add an explicit "Cancel" button.

The layout is a straightforward LinearLayout, so use that instead of
ConstraintLayout, and remove some unncessary IDs.

Update EditFilterActivity to handle the new layout.

* Cleanup

* Add more information to the filter list view

* First pass on code review comments

* Add view model to filters activity

* Add view model to edit filters activity

* Only use the status wrapper for filtered statuses

* Relint

---------

Co-authored-by: Nik Clayton <nik@ngo.org.uk>
2023-03-11 13:12:50 +01:00
Goooler cfea5700b0
Code cleanups (#3264)
* Kotlin 1.8.10

https://github.com/JetBrains/kotlin/releases/tag/v1.8.10

* Migrate onActivityCreated to onViewCreated

* More final modifiers

* Java Cleanups

* Kotlin cleanups

* More final modifiers

* Const value TOOLBAR_HIDE_DELAY_MS

* Revert
2023-02-20 19:58:37 +01:00
Nik Clayton 7d444d1f8c
Fix incorrect log message, s/favourite/bookmark/ (#3172) 2023-01-13 20:03:47 +01:00
Nik Clayton 9cf4882f41
Keep scroll position when loading missing statuses (#3000)
* Change "Load more" to load oldest statuses first in home timeline

Previous behaviour loaded missing statuses by using "since_id" and "max_id".
This loads the most recent N statuses, looking backwards from "max_id".

Change to load the oldest statuses first, assuming the user is scrolling
up through the timeline and will want to load statuses in reverse
chronological order.

* Scroll to the bottom of new entries added by "Load more"

- Remember the position of the "Load more" placeholder
- Check the position of inserted entries
- If they match, scroll to the bottom

* Change "Load more" to load oldest statuses first in home timeline

Previous behaviour loaded missing statuses by using "since_id" and "max_id".
This loads the most recent N statuses, looking backwards from "max_id".

Change to load the oldest statuses first, assuming the user is scrolling
up through the timeline and will want to load statuses in reverse
chronological order.

* Scroll to the bottom of new entries added by "Load more"

- Remember the position of the "Load more" placeholder
- Check the position of inserted entries
- If they match, scroll to the bottom

* Ensure the user can't have two simultaneous "Load more" coroutines

Having two simultanous coroutines would break the calculation used to figure
out which item in the list to scroll to after a "Load more" in the timeline.

Do this by:

- Creating a TimelineUiState and associated flow that tracks the "Load more"
  state
- Updating this in the (Cached|Network)TimelineViewModel
- Listening for changes to it in TimelineFragment, and notifying the adapter
- The adapter will disable any placeholder views while "Load more" is active

* Revert changes that loaded the oldest statuses instead of the newest

* Be more robust about locating the status to scroll to

Weirdness with the PagingData library meant that positionStart could still be
wrong after "Load more" was clicked.

Instead, remember the position of the "Load more" item and the ID of the
status immediately after it.

When new items are added, search for the remembered status at the position of
the "Load more" item. This is quick, testing at most LOAD_AT_ONCE items in
the adapter.

If the remembered status is not visible on screen then scroll to it.

* Lint

* Add a preference to specify the reading order

Default behaviour (oldest first) is for "load more" to load statuses and
stay at the oldest of the new statuses.

Alternative behaviour (if the user is reading from top to bottom) is to
stay at the newest of the new statuses.

* Move ReadingOrder enum construction logic in to the enum

* Jump to top if swipe/refresh while preferring newest-first order

* Show a circular progress spinner during "Load more" operations

Remove a dedicated view, and use an icon on the button instead.

Adjust the placeholder attributes and styles accordingly.

* Remove the "loadMoreActive" property

Complicates the code and doesn't really achieve the desired effect. If the
user wants to tap multiple "Load more" buttons they can.

* Update comments in TimelineFragment

* Respect the user's reading order preference if it changes

* Add developer tools

This is for functionality that makes it easier for developers to interact
with the app, or get it in to a known-state.

These features are for use by users, so are only visible in debug builds.

* Adjust how content is loaded based on preferred reading order

- Add the readingOrder to TimelineViewModel so derived classes can use it.
- Update the homeTimeline API to support the `minId` parameter and update
  calls in NetworkTimelineViewModel

In CachedTimelineViewModel:
- Set the bounds of the load to be the status IDs on either side of the
  placeholder ID (update TimelineDao with a new query for this)
- Load statuses using either minId or sinceId depending on the reading order
- Is there was no overlap then insert the new placeholder at the start/end
  of the list depending on reading order

* Lint

* Rename unused dialog parameter to _

* Update API arguments in tests

* Simplify ReadingOrder preference handling

* Fix bug with Placeholder and the "expanded" property

If a status is a Placeholder the "expanded" propery is used to indicate
whether or not it is loading.

replaceStatusRange() set this property based on the old value, and the user's
alwaysOpenSpoiler preference setting.

This shouldn't have been used if the status is a Placeholder, as it can lead
to incorrect loading states.

Fix this.

While I'm here, introduce an explicit computed property for whether a
TimelineStatusEntity is a placeholder, and use that for code clarity.

* Set the "Load more" button background to transparent

* Fix typo.

* Inline spec, update comment

* Revert 1480c6aa3ac5c0c2d362fb271f47ea2259ab14e2

Turns out the behaviour is not desired.

* Remove unnecessary Log call

* Extract function

* Change default to newest first
2023-01-13 19:26:24 +01:00
Nik Clayton f796f77f9a
Implement getFilters() without rxjava (#2990) 2022-12-07 19:30:53 +01:00
Konrad Pozniak f419e83c16
improve logout (#2579)
* improve logout

* fix tests

* add db migration

* delete wrongly committed file again

* improve LogoutUsecase
2022-06-20 16:45:54 +02:00
Konrad Pozniak dba2fbc5c1
fix empty timeline on initial load (#2586) 2022-06-20 16:11:30 +02:00
Ivan Kupalov e63cd68baf
Fix filters in timelines in a simple way, fix #2546 (#2566)
Loading of statuses and loading of filters is an "intended" race:
we want to display statuses first, especially if they are cached.
Unfortunately we do not cache filters themselves so when we load cached
statuses we do not apply filters.

One part of the solution is to re-filter the statuses once we fetch the
filters. This commit implements it. Caching of filters is not included
yet.
2022-05-29 19:22:59 +02:00
mcclure 06e32f703a
Fix unintended [mismatched] show-replies preference (with key force-reset) (#2568)
* Fix unintended [mismatched] show-replies preference and add a comment to prevent confusion.

* Change the key on TAB_FILTER_HOME_REPLIES to reset everyone's value here once.
2022-05-29 19:21:33 +02:00
Konrad Pozniak 34b7a3c8ee
Don't hide potential timeline bugs by catching all exceptions (#2372)
* don't hide potential timeline bugs by catching all exceptions

* fix NetworkTimelineRemoteMediatorTest

* improve ifExpected function

* fix code formatting
2022-03-08 21:39:59 +01:00
Konrad Pozniak 69bcc92c46
fix cache cleanup deleting more statuses than it should (#2348)
* fix cache cleanup deleting more statuses than it should

* reset LOAD_AT_ONCE

* improve tests

* move cache clean code back to ViewModel
2022-02-21 19:33:10 +01:00
Konrad Pozniak 643e012b11
Timeline paging (#2238)
* 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
2022-01-11 19:00:29 +01:00