diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 15f68eb87c..95d036381a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -127,6 +127,7 @@ jobs: name: xbox-arm64 path: app/src/main/assets/linuxfs/usr/local/lib/droiddeck-xbox retention-days: 14 + overwrite: true - uses: actions/upload-artifact@v4 with: name: xbox-corresponding-source @@ -135,6 +136,7 @@ jobs: app/build/xbox/runtime/*-source.tar.xz if-no-files-found: error retention-days: 14 + overwrite: true components-runner: needs: source @@ -330,6 +332,7 @@ jobs: if-no-files-found: error compression-level: 0 retention-days: 14 + overwrite: true build-runner: needs: [components] @@ -664,6 +667,7 @@ jobs: name: stores-cargo-lock path: app/src/main/rust/stores/Cargo.lock if-no-files-found: ignore + overwrite: true - name: Unit tests id: unit-tests @@ -687,6 +691,7 @@ jobs: app/build/reports/tests/testReleaseUnitTest/ if-no-files-found: ignore retention-days: 14 + overwrite: true - name: Sign with the testkey (v1 + v2 + v3) run: | @@ -724,6 +729,7 @@ jobs: if-no-files-found: error retention-days: 30 compression-level: 0 + overwrite: true - uses: actions/upload-artifact@v4 with: @@ -732,6 +738,7 @@ jobs: if-no-files-found: error retention-days: 30 compression-level: 0 + overwrite: true - name: Report on the pull request if: always() && github.event_name == 'pull_request' @@ -930,7 +937,7 @@ jobs: pull-requests: read env: CI_REPO: Droid-Deck/DroidDeck-CI - KEEP: 10 + KEEP_DAYS: 14 steps: - uses: actions/checkout@v4 with: diff --git a/.github/workflows/pr-rebuild-on-version.yml b/.github/workflows/pr-rebuild-on-version.yml new file mode 100644 index 0000000000..95abedf99f --- /dev/null +++ b/.github/workflows/pr-rebuild-on-version.yml @@ -0,0 +1,141 @@ +name: PR Rebuild On Version Bump +run-name: rebuild test builds below versionCode on main + +on: + push: + branches: [main] + paths: [app/build.gradle] + workflow_dispatch: + +permissions: + actions: write + contents: read + issues: write + pull-requests: read + +concurrency: + group: pr-rebuild-on-version + cancel-in-progress: false + queue: max + +jobs: + rebuild: + runs-on: ubuntu-24.04 + timeout-minutes: 180 + steps: + - uses: actions/checkout@v4 + with: + ref: main + fetch-depth: 2 + persist-credentials: false + - name: Rebuild open PRs whose test build Android would refuse over main + env: + GH_TOKEN: ${{ github.token }} + EVENT_NAME: ${{ github.event_name }} + BEFORE: ${{ github.event.before }} + PUSHED_AT: ${{ github.event.repository.pushed_at }} + run: | + set -euo pipefail + code() { sed -n 's/^[[:space:]]*versionCode[[:space:]][[:space:]]*\([0-9][0-9]*\)[[:space:]]*$/\1/p'; } + now=$(code < app/build.gradle) + [[ "$now" =~ ^[0-9]+$ ]] || { echo "::error::No numeric versionCode on main"; exit 1; } + if [ "$EVENT_NAME" = push ]; then + was=$(git show "$BEFORE:app/build.gradle" 2>/dev/null | code || true) + if [[ "$was" =~ ^[0-9]+$ ]] && [ "$was" -ge "$now" ]; then + echo "versionCode stayed at $now" + exit 0 + fi + fi + # This run is created right after the push, so a PR build that started earlier may have pinned the old main. + bumped=$(gh api "repos/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" --jq .created_at) + # A build can finish between the push and this run's creation; the push event carries the push time. + if [[ "${PUSHED_AT:-}" =~ ^[0-9]+$ ]]; then + pushed=$(date -u -d "@$PUSHED_AT" +%Y-%m-%dT%H:%M:%SZ) + [[ "$pushed" < "$bumped" ]] && bumped=$pushed + else + pushed=$(date -u -d "$bumped - 10 minutes" +%Y-%m-%dT%H:%M:%SZ) + fi + note() { + local number=$1 + local marker="" + gh api "repos/$GITHUB_REPOSITORY/issues/$number/comments?per_page=100" --jq '.[].body' | grep -qF "$marker" && return 0 + gh api -X POST "repos/$GITHUB_REPOSITORY/issues/$number/comments" -f body="$marker + Main is now at versionCode $now, so this PR's test build no longer installs over current DroidDeck, and its last build is too old for GitHub to re-run. Push a commit or merge main to get a new test build." >/dev/null + } + latest() { + gh api "repos/$GITHUB_REPOSITORY/actions/workflows/build.yml/runs?event=pull_request&head_sha=$1&per_page=20" \ + --jq '[.workflow_runs[] | select(.head_sha == "'"$1"'")] | sort_by(.created_at) | last // empty | [.id, .status, (.run_started_at // .created_at), .created_at, .updated_at] | @tsv' + } + consider() { + local number=$1 head=$2 built=$3 id status started created updated + IFS=$'\t' read -r id status started created updated <<<"$4" + if [[ "$started" > "$bumped" ]]; then + echo "PR #$number: build $id started after the bump" + elif ! gh api "repos/$GITHUB_REPOSITORY/pulls/$number" | + jq -e --arg head "$head" '.state == "open" and .draft == false and .base.ref == "main" and .head.sha == $head' >/dev/null; then + echo "PR #$number: moved on since the scan, its own build covers it" + elif gh run rerun "$id" -R "$GITHUB_REPOSITORY"; then + echo "PR #$number: rebuilding ${head:0:7} on main (versionCode $built -> $now)" + else + echo "::warning::PR #$number: could not rerun build $id" + # GitHub only re-runs a workflow within 30 days of its first run. + if [[ "$created" < "$(date -u -d '-30 days' +%Y-%m-%dT%H:%M:%SZ)" ]]; then + note "$number" || echo "::warning::PR #$number: could not leave a note" + fi + fi + } + pending=() + declare -A seen=() + candidates() { + gh api --paginate "repos/Droid-Deck/DroidDeck-CI/releases?per_page=100" \ + --jq '.[] | select(.tag_name | test("^pr-[0-9]+$")) | [(.tag_name | ltrimstr("pr-")), ((.body // "") | capture("(?m)^VersionCode: (?[0-9]+)").v // "0")] | @tsv' + # The latest build of every open PR: one that started before the bump and was still running at it + # may have pinned the old main. This also covers a PR's first build and fork builds. + gh api --paginate -X GET "repos/$GITHUB_REPOSITORY/pulls" -f state=open -f base=main -f per_page=100 \ + --jq '.[] | select(.draft | not) | [(.number | tostring), .head.sha] | @tsv' | + while IFS=$'\t' read -r number sha; do + run=$(latest "$sha") + [ -n "$run" ] || continue + IFS=$'\t' read -r _ status started _ updated <<<"$run" + if [[ "$started" < "$bumped" ]] && { [ "$status" != completed ] || [[ ! "$updated" < "$pushed" ]]; }; then + printf '%s\t?\n' "$number" + fi + done + } + found=$(mktemp) + candidates > "$found" + while IFS=$'\t' read -r number built; do + [ "$built" = "?" ] || [ "$built" -lt "$now" ] || continue + [ -z "${seen[$number]:-}" ] || continue + seen[$number]=1 + pr=$(gh api "repos/$GITHUB_REPOSITORY/pulls/$number") || continue + jq -e '.state == "open" and .draft == false and .base.ref == "main"' <<<"$pr" >/dev/null || continue + head=$(jq -r .head.sha <<<"$pr") + run=$(latest "$head") + if [ -z "$run" ]; then + echo "PR #$number: no build of ${head:0:7} to rerun" + elif [ "$(cut -f2 <<<"$run")" = completed ]; then + consider "$number" "$head" "$built" "$run" + else + pending+=("$number $head $built") + fi + done < "$found" + # Builds still running are polled together so one slow build cannot hold up the rest. + deadline=$((SECONDS + 150 * 60)) + while [ ${#pending[@]} -gt 0 ] && [ "$SECONDS" -lt "$deadline" ]; do + sleep 60 + left=() + for item in "${pending[@]}"; do + read -r number head built <<<"$item" + run=$(latest "$head") + if [ -n "$run" ] && [ "$(cut -f2 <<<"$run")" = completed ]; then + consider "$number" "$head" "$built" "$run" + else + left+=("$item") + fi + done + pending=(${left[@]+"${left[@]}"}) + done + for item in ${pending[@]+"${pending[@]}"}; do + echo "::warning::PR #${item%% *}: its build did not finish in time" + done diff --git a/.github/workflows/pr-release-sweep.yml b/.github/workflows/pr-release-sweep.yml index 6ea1874e27..f65777ba6d 100644 --- a/.github/workflows/pr-release-sweep.yml +++ b/.github/workflows/pr-release-sweep.yml @@ -55,3 +55,9 @@ jobs: fi done exit "$failed" + + catalog: + needs: sweep + if: ${{ always() }} + uses: ./.github/workflows/update-catalog.yml + secrets: inherit diff --git a/app/build.gradle b/app/build.gradle index bb0b7132e5..7f992a5f42 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -141,6 +141,7 @@ android { buildConfigField "boolean", "CI_BUILD", "${ciBuild}" buildConfigField "String", "RELEASE_SIGNER", "\"${releaseSigner}\"" buildConfigField "long", "COMMIT_TIME", "${commitTime}L * 1000L" + buildConfigField "String", "UPDATE_CATALOG_BRANCH", "\"${(System.getenv("DROIDDECK_UPDATE_CATALOG_BRANCH") ?: "main").with { it ==~ /[A-Za-z0-9._-]+/ ? it : "main" }}\"" buildConfigField "String", "VARIANT_SUFFIXES", "\"${variantSuffixes}\"" buildConfigField "String", "SGDB_API_KEY", "\"${System.getenv("SGDB_API_KEY") ?: project.findProperty("sgdbApiKey") ?: ""}\"" buildConfigField "String", "DESKTOP_KDE_TAG", "\"${desktopKde.DESKTOP_KDE_TAG}\"" diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 67240f4eb3..172da8d450 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -323,6 +323,10 @@ android:theme="@style/SessionTheme" /> + (null) @@ -43,6 +44,7 @@ internal class UpdatesMenu(private val activity: Activity, private val ui: Handl .onFailure { error = activity.getString(R.string.upd_unknown_apps_failed); pending = null } }, onDismissPermission = { askPermission = false; pending = null }, + onSeen = { r -> UpdateWatch.seen(activity, r) }, ) val hasUpdate: Boolean get() = AppUpdates.hasUpdate(catalog, follow) @@ -77,6 +79,7 @@ internal class UpdatesMenu(private val activity: Activity, private val ui: Handl private fun choose(f: AppUpdates.Follow) { AppUpdates.setFollow(activity, f) + UpdateWatch.sync(activity, f, catalog?.let { AppUpdates.release(it, f) }) follow = f error = null } diff --git a/app/src/main/java/com/droiddeck/launcher/ui/UpdatesPage.kt b/app/src/main/java/com/droiddeck/launcher/ui/UpdatesPage.kt index e0622acf5e..92478a6cd2 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/UpdatesPage.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/UpdatesPage.kt @@ -18,6 +18,8 @@ import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.BoxWithConstraints import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.ExperimentalLayoutApi +import androidx.compose.foundation.layout.FlowRow import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth @@ -31,7 +33,9 @@ import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.verticalScroll import androidx.compose.material.icons.Icons import androidx.compose.material.icons.outlined.Bolt +import androidx.compose.material.icons.automirrored.filled.OpenInNew import androidx.compose.material.icons.outlined.CheckCircle +import androidx.compose.material.icons.outlined.ContentCopy import androidx.compose.material.icons.outlined.Code import androidx.compose.material.icons.outlined.Download import androidx.compose.material.icons.outlined.Info @@ -50,6 +54,7 @@ import androidx.compose.material3.Text import androidx.compose.material3.TextButton import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.saveable.rememberSaveable @@ -59,7 +64,12 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.semantics.Role +import androidx.compose.ui.platform.LocalClipboardManager +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.text.AnnotatedString import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.text.input.ImeAction +import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp @@ -87,6 +97,7 @@ class UpdatesActions( val onInstall: (Release) -> Unit = {}, val onAllowInstalls: () -> Unit = {}, val onDismissPermission: () -> Unit = {}, + val onSeen: (Release) -> Unit = {}, ) @OptIn(androidx.compose.foundation.ExperimentalFoundationApi::class) @@ -112,6 +123,13 @@ internal fun UpdatesPage(s: FrontEndState, a: FrontEndActions, modifier: Modifie if (u.checking) stringResource(R.string.common_checking) else if (checked != null) stringResource(R.string.upd_checked, ago(checked).replaceFirstChar { it.lowercase() }) else stringResource(R.string.upd_not_checked), fontSize = 13.sp, color = colors.onSurfaceVariant, ) + val clipboard = LocalClipboardManager.current + val context = LocalContext.current + val details = buildDetails(me, s.buildLabel) + ToolIcon(Icons.Outlined.ContentCopy, stringResource(R.string.upd_copy_build)) { + clipboard.setText(AnnotatedString(details)) + android.widget.Toast.makeText(context, context.getString(R.string.upd_copied), android.widget.Toast.LENGTH_SHORT).show() + } ToolIcon(Icons.Outlined.Refresh, stringResource(R.string.store_check_updates), busy = u.checking, enabled = !u.checking && u.stage == null, onClick = ua.onCheck) } BoxWithConstraints(Modifier.weight(1f).fillMaxWidth()) { @@ -169,6 +187,8 @@ private fun StatusPanel(s: FrontEndState, u: UpdatesState, ua: UpdatesActions, m offered && installBlock != null -> Look(colors.onSurfaceVariant, stringResource(R.string.upd_blocked_status), newBuild(u.follow, release!!), null) offer == Offer.UPDATE -> Look(AttentionAmber, stringResource(R.string.upd_available), newBuild(u.follow, release!!), null) offer == Offer.SWITCH -> Look(pal.signal, stringResource(R.string.upd_switch), newBuild(u.follow, release!!), null) + offer == Offer.AHEAD && u.follow.channel == Channel.NIGHTLY -> Look(pal.signal, stringResource(R.string.upd_ahead_preview_status), + stringResource(R.string.upd_ahead_preview_headline), stringResource(R.string.upd_ahead_preview_detail)) offer == Offer.AHEAD -> Look(pal.signal, stringResource(R.string.upd_ahead_status), stringResource(R.string.upd_ahead_headline), stringResource(R.string.upd_ahead_detail)) offer == Offer.GONE -> Look(AttentionAmber, stringResource(R.string.upd_gone_status), stringResource(R.string.upd_gone_headline), @@ -186,6 +206,12 @@ private fun StatusPanel(s: FrontEndState, u: UpdatesState, ua: UpdatesActions, m Text(look.headline, fontSize = 22.sp, fontWeight = FontWeight.Bold, color = colors.onBackground, modifier = Modifier.padding(top = 4.dp)) if (offered) { ReleaseNotes(changeTitle(release!!.title.ifBlank { release.tag }), release.summary, release.tag) + ReleaseFacts(release) + } + if (release != null && u.follow.channel == Channel.TEST && catalog != null) { + androidx.compose.runtime.LaunchedEffect(release.tag, release.commit, release.apk?.sha256) { ua.onSeen(release) } + if (!offered) ReleaseFacts(release) + TestFreshness(catalog, release) } if (look.detail != null) Text(look.detail, fontSize = 14.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(top = 10.dp)) if (installBlock != null && offered) { @@ -204,7 +230,7 @@ private fun StatusPanel(s: FrontEndState, u: UpdatesState, ua: UpdatesActions, m offered && installBlock != null -> Unit offer == Offer.UPDATE -> PrimaryButton(stringResource(R.string.upd_update_button, button), enabled = installable, main = true) { ua.onInstall(release!!) } offer == Offer.SWITCH -> PrimaryButton(stringResource(R.string.upd_install_button, button), enabled = installable, main = true) { ua.onInstall(release!!) } - offer == Offer.AHEAD && installBlock == null -> + offer == Offer.AHEAD && u.follow.channel == Channel.STABLE && installBlock == null -> SecondaryButton(stringResource(R.string.upd_install_anyway, release?.version.orEmpty()), enabled = installable) { ua.onInstall(release!!) } offer == Offer.GONE -> PrimaryButton(stringResource(R.string.upd_follow_preview), main = true) { ua.onFollow(Follow(Channel.NIGHTLY)) } } @@ -213,7 +239,7 @@ private fun StatusPanel(s: FrontEndState, u: UpdatesState, ua: UpdatesActions, m Text(stringResource(R.string.upd_stop_session), fontSize = 12.5.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(top = 8.dp)) } if (u.follow.channel == Channel.NIGHTLY) { - PreviewHistory(catalog, me) + PreviewHistory(catalog, me, s, u, ua) } } } @@ -273,6 +299,9 @@ private fun ChannelPicker(u: UpdatesState, ua: UpdatesActions, sessionRunning: B val colors = MaterialTheme.colorScheme val catalog = u.catalog val tests = catalog?.tests.orEmpty() + val me = remember { AppUpdates.installed() } + val ready = tests.count { AppUpdates.installable(it, me) } + var showTests by rememberSaveable { mutableStateOf(false) } Column(verticalArrangement = Arrangement.spacedBy(10.dp)) { ChannelCard( Icons.Outlined.Verified, stringResource(R.string.upd_stable), stringResource(R.string.upd_stable_hint), @@ -284,13 +313,11 @@ private fun ChannelPicker(u: UpdatesState, ua: UpdatesActions, sessionRunning: B ) { ua.onFollow(Follow(Channel.NIGHTLY)) } ChannelCard( Icons.Outlined.Science, stringResource(R.string.upd_tests), stringResource(R.string.upd_tests_hint), - if (tests.isEmpty()) stringResource(R.string.upd_tests_none) else pluralStringResource(R.plurals.upd_tests_count, tests.size, tests.size), + if (tests.isEmpty()) stringResource(R.string.upd_tests_none) else pluralStringResource(R.plurals.upd_tests_count, ready, ready), u.follow.channel == Channel.TEST, enabled = tests.isNotEmpty() || u.follow.channel == Channel.TEST, - ) { tests.firstOrNull()?.let { ua.onFollow(Follow(Channel.TEST, it.pr)) } } - AnimatedVisibility(u.follow.channel == Channel.TEST && tests.isNotEmpty(), enter = expandVertically(Motion.sp(1f)) + fadeIn(Motion.sp(1f)), exit = shrinkVertically(Motion.sp(1f)) + fadeOut(Motion.sp(1f))) { - Column(Modifier.padding(start = 18.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) { - tests.forEach { t -> TestRow(t, u.follow.pr == t.pr) { ua.onFollow(Follow(Channel.TEST, t.pr)) } } - } + ) { showTests = !showTests } + AnimatedVisibility((showTests || u.follow.channel == Channel.TEST) && tests.isNotEmpty(), enter = expandVertically(Motion.sp(1f)) + fadeIn(Motion.sp(1f)), exit = shrinkVertically(Motion.sp(1f)) + fadeOut(Motion.sp(1f))) { + TestList(tests, me, u, ua) } val context = androidx.compose.ui.platform.LocalContext.current val agentReady = com.droiddeck.launcher.agent.AgentHost.installed && @@ -305,56 +332,211 @@ private fun ChannelPicker(u: UpdatesState, ua: UpdatesActions, sessionRunning: B } @Composable -private fun PreviewHistory(catalog: AppUpdates.Catalog?, me: AppUpdates.Installed) { +private fun PreviewHistory(catalog: AppUpdates.Catalog?, me: AppUpdates.Installed, s: FrontEndState, u: UpdatesState, ua: UpdatesActions) { val history = catalog?.let { AppUpdates.previewHistory(it, me) } ?: return val colors = MaterialTheme.colorScheme - val pal = LocalPalette.current - val key = catalog?.recentPreviews?.firstOrNull()?.commit - var expanded by rememberSaveable(key) { mutableStateOf(false) } val heading = when (history.kind) { AppUpdates.PreviewHistoryKind.CURRENT -> stringResource(R.string.upd_preview_current) AppUpdates.PreviewHistoryKind.BEHIND -> pluralStringResource( R.plurals.upd_preview_behind, history.buildsBehind, history.buildsBehind, ) AppUpdates.PreviewHistoryKind.RECENT -> pluralStringResource( - R.plurals.upd_preview_recent, history.changes.size, history.changes.size, + R.plurals.upd_preview_recent, maxOf(history.builds.size, history.changes.size), maxOf(history.builds.size, history.changes.size), ) } Column(Modifier.fillMaxWidth().padding(top = 18.dp)) { Text(heading, fontSize = 11.5.sp, fontWeight = FontWeight.Medium, color = colors.onSurfaceVariant) - if (history.changes.isNotEmpty()) { - val visible = if (expanded) history.changes else history.changes.take(3) - Column(Modifier.padding(top = 3.dp), verticalArrangement = Arrangement.spacedBy(3.dp)) { - visible.forEach { change -> - Column { - Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp)) { - Text( - changeTitle(change.title.ifBlank { change.commit.take(7) }), - fontSize = 12.5.sp, fontWeight = FontWeight.SemiBold, color = colors.onBackground, - maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f), - ) - Text(ago(change.publishedAt), fontSize = 11.sp, color = colors.onSurfaceVariant) - } - if (change.summary.isNotBlank()) Text( - change.summary, fontSize = 11.5.sp, color = colors.onSurfaceVariant, - maxLines = 1, overflow = TextOverflow.Ellipsis, - ) + if (history.builds.isNotEmpty()) { + Text(stringResource(R.string.upd_preview_pick), fontSize = 11.5.sp, color = colors.onSurfaceVariant) + PreviewBuilds(history, me, s, u, ua) + } else if (history.changes.isNotEmpty()) { + LegacyChanges(history.changes) + } + } +} + +@Composable +private fun PreviewBuilds(history: AppUpdates.PreviewHistory, me: AppUpdates.Installed, s: FrontEndState, u: UpdatesState, ua: UpdatesActions) { + val builds = history.builds + var open by rememberSaveable { mutableStateOf(null) } + var shown by rememberSaveable(builds.firstOrNull()?.commit) { + mutableIntStateOf(maxOf(5, if (history.installedIndex >= 0) history.installedIndex + 2 else 0)) + } + Column(Modifier.padding(top = 6.dp), verticalArrangement = Arrangement.spacedBy(4.dp)) { + builds.take(shown).forEachIndexed { index, build -> + PreviewBuildRow( + build, index, history.installedIndex, me, s, u, ua, + expanded = open == build.commit, + ) { open = if (open == build.commit) null else build.commit } + } + } + val more = builds.size - shown + if (more > 0) MoreLink(stringResource(R.string.upd_show_more, more), "preview:history:more") { shown += 20 } + else if (shown > 5) MoreLink(stringResource(R.string.upd_less), "preview:history:less") { shown = 5 } +} + +@Composable +private fun PreviewBuildRow( + build: Release, index: Int, installedIndex: Int, me: AppUpdates.Installed, + s: FrontEndState, u: UpdatesState, ua: UpdatesActions, expanded: Boolean, onToggle: () -> Unit, +) { + val colors = MaterialTheme.colorScheme + val pal = LocalPalette.current + val src = remember { MutableInteractionSource() } + val hot = rememberHot(src) + val installed = index == installedIndex + val block = AppUpdates.installBlock(build, me) + val tooOld = block != null && build.apk != null && build.apk.versionCode < me.versionCode + Column( + Modifier.fillMaxWidth().clip(Shape12) + .background(if (hot) pal.signal.copy(alpha = 0.12f) else if (expanded) colors.surfaceVariant else Color.Transparent) + .alpha(if (tooOld && !expanded) 0.55f else 1f), + ) { + Row( + verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp), + modifier = Modifier.fillMaxWidth().paneItem("preview:${build.commit}") + .glideBorder(hot, Shape12, pal.signal) + .hoverable(src).clickable(interactionSource = src, indication = null, role = Role.Button, onClick = onToggle) + .controllerConfirm(onClick = onToggle) + .padding(horizontal = 8.dp, vertical = 6.dp), + ) { + Column(Modifier.weight(1f)) { + Text( + changeTitle(build.title.ifBlank { build.shortCommit }), fontSize = 12.5.sp, fontWeight = FontWeight.SemiBold, + color = colors.onBackground, maxLines = if (expanded) Int.MAX_VALUE else 1, overflow = TextOverflow.Ellipsis, + ) + Text( + listOfNotNull(ago(build.committedAt.takeIf { it > 0 } ?: build.publishedAt), build.author.takeIf { it.isNotEmpty() }?.let { "@$it" }, build.shortCommit) + .joinToString(" · "), + fontSize = 11.sp, color = colors.onSurfaceVariant, maxLines = 1, overflow = TextOverflow.Ellipsis, + ) + } + if (installed) Chip(stringResource(R.string.upd_installed_tag), ok = true) + } + if (expanded) Column(Modifier.padding(start = 8.dp, end = 8.dp, bottom = 10.dp)) { + if (build.summary.isNotBlank()) Text(build.summary, fontSize = 12.5.sp, color = colors.onSurfaceVariant) + ReleaseFacts(build) + Box(Modifier.padding(top = 10.dp)) { + when { + installed -> Unit + block != null -> Text(block.message(LocalContext.current), fontSize = 12.5.sp, color = AttentionAmber) + me.updatable -> { + val size = build.apk?.size?.takeIf { it > 0 }?.let { " · ${megabytes(it)}" }.orEmpty() + val label = if (installedIndex in 0 until index) stringResource(R.string.upd_rollback_this, size) + else stringResource(R.string.upd_install_this, size) + SecondaryButton(label, enabled = u.stage == null && !s.sessionRunning, compact = true) { ua.onInstall(build) } } } } - if (history.changes.size > 3 || expanded) { - val src = remember { MutableInteractionSource() } - val hot = rememberHot(src) - val toggle = { expanded = !expanded } + } + } +} + +@Composable +private fun LegacyChanges(changes: List) { + val colors = MaterialTheme.colorScheme + Column(Modifier.padding(top = 3.dp), verticalArrangement = Arrangement.spacedBy(3.dp)) { + changes.take(10).forEach { change -> + Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp)) { Text( - if (expanded) stringResource(R.string.upd_less) else stringResource(R.string.upd_more), - fontSize = 12.sp, fontWeight = FontWeight.SemiBold, color = pal.signal, - modifier = Modifier.padding(top = 1.dp).offset(x = (-6).dp).paneItem("preview:history:more") - .clip(Shape12).glideBorder(hot, Shape12, pal.signal) - .hoverable(src).clickable(interactionSource = src, indication = null, role = Role.Button, onClick = toggle) - .controllerConfirm(onClick = toggle) - .padding(horizontal = 6.dp, vertical = 4.dp), + changeTitle(change.title.ifBlank { change.commit.take(7) }), + fontSize = 12.5.sp, fontWeight = FontWeight.SemiBold, color = colors.onBackground, + maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f), ) + Text(ago(change.publishedAt), fontSize = 11.sp, color = colors.onSurfaceVariant) + } + } + } +} + +@Composable +private fun MoreLink(text: String, id: String, onClick: () -> Unit) { + val pal = LocalPalette.current + val src = remember { MutableInteractionSource() } + val hot = rememberHot(src) + Text( + text, fontSize = 12.sp, fontWeight = FontWeight.SemiBold, color = pal.signal, + modifier = Modifier.padding(top = 2.dp).offset(x = (-6).dp).paneItem(id) + .clip(Shape12).glideBorder(hot, Shape12, pal.signal) + .hoverable(src).clickable(interactionSource = src, indication = null, role = Role.Button, onClick = onClick) + .controllerConfirm(onClick = onClick) + .padding(horizontal = 6.dp, vertical = 4.dp), + ) +} + +@OptIn(ExperimentalLayoutApi::class) +@Composable +private fun ReleaseFacts(r: Release) { + val colors = MaterialTheme.colorScheme + val facts = listOfNotNull( + r.author.takeIf { it.isNotEmpty() }?.let { "@$it" }, + stringResource(R.string.upd_version_code, r.versionCode), + ).joinToString(" · ") + Text(facts, fontSize = 12.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(top = 8.dp)) + FlowRow(Modifier.padding(top = 2.dp), horizontalArrangement = Arrangement.spacedBy(6.dp)) { + if (r.linkedPr > 0) LinkPill(stringResource(R.string.upd_pr, r.linkedPr), "https://github.com/Droid-Deck/DroidDeck/pull/${r.linkedPr}") + if (r.commit.length >= 7) LinkPill(stringResource(R.string.upd_link_commit, r.shortCommit), "https://github.com/Droid-Deck/DroidDeck/commit/${r.commit}") + if (r.url.startsWith("https://github.com/Droid-Deck/")) LinkPill(stringResource(R.string.upd_link_release), r.url) + } +} + +@Composable +private fun TestFreshness(catalog: AppUpdates.Catalog, r: Release) { + val colors = MaterialTheme.colorScheme + if (r.newerCommitPushed) Text( + stringResource(R.string.upd_newer_commit, r.headCommit.take(7)), fontSize = 12.5.sp, color = AttentionAmber, modifier = Modifier.padding(top = 8.dp), + ) + val behind = AppUpdates.previewsSince(catalog, r) + if (behind > 0) Text( + stringResource(R.string.upd_main_moved, behind), fontSize = 12.5.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(top = 4.dp), + ) +} + +@Composable +private fun LinkPill(label: String, url: String) { + val ctx = LocalContext.current + val pal = LocalPalette.current + val src = remember { MutableInteractionSource() } + val hot = rememberHot(src) + val open = { openUrl(ctx, url) } + Row( + verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(5.dp), + modifier = Modifier.paneItem("link:$url").heightIn(min = 36.dp).offset(x = (-8).dp).clip(Shape12) + .background(if (hot) pal.signal.copy(alpha = 0.14f) else Color.Transparent) + .glideBorder(hot, Shape12, pal.signal) + .hoverable(src).clickable(interactionSource = src, indication = null, role = Role.Button, onClick = open) + .controllerConfirm(onClick = open).padding(horizontal = 8.dp), + ) { + val tint = pal.signal + Text(label, fontSize = 12.sp, fontWeight = FontWeight.Medium, color = tint, maxLines = 1) + Icon(Icons.AutoMirrored.Filled.OpenInNew, contentDescription = null, tint = tint.copy(alpha = 0.65f), modifier = Modifier.size(11.dp)) + } +} + +@Composable +private fun TestList(tests: List, me: AppUpdates.Installed, u: UpdatesState, ua: UpdatesActions) { + val colors = MaterialTheme.colorScheme + var query by rememberSaveable { mutableStateOf("") } + val needle = query.trim().removePrefix("#").removePrefix("@") + val matches = tests.filter { + needle.isEmpty() || it.pr.toString().startsWith(needle) || it.title.contains(needle, ignoreCase = true) || + it.author.contains(needle, ignoreCase = true) || (needle.length >= 4 && it.commit.startsWith(needle, ignoreCase = true)) + } + val (ready, old) = matches.partition { it.versionCode >= me.versionCode } + val followedOld = u.follow.channel == Channel.TEST && old.any { it.pr == u.follow.pr } + var showOld by rememberSaveable { mutableStateOf(false) } + Column(Modifier.padding(start = 18.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) { + if (tests.size > 5 || query.isNotEmpty()) AdbTextField( + value = query, onValueChange = { query = it }, label = stringResource(R.string.upd_tests_find), + keyboardType = KeyboardType.Text, imeAction = ImeAction.Search, compact = true, showLabel = false, + placeholder = stringResource(R.string.upd_tests_find), modifier = Modifier.fillMaxWidth(), + ) + if (matches.isEmpty()) Text(stringResource(R.string.upd_tests_no_match), fontSize = 12.5.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(4.dp)) + ready.forEach { t -> TestRow(t, u.follow.pr == t.pr && u.follow.channel == Channel.TEST) { ua.onFollow(Follow(Channel.TEST, t.pr)) } } + if (old.isNotEmpty()) { + MoreLink(stringResource(R.string.upd_tests_old, old.size, me.versionCode), "tests:old") { showOld = !showOld } + if (showOld || followedOld || needle.isNotEmpty()) old.forEach { t -> + TestRow(t, u.follow.pr == t.pr && u.follow.channel == Channel.TEST, tooOld = true) { ua.onFollow(Follow(Channel.TEST, t.pr)) } } } } @@ -404,7 +586,7 @@ private fun RadioDot(selected: Boolean, size: androidx.compose.ui.unit.Dp = 22.d } @Composable -private fun TestRow(t: Release, selected: Boolean, onClick: () -> Unit) { +private fun TestRow(t: Release, selected: Boolean, tooOld: Boolean = false, onClick: () -> Unit) { val colors = MaterialTheme.colorScheme val pal = LocalPalette.current val src = remember { MutableInteractionSource() } @@ -417,6 +599,7 @@ private fun TestRow(t: Release, selected: Boolean, onClick: () -> Unit) { .clip(Shape12) .background(colors.surface).background(if (hot) pal.signal.copy(alpha = 0.14f) else Color.Transparent) .glideBorder(hot, Shape12, pal.signal, pal.line) + .alpha(if (tooOld && !selected) 0.6f else 1f) .hoverable(src) .clickable(interactionSource = src, indication = null, role = Role.RadioButton, onClick = onClick) .controllerConfirm(onClick = onClick) @@ -424,13 +607,29 @@ private fun TestRow(t: Release, selected: Boolean, onClick: () -> Unit) { ) { Text("#${t.pr}", fontSize = 13.sp, fontWeight = FontWeight.Bold, color = if (selected) pal.signal else colors.onSurfaceVariant) Column(Modifier.weight(1f)) { - Text(t.title.ifBlank { stringResource(R.string.upd_pr, t.pr) }, fontSize = 13.5.sp, fontWeight = FontWeight.SemiBold, color = colors.onBackground, maxLines = 1, overflow = TextOverflow.Ellipsis) - Text(if (t.apk == null) stringResource(R.string.upd_not_built) else stringResource(R.string.upd_updated, ago(t.publishedAt)), fontSize = 12.sp, color = colors.onSurfaceVariant) + Text(changeTitle(t.title.ifBlank { stringResource(R.string.upd_pr, t.pr) }), fontSize = 13.5.sp, fontWeight = FontWeight.SemiBold, color = colors.onBackground, maxLines = 1, overflow = TextOverflow.Ellipsis) + val detail = when { + t.apk == null -> stringResource(R.string.upd_not_built) + tooOld -> stringResource(R.string.upd_tests_old_row, t.versionCode) + else -> stringResource(R.string.upd_updated, ago(t.builtAt.takeIf { it > 0 } ?: t.publishedAt)) + } + Text( + listOfNotNull(detail, t.author.takeIf { it.isNotEmpty() }?.let { "@$it" }, t.shortCommit).joinToString(" · "), + fontSize = 12.sp, color = colors.onSurfaceVariant, maxLines = 1, overflow = TextOverflow.Ellipsis, + ) + if (t.newerCommitPushed) Text(stringResource(R.string.upd_newer_commit_short), fontSize = 12.sp, color = AttentionAmber, maxLines = 1, overflow = TextOverflow.Ellipsis) } RadioDot(selected, 20.dp) } } +private fun buildDetails(me: AppUpdates.Installed, label: String): String = buildString { + append("DroidDeck ").append(me.version).append(" (versionCode ").append(me.versionCode).append(")\n") + append(label) + if (me.pr > 0) append("\nPR #").append(me.pr).append(" https://github.com/Droid-Deck/DroidDeck/pull/").append(me.pr) + if (me.commit.length >= 7) append("\nCommit ").append(me.commit) +} + @Composable private fun channelName(f: Follow) = when (f.channel) { Channel.STABLE -> stringResource(R.string.upd_stable) diff --git a/app/src/main/java/com/droiddeck/launcher/update/AppUpdates.kt b/app/src/main/java/com/droiddeck/launcher/update/AppUpdates.kt index 51b5fc3d32..3540448b64 100644 --- a/app/src/main/java/com/droiddeck/launcher/update/AppUpdates.kt +++ b/app/src/main/java/com/droiddeck/launcher/update/AppUpdates.kt @@ -18,7 +18,7 @@ object AppUpdates { private const val TAG = "AppUpdates" private const val REPO = "Droid-Deck/DroidDeck" private const val CI_REPO = "Droid-Deck/DroidDeck-CI" - private const val CATALOG_URL = "https://raw.githubusercontent.com/$CI_REPO/main/catalog.json" + private val CATALOG_URL = "https://raw.githubusercontent.com/$CI_REPO/${BuildConfig.UPDATE_CATALOG_BRANCH}/catalog.json" private const val PREFS = "app_updates" private const val KEY_CATALOG = "catalog" private const val KEY_CHANNEL = "channel" @@ -49,7 +49,21 @@ object AppUpdates { val publishedAt: Long, val url: String, val apk: Apk?, - ) + val author: String = "", + val committedAt: Long = 0L, + /** The PR a Preview build merged, 0 for a direct push. Test builds use [pr]. */ + val mergedPr: Int = 0, + /** The PR's newest commit when the catalog was made; differs from [commit] while a rebuild is pending. */ + val headCommit: String = "", + /** When the APK itself was uploaded; release-note edits leave it unchanged. */ + val builtAt: Long = 0L, + ) { + val linkedPr: Int get() = if (pr > 0) pr else mergedPr + val shortCommit: String get() = commit.take(7) + val newerCommitPushed: Boolean get() = + headCommit.length >= 7 && !headCommit.startsWith(commit, ignoreCase = true) && + !commit.startsWith(headCommit, ignoreCase = true) + } class PreviewChange( val commit: String, @@ -64,7 +78,11 @@ object AppUpdates { val tests: List, val checkedAt: Long, val recentPreviews: List = emptyList(), - ) + val previews: List = emptyList(), + ) { + /** Every published Preview build, newest commit first; older catalogs only name the newest. */ + val previewBuilds: List get() = previews.ifEmpty { listOfNotNull(preview) } + } class Installed( val commit: String, @@ -88,6 +106,8 @@ object AppUpdates { val kind: PreviewHistoryKind, val buildsBehind: Int, val changes: List, + val builds: List = emptyList(), + val installedIndex: Int = -1, ) enum class Offer { @@ -149,7 +169,13 @@ object AppUpdates { compareVersions(r.version ?: "", me.version) > 0 -> Offer.UPDATE else -> Offer.AHEAD } - Channel.NIGHTLY -> if (me.pr != 0) Offer.SWITCH else Offer.UPDATE + Channel.NIGHTLY -> when { + me.pr != 0 -> Offer.SWITCH + previewIndex(catalog, me) > 0 -> Offer.UPDATE + previewIndex(catalog, me) < 0 && me.committedAt > 0 && r.committedAt > 0 && + me.committedAt > r.committedAt -> Offer.AHEAD + else -> Offer.UPDATE + } Channel.TEST -> if (me.pr == r.pr) Offer.UPDATE else Offer.SWITCH } } @@ -162,12 +188,39 @@ object AppUpdates { } fun isRunning(r: Release, me: Installed = installed()): Boolean { - if (me.commit.length < 7 || r.commit.length < 7 || r.pr != me.pr) return false + if (me.commit.length < 7 || r.commit.length < 7 || r.pr != me.pr || r.versionCode > me.versionCode) return false return me.commit.startsWith(r.commit, ignoreCase = true) || r.commit.startsWith(me.commit, ignoreCase = true) } + /** Where the installed build sits in [Catalog.previewBuilds], or -1 when it is not one of them. */ + fun previewIndex(catalog: Catalog, me: Installed = installed()): Int { + if (me.pr != 0) return -1 + val builds = catalog.previewBuilds + val matching = builds.indices.filter { matchesInstalledCommit(builds[it].commit, me.commit) } + return matching.singleOrNull() ?: -1 + } + + /** How many Preview builds landed on main after this test build was made. */ + fun previewsSince(catalog: Catalog, test: Release): Int = + catalog.previews.count { + (it.committedAt.takeIf { at -> at > 0 } ?: it.publishedAt) > (test.builtAt.takeIf { at -> at > 0 } ?: test.publishedAt) + } + + fun installable(r: Release, me: Installed = installed()): Boolean = + me.updatable && installBlock(r, me) == null && !isRunning(r, me) + fun previewHistory(catalog: Catalog, me: Installed = installed()): PreviewHistory? { + if (catalog.previews.isNotEmpty()) { + val builds = catalog.previews + val index = previewIndex(catalog, me) + val kind = when { + index == 0 -> PreviewHistoryKind.CURRENT + index > 0 -> PreviewHistoryKind.BEHIND + else -> PreviewHistoryKind.RECENT + } + return PreviewHistory(kind, maxOf(index, 0), emptyList(), builds, index) + } if (!me.ciBuild || catalog.recentPreviews.isEmpty()) return null val stable = catalog.stable if ( @@ -225,7 +278,8 @@ object AppUpdates { if (stable != null && isRunning(stable, me)) return Guess(Follow(Channel.STABLE), true) val publishedPreview = catalog != null && me.updatable && ( catalog.preview?.let { isRunning(it, me) } == true || - catalog.recentPreviews.any { matchesInstalledCommit(it.commit, me.commit) } + catalog.recentPreviews.any { matchesInstalledCommit(it.commit, me.commit) } || + catalog.previewBuilds.any { matchesInstalledCommit(it.commit, me.commit) } ) if (stable?.version?.let { compareVersions(me.version, it) < 0 } == true) return Guess(Follow(Channel.STABLE), !publishedPreview) return Guess(Follow(if (publishedPreview) Channel.NIGHTLY else Channel.STABLE), false) @@ -237,7 +291,7 @@ object AppUpdates { prefs(context).edit().putString(KEY_CHANNEL, value).apply() } - private fun stored(context: Context): Follow? { + fun stored(context: Context): Follow? { val v = prefs(context).getString(KEY_CHANNEL, null) ?: return null return when { v == "stable" -> Follow(Channel.STABLE) @@ -281,6 +335,7 @@ object AppUpdates { } val tests = root.optJSONArray("tests") ?: JSONArray() val recentPreviews = root.optJSONArray("recentPreviews") ?: JSONArray() + val previews = root.optJSONArray("previews") ?: JSONArray() return Catalog( root.optJSONObject("stable")?.let { readPublishedRelease(it, packageName) }, root.optJSONObject("preview")?.let { readPublishedRelease(it, packageName) }, @@ -294,6 +349,10 @@ object AppUpdates { .sortedByDescending { it.publishedAt } .distinctBy { it.commit.lowercase() } .take(10), + (0 until previews.length()) + .map { readPublishedRelease(previews.getJSONObject(it), packageName) } + .filter { it.pr == 0 } + .distinctBy { it.commit.lowercase() }, ) } @@ -327,6 +386,11 @@ object AppUpdates { o.optLong("publishedAt"), o.optString("url"), apk, + o.optString("author").takeIf { Regex("^[A-Za-z0-9-]{1,39}(\\[bot\\])?$").matches(it) }.orEmpty(), + o.optLong("committedAt"), + o.optInt("mergedPr").coerceAtLeast(0), + o.optString("headCommit").takeIf { Regex("^[0-9a-fA-F]{7,40}$").matches(it) }.orEmpty(), + o.optLong("builtAt"), ) } @@ -425,6 +489,11 @@ object AppUpdates { .put("publishedAt", r.publishedAt) .put("url", r.url) .put("apk", r.apk?.let(::writeApk)) + .put("author", r.author) + .put("committedAt", r.committedAt) + .put("mergedPr", r.mergedPr) + .put("headCommit", r.headCommit) + .put("builtAt", r.builtAt) private fun readCachedRelease(o: JSONObject): Release = Release( o.getString("tag"), @@ -447,6 +516,11 @@ object AppUpdates { it.getString("signerSha256"), ) }, + o.optString("author"), + o.optLong("committedAt"), + o.optInt("mergedPr"), + o.optString("headCommit"), + o.optLong("builtAt"), ) internal fun writeCatalog(c: Catalog): JSONObject = JSONObject() @@ -454,6 +528,7 @@ object AppUpdates { .put("preview", c.preview?.let(::writeRelease)) .put("tests", JSONArray().apply { c.tests.forEach { put(writeRelease(it)) } }) .put("recentPreviews", JSONArray().apply { c.recentPreviews.forEach { put(writePreviewChange(it)) } }) + .put("previews", JSONArray().apply { c.previews.forEach { put(writeRelease(it)) } }) .put("checkedAt", c.checkedAt) private fun writePreviewChange(c: PreviewChange): JSONObject = JSONObject() @@ -466,6 +541,7 @@ object AppUpdates { val tests = o.optJSONArray("tests") ?: JSONArray() val preview = o.optJSONObject("preview") ?: o.optJSONObject("nightly") val recentPreviews = o.optJSONArray("recentPreviews") ?: JSONArray() + val previews = o.optJSONArray("previews") ?: JSONArray() return Catalog( o.optJSONObject("stable")?.let(::readCachedRelease), preview?.let(::readCachedRelease), @@ -476,6 +552,7 @@ object AppUpdates { .sortedByDescending { it.publishedAt } .distinctBy { it.commit.lowercase() } .take(10), + (0 until previews.length()).map { readCachedRelease(previews.getJSONObject(it)) }, ) } diff --git a/app/src/main/java/com/droiddeck/launcher/update/UpdateWatch.kt b/app/src/main/java/com/droiddeck/launcher/update/UpdateWatch.kt new file mode 100644 index 0000000000..4c85c6a5d2 --- /dev/null +++ b/app/src/main/java/com/droiddeck/launcher/update/UpdateWatch.kt @@ -0,0 +1,102 @@ +package com.droiddeck.launcher.update + +import android.app.Notification +import android.app.NotificationChannel +import android.app.NotificationManager +import android.app.PendingIntent +import android.app.job.JobInfo +import android.app.job.JobParameters +import android.app.job.JobScheduler +import android.app.job.JobService +import android.content.ComponentName +import android.content.Context +import android.content.Intent +import com.droiddeck.launcher.FrontEndActivity +import com.droiddeck.launcher.R +import com.droiddeck.launcher.stores.download.StoreDownloadService + +/** Checks the catalog in the background while a PR test build is followed, and says when that PR has a new build. */ +class UpdateWatch : JobService() { + override fun onStartJob(params: JobParameters): Boolean { + Thread({ + runCatching { check(applicationContext) } + jobFinished(params, false) + }, "update-watch").start() + return true + } + + override fun onStopJob(params: JobParameters): Boolean = true + + companion object { + private const val JOB_ID = 41_230 + private const val NOTIFICATION_ID = 41_231 + private const val CHANNEL_ID = "test-builds" + private const val PREFS = "app_updates" + private const val KEY_SEEN = "watch_seen" + private const val INTERVAL_MS = 60 * 60 * 1000L + + fun sync(context: Context, follow: AppUpdates.Follow, current: AppUpdates.Release? = null) { + val scheduler = context.getSystemService(JobScheduler::class.java) ?: return + if (follow.channel != AppUpdates.Channel.TEST) { + scheduler.cancel(JOB_ID) + return + } + current?.let { seen(context, it) } + if (scheduler.getPendingJob(JOB_ID) != null) return + val job = JobInfo.Builder(JOB_ID, ComponentName(context, UpdateWatch::class.java)) + .setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY) + .setPeriodic(INTERVAL_MS) + .build() + runCatching { scheduler.schedule(job) } + } + + fun seen(context: Context, release: AppUpdates.Release) { + prefs(context).edit().putString(KEY_SEEN, key(release)).apply() + } + + private fun key(r: AppUpdates.Release) = "${r.pr}:${r.commit}:${r.versionCode}:${r.apk?.sha256.orEmpty()}" + + + internal fun check(context: Context) { + val catalog = AppUpdates.refresh(context) + val follow = AppUpdates.follow(context, catalog) + if (follow.channel != AppUpdates.Channel.TEST) return + val release = AppUpdates.release(catalog, follow) ?: return + if (prefs(context).getString(KEY_SEEN, null) == key(release)) return + val me = AppUpdates.installed() + val offer = AppUpdates.offer(catalog, follow, me) + if (!me.updatable || AppUpdates.installBlock(release, me) != null || + (offer != AppUpdates.Offer.UPDATE && offer != AppUpdates.Offer.SWITCH) + ) return + if (post(context, release)) seen(context, release) + } + + private fun post(context: Context, release: AppUpdates.Release): Boolean { + val manager = context.getSystemService(NotificationManager::class.java) ?: return false + manager.createNotificationChannel( + NotificationChannel(CHANNEL_ID, context.getString(R.string.upd_watch_channel), NotificationManager.IMPORTANCE_DEFAULT), + ) + if (!manager.areNotificationsEnabled() || + manager.getNotificationChannel(CHANNEL_ID)?.importance == NotificationManager.IMPORTANCE_NONE + ) return false + val open = PendingIntent.getActivity( + context, NOTIFICATION_ID, + Intent(context, FrontEndActivity::class.java).putExtra(StoreDownloadService.EXTRA_NAV, "updates") + .addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_REORDER_TO_FRONT), + PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT, + ) + val text = context.getString(R.string.upd_watch_text, release.title.ifBlank { release.commit.take(7) }) + val notification = Notification.Builder(context, CHANNEL_ID) + .setSmallIcon(R.drawable.ic_stat_session) + .setContentTitle(context.getString(R.string.upd_watch_title, release.pr)) + .setContentText(text) + .setStyle(Notification.BigTextStyle().bigText(text)) + .setContentIntent(open) + .setAutoCancel(true) + .build() + return runCatching { manager.notify(NOTIFICATION_ID, notification) }.isSuccess + } + + private fun prefs(context: Context) = context.getSharedPreferences(PREFS, Context.MODE_PRIVATE) + } +} diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index 7e7535eabb..f288b97098 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -1080,6 +1080,29 @@ المعاينة أحدث الإصلاحات، قبل الإصدار المستقر محدَّث + نسخ تفاصيل الإصدار + تم نسخ تفاصيل الإصدار + أحدث من المعاينة + إصدارك أحدث من المعاينة + هذا الإصدار أحدث من آخر إصدار معاينة. سيحدّثه إصدار المعاينة التالي. + اختر إصدارًا لرؤية تغييراته أو تثبيته. + مثبّت + تثبيت هذا الإصدار%1$s + الرجوع إلى هذا الإصدار%1$s + versionCode %1$d + الالتزام %1$s + صفحة الإصدار + في طلب الدمج التزام أحدث (%1$s). إصدار الاختبار الخاص به ليس جاهزًا بعد، لذا لا يتضمنه هذا الإصدار. + تم دفع التزام أحدث، الإصدار قيد الانتظار + رقم PR أو العنوان أو المؤلف + لا يوجد إصدار اختبار مطابق + يحتاج إلى إعادة بناء (versionCode %1$d) + تحديثات إصدارات الاختبار + إصدار اختبار جديد لـ PR #%1$d + %1$s. افتح التحديثات لتثبيته. + عرض المزيد (%1$d) + تحتاج إلى إعادة بناء لـ versionCode %2$d (%1$d) + إصدارات المعاينة على main منذ إصدار الاختبار هذا: %1$d إصدارات الاختبار جرّب إصلاحًا قبل إصداره رسميًا لا شيء حاليًا diff --git a/app/src/main/res/values-b+es+419/strings.xml b/app/src/main/res/values-b+es+419/strings.xml index 02a7a970e0..3d2a2ed8fa 100644 --- a/app/src/main/res/values-b+es+419/strings.xml +++ b/app/src/main/res/values-b+es+419/strings.xml @@ -1098,6 +1098,29 @@ Vista previa Las correcciones más recientes, antes que Estable Al día + Copiar detalles de la versión + Detalles de la versión copiados + Más nueva que Vista previa + Vas por delante de Vista previa + Esta versión es más nueva que la última Vista previa. La próxima versión de Vista previa la actualizará. + Elige una versión para ver sus cambios o instalarla. + Instalada + Instalar esta versión%1$s + Volver a esta versión%1$s + versionCode %1$d + Commit %1$s + Página de la versión + El PR tiene un commit más nuevo (%1$s). Su versión de prueba aún no está lista, así que esta no lo incluye. + Hay un commit más nuevo, versión pendiente + Número de PR, título o autor + Ninguna versión de prueba coincide + Necesita recompilarse (versionCode %1$d) + Actualizaciones de versiones de prueba + Nueva versión de prueba del PR #%1$d + %1$s. Abre Actualizaciones para instalarla. + Mostrar más (%1$d) + Necesitan recompilarse para versionCode %2$d (%1$d) + Versiones de Vista previa en main desde esta versión de prueba: %1$d Versiones de prueba Prueba una corrección antes de su publicación Ninguna por ahora diff --git a/app/src/main/res/values-bg/strings.xml b/app/src/main/res/values-bg/strings.xml index c3b6277b4e..089077750e 100644 --- a/app/src/main/res/values-bg/strings.xml +++ b/app/src/main/res/values-bg/strings.xml @@ -1068,6 +1068,29 @@ Preview Най-новите поправки, преди Stable Актуално + Копиране на данните за версията + Данните за версията са копирани + Пред Preview + Изпреварвате Preview + Тази версия е по-нова от последната Preview. Следващата Preview версия ще я обнови. + Изберете версия, за да видите промените или да я инсталирате. + Инсталирана + Инсталиране на тази версия%1$s + Връщане към тази версия%1$s + versionCode %1$d + Къмит %1$s + Страница на версията + PR има по-нов къмит (%1$s). Тестовата му версия още не е готова, затова тази не го включва. + Има по-нов къмит, версията предстои + Номер на PR, заглавие или автор + Няма съвпадащи тестови версии + Нужно е ново изграждане (versionCode %1$d) + Обновления на тестови версии + Нова тестова версия на PR #%1$d + %1$s. Отворете Обновления, за да я инсталирате. + Още (%1$d) + Нужно е ново изграждане за versionCode %2$d (%1$d) + Preview версии в main след тази тестова версия: %1$d Тестови версии Изпробвайте поправка, преди да бъде издадена Няма в момента diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 0e14f29976..241b3903e0 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -1074,6 +1074,29 @@ Preview Nejnovější opravy, dříve než ve Stable Aktuální + Kopírovat údaje o sestavě + Údaje o sestavě zkopírovány + Novější než Preview + Jste napřed před Preview + Tato sestava je novější než poslední Preview. Další sestava Preview ji aktualizuje. + Vyberte sestavu a zobrazte její změny nebo ji nainstalujte. + Nainstalováno + Nainstalovat tuto sestavu%1$s + Vrátit se k této sestavě%1$s + versionCode %1$d + Commit %1$s + Stránka vydání + PR má novější commit (%1$s). Jeho testovací sestava ještě není hotová, takže tato ho neobsahuje. + Nový commit odeslán, sestava čeká + Číslo PR, název nebo autor + Žádná testovací sestava neodpovídá + Nutné znovu sestavit (versionCode %1$d) + Aktualizace testovacích sestav + Nová testovací sestava PR #%1$d + %1$s. Nainstalujete ji v Aktualizacích. + Zobrazit další (%1$d) + Nutné znovu sestavit pro versionCode %2$d (%1$d) + Sestavy Preview v main od této testovací sestavy: %1$d Testovací sestavy Vyzkoušejte opravu před jejím vydáním Momentálně žádné diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index 77e5d84cbe..57cbc9f72d 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -1068,6 +1068,29 @@ Preview Nyeste rettelser, før Stable Opdateret + Kopiér builddetaljer + Builddetaljer kopieret + Foran Preview + Du er foran Preview + Dette build er nyere end det seneste Preview. Det næste Preview-build opdaterer det. + Vælg et build for at se ændringerne eller installere det. + Installeret + Installér dette build%1$s + Gå tilbage til dette build%1$s + versionCode %1$d + Commit %1$s + Udgivelsesside + PR\'en har et nyere commit (%1$s). Dens testbuild er ikke klar endnu, så dette indeholder det ikke. + Nyere commit sendt, build afventer + PR-nummer, titel eller forfatter + Intet testbuild passer + Skal bygges igen (versionCode %1$d) + Opdateringer af testbuilds + Nyt testbuild til PR #%1$d + %1$s. Åbn Opdateringer for at installere det. + Vis flere (%1$d) + Skal bygges igen til versionCode %2$d (%1$d) + Preview-builds på main siden dette testbuild: %1$d Testbuilds Prøv en rettelse, før den udgives Ingen lige nu diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 29bfc02e8e..6d14e4b65f 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -1060,6 +1060,29 @@ Vorschau Neueste Fixes, vor Stabil Aktuell + Build-Details kopieren + Build-Details kopiert + Vor der Vorschau + Du bist der Vorschau voraus + Dieser Build ist neuer als die neueste Vorschau. Der nächste Vorschau-Build aktualisiert ihn. + Wähle einen Build, um seine Änderungen zu sehen oder ihn zu installieren. + Installiert + Diesen Build installieren%1$s + Zu diesem Build zurück%1$s + versionCode %1$d + Commit %1$s + Release-Seite + Der PR hat einen neueren Commit (%1$s). Sein Test-Build ist noch nicht fertig, daher fehlt er in diesem. + Neuerer Commit, Build ausstehend + PR-Nummer, Titel oder Autor + Kein Test-Build passt + Muss neu gebaut werden (versionCode %1$d) + Test-Build-Updates + Neuer Test-Build für PR #%1$d + %1$s. Öffne Updates, um ihn zu installieren. + Mehr anzeigen (%1$d) + Müssen für versionCode %2$d neu gebaut werden (%1$d) + Vorschau-Builds auf main seit diesem Test-Build: %1$d Test-Builds Einen Fix vor dem Release ausprobieren Derzeit keine diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index 56c2132676..9b27f1a637 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -1068,6 +1068,29 @@ Preview Νεότερες διορθώσεις, πριν το Stable Ενημερωμένο + Αντιγραφή στοιχείων build + Τα στοιχεία του build αντιγράφηκαν + Νεότερο από το Preview + Είστε μπροστά από το Preview + Αυτό το build είναι νεότερο από το τελευταίο Preview. Το επόμενο Preview build θα το ενημερώσει. + Επιλέξτε ένα build για να δείτε τις αλλαγές ή να το εγκαταστήσετε. + Εγκατεστημένο + Εγκατάσταση αυτού του build%1$s + Επιστροφή σε αυτό το build%1$s + versionCode %1$d + Commit %1$s + Σελίδα έκδοσης + Το PR έχει νεότερο commit (%1$s). Το δοκιμαστικό του build δεν είναι έτοιμο ακόμη, οπότε αυτό δεν το περιλαμβάνει. + Νεότερο commit, το build εκκρεμεί + Αριθμός PR, τίτλος ή συντάκτης + Κανένα δοκιμαστικό build δεν ταιριάζει + Χρειάζεται νέο build (versionCode %1$d) + Ενημερώσεις δοκιμαστικών builds + Νέο δοκιμαστικό build για το PR #%1$d + %1$s. Ανοίξτε τις Ενημερώσεις για εγκατάσταση. + Περισσότερα (%1$d) + Χρειάζονται νέο build για versionCode %2$d (%1$d) + Preview builds στο main μετά από αυτό το δοκιμαστικό build: %1$d Δοκιμαστικά builds Δοκιμάστε μια διόρθωση πριν κυκλοφορήσει Κανένα προς το παρόν diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 275cc3c2d1..06576af8fd 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -1071,6 +1071,29 @@ Vista previa Las correcciones más recientes, antes que Estable Al día + Copiar detalles de la versión + Detalles de la versión copiados + Más nueva que Vista previa + Vas por delante de Vista previa + Esta versión es más nueva que la última Vista previa. La próxima versión de Vista previa la actualizará. + Elige una versión para ver sus cambios o instalarla. + Instalada + Instalar esta versión%1$s + Volver a esta versión%1$s + versionCode %1$d + Commit %1$s + Página de la versión + El PR tiene un commit más nuevo (%1$s). Su versión de prueba aún no está lista, así que esta no lo incluye. + Hay un commit más nuevo, versión pendiente + Número de PR, título o autor + Ninguna versión de prueba coincide + Hay que recompilarla (versionCode %1$d) + Actualizaciones de versiones de prueba + Nueva versión de prueba del PR #%1$d + %1$s. Abre Actualizaciones para instalarla. + Mostrar más (%1$d) + Hay que recompilarlas para versionCode %2$d (%1$d) + Versiones de Vista previa en main desde esta versión de prueba: %1$d Versiones de prueba Prueba una corrección antes de su publicación Ninguna por ahora diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index df6a488e98..47243b27f1 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -1068,6 +1068,29 @@ Preview Uusimmat korjaukset, ennen Stablea Ajan tasalla + Kopioi buildin tiedot + Buildin tiedot kopioitu + Previewtä uudempi + Olet Previewtä edellä + Tämä build on uudempi kuin viimeisin Preview. Seuraava Preview-build päivittää sen. + Valitse build nähdäksesi sen muutokset tai asentaaksesi sen. + Asennettu + Asenna tämä build%1$s + Palaa tähän buildiin%1$s + versionCode %1$d + Commit %1$s + Julkaisusivu + PR:ssä on uudempi commit (%1$s). Sen testibuild ei ole vielä valmis, joten tämä ei sisällä sitä. + Uudempi commit, build odottaa + PR-numero, otsikko tai tekijä + Mikään testibuild ei vastaa + Rakennettava uudelleen (versionCode %1$d) + Testibuildien päivitykset + Uusi testibuild PR:lle #%1$d + %1$s. Asenna se Päivitykset-sivulta. + Näytä lisää (%1$d) + Rakennettava uudelleen versionCodelle %2$d (%1$d) + Preview-buildejä mainissa tämän testibuildin jälkeen: %1$d Testibuildit Kokeile korjausta ennen sen julkaisua Ei yhtään juuri nyt diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 8e422b5590..5942840c08 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -1071,6 +1071,29 @@ Preview Derniers correctifs avant Stable À jour + Copier les détails de la version + Détails de la version copiés + En avance sur Preview + Vous avez une longueur d\'avance sur Preview + Cette version est plus récente que la dernière Preview. La prochaine version Preview la mettra à jour. + Choisissez une version pour voir ses changements ou l\'installer. + Installée + Installer cette version%1$s + Revenir à cette version%1$s + versionCode %1$d + Commit %1$s + Page de la version + La PR a un commit plus récent (%1$s). Sa version de test n\'est pas encore prête, donc celle-ci ne l\'inclut pas. + Commit plus récent, version en attente + Numéro de PR, titre ou auteur + Aucune version de test ne correspond + À recompiler (versionCode %1$d) + Mises à jour des versions de test + Nouvelle version de test de la PR #%1$d + %1$s. Ouvrez Mises à jour pour l\'installer. + Afficher plus (%1$d) + À recompiler pour le versionCode %2$d (%1$d) + Versions Preview sur main depuis cette version de test : %1$d Versions de test Essayer un correctif avant sa publication officielle Aucun pour le moment diff --git a/app/src/main/res/values-hi/strings.xml b/app/src/main/res/values-hi/strings.xml index 1c294fdbeb..42b60b68d3 100644 --- a/app/src/main/res/values-hi/strings.xml +++ b/app/src/main/res/values-hi/strings.xml @@ -1068,6 +1068,29 @@ प्रीव्यू नवीनतम फ़िक्स, स्टेबल से पहले नवीनतम + बिल्ड विवरण कॉपी करें + बिल्ड विवरण कॉपी हो गया + प्रीव्यू से आगे + आप प्रीव्यू से आगे हैं + यह बिल्ड नवीनतम प्रीव्यू से नया है। अगला प्रीव्यू बिल्ड इसे अपडेट करेगा। + बदलाव देखने या इंस्टॉल करने के लिए कोई बिल्ड चुनें। + इंस्टॉल है + यह बिल्ड इंस्टॉल करें%1$s + इस बिल्ड पर वापस जाएं%1$s + versionCode %1$d + कमिट %1$s + रिलीज़ पेज + PR में नया कमिट (%1$s) है। उसका टेस्ट बिल्ड अभी तैयार नहीं है, इसलिए यह बिल्ड उसे शामिल नहीं करता। + नया कमिट आया, बिल्ड बाकी है + PR नंबर, शीर्षक या लेखक + कोई टेस्ट बिल्ड मेल नहीं खाता + फिर से बनाना होगा (versionCode %1$d) + टेस्ट बिल्ड अपडेट + PR #%1$d का नया टेस्ट बिल्ड + %1$s। इसे इंस्टॉल करने के लिए अपडेट खोलें। + और दिखाएं (%1$d) + versionCode %2$d के लिए फिर से बनाने होंगे (%1$d) + इस टेस्ट बिल्ड के बाद main पर प्रीव्यू बिल्ड: %1$d टेस्ट बिल्ड रिलीज़ होने से पहले किसी फ़िक्स को आज़माएं अभी कोई नहीं diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index f8f16f0eea..1831f4ffa6 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -1068,6 +1068,29 @@ Preview A legújabb javítások, a Stable előtt Naprakész + Build adatainak másolása + Build adatai kimásolva + Újabb a Previewnál + Előrébb jársz a Previewnál + Ez a build újabb a legutóbbi Previewnál. A következő Preview build frissíti. + Válassz egy buildet a változásai megtekintéséhez vagy telepítéséhez. + Telepítve + Build telepítése%1$s + Visszatérés ehhez a buildhez%1$s + versionCode %1$d + Commit %1$s + Kiadási oldal + A PR-nek újabb commitja van (%1$s). A teszt buildje még nem kész, ezért ez nem tartalmazza. + Újabb commit, a build készül + PR-szám, cím vagy szerző + Nincs egyező teszt build + Újra kell építeni (versionCode %1$d) + Teszt buildek frissítései + Új teszt build: PR #%1$d + %1$s. A telepítéshez nyisd meg a Frissítéseket. + Több (%1$d) + Újra kell építeni a %2$d versionCode-hoz (%1$d) + Preview buildek a mainen e teszt build óta: %1$d Teszt buildek Próbáljon ki egy javítást a kiadása előtt Jelenleg nincs diff --git a/app/src/main/res/values-in/strings.xml b/app/src/main/res/values-in/strings.xml index 5b5f5ee99d..983958bbfd 100644 --- a/app/src/main/res/values-in/strings.xml +++ b/app/src/main/res/values-in/strings.xml @@ -1065,6 +1065,29 @@ Preview Perbaikan terbaru, sebelum Stable Terbaru + Salin detail build + Detail build disalin + Lebih baru dari Preview + Anda lebih baru dari Preview + Build ini lebih baru dari Preview terbaru. Build Preview berikutnya akan memperbaruinya. + Pilih build untuk melihat perubahannya atau memasangnya. + Terpasang + Pasang build ini%1$s + Kembali ke build ini%1$s + versionCode %1$d + Commit %1$s + Halaman rilis + PR ini punya commit lebih baru (%1$s). Build pengujiannya belum siap, jadi build ini belum memuatnya. + Ada commit baru, build menunggu + Nomor PR, judul, atau penulis + Tidak ada build pengujian yang cocok + Perlu dibangun ulang (versionCode %1$d) + Pembaruan build pengujian + Build pengujian baru untuk PR #%1$d + %1$s. Buka Pembaruan untuk memasangnya. + Tampilkan lagi (%1$d) + Perlu dibangun ulang untuk versionCode %2$d (%1$d) + Build Preview di main sejak build pengujian ini: %1$d Build pengujian Coba perbaikan sebelum dirilis Tidak ada saat ini diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index a677a289b0..ffc9b59f63 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -1063,6 +1063,29 @@ Preview Le correzioni più recenti, prima di Stable Aggiornato + Copia i dettagli della build + Dettagli della build copiati + Più recente di Preview + Sei avanti rispetto a Preview + Questa build è più recente dell\'ultima Preview. La prossima build Preview la aggiornerà. + Scegli una build per vederne le modifiche o installarla. + Installata + Installa questa build%1$s + Torna a questa build%1$s + versionCode %1$d + Commit %1$s + Pagina della release + La PR ha un commit più recente (%1$s). La sua build di test non è ancora pronta, quindi questa non lo include. + Commit più recente, build in attesa + Numero PR, titolo o autore + Nessuna build di test corrisponde + Da ricompilare (versionCode %1$d) + Aggiornamenti build di test + Nuova build di test per la PR #%1$d + %1$s. Apri Aggiornamenti per installarla. + Mostra altre (%1$d) + Da ricompilare per versionCode %2$d (%1$d) + Build Preview su main dopo questa build di test: %1$d Build di test Prova una correzione prima che venga rilasciata Nessuna al momento diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 0ebe258634..7e292b3f77 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -1065,6 +1065,29 @@ プレビュー版 安定版より先に最新の修正 最新です + ビルド情報をコピー + ビルド情報をコピーしました + プレビュー版より新しい + プレビュー版より先行しています + このビルドは最新のプレビュー版より新しいです。次のプレビュー版で更新されます。 + ビルドを選ぶと変更内容の確認やインストールができます。 + インストール済み + このビルドをインストール%1$s + このビルドに戻す%1$s + versionCode %1$d + コミット %1$s + リリースページ + このPRには新しいコミット (%1$s) があります。そのテストビルドはまだ準備中のため、このビルドには含まれていません。 + 新しいコミットあり、ビルド待ち + PR番号、タイトル、作成者 + 一致するテストビルドはありません + 再ビルドが必要 (versionCode %1$d) + テストビルドの更新 + PR #%1$d の新しいテストビルド + %1$s。アップデートを開いてインストールしてください。 + さらに表示 (%1$d) + versionCode %2$d 向けに再ビルドが必要 (%1$d) + このテストビルド以降の main のプレビュー版ビルド: %1$d テストビルド 正式リリース前に特定の修正を試す 現在ありません diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index e0482bcee0..3ce35f034f 100644 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -1065,6 +1065,29 @@ 미리보기 안정판보다 먼저 받는 최신 수정 사항 최신 버전 + 빌드 정보 복사 + 빌드 정보를 복사했습니다 + 미리보기보다 최신 + 미리보기보다 앞서 있습니다 + 이 빌드는 최신 미리보기보다 새롭습니다. 다음 미리보기 빌드가 업데이트합니다. + 빌드를 선택해 변경 사항을 보거나 설치하세요. + 설치됨 + 이 빌드 설치%1$s + 이 빌드로 되돌리기%1$s + versionCode %1$d + 커밋 %1$s + 릴리스 페이지 + 이 PR에 더 새로운 커밋(%1$s)이 있습니다. 해당 테스트 빌드가 아직 준비되지 않아 이 빌드에는 포함되지 않았습니다. + 새 커밋 있음, 빌드 대기 중 + PR 번호, 제목 또는 작성자 + 일치하는 테스트 빌드가 없습니다 + 다시 빌드 필요 (versionCode %1$d) + 테스트 빌드 업데이트 + PR #%1$d 새 테스트 빌드 + %1$s. 업데이트를 열어 설치하세요. + 더 보기 (%1$d) + versionCode %2$d용으로 다시 빌드 필요 (%1$d) + 이 테스트 빌드 이후 main의 미리보기 빌드: %1$d 테스트 빌드 정식 출시 전에 특정 수정 사항을 시험해 보기 현재 없음 diff --git a/app/src/main/res/values-ms/strings.xml b/app/src/main/res/values-ms/strings.xml index 978ab19ffc..4f0cbd5362 100644 --- a/app/src/main/res/values-ms/strings.xml +++ b/app/src/main/res/values-ms/strings.xml @@ -1065,6 +1065,29 @@ Preview Pembetulan terbaharu, sebelum Stable Terkini + Salin butiran binaan + Butiran binaan disalin + Lebih baharu daripada Preview + Anda mendahului Preview + Binaan ini lebih baharu daripada Preview terkini. Binaan Preview seterusnya akan mengemas kininya. + Pilih binaan untuk melihat perubahannya atau memasangnya. + Dipasang + Pasang binaan ini%1$s + Kembali ke binaan ini%1$s + versionCode %1$d + Commit %1$s + Halaman keluaran + PR ini ada commit lebih baharu (%1$s). Binaan ujiannya belum siap, jadi binaan ini tidak memuatkannya. + Commit baharu ditolak, binaan menunggu + Nombor PR, tajuk atau pengarang + Tiada binaan ujian yang sepadan + Perlu dibina semula (versionCode %1$d) + Kemas kini binaan ujian + Binaan ujian baharu untuk PR #%1$d + %1$s. Buka Kemas kini untuk memasangnya. + Tunjuk lagi (%1$d) + Perlu dibina semula untuk versionCode %2$d (%1$d) + Binaan Preview di main sejak binaan ujian ini: %1$d Binaan ujian Cuba pembetulan sebelum dikeluarkan Tiada pada masa ini diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml index 4c9931ca33..21d08282a7 100644 --- a/app/src/main/res/values-nb/strings.xml +++ b/app/src/main/res/values-nb/strings.xml @@ -1068,6 +1068,29 @@ Preview Nyeste fikser, før Stable Oppdatert + Kopier byggdetaljer + Byggdetaljer kopiert + Foran Preview + Du er foran Preview + Dette bygget er nyere enn siste Preview. Neste Preview-bygg oppdaterer det. + Velg et bygg for å se endringene eller installere det. + Installert + Installer dette bygget%1$s + Gå tilbake til dette bygget%1$s + versionCode %1$d + Commit %1$s + Utgivelsesside + PR-en har en nyere commit (%1$s). Testbygget for den er ikke klart ennå, så dette inneholder den ikke. + Nyere commit, bygg venter + PR-nummer, tittel eller forfatter + Ingen testbygg passer + Må bygges på nytt (versionCode %1$d) + Oppdateringer for testbygg + Nytt testbygg for PR #%1$d + %1$s. Åpne Oppdateringer for å installere det. + Vis flere (%1$d) + Må bygges på nytt for versionCode %2$d (%1$d) + Preview-bygg på main siden dette testbygget: %1$d Testbuilder Prøv en fiks før den blir utgitt Ingen akkurat nå diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 68e7983d02..4b514189f2 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -1068,6 +1068,29 @@ Preview Nieuwste fixes, vóór Stabiel Up-to-date + Builddetails kopiëren + Builddetails gekopieerd + Voor op Preview + Je loopt voor op Preview + Deze build is nieuwer dan de nieuwste Preview. De volgende Preview-build werkt hem bij. + Kies een build om de wijzigingen te zien of hem te installeren. + Geïnstalleerd + Deze build installeren%1$s + Terug naar deze build%1$s + versionCode %1$d + Commit %1$s + Releasepagina + De PR heeft een nieuwere commit (%1$s). De testbuild daarvan is nog niet klaar, dus deze bevat hem niet. + Nieuwere commit, build volgt + PR-nummer, titel of auteur + Geen testbuild gevonden + Moet opnieuw gebouwd (versionCode %1$d) + Updates van testbuilds + Nieuwe testbuild voor PR #%1$d + %1$s. Open Updates om hem te installeren. + Meer tonen (%1$d) + Moeten opnieuw gebouwd voor versionCode %2$d (%1$d) + Preview-builds op main sinds deze testbuild: %1$d Testbuilds Probeer een fix voordat die wordt uitgebracht Momenteel geen diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 1a7f2e4f87..5c0f3ec1b0 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -1074,6 +1074,29 @@ Preview Najnowsze poprawki, zanim trafią do Stable Aktualne + Kopiuj szczegóły kompilacji + Skopiowano szczegóły kompilacji + Nowsza niż Preview + Wyprzedzasz Preview + Ta kompilacja jest nowsza niż najnowsza Preview. Zaktualizuje ją następna kompilacja Preview. + Wybierz kompilację, aby zobaczyć zmiany lub ją zainstalować. + Zainstalowana + Zainstaluj tę kompilację%1$s + Wróć do tej kompilacji%1$s + versionCode %1$d + Commit %1$s + Strona wydania + PR ma nowszy commit (%1$s). Jego kompilacja testowa nie jest jeszcze gotowa, więc ta go nie zawiera. + Nowszy commit, kompilacja w toku + Numer PR, tytuł lub autor + Brak pasujących kompilacji testowych + Wymaga ponownej kompilacji (versionCode %1$d) + Aktualizacje kompilacji testowych + Nowa kompilacja testowa PR #%1$d + %1$s. Otwórz Aktualizacje, aby ją zainstalować. + Pokaż więcej (%1$d) + Wymagają ponownej kompilacji dla versionCode %2$d (%1$d) + Kompilacje Preview na main od tej kompilacji testowej: %1$d Kompilacje testowe Wypróbuj poprawkę przed jej wydaniem Obecnie żadnych diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml index 8ed6c78568..ef63016613 100644 --- a/app/src/main/res/values-pt-rPT/strings.xml +++ b/app/src/main/res/values-pt-rPT/strings.xml @@ -1063,6 +1063,29 @@ Antevisão As correções mais recentes, antes do Estável Atualizado + Copiar detalhes da versão + Detalhes da versão copiados + À frente da Antevisão + Está à frente da Antevisão + Esta versão é mais recente do que a última Antevisão. A próxima versão de Antevisão vai atualizá-la. + Escolha uma versão para ver as alterações ou instalá-la. + Instalada + Instalar esta versão%1$s + Voltar a esta versão%1$s + versionCode %1$d + Commit %1$s + Página da versão + O PR tem um commit mais recente (%1$s). A versão de teste dele ainda não está pronta, por isso esta não o inclui. + Commit mais recente, versão pendente + Número do PR, título ou autor + Nenhuma versão de teste corresponde + Precisa de ser recompilada (versionCode %1$d) + Atualizações de versões de teste + Nova versão de teste do PR #%1$d + %1$s. Abra Atualizações para a instalar. + Mostrar mais (%1$d) + Precisam de ser recompiladas para o versionCode %2$d (%1$d) + Versões de Antevisão no main desde esta versão de teste: %1$d Versões de teste Experimente uma correção antes de ser lançada Nenhuma de momento diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index d6623028fb..b559645180 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -1063,6 +1063,29 @@ Prévia As correções mais recentes, antes da Estável Atualizado + Copiar detalhes da versão + Detalhes da versão copiados + À frente da Prévia + Você está à frente da Prévia + Esta versão é mais nova que a última Prévia. A próxima versão da Prévia vai atualizá-la. + Escolha uma versão para ver as mudanças ou instalá-la. + Instalada + Instalar esta versão%1$s + Voltar para esta versão%1$s + versionCode %1$d + Commit %1$s + Página da versão + O PR tem um commit mais novo (%1$s). A versão de teste dele ainda não está pronta, então esta não o inclui. + Commit mais novo, versão pendente + Número do PR, título ou autor + Nenhuma versão de teste corresponde + Precisa ser recompilada (versionCode %1$d) + Atualizações de versões de teste + Nova versão de teste do PR #%1$d + %1$s. Abra Atualizações para instalá-la. + Mostrar mais (%1$d) + Precisam ser recompiladas para o versionCode %2$d (%1$d) + Versões da Prévia no main desde esta versão de teste: %1$d Versões de teste Experimente uma correção antes do lançamento Nenhuma no momento diff --git a/app/src/main/res/values-ro/strings.xml b/app/src/main/res/values-ro/strings.xml index 4788d92384..fb1390fd11 100644 --- a/app/src/main/res/values-ro/strings.xml +++ b/app/src/main/res/values-ro/strings.xml @@ -1071,6 +1071,29 @@ Preview Cele mai noi remedieri, înainte de Stabilă Actualizat + Copiază detaliile versiunii + Detaliile versiunii au fost copiate + Înaintea Preview + Ești înaintea Preview + Această versiune este mai nouă decât ultima Preview. Următoarea versiune Preview o va actualiza. + Alege o versiune pentru a-i vedea modificările sau a o instala. + Instalată + Instalează această versiune%1$s + Revino la această versiune%1$s + versionCode %1$d + Commit %1$s + Pagina versiunii + PR-ul are un commit mai nou (%1$s). Versiunea lui de test nu e gata încă, așa că aceasta nu îl include. + Commit mai nou, versiune în așteptare + Număr PR, titlu sau autor + Nicio versiune de test nu se potrivește + Trebuie recompilată (versionCode %1$d) + Actualizări pentru versiunile de test + Versiune de test nouă pentru PR #%1$d + %1$s. Deschide Actualizări pentru a o instala. + Arată mai multe (%1$d) + Trebuie recompilate pentru versionCode %2$d (%1$d) + Versiuni Preview pe main de la această versiune de test: %1$d Versiuni de test Încearcă o remediere înainte de lansare Niciuna acum diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 007c897ef5..4499bc9d88 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -1074,6 +1074,29 @@ Preview Последние исправления перед Stable Актуально + Скопировать сведения о сборке + Сведения о сборке скопированы + Новее Preview + Вы опережаете Preview + Эта сборка новее последней Preview. Её обновит следующая сборка Preview. + Выберите сборку, чтобы увидеть изменения или установить её. + Установлена + Установить эту сборку%1$s + Вернуться к этой сборке%1$s + versionCode %1$d + Коммит %1$s + Страница релиза + В PR есть более новый коммит (%1$s). Его тестовая сборка ещё не готова, поэтому в этой его нет. + Есть новый коммит, сборка ожидается + Номер PR, название или автор + Подходящих тестовых сборок нет + Нужна пересборка (versionCode %1$d) + Обновления тестовых сборок + Новая тестовая сборка PR #%1$d + %1$s. Откройте Обновления, чтобы установить её. + Показать ещё (%1$d) + Нужна пересборка для versionCode %2$d (%1$d) + Сборок Preview в main после этой тестовой сборки: %1$d Тестовые сборки Попробовать исправление до официального выпуска Сейчас нет diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 4b9d2ad460..05705053ca 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -1068,6 +1068,29 @@ Förhandsversion De senaste fixarna, före Stabil Senaste versionen + Kopiera bygguppgifter + Bygguppgifter kopierade + Före Förhandsversion + Du ligger före Förhandsversion + Det här bygget är nyare än den senaste förhandsversionen. Nästa förhandsbygge uppdaterar det. + Välj ett bygge för att se ändringarna eller installera det. + Installerat + Installera det här bygget%1$s + Gå tillbaka till det här bygget%1$s + versionCode %1$d + Commit %1$s + Versionssida + PR:en har en nyare commit (%1$s). Dess testbygge är inte klart än, så det här innehåller den inte. + Nyare commit, bygge väntar + PR-nummer, titel eller författare + Inget testbygge matchar + Måste byggas om (versionCode %1$d) + Uppdateringar av testbyggen + Nytt testbygge för PR #%1$d + %1$s. Öppna Uppdateringar för att installera det. + Visa fler (%1$d) + Måste byggas om för versionCode %2$d (%1$d) + Förhandsbyggen på main sedan det här testbygget: %1$d Testbyggen Prova en fix innan den släpps Inga just nu diff --git a/app/src/main/res/values-th/strings.xml b/app/src/main/res/values-th/strings.xml index 5e8be9a4d8..25399225fc 100644 --- a/app/src/main/res/values-th/strings.xml +++ b/app/src/main/res/values-th/strings.xml @@ -1065,6 +1065,29 @@ Preview การแก้ไขล่าสุด ก่อนถึง Stable เป็นรุ่นล่าสุดแล้ว + คัดลอกรายละเอียดบิลด์ + คัดลอกรายละเอียดบิลด์แล้ว + ใหม่กว่า Preview + คุณนำหน้า Preview + บิลด์นี้ใหม่กว่า Preview ล่าสุด บิลด์ Preview ถัดไปจะอัปเดตให้ + เลือกบิลด์เพื่อดูการเปลี่ยนแปลงหรือติดตั้ง + ติดตั้งแล้ว + ติดตั้งบิลด์นี้%1$s + ย้อนกลับไปบิลด์นี้%1$s + versionCode %1$d + คอมมิต %1$s + หน้ารีลีส + PR นี้มีคอมมิตใหม่กว่า (%1$s) บิลด์ทดสอบของคอมมิตนั้นยังไม่พร้อม บิลด์นี้จึงยังไม่มีคอมมิตนั้น + มีคอมมิตใหม่ รอบิลด์ + หมายเลข PR ชื่อ หรือผู้เขียน + ไม่มีบิลด์ทดสอบที่ตรงกัน + ต้องบิลด์ใหม่ (versionCode %1$d) + อัปเดตบิลด์ทดสอบ + บิลด์ทดสอบใหม่ของ PR #%1$d + %1$s เปิดอัปเดตเพื่อติดตั้ง + แสดงเพิ่ม (%1$d) + ต้องบิลด์ใหม่สำหรับ versionCode %2$d (%1$d) + บิลด์ Preview บน main หลังบิลด์ทดสอบนี้: %1$d บิลด์ทดสอบ ลองการแก้ไขก่อนเผยแพร่จริง ไม่มีในขณะนี้ diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 93bbe73c58..4deeaafe3d 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -1060,6 +1060,29 @@ Önizleme En yeni düzeltmeler, Kararlı\'dan önce Güncel + Derleme ayrıntılarını kopyala + Derleme ayrıntıları kopyalandı + Önizlemeden yeni + Önizlemenin önündesiniz + Bu derleme en son Önizlemeden daha yeni. Bir sonraki Önizleme derlemesi onu güncelleyecek. + Değişiklikleri görmek veya yüklemek için bir derleme seçin. + Yüklü + Bu derlemeyi yükle%1$s + Bu derlemeye geri dön%1$s + versionCode %1$d + Commit %1$s + Sürüm sayfası + PR\'de daha yeni bir commit var (%1$s). Test derlemesi henüz hazır değil, bu yüzden bu derleme onu içermiyor. + Yeni commit var, derleme bekleniyor + PR numarası, başlık veya yazar + Eşleşen test derlemesi yok + Yeniden derlenmeli (versionCode %1$d) + Test derlemesi güncellemeleri + PR #%1$d için yeni test derlemesi + %1$s. Yüklemek için Güncellemeler\'i açın. + Daha fazla göster (%1$d) + versionCode %2$d için yeniden derlenmeli (%1$d) + Bu test derlemesinden beri main üzerindeki Önizleme derlemeleri: %1$d Test derlemeleri Yayınlanmadan önce bir düzeltmeyi deneyin Şu anda yok diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index 60cef3ca95..a459dc4444 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -1074,6 +1074,29 @@ Попередній Найновіші виправлення, до стабільного каналу Актуальна версія + Копіювати відомості про збірку + Відомості про збірку скопійовано + Новіша за Попередній + Ви випереджаєте Попередній канал + Ця збірка новіша за останню попередню. Її оновить наступна попередня збірка. + Виберіть збірку, щоб побачити зміни або встановити її. + Встановлено + Встановити цю збірку%1$s + Повернутися до цієї збірки%1$s + versionCode %1$d + Коміт %1$s + Сторінка релізу + У PR є новіший коміт (%1$s). Його тестова збірка ще не готова, тож у цій його немає. + Є новий коміт, збірка очікується + Номер PR, назва або автор + Немає відповідних тестових збірок + Потрібна перезбірка (versionCode %1$d) + Оновлення тестових збірок + Нова тестова збірка PR #%1$d + %1$s. Відкрийте Оновлення, щоб встановити її. + Показати ще (%1$d) + Потрібна перезбірка для versionCode %2$d (%1$d) + Попередніх збірок у main після цієї тестової збірки: %1$d Тестові збірки Спробуйте виправлення до його випуску Поки що немає diff --git a/app/src/main/res/values-vi/strings.xml b/app/src/main/res/values-vi/strings.xml index 90588d0191..c048cfd5ac 100644 --- a/app/src/main/res/values-vi/strings.xml +++ b/app/src/main/res/values-vi/strings.xml @@ -1065,6 +1065,29 @@ Preview Các bản sửa mới nhất, trước Stable Đã mới nhất + Sao chép chi tiết bản dựng + Đã sao chép chi tiết bản dựng + Mới hơn Preview + Bạn đang đi trước Preview + Bản dựng này mới hơn Preview mới nhất. Bản Preview tiếp theo sẽ cập nhật nó. + Chọn một bản dựng để xem thay đổi hoặc cài đặt. + Đã cài + Cài bản dựng này%1$s + Quay lại bản dựng này%1$s + versionCode %1$d + Commit %1$s + Trang phát hành + PR có commit mới hơn (%1$s). Bản thử nghiệm của nó chưa sẵn sàng nên bản này chưa có. + Có commit mới, đang chờ bản dựng + Số PR, tiêu đề hoặc tác giả + Không có bản thử nghiệm nào khớp + Cần dựng lại (versionCode %1$d) + Cập nhật bản thử nghiệm + Bản thử nghiệm mới của PR #%1$d + %1$s. Mở Cập nhật để cài đặt. + Xem thêm (%1$d) + Cần dựng lại cho versionCode %2$d (%1$d) + Bản Preview trên main kể từ bản thử nghiệm này: %1$d Bản thử nghiệm Thử một bản sửa trước khi nó được phát hành Hiện không có diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 45c3669b17..ec65c282eb 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -1148,6 +1148,29 @@ 预览版 最新修复,先于稳定版 已是最新 + 复制构建信息 + 已复制构建信息 + 比预览版新 + 你领先于预览版 + 此构建比最新的预览版更新。下一个预览版构建会更新它。 + 选择一个构建以查看其更改或安装。 + 已安装 + 安装此构建%1$s + 回退到此构建%1$s + versionCode %1$d + 提交 %1$s + 发布页面 + 此 PR 有更新的提交(%1$s)。它的测试构建尚未就绪,因此此构建不包含它。 + 已推送新提交,构建待生成 + PR 编号、标题或作者 + 没有匹配的测试构建 + 需要重新构建(versionCode %1$d) + 测试构建更新 + PR #%1$d 有新的测试构建 + %1$s。打开“更新”进行安装。 + 显示更多(%1$d) + 需要为 versionCode %2$d 重新构建(%1$d) + 此测试构建之后 main 上的预览版构建:%1$d 测试构建 在修复正式发布前先试用 当前没有 diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index fdcb636916..3b5883d3a3 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -1064,6 +1064,29 @@ 預覽版 最新修正,比穩定版更早推出 已是最新 + 複製版本資料 + 已複製版本資料 + 比預覽版新 + 你領先預覽版 + 此版本比最新的預覽版更新。下一個預覽版會更新它。 + 選擇一個版本以查看其變更或安裝。 + 已安裝 + 安裝此版本%1$s + 退回此版本%1$s + versionCode %1$d + 提交 %1$s + 發佈頁面 + 此 PR 有較新的提交(%1$s)。它的測試版本尚未準備好,因此此版本不包含它。 + 已推送新提交,版本待建立 + PR 編號、標題或作者 + 沒有相符的測試版本 + 需要重新建置(versionCode %1$d) + 測試版本更新 + PR #%1$d 有新的測試版本 + %1$s。開啟「更新」進行安裝。 + 顯示更多(%1$d) + 需要為 versionCode %2$d 重新建置(%1$d) + 此測試版本之後 main 上的預覽版:%1$d 測試版本 在正式發佈前試用修正 目前沒有 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index eca4bcbe72..7661d16baa 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -1064,6 +1064,29 @@ 預覽版 比穩定版更早取得的最新修正 已是最新 + 複製組建資訊 + 已複製組建資訊 + 比預覽版新 + 你領先預覽版 + 此組建比最新的預覽版更新。下一個預覽版組建會更新它。 + 選擇一個組建以查看其變更或安裝。 + 已安裝 + 安裝此組建%1$s + 退回此組建%1$s + versionCode %1$d + 提交 %1$s + 發行頁面 + 此 PR 有較新的提交(%1$s)。它的測試組建尚未就緒,因此此組建不包含它。 + 已推送新提交,組建待產生 + PR 編號、標題或作者 + 沒有相符的測試組建 + 需要重新組建(versionCode %1$d) + 測試組建更新 + PR #%1$d 有新的測試組建 + %1$s。開啟「更新」進行安裝。 + 顯示更多(%1$d) + 需要為 versionCode %2$d 重新組建(%1$d) + 此測試組建之後 main 上的預覽版組建:%1$d 測試組建版本 在正式發布前試用修正 目前沒有 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3b9c7c9c4c..2d6a82851b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1130,6 +1130,29 @@ Preview Newest fixes, before Stable Up to date + Copy build details + Build details copied + Ahead of Preview + You\'re ahead of Preview + This build is newer than the latest Preview. The next Preview build will update it. + Pick a build to see its changes or install it. + Installed + Install this build%1$s + Roll back to this build%1$s + versionCode %1$d + Commit %1$s + Release page + The PR has a newer commit (%1$s). Its test build isn\'t ready yet, so this one doesn\'t include it. + Newer commit pushed, build pending + PR number, title or author + No test build matches + Needs a rebuild (versionCode %1$d) + Test build updates + New PR #%1$d test build + Show more (%1$d) + Need a rebuild for versionCode %2$d (%1$d) + Preview builds on main since this test build: %1$d + %1$s. Open Updates to install it. Test builds Try a fix before it\'s released None right now diff --git a/app/src/test/java/com/droiddeck/launcher/update/AppUpdatesTest.kt b/app/src/test/java/com/droiddeck/launcher/update/AppUpdatesTest.kt index 1dad18e921..21fa491d30 100644 --- a/app/src/test/java/com/droiddeck/launcher/update/AppUpdatesTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/update/AppUpdatesTest.kt @@ -357,4 +357,80 @@ class AppUpdatesTest { assertEquals(AppUpdates.Channel.TEST, g.follow.channel) assertTrue(g.certain) } + + private fun preview(commit: String, committedAt: Long, versionCode: Int = 9) = AppUpdates.Release( + "main-${commit.take(7)}", commit, "", commit, 0, null, versionCode, committedAt, "", apk(versionCode), + committedAt = committedAt, + ) + + private val history = listOf( + preview("1".repeat(40), 300L), + preview("2".repeat(40), 200L), + preview("3".repeat(40), 100L, versionCode = 8), + ) + private val withHistory = AppUpdates.Catalog(stable, history.first(), emptyList(), 0L, previews = history) + + @Test + fun previewOffersOnlyNewerBuildsAsUpdates() { + val nightly = Follow(Channel.NIGHTLY) + assertEquals(Offer.CURRENT, AppUpdates.offer(withHistory, nightly, me("1".repeat(40)))) + assertEquals(Offer.UPDATE, AppUpdates.offer(withHistory, nightly, me("2222222"))) + val newer = Installed("4".repeat(40), 0, "0.2.0", 9, updatable = true, committedAt = 400L) + assertEquals(Offer.AHEAD, AppUpdates.offer(withHistory, nightly, newer)) + val older = Installed("5".repeat(40), 0, "0.2.0", 9, updatable = true, committedAt = 50L) + assertEquals(Offer.UPDATE, AppUpdates.offer(withHistory, nightly, older)) + } + + @Test + fun previewHistoryListsEveryBuildAndWhereTheInstalledOneSits() { + val behind = AppUpdates.previewHistory(withHistory, me("2".repeat(40), ciBuild = false))!! + assertEquals(PreviewHistoryKind.BEHIND, behind.kind) + assertEquals(1, behind.installedIndex) + assertEquals(3, behind.builds.size) + assertEquals(PreviewHistoryKind.RECENT, AppUpdates.previewHistory(withHistory, me("9".repeat(40)))!!.kind) + } + + @Test + fun anOlderVersionCodePreviewCannotBeInstalledButASameCodeRollbackCan() { + val mine = me("1".repeat(40)) + assertFalse(AppUpdates.installable(history[0], mine)) + assertTrue(AppUpdates.installable(history[1], mine)) + assertFalse(AppUpdates.installable(history[2], mine)) + } + + @Test + fun aTestBuildBehindItsPrHeadIsFlaggedAndCountsLaterPreviews() { + val test = AppUpdates.Release("pr-7", "t", "", "abcdef1", 7, null, 9, 150L, "", apk(), headCommit = "1234567890") + assertTrue(test.newerCommitPushed) + val current = AppUpdates.Release("pr-7", "t", "", "abcdef1", 7, null, 9, 150L, "", apk(), headCommit = "abcdef1234") + assertFalse(current.newerCommitPushed) + val rebuiltHigher = AppUpdates.Release("pr-7", "t", "", "abcdef1", 7, null, 10, 150L, "", apk(10)) + assertFalse(AppUpdates.isRunning(rebuiltHigher, me("abcdef1234", pr = 7))) + assertTrue(AppUpdates.isRunning(current, me("abcdef1234", pr = 7))) + assertEquals(2, AppUpdates.previewsSince(withHistory, test)) + val rebuilt = AppUpdates.Release("pr-7", "t", "", "abcdef1", 7, null, 9, 150L, "", apk(), builtAt = 250L) + assertEquals(1, AppUpdates.previewsSince(withHistory, rebuilt)) + } + + @Test + fun publishedCatalogReadsEveryPreviewWithItsAuthorAndKeepsThemInTheCache() { + val entry = JSONObject(publishedCatalog().getJSONObject("preview").toString()) + .put("author", "maxjivi05").put("committedAt", 5L).put("mergedPr", 2602) + val bad = JSONObject(entry.toString()).put("commit", "feedbee1234567").put("author", "not a login") + val raw = publishedCatalog().put("previews", JSONArray().put(entry).put(bad)) + val parsed = AppUpdates.readPublishedCatalog(raw, "com.droiddeck.launcher", 1L) + assertEquals(2, parsed.previews.size) + assertEquals("maxjivi05", parsed.previews[0].author) + assertEquals(2602, parsed.previews[0].linkedPr) + assertEquals("", parsed.previews[1].author) + val cached = AppUpdates.readCachedCatalog(AppUpdates.writeCatalog(parsed)) + assertEquals(2, cached.previews.size) + assertEquals(5L, cached.previews[0].committedAt) + } + + @Test + fun aCatalogWithoutTheFullListStillOffersItsNewestPreview() { + val parsed = AppUpdates.readPublishedCatalog(publishedCatalog(), "com.droiddeck.launcher", 1L) + assertEquals(listOf("main-deadbee"), parsed.previewBuilds.map { it.tag }) + } } diff --git a/tools/release/publish-ci.sh b/tools/release/publish-ci.sh index 987ef622dd..1b3a9ae477 100644 --- a/tools/release/publish-ci.sh +++ b/tools/release/publish-ci.sh @@ -17,8 +17,9 @@ $(cat signed/SHA256SUMS.txt) gh release delete "$tag" -R "$CI_REPO" --yes --cleanup-tag 2>/dev/null || true gh release create "$tag" -R "$CI_REPO" --target main --prerelease \ --title "main ${GITHUB_SHA::7}" --notes "$notes" signed/* -gh release list -R "$CI_REPO" -L 200 --json tagName,publishedAt \ - --jq '[.[] | select(.tagName | startswith("main-"))] | sort_by(.publishedAt) | reverse | .['"$KEEP"':][] | .tagName' | +cutoff=$(date -u -d "-${KEEP_DAYS} days" +%Y-%m-%dT%H:%M:%SZ) +gh release list -R "$CI_REPO" -L 1000 --exclude-drafts --json tagName,publishedAt \ + --jq '.[] | select((.tagName | startswith("main-")) and .publishedAt < "'"$cutoff"'") | .tagName' | while IFS= read -r old; do if [ "$old" = "$tag" ]; then continue diff --git a/tools/release/update_catalog.py b/tools/release/update_catalog.py index 94ecd1ce5c..8ceadb5fcb 100755 --- a/tools/release/update_catalog.py +++ b/tools/release/update_catalog.py @@ -17,6 +17,7 @@ API = "https://api.github.com" SHA256 = re.compile(r"^[0-9a-f]{64}$") PR_TAG = re.compile(r"^pr-([1-9][0-9]*)$") MAIN_TAG = re.compile(r"^main-([0-9a-f]{7,40})$") +MERGED_PR = re.compile(r"\[PR #([1-9][0-9]*)\]\(") class ApiError(RuntimeError): @@ -53,6 +54,20 @@ class GitHub: def get(self, path: str): return self.request("GET", path) + def get_all(self, path: str, limit: int = 1000) -> list: + items = [] + page = 1 + sep = "&" if "?" in path else "?" + while len(items) < limit: + batch = self.get(f"{path}{sep}per_page=100&page={page}") + if not batch: + break + items.extend(batch) + if len(batch) < 100: + break + page += 1 + return items + def put(self, path: str, body): return self.request("PUT", path, body) @@ -100,15 +115,20 @@ def parse_variants(text: str) -> list[tuple[str, str]]: return out -def published_millis(release: dict, prefer_updated: bool = False) -> int: - value = ( - release.get("updated_at") if prefer_updated else None - ) or release.get("published_at") or release.get("created_at") +def iso_millis(value: str | None) -> int: if not value: return 0 return int(dt.datetime.fromisoformat(value.replace("Z", "+00:00")).timestamp() * 1000) +def published_millis(release: dict, prefer_updated: bool = False) -> int: + return iso_millis( + (release.get("updated_at") if prefer_updated else None) + or release.get("published_at") + or release.get("created_at") + ) + + def paragraphs(markdown: str) -> list[str]: return [p.strip() for p in re.split(r"\n\s*\n", markdown.replace("\r", "")) if p.strip()] @@ -195,6 +215,7 @@ def release_entry( title: str, summary: str, prefer_updated: bool = False, + extra: dict | None = None, ): suffixes = [suffix for _, suffix in variants] apks = {} @@ -220,6 +241,7 @@ def release_entry( "versionCode": version_code, "publishedAt": published_millis(release, prefer_updated), "url": release.get("html_url") or "", + **(extra or {}), "apks": apks, } @@ -289,8 +311,52 @@ def stable_app_release(releases: list[dict]) -> dict | None: return max(apps, key=lambda r: r.get("published_at") or r.get("created_at") or "", default=None) -def build_catalog(source: GitHub, ci: GitHub, source_repo: str, ci_repo: str) -> dict: - stable_release = stable_app_release(source.get(f"/repos/{source_repo}/releases?per_page=100")) +def merged_pr(release: dict) -> int: + ps = paragraphs(release.get("body") or "") + match = MERGED_PR.search(ps[0]) if ps else None + return int(match.group(1)) if match else 0 + + +class Cache: + """Commit facts carried over from the published catalog, so a run only asks GitHub about new builds.""" + + def __init__(self, previous: dict | None): + self.commits: dict[str, dict] = {} + for entry in (previous or {}).get("previews") or []: + commit = (entry.get("commit") or "").lower() + if commit and entry.get("committedAt"): + self.commits[commit] = {"author": entry.get("author") or "", "committedAt": entry["committedAt"]} + + def commit(self, gh: GitHub, repo: str, sha: str) -> dict: + sha = sha.lower() + if sha not in self.commits: + try: + obj = gh.get(f"/repos/{repo}/commits/{q(sha)}") + self.commits[sha] = { + "author": (obj.get("author") or {}).get("login") or "", + "committedAt": iso_millis(((obj.get("commit") or {}).get("committer") or {}).get("date")), + } + except ApiError: + self.commits[sha] = {"author": "", "committedAt": 0} + return self.commits[sha] + + +def unique_previews(previews: list[dict]) -> list[dict]: + ordered = sorted(previews, key=lambda r: (r.get("committedAt") or r["publishedAt"], r["publishedAt"]), reverse=True) + result = [] + seen = set() + for preview in ordered: + commit = preview["commit"].lower() + if commit in seen: + continue + seen.add(commit) + result.append(preview) + return result + + +def build_catalog(source: GitHub, ci: GitHub, source_repo: str, ci_repo: str, previous: dict | None = None) -> dict: + cache = Cache(previous) + stable_release = stable_app_release(source.get_all(f"/repos/{source_repo}/releases", limit=300)) stable = None if stable_release: @@ -307,9 +373,11 @@ def build_catalog(source: GitHub, ci: GitHub, source_repo: str, ci_repo: str) -> signer, title, summary, + extra={"committedAt": cache.commit(source, source_repo, stable_commit)["committedAt"]}, ) - releases = ci.get(f"/repos/{ci_repo}/releases?per_page=100") + main_code, _, main_variants, main_signer = source_meta(source, source_repo, "main") + releases = ci.get_all(f"/repos/{ci_repo}/releases") previews = [] preview_history = [] tests = [] @@ -322,12 +390,20 @@ def build_catalog(source: GitHub, ci: GitHub, source_repo: str, ci_repo: str) -> commit = main_commit(release) if not commit: continue - try: - code, _, variants, signer = source_meta(source, source_repo, commit) - except ApiError: - continue + code_text = release_body_value(release.get("body") or "", "VersionCode") + if code_text and code_text.isdigit(): + code, variants, signer = int(code_text), main_variants, main_signer + else: + try: + code, _, variants, signer = source_meta(source, source_repo, commit) + except ApiError: + continue + facts = cache.commit(source, source_repo, commit) title, summary = ci_description(release) - preview = release_entry(release, commit, 0, None, code, variants, signer, title, summary) + preview = release_entry( + release, commit, 0, None, code, variants, signer, title, summary, + extra={"mergedPr": merged_pr(release), "author": facts["author"], "committedAt": facts["committedAt"]}, + ) previews.append(preview) history_entry = preview_history_entry(release, preview, variants) if history_entry: @@ -350,16 +426,15 @@ def build_catalog(source: GitHub, ci: GitHub, source_repo: str, ci_repo: str) -> commit = release_body_value(body, "Commit") if not commit or not re.fullmatch(r"[0-9a-f]{7,40}", commit): continue - base_ref = release_body_value(body, "Base") or pull["base"]["sha"] - try: - base_code, _, variants, signer = source_meta(source, source_repo, base_ref) - except ApiError: - continue version_code_text = release_body_value(body, "VersionCode") if version_code_text and version_code_text.isdigit(): version_code = int(version_code_text) else: - version_code = base_code + base_ref = release_body_value(body, "Base") or pull["base"]["sha"] + try: + version_code = source_meta(source, source_repo, base_ref)[0] + except ApiError: + continue try: changed = source.get(f"/repos/{source_repo}/pulls/{pr}/files?per_page=100") if any(item.get("filename") == "app/build.gradle" for item in changed): @@ -375,52 +450,69 @@ def build_catalog(source: GitHub, ci: GitHub, source_repo: str, ci_repo: str) -> pr, None, version_code, - variants, - signer, + main_variants, + main_signer, title, summary, prefer_updated=True, + extra={ + "author": (pull.get("user") or {}).get("login") or "", + "headCommit": (pull.get("head") or {}).get("sha") or "", + "builtAt": max( + (iso_millis(a.get("updated_at") or a.get("created_at")) + for a in release.get("assets") or [] if (a.get("name") or "").endswith(".apk")), + default=0, + ), + }, ) ) - previews.sort(key=lambda r: r["publishedAt"], reverse=True) + ordered = unique_previews(previews) tests.sort(key=lambda r: r["publishedAt"], reverse=True) return { "schema": 1, "sourceRepo": source_repo, "ciRepo": ci_repo, "generatedAt": int(time.time() * 1000), + "mainVersionCode": main_code, "stable": stable, - "preview": previews[0] if previews else None, + "preview": ordered[0] if ordered else None, "recentPreviews": recent_previews(preview_history), + "previews": ordered, "tests": tests, } -def current_file(ci: GitHub, repo: str, path: str): +def current_file(ci: GitHub, repo: str, path: str, branch: str = "main"): try: - return ci.get(f"/repos/{repo}/contents/{q(path)}?ref=main") + return ci.get(f"/repos/{repo}/contents/{q(path)}?ref={q(branch)}") except ApiError as e: if e.status == 404: return None raise -def publish_catalog(source: GitHub, ci: GitHub, source_repo: str, ci_repo: str, path: str): +def previous_catalog(old: dict | None) -> dict | None: + try: + return json.loads(base64.b64decode(old["content"])) if old and old.get("content") else None + except Exception: + return None + + +def publish_catalog(source: GitHub, ci: GitHub, source_repo: str, ci_repo: str, path: str, branch: str = "main"): for attempt in range(4): - catalog = build_catalog(source, ci, source_repo, ci_repo) - content = (json.dumps(catalog, indent=2, sort_keys=False) + "\n").encode() - old = current_file(ci, ci_repo, path) + old = current_file(ci, ci_repo, path, branch) + catalog = build_catalog(source, ci, source_repo, ci_repo, previous_catalog(old)) + content = (json.dumps(catalog, separators=(",", ":")) + "\n").encode() body = { "message": "ci: refresh DroidDeck update catalog", "content": base64.b64encode(content).decode(), - "branch": "main", + "branch": branch, } if old: body["sha"] = old["sha"] try: - old_bytes = base64.b64decode(old["content"]) - old_json = json.loads(old_bytes) + old_json = dict(previous_catalog(old) or {}) old_json.pop("generatedAt", None) new_json = dict(catalog) new_json.pop("generatedAt", None) @@ -431,7 +523,7 @@ def publish_catalog(source: GitHub, ci: GitHub, source_repo: str, ci_repo: str, pass try: ci.put(f"/repos/{ci_repo}/contents/{q(path)}", body) - print(f"published https://raw.githubusercontent.com/{ci_repo}/main/{path}") + print(f"published https://raw.githubusercontent.com/{ci_repo}/{branch}/{path}") return catalog except ApiError as e: if e.status not in (409, 422) or attempt == 3: @@ -445,6 +537,7 @@ def main(): parser.add_argument("--source-repo", default="Droid-Deck/DroidDeck") parser.add_argument("--ci-repo", default="Droid-Deck/DroidDeck-CI") parser.add_argument("--path", default="catalog.json") + parser.add_argument("--branch", default="main") parser.add_argument("--dry-run", action="store_true") args = parser.parse_args() @@ -455,7 +548,7 @@ def main(): else: if not os.environ.get("CI_GITHUB_TOKEN"): raise SystemExit("CI_GITHUB_TOKEN is required to publish") - publish_catalog(source, ci, args.source_repo, args.ci_repo, args.path) + publish_catalog(source, ci, args.source_repo, args.ci_repo, args.path, args.branch) if __name__ == "__main__": diff --git a/tools/tests/test_update_catalog.py b/tools/tests/test_update_catalog.py index 3a0fc3de38..5ec076d1c6 100644 --- a/tools/tests/test_update_catalog.py +++ b/tools/tests/test_update_catalog.py @@ -1,7 +1,9 @@ import unittest from tools.release.update_catalog import ( + Cache, asset_for_suffix, + merged_pr, ci_description, parse_gradle, parse_variants, @@ -10,6 +12,7 @@ from tools.release.update_catalog import ( recent_previews, release_body_value, stable_app_release, + unique_previews, ) @@ -149,6 +152,25 @@ pubg com.tencent.ig -pubg self.assertEqual("0.2.0", stable_app_release(releases)["tag_name"]) self.assertIsNone(stable_app_release(releases[:1])) + def test_merged_pr_comes_from_the_first_paragraph(self): + body = "**Merged to main** - [PR #2602](https://github.com/Droid-Deck/DroidDeck/pull/2602): fix: x\n\nSee [PR #9](u)." + self.assertEqual(2602, merged_pr({"body": body})) + self.assertEqual(0, merged_pr({"body": "**Pushed to main** without a PR - fix: x"})) + + def test_previews_follow_commit_order_not_publish_order(self): + older = {"commit": "a" * 40, "committedAt": 100, "publishedAt": 900} + newer = {"commit": "b" * 40, "committedAt": 200, "publishedAt": 300} + again = {**newer, "publishedAt": 50} + self.assertEqual([newer, older], unique_previews([older, again, newer])) + + def test_cache_reuses_commit_facts_from_the_last_catalog(self): + class NoNetwork: + def get(self, path): + raise AssertionError(path) + + cache = Cache({"previews": [{"commit": "A" * 40, "author": "dev", "committedAt": 5}]}) + self.assertEqual({"author": "dev", "committedAt": 5}, cache.commit(NoNetwork(), "o/r", "a" * 40)) + if __name__ == "__main__": unittest.main()