Commit Graph

7 Commits

Author SHA1 Message Date
Konrad Pozniak b85ada930b
fix warnings in test runs (#4340)
Found while working on #4026 but not directly related.

Two cases of unmocked methods and one of unclosed resource.
2024-03-28 09:13:05 +01:00
Konrad Pozniak 5192fb08a5
upgrade ktlint plugin to 12.0.3 (#4169)
There are some new rules, I think they mostly make sense, except for the
max line length which I had to disable because we are over it in a lot
of places.

---------

Co-authored-by: Goooler <wangzongler@gmail.com>
2024-01-04 17:00:55 +01: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
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
Nik Clayton c650ca9362
Improve the actual and perceived speed of thread loading (#3118)
* Improve the actual and perceived speed of thread loading

To improve the actual speed, note that if the user has opened a thread from
their home timeline then the initial status is cached in the database. Other
statuses in the same thread may be cached as well.

So try and load the initial status from the database, falling back to the
network if it's not present (e.g., the user has opened a thread from the
local or federated timelines, or a search).

Introduce a new loading state to deal with this case.

In typical cases this allows the UI to display the initial status immediately
with no need to show a progress indicator.

To improve the perceived speed, delay showing the initial loading circular
progress indicators by 500ms. If loading the initial status completes within
that time no spinner is shown and the user will perceive the action as
close-to-immediate
(https://www.nngroup.com/articles/response-times-3-important-limits/).

Additionally, introduce an extra indeterminate progress indicator.

The new indicator is linear, anchored to the bottom of the screen, and shows
progress loading ancestor/descendant statuses. Like the other indicator is
also delayed 500ms from when ancestor/descendant status information is
fetched, and if the fetch completes in that time it will not be shown.

* Mark `getStatus` as suspend so it doesn't run on the main thread

* Save an allocation, use an isDetailed parameter to TimelineStatusWithAccount.toViewData

Rename Status.toViewData's "detailed" parameter to "isDetailed" for
consistency with other uses.

* Ensure suspend functions run to completion when testing

* Delay-load the status from the network even if it's cached

This speeds up the UI while ensuring it will eventually contain accurate data
from the remote.

* Load the network status before updating the list

Avoids excess animations if the network copy has changes

* Fix UI flicker when loading reblogged statuses

* Lint

* Fixup tests
2023-01-09 21:31:31 +01:00
Konrad Pozniak 741461acde
rewrite threads with Kotlin & coroutines (#2617)
* initial class setup

* handle events and filters

* handle status state changes

* code formatting

* fix status filtering

* cleanup code a bit

* implement removeAllByAccountId

* move toolbar into fragment, implement menu

* error and load state handling

* fix pull to refresh

* implement reveal button

* use requireContext() instead of context!!

* jump to detailed status

* add ViewThreadViewModelTest

* fix ktlint

* small code improvements (thx charlag)

* add testcase for toggleRevealButton

* add more state change testcases to ViewThreadViewModel
2022-08-15 11:00:18 +02:00