Nik Clayton b0d63e4243
fix: Update PageCache to handle non-chronological ordering (#633)
The PageCache implementation wasn't properly dealing with timelines that
could return statuses in non-chronological order.

For example, if you bookmark a recent status, then go back in the
timeline and bookmark an older status; the bookmarks timeline is ordered
by the time of the bookmark event, not the creation time of the status
that was bookmarked.

If a sufficiently old status was bookmarked so it straddled a page
boundary you could have a situation where the range of status IDs in two
different cached pages overlapped.

E.g., this log extract:

```
0: k: 110912736679636090, prev: 3521487, next: 3057175, size: 40, range: 112219564107059218..110912736679636090
1: k: 111651744569170291, prev: 3049659, next: 2710596, size: 40, range: 111926741634665808..111651744569170291
```

The range of IDs in page 0 overlaps with the range of IDs in page 1.

The previous `PageCache` assumed this couldn't happen, and broke in
various interesting ways when it did.

E.g., you can't find the page that contains a given status by looking
for the largest key less than the needle's status id. Given the pages
above looking for ID 112219564107059218 (first status in page 0) would
suggest page 1 as having the greatest key less than that ID. This
manifested as the correct page briefly appearing in the UI (page 0),
then being completely replaced with page 1.

Rewrite PageCache to fix this. The previous implementation used a single
`TreeMap` assuming items were always sorted by ID. The new code keeps an
unordered map from status IDs to the page that contains that status, and
a separate `LinkedList` that contains the pages in order they're
provided by the API. This decouples the ordering of pages in the cache
with the overall ordering of items within the pages.
2024-04-22 20:34:16 +02:00
2023-02-04 19:58:53 +01:00
2023-09-12 13:18:50 +02:00
2023-09-01 18:26:21 +02:00
2024-01-30 12:29:47 +01:00
2017-04-09 20:12:31 -04:00
2023-03-18 09:51:21 +01:00
2023-09-04 20:22:05 +02:00
2023-09-04 20:22:05 +02:00
2024-03-21 16:03:07 +01:00

Pachli

Pachli is a full-featured Android client for Mastodon, with a cooperative development model.

Features include:

  • Read, reply, filter, post, favourite, and boost posts
  • Translate posts from other languages
  • Your timeline is cached locally, so you can read when offline
  • Draft posts now to finish them later
  • Write posts now and schedule them to send later
  • Read and post from multiple accounts
  • Manage who you follow with multiple lists
  • Use different themes to customise the UI
  • A variety of accessible fonts in different sizes
  • Full control over how and when you receive notifications
  • Explore trending posts, links, and hashtags

Pachli is Open Source.

Install the newest release from the list of releases, or from Google Play and F-Droid.

Get it on Google Play Get it on F-Droid

Support

Contributing

We actively welcome new contributors. Please read CONTRIBUTING.md for more information.

Contributor Covenant Contributor License Agreement Translate - with Weblate

More information

More information about the application and the principals underpinning its development are at https://pachli.app.

Description
Pachli è un client Android completo per Mastodon: La timeline viene memorizzata nella cache locale, in modo da poterla leggere anche quando si è offline Bozza dei post ora per finirli in un secondo momento Scrivere i post ora e programmarne l'invio in un secondo momento Leggere e pubblicare da più account Gestite chi seguite con più elenchi Utilizzare diversi temi per personalizzare l'interfaccia utente Una varietà di font accessibili in diverse dimensioni Pieno controllo su come e quando si ricevono le notifiche
https://mastodon.it/it/Quale-app-mastodon-utilizzare Readme
Languages
Kotlin 100%