feat(updates): install any kept Preview build, link builds to their PR and commit, flag stale test builds (#2624)

* feat(updates): install any kept Preview build, link builds to their PR and commit, flag stale test builds

* fix(updates): address review of the Updates tab history and test-build watch

* fix(updates): notify on switch to a followed PR, keep higher-version rebuilds installable

* fix(ci): let full reruns replace every artifact, note only expired PR builds

* fix(ci): leave the rebuild note only when the PR build is too old to rerun

* fix(ci): poll unfinished PR builds together and queue version-bump runs

* fix(ci): also rebuild PR builds that were running when the versionCode changed

* fix(ci): rebuild fork and just-finished PR builds, recheck the PR head before a rerun

* fix(ci): fail the rebuild sweep when finding candidates fails

* fix(ci): time the bump from the rebuild run's creation and scan unfinished builds of any age

* fix(ci): check the latest build of every open PR instead of scanning run history

* fix(ci): count PR builds that finish between the version push and the rebuild run

* fix(ci): use the push time from the event as the rebuild boundary
This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-11-14 16:20:29 -05:00
1 parent c847659789
commit 87c571f443
47 files changed
+1579 -87

No files matched your search

@@ -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<String?>(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<AppUpdates.PreviewChange>) {
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<Release>, 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)