Skip to content

Read the module repository through the shared Store code - #135

Open
JingMatrix wants to merge 2 commits into
masterfrom
store-shared-repository
Open

JingMatrix wants to merge 2 commits into
masterfrom
store-shared-repository

Conversation

@JingMatrix

Copy link
Copy Markdown
Owner

This manager and Vector show the same Store screen and read the same two hosts, and until now each had its own copy of the code that reads them. Vector's now lives in manager-ui, so RepoRepository here is a subclass of StoreRepository that supplies only what is LSPatch's: how the device is asked what is installed, and where a log line goes. The file goes from 210 lines to 76.

What arrives with the shared code:

  • The catalogue is built from both hosts. backup.modules.lsposed.org serves the whole snapshot but is a periodic rebuild; modules.lsposed.org refuses that path and serves the index a page at a time, current. The snapshot is the base and the pages correct it, stopping at the first page that agrees.
  • The shared OkHttp client's disk cache is used, with every request stating its own freshness. A cold start with no network renders the last catalogue instead of an empty screen.
  • Pull-to-refresh bypasses the cache and reads the index to its last page.

The Store's three preferences were in-memory defaults on the grounds that this manager could not install from the store. It can, so they are persisted in the app's settings store: the release channel, the muted updates, and a note of what each install left behind — without that note the Store keeps offering a release it has already installed. A package event refreshes the installed map, but only once the Store has been opened.

Tried on a Pixel 7 (Android 17): 1380 modules with the walk stopping at page 6 of 47; the same list rendered from the cache with Wi-Fi and data off; all 47 pages read on a pull; a module's details page and its install bar intact. No crashes.

core moves from e00c5c5 to 6f6b976, where the shared code lives (JingMatrix/Vector#1022).

core carries the Store's networking in manager-ui, so RepoRepository
is a subclass of StoreRepository and keeps only what is LSPatch's: how
the device is asked what is installed, and where a log line goes.

What comes with it is the catalogue built from both hosts — the whole
snapshot from backup.modules.lsposed.org as the base, the index pages
from modules.lsposed.org as corrections — and the shared client's disk
cache, so a cold start with no network renders the last catalogue
rather than an empty screen, and pull-to-refresh reads the index to
its last page.

The Store's three preferences move into the app's settings store,
because a module installed from the store is one LSPatch installed:
the release channel, the muted updates, and a note of what each
install left behind, which is what keeps the same release from being
offered again. A package event refreshes the installed map, when the
Store has been opened.

Also here: core moves to 6f6b976, where that shared code lives.

On a Pixel 7: 1380 modules, the walk stopping at page 6 of 47; the
same list from the cache with the radios off; all 47 pages on a pull.
Installed versions come from one getInstalledPackages call rather than
a version read per package over the manager's app-list scan: the scan
carries no version, so that was a binder round trip for every app on
the device, on every package event.

The store install writes its note after the bar reaches Done rather
than before. The note asks the device what it now holds, and a reader
watching the install has no reason to wait on bookkeeping; the package
rescan it did first is the broadcast's job and no longer needed here.

On a moto g75: a module installed from the Store is recorded as
2-1.1/2-1.1, comes back as Installed in the list, and the catalogue
reads 1382 modules.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant