Repository navigation
Conversation
…ersion announcement with Update/Later
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
v2rayNG is released on GitHub (and F-Droid), so many users stay on an old version without noticing new ones, and "Check for update" makes them leave the app to download and install. This PR adds in-app updating:
Implementation notes
UpdateAnnouncementPolicy(pure, no Android types): version comparison (non-numeric parts count as 0 instead of throwing), the "postponed version" rule and the check interval. Covered by JUnit tests.AppUpdateManager: the announcement check, download, copy to Downloads and the install intents.HttpUtil.downloadToFilegains optional progress and cancellation parameters (existing callers unchanged).GitHubRelease.Assetnow readssize, andCheckUpdateResultcarries the asset name and size.ui/update:AppUpdateController(state machine shared by both screens),AppUpdateSheetHost(Compose; the parts needing an Activity: permission screen and installer),AppUpdateViewModel(startup announcement). The APK goes through the existing${applicationId}.cacheFileProvider.REQUEST_INSTALL_PACKAGES. Four new strings (translated for all locales inlocaleFilters; the non-English translations are mine and need native review).Open question
The F-Droid flavor already finds its own asset in the update check, but F-Droid generally prefers that apps do not install updates themselves. I left the behavior identical for both flavors; if you prefer, I can restrict the download/install (and the permission) to the non-F-Droid flavor and keep the old "open in browser" behavior there.
Verification
UpdateAnnouncementPolicy(run withkotlincoutside Gradle, all passed).:app:assembleReleasesucceeded in a GitHub Actions build of this exact branch on my fork (compiles and packages)../gradlew :app:testPlaystoreDebugUnitTest :app:compilePlaystoreDebugKotlin :app:assemblePlaystoreDebug(no local Gradle run).