Skip to content

fix(test): keep SyncInstalledAppsUseCase on the test dispatcher - #4

Merged
Darkmintis merged 29 commits into
mainfrom
fix/test-sync-dispatcher
Nov 9, 2026
Merged

Darkmintis merged 29 commits into
mainfrom
fix/test-sync-dispatcher

Conversation

@Darkmintis

Copy link
Copy Markdown
Owner

ViewModel tests were racing Dispatchers.IO resumes against resetMain(), which left UncaughtExceptionsBeforeTest on SearchViewModelTest in CI.

Description

Fixes the CI flake by keeping SyncInstalledAppsUseCase on the test dispatcher, then ships launch UX for v1.4.1: background downloads with tappable notifications, smarter search sort, install/downloaded state on Details, theme flash / status-bar contrast fixes, and updated release notes.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring
  • Performance improvement

Related Issue

N/A

Changes Made

  • Keep SyncInstalledAppsUseCase on the injected/test dispatcher so ViewModel tests no longer race Dispatchers.IO vs resetMain()
  • Sync status-bar icon contrast with the app theme (including dark mode)
  • Apply AppCompat night mode and seed theme state before the first frame to stop light-theme flash on cold start
  • Wire Sort By to the GitHub API, boost name matches after APK verification, and restyle the sort sheet as modal radio rows
  • Keep DownloadManager transfers alive after leaving Details; show progress/complete notifications that deep-link to gitstore://repo/{id}
  • Polish Downloads cards (repo name, open Details, Cancel / Install / Delete)
  • Persist installs from Downloads and show Install downloaded / Reinstall on Details when the APK is local or installed
  • Use simpler Download / Upgrade icons for install and update actions
  • Update RELEASE_NOTES.md for the v1.4.1 launch UX

Testing

  • Tested on Android device/emulator
  • All existing tests pass
  • Added new tests (if applicable)

Test Configuration:

  • Android Version: TBD
  • Device: TBD

Checklist

  • My code follows the code style of this project
  • I have performed a self-review of my code
  • I have commented my code where necessary
  • My changes generate no new warnings
  • I have updated the documentation accordingly
  • No lint errors

Additional Notes

Branch also includes: DeepLinkHandlerTest, RankSearchResultsTest, and the earlier status-bar / test-dispatcher fixes. Push the 5 local launch-UX commits if origin is still behind.

ViewModel tests were racing Dispatchers.IO resumes against resetMain(),
which left UncaughtExceptionsBeforeTest on SearchViewModelTest in CI.
Locale LocalContext hid the Activity so bar updates never ran, and
enableEdgeToEdge followed system night mode instead of the in-app theme.
Seed AppCompat night mode and theme state early so cold start no longer
flashes light under a dark preference.
Send sort params to GitHub, tighten name-scope ranking after APK
verification, and restyle the sort sheet as modal radio rows.
Survive leaving Details, show progress/complete notifications that deep
link into the repo, and polish the Downloads list with repo metadata.
Reflect local APKs and Downloads installs on the Details button, skip
re-download when the file exists, and use Download/Upgrade icons.
Document background downloads, search sort, theme flash fix, and
install-state UI for the 1.4.1 release notes.
MainActivity offers the notification intent from onCreate, before Compose starts
collecting, and DeepLinkHandler used a MutableSharedFlow with replay = 0. With no
subscriber at that moment the emission was dropped, so tapping a download
notification while the process was dead opened Home instead of the repo.

Buffer the destination in a conflated Channel so a cold-start link survives until
App.kt collects it. Covered by a new delivery test.
notifyProgress() and notifyComplete() return early unless canNotify() has
verified POST_NOTIFICATIONS, but lint cannot see across methods and reports
MissingPermission on manager.notify(). Suppress at the two call sites with the
existing check documented.
install_downloaded and the four download-notification strings were English-only,
breaking the established key parity. Add German, Spanish, French, Japanese,
Russian and Chinese translations so all seven locales carry 286 keys.

Fixes the five MissingTranslation lint errors.
…ications

AndroidDownloader still requests VISIBILITY_HIDDEN when the app can show its own
notification, but the manifest had dropped DOWNLOAD_WITHOUT_NOTIFICATION, which
that visibility requires. Declare it again so DownloadManager does not fall back
to its own notification and duplicate the app's.
getDownloadedFilePath() treated any existing non-empty file as downloaded, but
DownloadManager writes into the destination while the transfer runs. At 80% the
Details button switched to "Install downloaded", and tapping it handed a partial
APK to the package installer (parse error).

Track completion explicitly: DownloadManager status is the source of truth
(plus a .complete marker for records that get pruned). getFileState() reports
in-progress/complete/failed, and both Details and Downloads validate the APK
before offering or launching install. Unfinished or corrupt files are removed
instead of being surfaced.

Downloads metadata now also carries the repo avatar URL, persisted in the
sidecar next to repoId/displayName.
Replace the generic Android glyph with the repo avatar (falling back to the app
icon) and keep the app/repo title above the .apk filename and size. The install
action uses the System Update icon instead of the Android logo.
Use the filled download glyph so the small icon reads clearly at 24dp in the
status bar and the notification shade.
Switching categories was ignored while any list was loading because loadRepos
returned early on isLoading, and the chip only updates when the new load starts.

Drop that guard, cancel the in-flight job, and guard state updates with a load
generation so a late emission from the old category cannot overwrite the new one.

New and Popular are now saved per category under cacheDir/home_cache with a
10-minute TTL. Page one emits the saved list immediately (and skips the network
while it is fresh), then the live flow replaces it. Fresh cached data no longer
shows the offline-only notice while online.
Downloads saved before avatar metadata existed fell back to the GitStore app
icon, which looked like the wrong app. Backfill the avatar from the installed
app row when the sidecar has none, and use the repo's initial as the final
fallback instead of the launcher icon.
Trending still fetched jsDelivr before reading its disk copy, so a cold start
could sit on "Finding repositories" for the whole request timeout even with a
saved list available. Read the cache first, emit it, and only then refresh.

Trending and the New/Popular cache now share the same shape: saved list first,
network only when the entry is older than a day or the user taps Retry
(forceRefresh). New/Popular move from a 10-minute to a 24-hour window so the
daily data from the discovery bot is picked up once per day.
Legacy download sidecars have no avatar URL, so cards fell back to a single
letter even though the repo avatar is available. Resolve it from the installed
app row first, then derive https://github.com/<owner>.png from the saved
"owner/repo" display name.

Replace the ambiguous icon-only install action with a clear "Install" button.
New/Popular only wrote their cache after the whole probe finished. Because the
probe emits in batches and is cancelled when you leave the tab, a normal visit
often ended without a cache, so every return re-ran the expensive probing pass.

Save after every verified batch (and at the end), so a tab is cached as soon as
it shows its first three results.

All three categories now share one offline rule: paint the saved list if there
is one, otherwise emit the offline state. New/Popular no longer skip their cache
when offline, and load-more stops instead of attempting a doomed request.
Verifies that a saved list survives serialization, keeps its repo fields, reads
back for the same key, and is considered fresh immediately after writing.
Batch writes made the first three results look like a complete page for 24
hours. Track a `complete` flag: partial writes paint instantly but still run
the probe, and only a finished page short-circuits the network.

Verified on the signed-in release: New/Popular write after each batch and end
with complete=true, and switching back serves the saved list without a probe.
Android's cache trim purged cacheDir/trending_apps.json mid-session, and the
Home category cache lived there too, so saved lists could vanish between
launches and every tab switch paid for a full probe.

Move both stores to filesDir so saved lists survive system cache cleanup.
GitHub now serves the repository at Darkmintis/GitStore (no hyphen). Update the
jsDelivr trending seed URL, the update-check API, the in-app repo/bug-report
links, and the CONTRIBUTING/SECURITY links so nothing depends on a redirect.
@Darkmintis
Darkmintis merged commit 1369f95 into main Nov 9, 2026
2 checks passed
@Darkmintis
Darkmintis deleted the fix/test-sync-dispatcher branch November 9, 2026 07:56
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