Add "Update to latest" button to Settings - #20
Merged
Conversation
Adds a new core:update module that checks GitHub Releases (neteinstein/InstaMaps) for a build newer than the one installed, downloads its APK, and hands it to the system Package Installer. - core:update: UpdateRepository/CheckForUpdateUseCase/DownloadAppUpdateUseCase (domain), GitHubUpdateRepository (data, raw HttpURLConnection + org.json, same pattern as GeminiLocationRepository), VersionComparator.isNewerVersion (numeric, not lexicographic, version comparison), and AppUpdateInstaller (Android glue: checks/requests the "install unknown apps" permission, launches the system installer via a FileProvider content:// URI). - app: REQUEST_INSTALL_PACKAGES permission plus FileProvider provider entry, Koin module registration. - feature:settings: "Update to latest" button and status section wired through SettingsViewModel/SettingsUiState/SettingsScreen. Checks for an update, then checks the sideloading permission before downloading (to avoid wasted bandwidth) - shows a WarningBanner with an "enable sideloading" action if it is not granted instead of downloading. - Unit tests for VersionComparator, the two use cases, and parseGitHubReleaseResponse; docs updated in agents.md and README.md. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.
What
Adds an Update to latest button to the Settings screen. Pressing it checks GitHub Releases for a build newer than the one installed, downloads its APK if one exists, and hands it to the system Package Installer to update in place.
If the device doesn't have "install unknown apps" (sideloading) enabled for InstaMaps, pressing the button shows a warning instead of downloading, with an action that jumps straight to that permission's system Settings screen.
How
core:update(new module):UpdateRepository/CheckForUpdateUseCase/DownloadAppUpdateUseCase(domain) +GitHubUpdateRepository(data) hit the unauthenticated GitHub "get the latest release" API (same rawHttpURLConnection/org.jsonapproach asGeminiLocationRepository- no new SDK dependency).VersionComparator.isNewerVersioncompares versions numerically per-segment, not lexicographically ("1.0.9"vs"1.0.16"would otherwise compare backwards as plain strings).AppUpdateInstalleris the Android glue: checks/requests the per-app "install unknown apps" permission and launches the system installer via aFileProvidercontent://URI.app:REQUEST_INSTALL_PACKAGESpermission +FileProvider<provider>entry (scoped to acacheDir/updates/subdirectory), Koin module registration.feature:settings: new "Updates" section with the button and live status (checking/downloading/up-to-date/failed/sideloading-blocked), wired throughSettingsViewModel/SettingsUiState/SettingsScreen. The flow checks the sideloading permission before downloading, so no bandwidth is wasted if it's blocked.Testing
VersionComparatorTest(7 cases, including the numeric-vs-lexicographic bug it exists to avoid),CheckForUpdateUseCaseTest/DownloadAppUpdateUseCaseTest(fake-repository delegation),GitHubUpdateRepositoryTest(realorg.jsonparsing of GitHub's actual response shape, verified against a live fetch of the repo's latest release)../gradlew ktlintCheck compileDebugKotlin compileDebugUnitTestKotlin test- all green, including the full existing suite../gradlew :app:assembleDebugand inspected the merged manifest to confirm theFileProviderauthority andREQUEST_INSTALL_PACKAGESpermission are wired correctly end-to-end.agents.md(module map + tech stack + testing standards) andREADME.md(new "Updating InstaMaps" section) per repo docs policy.Co-authored-by: Copilot App 223556219+Copilot@users.noreply.github.com