Skip to content

Install button labels picked release for not-yet-installed apps#566

Merged
rainxchzed merged 3 commits into
mainfrom
fix/install-button-version-label
May 11, 2026
Merged

Install button labels picked release for not-yet-installed apps#566
rainxchzed merged 3 commits into
mainfrom
fix/install-button-version-label

Conversation

@rainxchzed
Copy link
Copy Markdown
Member

@rainxchzed rainxchzed commented May 10, 2026

Repro

  1. Open details for an app you don't have installed.
  2. Open the release picker, pick something other than the newest release.
  3. The CTA still says "Install latest" — but tapping it installs the older release the picker is on. Misleading.

Cause

SmartInstallButton only switched to the "Install version X" label inside the isInstalled && installed != selected branch. When the app wasn't installed at all, that branch was skipped and the cascade fell straight to the else -> "Install latest" regardless of what the picker had selected.

Fix

Insert an intermediate branch that fires when the app isn't installed yet but state.selectedRelease.tagName differs from state.allReleases.first().tagName (GitHub returns the feed newest-first by published_at, so the head is the latest). When that's the case, render Install version <selectedTag>.

Install latest stays as the genuine fall-through:

  • the picker is on the head of allReleases, or
  • allReleases is empty / we can't compare.

Behaviour matrix

State Picker selection Before After
Not installed Latest release Install latest Install latest (unchanged)
Not installed Older release Install latest Install version X
Installed v1.0, no update Same v1.0 Open / Uninstall (handled higher up) unchanged
Installed v1.0, update available (any) Update to vY unchanged
Installed v1.0 Different v0.9 Install version 0.9 unchanged

Verify

./gradlew :feature:details:presentation:compileDebugKotlinAndroid passes clean (only pre-existing warnings).

Summary by CodeRabbit

  • New Features
    • Clearer install button messaging: selecting a specific release now shows "Install [version]" instead of defaulting to "Install Latest".
    • Display-friendly version labels: version strings are normalized for display so long/path-like tags don’t wrap.
    • Preserves install behavior: the actual selected tag remains unchanged for installation.
    • Button text now enforces a single-line display with ellipsis for overflow.

Review Change Stack

Reproducer: open details for an app you don't have installed, open the
release picker, choose a non-latest release. The button stayed
"Install latest" — confusing because tapping it would actually install
the picked older release.

The label switch only checked the installed-vs-selected branch
(`isInstalled && normInstalled != null && ...`). When the app wasn't
installed, that branch was skipped and the cascade fell straight through
to "Install latest" regardless of which release the picker had
selected.

Add an intermediate branch: when the app isn't installed but the
selection differs from `allReleases.first()` (GitHub returns the feed
newest-first by `published_at`), render "Install version X". The
existing "Install latest" stays as the fall-through for the genuine
latest selection or when the comparison can't be done.

Refs #538.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 10, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 682a2703-b288-4af3-8f16-cd8fe5ab67cb

📥 Commits

Reviewing files that changed from the base of the PR and between 9ccd237 and 17729db.

📒 Files selected for processing (1)
  • feature/details/presentation/src/commonMain/kotlin/zed/rainxch/details/presentation/components/SmartInstallButton.kt
🚧 Files skipped from review as they are similar to previous changes (1)
  • feature/details/presentation/src/commonMain/kotlin/zed/rainxch/details/presentation/components/SmartInstallButton.kt

Walkthrough

SmartInstallButton normalizes the selected release tag for display, adds a button-text branch that shows "Install version X" when an uninstalled non-latest release is selected, and forces the button label to a single line with ellipsis.

Changes

Version-Specific Install Label

Layer / File(s) Summary
Normalize selected tag for display
feature/details/presentation/src/commonMain/kotlin/zed/rainxch/details/presentation/components/SmartInstallButton.kt
Adds displaySelected from VersionMath.normalizeVersion to produce a shorter, display-safe selected tag.
Install Button Text Logic
feature/details/presentation/src/commonMain/kotlin/zed/rainxch/details/presentation/components/SmartInstallButton.kt
New buttonText branch: when not installed and normSelected differs from latest release tag, use Res.string.install_version with displaySelected (fallback to normSelected) instead of Res.string.install_latest.
Label Rendering
feature/details/presentation/src/commonMain/kotlin/zed/rainxch/details/presentation/components/SmartInstallButton.kt
Button label Text now uses maxLines = 1 and TextOverflow.Ellipsis to prevent wrapping.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • OpenHub-Store/GitHub-Store#540: Both PRs touch SmartInstallButton’s install/label logic; this PR adds normalization/display changes while #540 adjusted version-comparison utilities.

Poem

🐰 I found a tag too long and wide,
I trimmed it down to show with pride.
"Install version X!" — neat and terse,
One-line label, no more reverse.
Hoppity, versioning delights!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: fixing install button labels to show the selected (picked) release version for not-yet-installed apps instead of incorrectly displaying 'Install latest'.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/install-button-version-label

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@feature/details/presentation/src/commonMain/kotlin/zed/rainxch/details/presentation/components/SmartInstallButton.kt`:
- Around line 260-263: The branch that checks normSelected vs latestTag can
wrongly fire for installed apps when the installed version is missing; update
the conditional that currently reads the normSelected &&
state.allReleases.firstOrNull()?.tagName... to also require !isInstalled so the
branch only runs for non-installed flows—locate the check around normSelected,
VersionMath.isExactSameVersion(latestTag, normSelected) and add the !isInstalled
guard to the combined condition.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1a4e0f23-6500-4396-bcdd-09c47a7409a1

📥 Commits

Reviewing files that changed from the base of the PR and between f46e20f and 9ccd237.

📒 Files selected for processing (1)
  • feature/details/presentation/src/commonMain/kotlin/zed/rainxch/details/presentation/components/SmartInstallButton.kt

…th-style tags.

Some maintainers tag releases with path-style strings such as
`com.akylas.documentscanner/android/github/1.21.0/152`. Plugging that
into the "Install version X" template wrapped the CTA across two
lines and rendered visibly broken.

Two stacked safety nets:
- Derive `displaySelected` via `VersionMath.normalizeVersion`. For
  the OSS-DocumentScanner tag above it returns `1.21.0`. For
  conventional tags (`v1.2.3`, `1.2.3-rc1`, `release-1.2.0`) the
  output already matches what we'd render today, so the change is a
  no-op for the common case. The raw tag still flows through the
  install pipeline — only the display label uses the trimmed form.
- Ellipsise the button Text (`maxLines = 1, overflow = Ellipsis`).
  When the trim heuristic doesn't help (commit-hash tags, weird
  schemes) the button stays single-line instead of breaking the row.

Refs #538.
@rainxchzed rainxchzed merged commit 8b3cf45 into main May 11, 2026
1 check passed
@rainxchzed rainxchzed deleted the fix/install-button-version-label branch May 11, 2026 05:56
@rainxchzed rainxchzed mentioned this pull request May 11, 2026
@HikaruIchijyo
Copy link
Copy Markdown

that ui glitch usthat ui glitch was this.
i installed card reader & doc scanner both but https://github-store.org/app?repo=ossappscollective/OSS-DocumentScanner
when i switch from card to document it glitches like that

@rainxchzed
Copy link
Copy Markdown
Member Author

@HikaruIchijyo Yeah that one has a long release tag name, thats why it broke, but now its fixed

@HikaruIchijyo
Copy link
Copy Markdown

@HikaruIchijyo Yeah that one has a long release tag name, thats why it broke, but now its fixed

will see thanks for this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants