Feat/settings update check - #9
Merged
Merged
Conversation
The version row in Settings was static text. It is now an update check against the repo's latest GitHub release (public REST endpoint, no auth; releases are cut with np so tag/name/body carry the version, title and changelog): - entering Settings runs an automatic check — failures are silent, and a found update only switches the row to 'Update available' with the latest version number; - tapping the row runs a manual check with a spinner on the value: a newer release opens a dialog (version, release title, notes with markdown links flattened), being up to date gets a toast, and a failure opens a dialog carrying the classified network wording (offline / timeout / rate limit / 5xx with status) shared with the list-page toasts; - the timestamp of the last check is recorded in MMKV for future use. Version comparison is numeric per component, so 0.10.0 correctly supersedes 0.9.0. Strings localized in all seven app languages.
GitHub release bodies use CRLF line endings; the leftover \r glues multi-line notes into a single line on Android. Notes cleaning now normalizes \r\n first and also flattens headings, emphasis/code markers and list bullets (•), instead of only stripping links. The length cap rises to 2000 chars — the update dialog scrolls, so notes no longer need aggressive truncation.
The update dialog needs more than version + notes: the release page URL (every platform), the direct APK asset link and size when the release ships one (EAS builds attach r34-<version>.apk), and the publication timestamp. Payload parsing is now strict — a tag that isn't a plain dotted number makes the whole release unusable instead of silently comparing garbage versions.
The 'update available' hint lived only in hook state, so it vanished on every app restart until Settings re-fetched successfully. The last successful check is now persisted (version + release metadata): the hint is seeded on mount — visible immediately, even offline — and a stale hint whose version no longer beats the installed one is not seeded back after the user updates.
The new-release announcement was a system Alert, whose height can't be capped — long changelogs would flood the screen. It is now an in-app card clamped to 80% of the screen with the body scrolling inside, showing the version comparison, release date (ISO slice, Hermes-safe), APK size when the release ships one, and the flattened notes. 'Update now' opens the direct APK asset on Android (EAS attaches r34-<version>.apk per release) and the release page everywhere else; backdrop or Cancel dismisses, keeping the hint row. Dialog strings localized in all seven app languages.
The 'Update available' row now shows the new version in danger red and semibold, so the hint reads at a glance instead of blending into the muted value styling of the other rows.
Checking on every Settings visit was noisy and unnecessary — GitHub's anonymous rate limit aside, release cadence is daily at most. The check timestamp now lives in a small zustand store backed by MMKV (update-check-store) and the automatic check only runs when the last successful check is older than 24h (survives restarts; failures don't count and retry on the next visit). Manual checks always run. The persisted-release hint is unaffected: on throttled visits the row still seeds from the last known outcome, so a found update stays visible.
💯 Test Coverage
😎 Tests Results
👀 Tests Details • (56%)
|
The update check swapped the version text out for the spinner, hiding the very number the row exists to show — the spinner now renders left of the value. Both version displays (current and available update) carry a 'v' prefix, matching the release tags.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.