Merge pull request #23 from meowarex/dev

Fix Update Status & Dynamic Labels
This commit is contained in:
2026-05-25 00:51:52 +10:00
committed by GitHub
2 changed files with 13 additions and 4 deletions
@@ -117,18 +117,22 @@ class HomeModel(
val remote = remoteDataJson val remote = remoteDataJson
val currentPatches = remote?.patchesVersion?.toString() val currentPatches = remote?.patchesVersion?.toString()
val installedPatches = installMetadata?.patchesVersion?.toString()
val previousPatches = initialPrefPatchesVersion.ifEmpty { val previousPatches = initialPrefPatchesVersion.ifEmpty {
installMetadata?.patchesVersion?.toString().orEmpty() installedPatches.orEmpty()
} }
val patchesFrom = previousPatches.takeIf { it.isNotEmpty() } val patchesFrom = previousPatches.takeIf { it.isNotEmpty() }
val patchesTo = currentPatches ?: previousPatches.ifEmpty { "?" } val patchesTo = currentPatches ?: previousPatches.ifEmpty { "?" }
val patchesUpdateAvailable = installedPatches != null
&& currentPatches != null
&& installedPatches != currentPatches
add( add(
VersionDelta( VersionDelta(
label = application.getString(R.string.manager_update_row_patches), label = application.getString(R.string.manager_update_row_patches),
iconRes = R.drawable.ic_extension, iconRes = R.drawable.ic_extension,
from = patchesFrom, from = patchesFrom,
to = patchesTo, to = patchesTo,
tag = if (patchesFrom != null && patchesFrom != patchesTo) tag = if (patchesUpdateAvailable)
application.getString(R.string.manager_update_tag_available) else null, application.getString(R.string.manager_update_tag_available) else null,
) )
) )
@@ -142,13 +146,16 @@ class HomeModel(
val tidalTo = currentTidal?.toString() val tidalTo = currentTidal?.toString()
?: previousTidal.takeIf { it > 0 }?.toString() ?: previousTidal.takeIf { it > 0 }?.toString()
?: "?" ?: "?"
val tidalUpdateAvailable = installedTidalVersionCode > 0
&& currentTidal != null
&& installedTidalVersionCode != currentTidal
add( add(
VersionDelta( VersionDelta(
label = application.getString(R.string.manager_update_row_tidal), label = application.getString(R.string.manager_update_row_tidal),
iconRes = R.drawable.ic_music_note, iconRes = R.drawable.ic_music_note,
from = tidalFrom, from = tidalFrom,
to = tidalTo, to = tidalTo,
tag = if (tidalFrom != null && tidalFrom != tidalTo) tag = if (tidalUpdateAvailable)
application.getString(R.string.manager_update_tag_available) else null, application.getString(R.string.manager_update_tag_available) else null,
) )
) )
@@ -208,7 +208,9 @@ private fun ColumnScope.HomeContent(
val label = when { val label = when {
state.latestTidalVersionCode == null -> "Loading…" state.latestTidalVersionCode == null -> "Loading…"
install == null -> "Install" install == null -> "Install"
install.isUpToDate == false -> "Update" patchesBehind && tidalBehind -> "Update Patches & TIDAL"
patchesBehind -> "Update Patches"
tidalBehind -> "Update TIDAL"
else -> "Repatch" else -> "Repatch"
} }
Text( Text(