Android: a RuStore build, without the app's own updates and the counted check
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run

The owner puts the app in RuStore: the store updates it, and the store's build
must neither update itself nor be counted by the site. A build type «rustore»
on the same branch (not a branch to catch up each time): the release with
SELF_UPDATE off — no check of releases (the check is what the site counts
installations by), no download or install, no updates block in About, a
release kept from the site's build forgotten; its manifest drops the install
permissions and the installer's receiver. The full build only; the same
package and key, so it goes over the site's one and back with the databases.
release.sh builds it into dist-rustore and checks it asks for no install
permission; the release workflow keeps it as the run's «rustore» artifact, not
a file of the release. The site's builds are as they were.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
vrubelroman 2026-10-27 18:49:12 +03:00
parent f31023dcd7
commit dd4572fd8a
9 changed files with 73 additions and 10 deletions

View file

@ -186,8 +186,9 @@ class AppUpdates(private val context: Context, private val scope: CoroutineScope
}
val update = known()
when {
// Installed by hand from the site, or never newer than this app.
update == null || !newer(update.version) -> forgetAll()
// Installed by hand from the site, or never newer than this app; or a store's
// build put over the site's (the store updates it, a release kept is dropped).
!BuildConfig.SELF_UPDATE || update == null || !newer(update.version) -> forgetAll()
prefs.getLong(DOWNLOAD, -1L) != -1L -> watch(update, prefs.getLong(DOWNLOAD, -1L))
update.sha256.isEmpty() -> _state.value = UpdateState.Failed(update, UpdateProblem.BadRelease, null)
prefs.getString(READY, null) == update.version && apk(update).exists() -> _state.value = UpdateState.Ready(update, aborted = false)
@ -205,7 +206,7 @@ class AppUpdates(private val context: Context, private val scope: CoroutineScope
/// of the app, as the desktop does (a release out since the last check is offered at
/// once), and on return 6 h after the last answer (1 h after a failed try).
fun checkIfDue() {
if (!_auto.value || busy()) return
if (!BuildConfig.SELF_UPDATE || !_auto.value || busy()) return
val now = System.currentTimeMillis()
if (askedThisRun && (now - _lastCheck.value < RECHECK || now - prefs.getLong(LAST_ATTEMPT, 0L) < HOUR)) return
askedThisRun = true
@ -214,11 +215,13 @@ class AppUpdates(private val context: Context, private val scope: CoroutineScope
/// «Check now» (works with the automatic check off).
fun checkNow() {
if (_check.value == CheckState.Checking) return
if (!BuildConfig.SELF_UPDATE || _check.value == CheckState.Checking) return
scope.launch { runCheck(manual = true) }
}
private suspend fun runCheck(manual: Boolean) {
// A store's build never asks the site (nor counts itself there).
if (!BuildConfig.SELF_UPDATE) return
if (busy()) {
if (manual) _check.value = CheckState.Idle
return

View file

@ -86,9 +86,12 @@ fun AboutScreen(onBack: () -> Unit) {
val build = stringResource(if (BuildConfig.NET_BUILT_IN) R.string.build_full else R.string.build_light)
Text("${BuildConfig.VERSION_NAME} ${stringResource(R.string.alpha)} · $build", color = MaterialTheme.colorScheme.onSurfaceVariant)
Spacer(Modifier.height(24.dp))
// Right under the version (android-ui.md §25.5).
AboutUpdates()
Spacer(Modifier.height(24.dp))
// Right under the version (android-ui.md §25.5); a store's build is updated by
// the store.
if (BuildConfig.SELF_UPDATE) {
AboutUpdates()
Spacer(Modifier.height(24.dp))
}
Text(stringResource(R.string.about_text), style = MaterialTheme.typography.bodyLarge)
TextButton(onClick = { uri.openUri(SITE) }, contentPadding = androidx.compose.foundation.layout.PaddingValues(0.dp)) {
Text(stringResource(R.string.website))

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- The RuStore build (build.gradle.kts, buildType "rustore"): the store installs and
updates the app, so it neither installs packages nor receives the installer's answer. -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" tools:node="remove" />
<uses-permission android:name="android.permission.UPDATE_PACKAGES_WITHOUT_USER_ACTION" tools:node="remove" />
<application>
<receiver android:name=".data.InstallResult" tools:node="remove" />
</application>
</manifest>