Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion app/src/main/java/app/gamenative/service/SteamService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,13 @@ class SteamService : Service(), IChallengeUrlChanged {

val appDirPath = getAppDirPath(appId)

return File(appDirPath).deleteRecursively()
val removed = File(appDirPath).deleteRecursively()
// Also remove any custom media for this game stored under app data
try {
app.gamenative.utils.MediaUtils.deleteAllMediaFor(appId)
} catch (_: Throwable) { }

return removed
}

fun downloadApp(appId: Int): DownloadInfo? {
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import app.gamenative.Constants
import app.gamenative.data.OwnedGames
import app.gamenative.ui.component.LoadingScreen
import app.gamenative.ui.theme.PluviaTheme
import app.gamenative.ui.util.ListItemImage
import app.gamenative.utils.ListItemImage
import app.gamenative.utils.SteamUtils

@OptIn(ExperimentalMaterial3Api::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import androidx.compose.ui.unit.dp
import app.gamenative.R
import app.gamenative.ui.screen.PluviaScreen
import app.gamenative.ui.theme.PluviaTheme
import app.gamenative.ui.util.SteamIconImage
import app.gamenative.utils.SteamIconImage
import app.gamenative.utils.getAvatarURL
import `in`.dragonbra.javasteam.enums.EPersonaState

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import app.gamenative.events.SteamEvent
import app.gamenative.service.SteamService
import app.gamenative.ui.component.dialog.ProfileDialog
import app.gamenative.ui.theme.PluviaTheme
import app.gamenative.ui.util.SteamIconImage
import app.gamenative.utils.SteamIconImage
import app.gamenative.utils.getAvatarURL
import `in`.dragonbra.javasteam.enums.EPersonaState
import kotlinx.coroutines.launch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ import app.gamenative.ui.data.ChatState
import app.gamenative.ui.internal.fakeSteamFriends
import app.gamenative.ui.model.ChatViewModel
import app.gamenative.ui.theme.PluviaTheme
import app.gamenative.ui.util.ListItemImage
import app.gamenative.utils.ListItemImage
import app.gamenative.utils.SteamUtils
import app.gamenative.utils.getAvatarURL
import kotlinx.coroutines.launch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
Expand Down Expand Up @@ -516,6 +517,12 @@ fun AppScreen(
showConfigDialog = false
ContainerUtils.applyToContainer(context, appId, it)
},
mediaHeroUrl = appInfo.getHeroUrl(),
mediaLogoUrl = appInfo.getLogoUrl(),
mediaCapsuleUrl = appInfo.getCapsuleUrl(),
mediaHeaderUrl = appInfo.getHeaderImageUrl(),
mediaIconUrl = appInfo.clientIconUrl,
gameId = appInfo.id,
)

LoadingDialog(
Expand Down Expand Up @@ -943,9 +950,16 @@ private fun AppScreenContent(
.height(250.dp)
) {
// Hero background image
// Observe media change notifications to refresh hero immediately
val mediaVersion by app.gamenative.utils.MediaUtils.mediaVersionFlow.collectAsState(initial = 0)

CoilImage(
modifier = Modifier.fillMaxSize(),
imageModel = { appInfo.getHeroUrl() },
imageModel = {
val custom = app.gamenative.utils.MediaUtils.getCustomHeroUri(appInfo.id)
val base = custom ?: appInfo.getHeroUrl()
app.gamenative.utils.bustCache(base, mediaVersion)
},
imageOptions = ImageOptions(contentScale = ContentScale.Crop),
loading = { LoadingScreen() },
failure = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
Expand All @@ -59,7 +60,7 @@ import app.gamenative.service.SteamService
import app.gamenative.ui.enums.PaneType
import app.gamenative.ui.internal.fakeAppInfo
import app.gamenative.ui.theme.PluviaTheme
import app.gamenative.ui.util.ListItemImage
import app.gamenative.utils.ListItemImage

@Composable
internal fun AppItem(
Expand Down Expand Up @@ -139,23 +140,37 @@ internal fun AppItem(
.clip(RoundedCornerShape(12.dp)),
) {
if (paneType == PaneType.LIST) {
// Observe media changes to refresh icon immediately when user updates or resets
val mediaVersion by app.gamenative.utils.MediaUtils.mediaVersionFlow.collectAsState(initial = 0)
val iconModel: Any? = remember(mediaVersion, appInfo.gameId) {
app.gamenative.utils.MediaUtils.getCustomIconUri(appInfo.gameId)
?: appInfo.clientIconUrl
}
ListItemImage(
modifier = Modifier.size(56.dp),
imageModifier = Modifier.clip(RoundedCornerShape(10.dp)),
image = { appInfo.clientIconUrl }
image = { app.gamenative.utils.bustCache(iconModel, mediaVersion) }
)
} else {
val aspectRatio = if (paneType == PaneType.GRID_CAPSULE) { 2/3f } else { 460/215f }
val imageUrl = if (paneType == PaneType.GRID_CAPSULE) {
"https://shared.steamstatic.com/store_item_assets/steam/apps/" + appInfo.gameId + "/library_600x900.jpg"
// Observe media changes to refresh images immediately when user updates or resets
val mediaVersion by app.gamenative.utils.MediaUtils.mediaVersionFlow.collectAsState(initial = 0)


val baseModel: Any? = if (paneType == PaneType.GRID_CAPSULE) {
// Prefer custom capsule if present, otherwise Steam capsule
app.gamenative.utils.MediaUtils.getCustomCapsuleUri(appInfo.gameId)
?: ("https://shared.steamstatic.com/store_item_assets/steam/apps/" + appInfo.gameId + "/library_600x900.jpg")
} else {
"https://shared.steamstatic.com/store_item_assets/steam/apps/" + appInfo.gameId + "/header.jpg"
// Prefer custom header if present, otherwise Steam header
app.gamenative.utils.MediaUtils.getCustomHeaderUri(appInfo.gameId)
?: ("https://shared.steamstatic.com/store_item_assets/steam/apps/" + appInfo.gameId + "/header.jpg")
}

ListItemImage(
modifier = Modifier.aspectRatio(aspectRatio),
imageModifier = Modifier.clip(RoundedCornerShape(3.dp)).alpha(alpha),
image = { imageUrl },
image = { app.gamenative.utils.bustCache(baseModel, mediaVersion) },
onFailure = {
hideText = false
alpha = 0.1f
Expand Down
119 changes: 0 additions & 119 deletions app/src/main/java/app/gamenative/ui/util/Images.kt

This file was deleted.

Loading