mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-21 13:55:58 +00:00
Check itch updates per game from the game page instead of from the Library header
This commit is contained in:
5 files changed
+61
-34
No files matched your search
@@ -205,7 +205,12 @@ internal fun GameDetail(
|
||||
GameHero(
|
||||
title, item, installed, game,
|
||||
Modifier.fillMaxWidth().heightIn(min = if (narrow) 170.dp else 210.dp).onGloballyPositioned { StoresMotion.heroAt = it.boundsInRoot() },
|
||||
corner = { if (!s.shortcutPicker) RemoveButton(title, game, installed, a) },
|
||||
corner = {
|
||||
if (!s.shortcutPicker) Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
if (installed != null && installed.sidecar.store == Store.ITCH) ItchCheckButton(installed)
|
||||
RemoveButton(title, game, installed, a)
|
||||
}
|
||||
},
|
||||
scores = scores.takeIf { !stacked },
|
||||
) {
|
||||
HeroEyebrow(source, game, item, installed, download?.location ?: failed?.location)
|
||||
@@ -530,7 +535,7 @@ private fun EditArtButton(g: Library.SteamGame) {
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun IconAction(icon: androidx.compose.ui.graphics.vector.ImageVector, label: String, id: String, danger: Boolean = false, enabled: Boolean = true, onClick: () -> Unit) {
|
||||
internal fun IconAction(icon: androidx.compose.ui.graphics.vector.ImageVector, label: String, id: String, danger: Boolean = false, enabled: Boolean = true, onClick: () -> Unit) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val pal = LocalPalette.current
|
||||
val src = remember { MutableInteractionSource() }
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.droiddeck.launcher.ui
|
||||
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Refresh
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
@@ -18,6 +20,14 @@ import com.droiddeck.launcher.stores.InstalledStoreGame
|
||||
import com.droiddeck.launcher.stores.itch.ItchUpdate
|
||||
import com.droiddeck.launcher.stores.itch.ItchUpdates
|
||||
|
||||
@Composable
|
||||
internal fun ItchCheckButton(installed: InstalledStoreGame) {
|
||||
val ctx = LocalContext.current
|
||||
IconAction(Icons.Filled.Refresh, stringResource(R.string.store_check_updates), "game:check-updates", enabled = ItchUpdates.checkingKey == null) {
|
||||
ItchUpdates.checkGame(ctx, installed)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
internal fun ItchUpdateButton(installed: InstalledStoreGame, enabled: Boolean) {
|
||||
val ctx = LocalContext.current
|
||||
|
||||
@@ -38,7 +38,6 @@ import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.FilterAlt
|
||||
import androidx.compose.material.icons.filled.GridView
|
||||
import androidx.compose.material.icons.filled.PlayArrow
|
||||
import androidx.compose.material.icons.filled.Refresh
|
||||
import androidx.compose.material.icons.filled.Sort
|
||||
import androidx.compose.material.icons.filled.ViewList
|
||||
import androidx.compose.material.icons.filled.ViewModule
|
||||
@@ -198,7 +197,7 @@ internal fun LibraryPage(s: FrontEndState, a: FrontEndActions, selected: String,
|
||||
val xboxFilter = if (source == Store.XBOX.id) XboxLibraryFilter.current else XboxLibraryFilter.ALL
|
||||
LaunchedEffect(source, itchSignedIn) { if (source == Store.ITCH.id && itchSignedIn) {
|
||||
ItchCollections.load(ctx)
|
||||
ItchUpdates.check(ctx, false)
|
||||
ItchUpdates.check(ctx)
|
||||
} }
|
||||
val collection = if (source == Store.ITCH.id) ItchCollections.chosen() else null
|
||||
val pool = if (collection == null) all else collectionEntries(all, ItchCollections.gamesOf(collection.id).orEmpty())
|
||||
@@ -473,10 +472,7 @@ private fun LibraryHeader(
|
||||
},
|
||||
) {
|
||||
if (showUninstalled != null || xbox) LibraryFilterButton(showUninstalled, onShowUninstalled, xbox)
|
||||
if (collections) {
|
||||
CollectionsButton()
|
||||
UpdatesButton()
|
||||
}
|
||||
if (collections) CollectionsButton()
|
||||
SortButton(s, a)
|
||||
ViewButton(s, a)
|
||||
GameFileFolderActions(s, a)
|
||||
@@ -731,14 +727,6 @@ private fun LibraryFilterButton(showUninstalled: Boolean?, onShowUninstalled: (B
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun UpdatesButton() {
|
||||
val ctx = LocalContext.current
|
||||
val title = stringResource(R.string.store_check_updates)
|
||||
val description = if (ItchUpdates.checking) title + " · " + ItchUpdates.done + "/" + ItchUpdates.total else title
|
||||
HeaderIconButton(description, Icons.Filled.Refresh, "itch-updates") { ItchUpdates.check(ctx, true) }
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun CollectionsButton() {
|
||||
val pal = LocalPalette.current
|
||||
|
||||
Reference in new issue
Block a user