feat(bottom): Steam guides tab with per-game reading position

This commit is contained in:
Kurt Himebauch committed 2026-11-26 18:00:37 -05:00
1 parent 72050de1f6
commit b3ad19ae32
38 files changed
+539

No files matched your search

@@ -23,6 +23,7 @@ object GameProfileManager {
clear("texture filtering") { SessionPrefs.clearGameTextureFiltering(context, scope) }
clear("Windows components") { WinComponents.setPicks(context, scope, emptyList()) }
clear("bottom screen") { SessionPrefs.clearGameBottomScreen(context, scope) }
clear("guides") { SteamGuides.clear(context, scope) }
if (failures.isNotEmpty()) {
val names = failures.joinToString { it.first }
@@ -0,0 +1,69 @@
package com.droiddeck.launcher.session
import android.content.Context
import android.text.Html
import java.net.HttpURLConnection
import java.net.URL
object SteamGuides {
class Guide(val id: String, val title: String, val author: String, val summary: String, val preview: String?, val stars: Int) {
val url: String get() = "https://steamcommunity.com/sharedfiles/filedetails/?id=$id"
}
class Place(val url: String, val scroll: Float)
fun list(appId: Long, cookies: String?): List<Guide>? = runCatching {
val connection = URL("https://steamcommunity.com/app/$appId/guides/?browsefilter=toprated&browsesort=toprated").openConnection() as HttpURLConnection
connection.connectTimeout = 10_000
connection.readTimeout = 15_000
connection.setRequestProperty("User-Agent", "Mozilla/5.0 (X11; Linux x86_64) DroidDeck")
cookies?.takeIf { it.isNotEmpty() }?.let { connection.setRequestProperty("Cookie", it) }
try {
if (connection.responseCode != 200) return null
parse(connection.inputStream.bufferedReader().use { it.readText() })
} finally {
connection.disconnect()
}
}.getOrNull()
internal fun parse(html: String): List<Guide> = html.split("class=\"workshopItemCollectionContainer\"").drop(1).mapNotNull { card ->
val id = ID.find(card)?.groupValues?.get(1) ?: return@mapNotNull null
val title = TITLE.find(card)?.groupValues?.get(1)?.let(::text)?.takeIf { it.isNotEmpty() } ?: return@mapNotNull null
Guide(
id, title,
AUTHOR.find(card)?.groupValues?.get(1)?.let(::text).orEmpty(),
SUMMARY.find(card)?.groupValues?.get(1)?.let(::text).orEmpty(),
PREVIEW.find(card)?.groupValues?.get(1)?.let { Html.fromHtml(it, Html.FROM_HTML_MODE_LEGACY).toString() },
STARS.find(card)?.groupValues?.get(1)?.toIntOrNull() ?: 0,
)
}.distinctBy { it.id }
fun place(context: Context, game: String): Place? {
val prefs = context.getSharedPreferences(PREFS, Context.MODE_PRIVATE)
val url = prefs.getString("$game.url", null)?.takeIf(::isGuide) ?: return null
return Place(url, prefs.getFloat("$game.scroll", 0f))
}
fun savePlace(context: Context, game: String, url: String, scroll: Float) {
if (!isGuide(url)) return
context.getSharedPreferences(PREFS, Context.MODE_PRIVATE).edit()
.putString("$game.url", url).putFloat("$game.scroll", scroll.coerceIn(0f, 1f)).apply()
}
fun clear(context: Context, game: String) {
context.getSharedPreferences(PREFS, Context.MODE_PRIVATE).edit().remove("$game.url").remove("$game.scroll").apply()
}
internal fun isGuide(url: String): Boolean = GUIDE_URL.matches(url)
private fun text(html: String): String = Html.fromHtml(html, Html.FROM_HTML_MODE_LEGACY).toString().trim().replace(Regex("\\s+"), " ")
private const val PREFS = "steam_guides"
private val GUIDE_URL = Regex("https://steamcommunity\\.com/sharedfiles/filedetails/\\?id=\\d+(#[\\w-]*)?")
private val ID = Regex("""filedetails/\?id=(\d+)""")
private val TITLE = Regex("""class="workshopItemTitle">(.*?)</div>""", RegexOption.DOT_MATCHES_ALL)
private val AUTHOR = Regex("""class="workshopItemAuthorName">(.*?)</span>""", RegexOption.DOT_MATCHES_ALL)
private val SUMMARY = Regex("""class="workshopItemShortDesc">(.*?)</div>""", RegexOption.DOT_MATCHES_ALL)
private val PREVIEW = Regex("""class="workshopItemPreviewImage" src="([^"]+)"""")
private val STARS = Regex("""/(\d)-star\.png""")
}
@@ -0,0 +1,196 @@
package com.droiddeck.launcher.ui
import android.annotation.SuppressLint
import android.view.ViewGroup
import android.webkit.CookieManager
import android.webkit.RenderProcessGoneDetail
import android.webkit.WebResourceRequest
import android.webkit.WebView
import android.webkit.WebViewClient
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.compose.ui.viewinterop.AndroidView
import coil.compose.AsyncImage
import com.droiddeck.launcher.R
import com.droiddeck.launcher.runtime.LinuxRuntime
import com.droiddeck.launcher.session.SessionState
import com.droiddeck.launcher.session.SteamGuides
import com.droiddeck.launcher.session.SteamWebLogin
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.isActive
import kotlinx.coroutines.suspendCancellableCoroutine
import kotlinx.coroutines.withContext
import java.io.File
import kotlin.coroutines.resume
private const val GAME_POLL_MS = 2_000L
private sealed class GuideList {
object Loading : GuideList()
object Failed : GuideList()
class Found(val guides: List<SteamGuides.Guide>) : GuideList()
}
@Composable
internal fun BottomGuidesPage(runningGame: () -> String?) {
val context = LocalContext.current
var appId by remember { mutableStateOf(runningGame()?.toLongOrNull()) }
LaunchedEffect(Unit) {
while (isActive) {
appId = runningGame()?.toLongOrNull()
delay(GAME_POLL_MS)
}
}
val id = appId
if (id == null) {
PageNote(stringResource(R.string.bottom_guides_no_game))
return
}
val game = id.toString()
var reading by remember(id) { mutableStateOf(SteamGuides.place(context, game)?.url) }
var list by remember(id) { mutableStateOf<GuideList>(GuideList.Loading) }
LaunchedEffect(id) {
val cookies = withContext(Dispatchers.IO) {
runCatching {
SteamWebLogin.read(LinuxRuntime.rootDir(context), SessionState.steamClientArch, File(context.cacheDir, "steam-web-login"))
}.getOrDefault(emptyList())
}
val manager = CookieManager.getInstance()
for (c in cookies) suspendCancellableCoroutine { cont -> manager.setCookie("https://${c.host}", c.header) { cont.resume(Unit) } }
val header = cookies.filter { steamChatAllows(it.host) }.joinToString("; ") { it.header.substringBefore(';') }
list = withContext(Dispatchers.IO) { SteamGuides.list(id, header) }?.let { GuideList.Found(it) } ?: GuideList.Failed
}
val open = reading
if (open != null) {
Column(Modifier.fillMaxSize(), verticalArrangement = Arrangement.spacedBy(8.dp)) {
Row(Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically) {
BottomPillButton(stringResource(R.string.bottom_guides_back), "bottom-guides-back") { reading = null }
}
Box(Modifier.weight(1f).fillMaxWidth().clip(RoundedCornerShape(14.dp))) {
GuideReader(open, SteamGuides.place(context, game)?.takeIf { it.url == open }?.scroll ?: 0f,
onPlace = { url, scroll -> SteamGuides.savePlace(context, game, url, scroll) },
onStopped = { reading = null })
}
}
return
}
when (val l = list) {
GuideList.Loading -> PageNote(stringResource(R.string.achievements_reading))
GuideList.Failed -> PageNote(stringResource(R.string.bottom_guides_failed))
is GuideList.Found -> if (l.guides.isEmpty()) PageNote(stringResource(R.string.bottom_guides_empty)) else {
val last = SteamGuides.place(context, game)
LazyColumn(Modifier.fillMaxSize(), verticalArrangement = Arrangement.spacedBy(8.dp)) {
if (last != null) item(key = "continue") {
BottomPillButton(stringResource(R.string.bottom_guides_continue), "bottom-guides-continue") { reading = last.url }
}
items(l.guides, key = { it.id }) { guide -> GuideRow(guide) { reading = guide.url } }
}
}
}
}
@Composable
private fun PageNote(text: String) {
Box(Modifier.fillMaxSize()) {
Text(text, fontSize = 15.sp, color = MaterialTheme.colorScheme.onSurfaceVariant, textAlign = TextAlign.Center,
modifier = Modifier.align(Alignment.Center).padding(24.dp))
}
}
@Composable
internal fun GuideRow(guide: SteamGuides.Guide, onOpen: () -> Unit) {
val pal = LocalPalette.current
val colors = MaterialTheme.colorScheme
Row(
Modifier.fillMaxWidth().clip(RoundedCornerShape(14.dp)).background(pal.surface)
.clickable(role = Role.Button, onClick = onOpen).testTag("guide-${guide.id}").padding(10.dp),
horizontalArrangement = Arrangement.spacedBy(12.dp), verticalAlignment = Alignment.CenterVertically,
) {
Box(Modifier.size(64.dp).clip(RoundedCornerShape(10.dp)).background(pal.line)) {
if (guide.preview != null) AsyncImage(model = guide.preview, contentDescription = null, contentScale = ContentScale.Crop, modifier = Modifier.fillMaxSize())
}
Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(2.dp)) {
Text(guide.title, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, color = colors.onBackground, maxLines = 1, overflow = TextOverflow.Ellipsis)
Text(listOfNotNull(guide.author.takeIf { it.isNotEmpty() }, "★".repeat(guide.stars).takeIf { it.isNotEmpty() }).joinToString(" · "),
fontSize = 12.sp, color = pal.signal, maxLines = 1)
Text(guide.summary, fontSize = 12.sp, color = colors.onSurfaceVariant, maxLines = 2, overflow = TextOverflow.Ellipsis)
}
}
}
@SuppressLint("SetJavaScriptEnabled")
@Composable
private fun GuideReader(url: String, scroll: Float, onPlace: (String, Float) -> Unit, onStopped: () -> Unit) {
AndroidView(factory = { ctx ->
WebView(ctx).apply {
layoutParams = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
isFocusable = false
isFocusableInTouchMode = false
setBackgroundColor(0xFF1B2838.toInt())
settings.javaScriptEnabled = true
settings.domStorageEnabled = true
settings.allowFileAccess = false
settings.allowContentAccess = false
var restore = scroll
webViewClient = object : WebViewClient() {
override fun shouldOverrideUrlLoading(view: WebView, request: WebResourceRequest): Boolean = !steamChatAllows(request.url.host)
override fun onPageFinished(view: WebView, url: String) {
if (restore > 0f) {
val ratio = restore
restore = 0f
view.postDelayed({ view.scrollTo(0, (view.contentHeight * view.scale * ratio).toInt()) }, 400)
}
}
override fun onRenderProcessGone(view: WebView, detail: RenderProcessGoneDetail): Boolean {
onStopped()
return true
}
}
setOnScrollChangeListener { v, _, y, _, _ ->
val web = v as WebView
val height = web.contentHeight * web.scale
val current = web.url ?: return@setOnScrollChangeListener
if (height > 0) onPlace(current, y / height)
}
loadUrl(url)
}
}, modifier = Modifier.fillMaxSize(), onRelease = { view ->
view.url?.let { current -> onPlace(current, view.scrollY / (view.contentHeight * view.scale).coerceAtLeast(1f)) }
view.destroy()
})
}
@@ -11,6 +11,7 @@ import androidx.compose.material.icons.filled.Speed
import androidx.compose.material.icons.filled.Download
import androidx.compose.material.icons.filled.EmojiEvents
import androidx.compose.material.icons.filled.GridView
import androidx.compose.material.icons.filled.MenuBook
import androidx.compose.material.icons.filled.Image
import androidx.compose.material.icons.filled.People
import androidx.compose.material3.Text
@@ -39,6 +40,7 @@ fun sessionBottomPages(actions: BottomPageActions): List<BottomPage> = listOf(
BottomPage(BOTTOM_PAGE_TELEMETRY, R.string.bottom_page_telemetry, Icons.Filled.Speed) { BottomTelemetryPage(actions.fps, actions.runningGame) },
BottomPage("quick", R.string.drawer_quick_access, Icons.Filled.GridView) { BottomQuickPage(actions) },
BottomPage("achievements", R.string.achievements_title, Icons.Filled.EmojiEvents) { BottomAchievementsPage(actions.runningGame) },
BottomPage("guides", R.string.bottom_page_guides, Icons.Filled.MenuBook) { BottomGuidesPage(actions.runningGame) },
BottomPage("downloads", R.string.bottom_page_downloads, Icons.Filled.Download) { BottomDownloadsPage() },
BottomPage("screenshots", R.string.bottom_page_screenshots, Icons.Filled.Image) { BottomScreenshotsPage(actions.takeScreenshot) },
BottomPage("chat", R.string.bottom_page_chat, Icons.Filled.People) { BottomChatPage() },
+6
View File
@@ -2181,6 +2181,12 @@
<string name="bottom_screen_off">أطفئ الشاشة السفلية</string>
<string name="bottom_quick_on">تشغيل</string>
<string name="bottom_quick_off">إيقاف</string>
<string name="bottom_page_guides">الأدلة</string>
<string name="bottom_guides_no_game">ابدأ لعبة لترى أدلة Steam الخاصة بها هنا.</string>
<string name="bottom_guides_continue">متابعة القراءة</string>
<string name="bottom_guides_back">كل الأدلة</string>
<string name="bottom_guides_empty">لا توجد أدلة Steam لهذه اللعبة بعد.</string>
<string name="bottom_guides_failed">تعذّر تحميل أدلة Steam. عد عندما تكون متصلًا.</string>
<string name="bottom_page_telemetry">إحصاءات داخل اللعبة</string>
<string name="bottom_hud_group">مؤشرات الشاشة السفلية</string>
<string name="bottom_strip_tabs">شريط على كل تبويب</string>
@@ -2176,6 +2176,12 @@
<string name="bottom_screen_off">Apagar la pantalla inferior</string>
<string name="bottom_quick_on">Activado</string>
<string name="bottom_quick_off">Desactivado</string>
<string name="bottom_page_guides">Guías</string>
<string name="bottom_guides_no_game">Inicia un juego para ver aquí sus guías de Steam.</string>
<string name="bottom_guides_continue">Seguir leyendo</string>
<string name="bottom_guides_back">Todas las guías</string>
<string name="bottom_guides_empty">Este juego aún no tiene guías de Steam.</string>
<string name="bottom_guides_failed">No se pudieron cargar las guías de Steam. Vuelve a intentarlo cuando tengas conexión.</string>
<string name="bottom_page_telemetry">Estadísticas del juego</string>
<string name="bottom_hud_group">HUD de la pantalla inferior</string>
<string name="bottom_strip_tabs">Franja en todas las pestañas</string>
+6
View File
@@ -2081,6 +2081,12 @@
<string name="bottom_screen_off">Изключи долния екран</string>
<string name="bottom_quick_on">Вкл.</string>
<string name="bottom_quick_off">Изкл.</string>
<string name="bottom_page_guides">Ръководства</string>
<string name="bottom_guides_no_game">Пуснете игра, за да видите тук нейните ръководства в Steam.</string>
<string name="bottom_guides_continue">Продължи четенето</string>
<string name="bottom_guides_back">Всички ръководства</string>
<string name="bottom_guides_empty">Все още няма ръководства в Steam за тази игра.</string>
<string name="bottom_guides_failed">Ръководствата в Steam не се заредиха. Опитайте отново, когато сте онлайн.</string>
<string name="bottom_page_telemetry">Статистика в играта</string>
<string name="bottom_hud_group">HUD на долния екран</string>
<string name="bottom_strip_tabs">Лента на всеки раздел</string>
+6
View File
@@ -2131,6 +2131,12 @@
<string name="bottom_screen_off">Vypnout spodní obrazovku</string>
<string name="bottom_quick_on">Zapnuto</string>
<string name="bottom_quick_off">Vypnuto</string>
<string name="bottom_page_guides">Návody</string>
<string name="bottom_guides_no_game">Spusťte hru a uvidíte zde její návody ze Steamu.</string>
<string name="bottom_guides_continue">Pokračovat ve čtení</string>
<string name="bottom_guides_back">Všechny návody</string>
<string name="bottom_guides_empty">Pro tuto hru zatím nejsou žádné návody na Steamu.</string>
<string name="bottom_guides_failed">Návody ze Steamu se nepodařilo načíst. Zkuste to znovu, až budete online.</string>
<string name="bottom_page_telemetry">Statistiky ve hře</string>
<string name="bottom_hud_group">HUD na spodní obrazovce</string>
<string name="bottom_strip_tabs">Lišta na každé kartě</string>
+6
View File
@@ -2081,6 +2081,12 @@
<string name="bottom_screen_off">Sluk den nederste skærm</string>
<string name="bottom_quick_on">Til</string>
<string name="bottom_quick_off">Fra</string>
<string name="bottom_page_guides">Guides</string>
<string name="bottom_guides_no_game">Start et spil for at se dets Steam-guides her.</string>
<string name="bottom_guides_continue">Læs videre</string>
<string name="bottom_guides_back">Alle guides</string>
<string name="bottom_guides_empty">Der er endnu ingen Steam-guides til dette spil.</string>
<string name="bottom_guides_failed">Kunne ikke hente Steam-guides. Prøv igen, når du er online.</string>
<string name="bottom_page_telemetry">Statistik i spillet</string>
<string name="bottom_hud_group">HUD på nederste skærm</string>
<string name="bottom_strip_tabs">Stribe på alle faner</string>
+6
View File
@@ -2073,6 +2073,12 @@
<string name="bottom_screen_off">Unteren Bildschirm ausschalten</string>
<string name="bottom_quick_on">An</string>
<string name="bottom_quick_off">Aus</string>
<string name="bottom_page_guides">Anleitungen</string>
<string name="bottom_guides_no_game">Starte ein Spiel, um hier seine Steam-Anleitungen zu sehen.</string>
<string name="bottom_guides_continue">Weiterlesen</string>
<string name="bottom_guides_back">Alle Anleitungen</string>
<string name="bottom_guides_empty">Für dieses Spiel gibt es noch keine Steam-Anleitungen.</string>
<string name="bottom_guides_failed">Steam-Anleitungen konnten nicht geladen werden. Versuche es erneut, sobald du online bist.</string>
<string name="bottom_page_telemetry">Spielstatistiken</string>
<string name="bottom_hud_group">HUD für den unteren Bildschirm</string>
<string name="bottom_strip_tabs">Leiste auf jedem Tab</string>
+6
View File
@@ -2081,6 +2081,12 @@
<string name="bottom_screen_off">Απενεργοποίηση κάτω οθόνης</string>
<string name="bottom_quick_on">Ενεργό</string>
<string name="bottom_quick_off">Ανενεργό</string>
<string name="bottom_page_guides">Οδηγοί</string>
<string name="bottom_guides_no_game">Ξεκινήστε ένα παιχνίδι για να δείτε εδώ τους οδηγούς του στο Steam.</string>
<string name="bottom_guides_continue">Συνέχεια ανάγνωσης</string>
<string name="bottom_guides_back">Όλοι οι οδηγοί</string>
<string name="bottom_guides_empty">Δεν υπάρχουν ακόμη οδηγοί Steam για αυτό το παιχνίδι.</string>
<string name="bottom_guides_failed">Δεν ήταν δυνατή η φόρτωση των οδηγών Steam. Δοκιμάστε ξανά όταν είστε online.</string>
<string name="bottom_page_telemetry">Στατιστικά παιχνιδιού</string>
<string name="bottom_hud_group">HUD κάτω οθόνης</string>
<string name="bottom_strip_tabs">Λωρίδα σε κάθε καρτέλα</string>
+6
View File
@@ -2106,6 +2106,12 @@
<string name="bottom_screen_off">Apagar la pantalla inferior</string>
<string name="bottom_quick_on">Activado</string>
<string name="bottom_quick_off">Desactivado</string>
<string name="bottom_page_guides">Guías</string>
<string name="bottom_guides_no_game">Inicia un juego para ver aquí sus guías de Steam.</string>
<string name="bottom_guides_continue">Seguir leyendo</string>
<string name="bottom_guides_back">Todas las guías</string>
<string name="bottom_guides_empty">Este juego aún no tiene guías de Steam.</string>
<string name="bottom_guides_failed">No se han podido cargar las guías de Steam. Vuelve a intentarlo cuando tengas conexión.</string>
<string name="bottom_page_telemetry">Estadísticas del juego</string>
<string name="bottom_hud_group">HUD de la pantalla inferior</string>
<string name="bottom_strip_tabs">Barra en todas las pestañas</string>
+6
View File
@@ -2081,6 +2081,12 @@
<string name="bottom_screen_off">Sammuta alanäyttö</string>
<string name="bottom_quick_on">Päällä</string>
<string name="bottom_quick_off">Pois</string>
<string name="bottom_page_guides">Oppaat</string>
<string name="bottom_guides_no_game">Käynnistä peli nähdäksesi sen Steam-oppaat täällä.</string>
<string name="bottom_guides_continue">Jatka lukemista</string>
<string name="bottom_guides_back">Kaikki oppaat</string>
<string name="bottom_guides_empty">Tälle pelille ei ole vielä Steam-oppaita.</string>
<string name="bottom_guides_failed">Steam-oppaiden lataus epäonnistui. Yritä uudelleen, kun olet verkossa.</string>
<string name="bottom_page_telemetry">Pelinsisäiset tilastot</string>
<string name="bottom_hud_group">Alanäytön HUD</string>
<string name="bottom_strip_tabs">Palkki kaikilla välilehdillä</string>
+6
View File
@@ -2105,6 +2105,12 @@
<string name="bottom_screen_off">Éteindre l’écran du bas</string>
<string name="bottom_quick_on">Activé</string>
<string name="bottom_quick_off">Désactivé</string>
<string name="bottom_page_guides">Guides</string>
<string name="bottom_guides_no_game">Lancez un jeu pour voir ses guides Steam ici.</string>
<string name="bottom_guides_continue">Reprendre la lecture</string>
<string name="bottom_guides_back">Tous les guides</string>
<string name="bottom_guides_empty">Ce jeu n’a pas encore de guides Steam.</string>
<string name="bottom_guides_failed">Impossible de charger les guides Steam. Réessayez une fois en ligne.</string>
<string name="bottom_page_telemetry">Statistiques en jeu</string>
<string name="bottom_hud_group">HUD de l\'écran du bas</string>
<string name="bottom_strip_tabs">Bande sur tous les onglets</string>
+6
View File
@@ -2081,6 +2081,12 @@
<string name="bottom_screen_off">नीचे की स्क्रीन बंद करें</string>
<string name="bottom_quick_on">चालू</string>
<string name="bottom_quick_off">बंद</string>
<string name="bottom_page_guides">गाइड</string>
<string name="bottom_guides_no_game">यहाँ Steam गाइड देखने के लिए कोई गेम शुरू करें।</string>
<string name="bottom_guides_continue">पढ़ना जारी रखें</string>
<string name="bottom_guides_back">सभी गाइड</string>
<string name="bottom_guides_empty">इस गेम के लिए अभी कोई Steam गाइड नहीं है।</string>
<string name="bottom_guides_failed">Steam गाइड लोड नहीं हो सके। ऑनलाइन होने पर फिर देखें।</string>
<string name="bottom_page_telemetry">इन-गेम आंकड़े</string>
<string name="bottom_hud_group">निचली स्क्रीन HUD</string>
<string name="bottom_strip_tabs">हर टैब पर स्ट्रिप</string>
+6
View File
@@ -2081,6 +2081,12 @@
<string name="bottom_screen_off">Alsó képernyő kikapcsolása</string>
<string name="bottom_quick_on">Be</string>
<string name="bottom_quick_off">Ki</string>
<string name="bottom_page_guides">Útmutatók</string>
<string name="bottom_guides_no_game">Indíts el egy játékot, hogy itt lásd a Steam-útmutatóit.</string>
<string name="bottom_guides_continue">Olvasás folytatása</string>
<string name="bottom_guides_back">Összes útmutató</string>
<string name="bottom_guides_empty">Ehhez a játékhoz még nincs Steam-útmutató.</string>
<string name="bottom_guides_failed">Nem sikerült betölteni a Steam-útmutatókat. Próbáld újra, ha online vagy.</string>
<string name="bottom_page_telemetry">Játékon belüli statisztikák</string>
<string name="bottom_hud_group">HUD az alsó képernyőn</string>
<string name="bottom_strip_tabs">Sáv minden lapon</string>
+6
View File
@@ -2057,6 +2057,12 @@
<string name="bottom_screen_off">Matikan layar bawah</string>
<string name="bottom_quick_on">Aktif</string>
<string name="bottom_quick_off">Nonaktif</string>
<string name="bottom_page_guides">Panduan</string>
<string name="bottom_guides_no_game">Mulai game untuk melihat panduan Steam-nya di sini.</string>
<string name="bottom_guides_continue">Lanjutkan membaca</string>
<string name="bottom_guides_back">Semua panduan</string>
<string name="bottom_guides_empty">Belum ada panduan Steam untuk game ini.</string>
<string name="bottom_guides_failed">Tidak dapat memuat panduan Steam. Coba lagi saat Anda online.</string>
<string name="bottom_page_telemetry">Statistik dalam gim</string>
<string name="bottom_hud_group">HUD layar bawah</string>
<string name="bottom_strip_tabs">Strip di setiap tab</string>
+6
View File
@@ -2097,6 +2097,12 @@
<string name="bottom_screen_off">Spegni lo schermo inferiore</string>
<string name="bottom_quick_on">Attivo</string>
<string name="bottom_quick_off">Disattivo</string>
<string name="bottom_page_guides">Guide</string>
<string name="bottom_guides_no_game">Avvia un gioco per vederne qui le guide di Steam.</string>
<string name="bottom_guides_continue">Continua a leggere</string>
<string name="bottom_guides_back">Tutte le guide</string>
<string name="bottom_guides_empty">Non ci sono ancora guide di Steam per questo gioco.</string>
<string name="bottom_guides_failed">Impossibile caricare le guide di Steam. Riprova quando sei online.</string>
<string name="bottom_page_telemetry">Statistiche di gioco</string>
<string name="bottom_hud_group">HUD dello schermo inferiore</string>
<string name="bottom_strip_tabs">Barra su ogni scheda</string>
+6
View File
@@ -2057,6 +2057,12 @@
<string name="bottom_screen_off">下の画面をオフにする</string>
<string name="bottom_quick_on">オン</string>
<string name="bottom_quick_off">オフ</string>
<string name="bottom_page_guides">ガイド</string>
<string name="bottom_guides_no_game">ゲームを起動すると、ここに Steam ガイドが表示されます。</string>
<string name="bottom_guides_continue">続きを読む</string>
<string name="bottom_guides_back">すべてのガイド</string>
<string name="bottom_guides_empty">このゲームの Steam ガイドはまだありません。</string>
<string name="bottom_guides_failed">Steam ガイドを読み込めませんでした。オンラインになってから再度お試しください。</string>
<string name="bottom_page_telemetry">ゲーム内統計</string>
<string name="bottom_hud_group">下部画面の HUD</string>
<string name="bottom_strip_tabs">すべてのタブにストリップを表示</string>
+6
View File
@@ -2057,6 +2057,12 @@
<string name="bottom_screen_off">아래 화면 끄기</string>
<string name="bottom_quick_on">켜짐</string>
<string name="bottom_quick_off">꺼짐</string>
<string name="bottom_page_guides">가이드</string>
<string name="bottom_guides_no_game">게임을 시작하면 여기에 Steam 가이드가 표시됩니다.</string>
<string name="bottom_guides_continue">이어서 읽기</string>
<string name="bottom_guides_back">모든 가이드</string>
<string name="bottom_guides_empty">이 게임에는 아직 Steam 가이드가 없습니다.</string>
<string name="bottom_guides_failed">Steam 가이드를 불러오지 못했습니다. 온라인 상태에서 다시 확인하세요.</string>
<string name="bottom_page_telemetry">게임 내 통계</string>
<string name="bottom_hud_group">하단 화면 HUD</string>
<string name="bottom_strip_tabs">모든 탭에 스트립 표시</string>
+6
View File
@@ -2057,6 +2057,12 @@
<string name="bottom_screen_off">Matikan skrin bawah</string>
<string name="bottom_quick_on">Hidup</string>
<string name="bottom_quick_off">Mati</string>
<string name="bottom_page_guides">Panduan</string>
<string name="bottom_guides_no_game">Mulakan permainan untuk melihat panduan Steamnya di sini.</string>
<string name="bottom_guides_continue">Sambung membaca</string>
<string name="bottom_guides_back">Semua panduan</string>
<string name="bottom_guides_empty">Belum ada panduan Steam untuk permainan ini.</string>
<string name="bottom_guides_failed">Tidak dapat memuatkan panduan Steam. Cuba lagi apabila anda dalam talian.</string>
<string name="bottom_page_telemetry">Statistik dalam permainan</string>
<string name="bottom_hud_group">HUD skrin bawah</string>
<string name="bottom_strip_tabs">Jalur pada setiap tab</string>
+6
View File
@@ -2081,6 +2081,12 @@
<string name="bottom_screen_off">Slå av den nederste skjermen</string>
<string name="bottom_quick_on">På</string>
<string name="bottom_quick_off">Av</string>
<string name="bottom_page_guides">Guider</string>
<string name="bottom_guides_no_game">Start et spill for å se Steam-guidene her.</string>
<string name="bottom_guides_continue">Fortsett å lese</string>
<string name="bottom_guides_back">Alle guider</string>
<string name="bottom_guides_empty">Det finnes ingen Steam-guider for dette spillet ennå.</string>
<string name="bottom_guides_failed">Kunne ikke laste Steam-guider. Prøv igjen når du er på nett.</string>
<string name="bottom_page_telemetry">Statistikk i spillet</string>
<string name="bottom_hud_group">HUD på bunnskjermen</string>
<string name="bottom_strip_tabs">Stripe på hver fane</string>
+6
View File
@@ -2081,6 +2081,12 @@
<string name="bottom_screen_off">Onderste scherm uitzetten</string>
<string name="bottom_quick_on">Aan</string>
<string name="bottom_quick_off">Uit</string>
<string name="bottom_page_guides">Handleidingen</string>
<string name="bottom_guides_no_game">Start een game om hier de Steam-handleidingen te zien.</string>
<string name="bottom_guides_continue">Verder lezen</string>
<string name="bottom_guides_back">Alle handleidingen</string>
<string name="bottom_guides_empty">Er zijn nog geen Steam-handleidingen voor deze game.</string>
<string name="bottom_guides_failed">Kan Steam-handleidingen niet laden. Probeer het opnieuw wanneer je online bent.</string>
<string name="bottom_page_telemetry">In-game statistieken</string>
<string name="bottom_hud_group">HUD op het onderste scherm</string>
<string name="bottom_strip_tabs">Strip op elk tabblad</string>
+6
View File
@@ -2131,6 +2131,12 @@
<string name="bottom_screen_off">Wyłącz dolny ekran</string>
<string name="bottom_quick_on">Wł.</string>
<string name="bottom_quick_off">Wył.</string>
<string name="bottom_page_guides">Poradniki</string>
<string name="bottom_guides_no_game">Uruchom grę, aby zobaczyć tu jej poradniki ze Steam.</string>
<string name="bottom_guides_continue">Czytaj dalej</string>
<string name="bottom_guides_back">Wszystkie poradniki</string>
<string name="bottom_guides_empty">Ta gra nie ma jeszcze poradników na Steam.</string>
<string name="bottom_guides_failed">Nie udało się wczytać poradników ze Steam. Spróbuj ponownie, gdy będziesz online.</string>
<string name="bottom_page_telemetry">Statystyki w grze</string>
<string name="bottom_hud_group">HUD dolnego ekranu</string>
<string name="bottom_strip_tabs">Pasek na każdej karcie</string>
@@ -2111,6 +2111,12 @@
<string name="bottom_screen_off">Desligar o ecrã inferior</string>
<string name="bottom_quick_on">Ativado</string>
<string name="bottom_quick_off">Desativado</string>
<string name="bottom_page_guides">Guias</string>
<string name="bottom_guides_no_game">Inicie um jogo para ver aqui os guias Steam dele.</string>
<string name="bottom_guides_continue">Continuar a ler</string>
<string name="bottom_guides_back">Todos os guias</string>
<string name="bottom_guides_empty">Ainda não há guias Steam para este jogo.</string>
<string name="bottom_guides_failed">Não foi possível carregar os guias Steam. Tente novamente quando estiver online.</string>
<string name="bottom_page_telemetry">Estatísticas no jogo</string>
<string name="bottom_hud_group">HUD do ecrã inferior</string>
<string name="bottom_strip_tabs">Faixa em todos os separadores</string>
+6
View File
@@ -2119,6 +2119,12 @@
<string name="bottom_screen_off">Desligar a tela inferior</string>
<string name="bottom_quick_on">Ativado</string>
<string name="bottom_quick_off">Desativado</string>
<string name="bottom_page_guides">Guias</string>
<string name="bottom_guides_no_game">Inicie um jogo para ver os guias Steam dele aqui.</string>
<string name="bottom_guides_continue">Continuar lendo</string>
<string name="bottom_guides_back">Todos os guias</string>
<string name="bottom_guides_empty">Ainda não há guias Steam para este jogo.</string>
<string name="bottom_guides_failed">Não foi possível carregar os guias Steam. Tente de novo quando estiver online.</string>
<string name="bottom_page_telemetry">Estatísticas no jogo</string>
<string name="bottom_hud_group">HUD da tela inferior</string>
<string name="bottom_strip_tabs">Faixa em todas as abas</string>
+6
View File
@@ -2106,6 +2106,12 @@
<string name="bottom_screen_off">Oprește ecranul de jos</string>
<string name="bottom_quick_on">Pornit</string>
<string name="bottom_quick_off">Oprit</string>
<string name="bottom_page_guides">Ghiduri</string>
<string name="bottom_guides_no_game">Pornește un joc ca să-i vezi aici ghidurile Steam.</string>
<string name="bottom_guides_continue">Continuă lectura</string>
<string name="bottom_guides_back">Toate ghidurile</string>
<string name="bottom_guides_empty">Încă nu există ghiduri Steam pentru acest joc.</string>
<string name="bottom_guides_failed">Ghidurile Steam nu s-au putut încărca. Încearcă din nou când ești online.</string>
<string name="bottom_page_telemetry">Statistici în joc</string>
<string name="bottom_hud_group">HUD pe ecranul de jos</string>
<string name="bottom_strip_tabs">Bandă pe fiecare filă</string>
+6
View File
@@ -2132,6 +2132,12 @@
<string name="bottom_screen_off">Выключить нижний экран</string>
<string name="bottom_quick_on">Вкл.</string>
<string name="bottom_quick_off">Выкл.</string>
<string name="bottom_page_guides">Руководства</string>
<string name="bottom_guides_no_game">Запустите игру, чтобы увидеть здесь её руководства Steam.</string>
<string name="bottom_guides_continue">Продолжить чтение</string>
<string name="bottom_guides_back">Все руководства</string>
<string name="bottom_guides_empty">Для этой игры пока нет руководств Steam.</string>
<string name="bottom_guides_failed">Не удалось загрузить руководства Steam. Попробуйте снова, когда будете в сети.</string>
<string name="bottom_page_telemetry">Игровая статистика</string>
<string name="bottom_hud_group">HUD нижнего экрана</string>
<string name="bottom_strip_tabs">Полоса на всех вкладках</string>
+6
View File
@@ -2081,6 +2081,12 @@
<string name="bottom_screen_off">Stäng av den nedre skärmen</string>
<string name="bottom_quick_on">På</string>
<string name="bottom_quick_off">Av</string>
<string name="bottom_page_guides">Guider</string>
<string name="bottom_guides_no_game">Starta ett spel för att se dess Steam-guider här.</string>
<string name="bottom_guides_continue">Fortsätt läsa</string>
<string name="bottom_guides_back">Alla guider</string>
<string name="bottom_guides_empty">Det finns inga Steam-guider för det här spelet ännu.</string>
<string name="bottom_guides_failed">Det gick inte att läsa in Steam-guider. Försök igen när du är online.</string>
<string name="bottom_page_telemetry">Statistik i spelet</string>
<string name="bottom_hud_group">HUD på nedre skärmen</string>
<string name="bottom_strip_tabs">Remsa på varje flik</string>
+6
View File
@@ -2057,6 +2057,12 @@
<string name="bottom_screen_off">ปิดหน้าจอล่าง</string>
<string name="bottom_quick_on">เปิด</string>
<string name="bottom_quick_off">ปิด</string>
<string name="bottom_page_guides">คู่มือ</string>
<string name="bottom_guides_no_game">เริ่มเกมเพื่อดูคู่มือ Steam ของเกมที่นี่</string>
<string name="bottom_guides_continue">อ่านต่อ</string>
<string name="bottom_guides_back">คู่มือทั้งหมด</string>
<string name="bottom_guides_empty">ยังไม่มีคู่มือ Steam สำหรับเกมนี้</string>
<string name="bottom_guides_failed">โหลดคู่มือ Steam ไม่ได้ ลองอีกครั้งเมื่อออนไลน์</string>
<string name="bottom_page_telemetry">สถิติในเกม</string>
<string name="bottom_hud_group">HUD หน้าจอล่าง</string>
<string name="bottom_strip_tabs">แถบในทุกแท็บ</string>
+6
View File
@@ -2073,6 +2073,12 @@
<string name="bottom_screen_off">Alt ekranı kapat</string>
<string name="bottom_quick_on">Açık</string>
<string name="bottom_quick_off">Kapalı</string>
<string name="bottom_page_guides">Rehberler</string>
<string name="bottom_guides_no_game">Steam rehberlerini burada görmek için bir oyun başlatın.</string>
<string name="bottom_guides_continue">Okumaya devam et</string>
<string name="bottom_guides_back">Tüm rehberler</string>
<string name="bottom_guides_empty">Bu oyun için henüz Steam rehberi yok.</string>
<string name="bottom_guides_failed">Steam rehberleri yüklenemedi. Çevrimiçi olduğunuzda tekrar deneyin.</string>
<string name="bottom_page_telemetry">Oyun içi istatistikler</string>
<string name="bottom_hud_group">Alt ekrandaki HUD</string>
<string name="bottom_strip_tabs">Her sekmede şerit</string>
+6
View File
@@ -2131,6 +2131,12 @@
<string name="bottom_screen_off">Вимкнути нижній екран</string>
<string name="bottom_quick_on">Увімк.</string>
<string name="bottom_quick_off">Вимк.</string>
<string name="bottom_page_guides">Посібники</string>
<string name="bottom_guides_no_game">Запустіть гру, щоб побачити тут її посібники Steam.</string>
<string name="bottom_guides_continue">Продовжити читання</string>
<string name="bottom_guides_back">Усі посібники</string>
<string name="bottom_guides_empty">Для цієї гри ще немає посібників Steam.</string>
<string name="bottom_guides_failed">Не вдалося завантажити посібники Steam. Спробуйте знову, коли будете онлайн.</string>
<string name="bottom_page_telemetry">Ігрова статистика</string>
<string name="bottom_hud_group">HUD на нижньому екрані</string>
<string name="bottom_strip_tabs">Смуга на кожній вкладці</string>
+6
View File
@@ -2057,6 +2057,12 @@
<string name="bottom_screen_off">Tắt màn hình dưới</string>
<string name="bottom_quick_on">Bật</string>
<string name="bottom_quick_off">Tắt</string>
<string name="bottom_page_guides">Hướng dẫn</string>
<string name="bottom_guides_no_game">Hãy mở một trò chơi để xem hướng dẫn Steam của nó tại đây.</string>
<string name="bottom_guides_continue">Đọc tiếp</string>
<string name="bottom_guides_back">Tất cả hướng dẫn</string>
<string name="bottom_guides_empty">Trò chơi này chưa có hướng dẫn Steam nào.</string>
<string name="bottom_guides_failed">Không tải được hướng dẫn Steam. Hãy thử lại khi bạn trực tuyến.</string>
<string name="bottom_page_telemetry">Thông số trong game</string>
<string name="bottom_hud_group">HUD màn hình dưới</string>
<string name="bottom_strip_tabs">Thanh trên mọi tab</string>
@@ -2134,6 +2134,12 @@
<string name="bottom_screen_off">关闭下屏</string>
<string name="bottom_quick_on">开</string>
<string name="bottom_quick_off">关</string>
<string name="bottom_page_guides">指南</string>
<string name="bottom_guides_no_game">启动游戏后,这里会显示它的 Steam 指南。</string>
<string name="bottom_guides_continue">继续阅读</string>
<string name="bottom_guides_back">全部指南</string>
<string name="bottom_guides_empty">此游戏还没有 Steam 指南。</string>
<string name="bottom_guides_failed">无法加载 Steam 指南。请在联网后重试。</string>
<string name="bottom_page_telemetry">游戏内数据</string>
<string name="bottom_hud_group">下屏 HUD</string>
<string name="bottom_strip_tabs">所有页签显示横条</string>
@@ -2056,6 +2056,12 @@
<string name="bottom_screen_off">關閉下螢幕</string>
<string name="bottom_quick_on">開</string>
<string name="bottom_quick_off">關</string>
<string name="bottom_page_guides">指南</string>
<string name="bottom_guides_no_game">啟動遊戲後,這裡會顯示它的 Steam 指南。</string>
<string name="bottom_guides_continue">繼續閱讀</string>
<string name="bottom_guides_back">全部指南</string>
<string name="bottom_guides_empty">此遊戲暫時沒有 Steam 指南。</string>
<string name="bottom_guides_failed">無法載入 Steam 指南。請在連線後再試。</string>
<string name="bottom_page_telemetry">遊戲內數據</string>
<string name="bottom_hud_group">下方螢幕 HUD</string>
<string name="bottom_strip_tabs">在所有分頁顯示資訊列</string>
@@ -2056,6 +2056,12 @@
<string name="bottom_screen_off">關閉下螢幕</string>
<string name="bottom_quick_on">開</string>
<string name="bottom_quick_off">關</string>
<string name="bottom_page_guides">指南</string>
<string name="bottom_guides_no_game">啟動遊戲後,這裡會顯示它的 Steam 指南。</string>
<string name="bottom_guides_continue">繼續閱讀</string>
<string name="bottom_guides_back">全部指南</string>
<string name="bottom_guides_empty">此遊戲尚無 Steam 指南。</string>
<string name="bottom_guides_failed">無法載入 Steam 指南。請在連線後再試。</string>
<string name="bottom_page_telemetry">遊戲內數據</string>
<string name="bottom_hud_group">下螢幕 HUD</string>
<string name="bottom_strip_tabs">在每個分頁顯示資訊列</string>
+6
View File
@@ -2352,6 +2352,12 @@
<string name="bottom_screen_off">Turn off the bottom screen</string>
<string name="bottom_quick_on">On</string>
<string name="bottom_quick_off">Off</string>
<string name="bottom_page_guides">Guides</string>
<string name="bottom_guides_no_game">Start a game to see its Steam guides here.</string>
<string name="bottom_guides_continue">Continue reading</string>
<string name="bottom_guides_back">All guides</string>
<string name="bottom_guides_empty">There are no Steam guides for this game yet.</string>
<string name="bottom_guides_failed">Could not load Steam guides. Check back once you are online.</string>
<string name="bottom_page_telemetry">In-game stats</string>
<string name="bottom_hud_group">Bottom screen HUD</string>
<string name="bottom_strip_tabs">Strip on every tab</string>
@@ -0,0 +1,73 @@
package com.droiddeck.launcher.session
import androidx.test.core.app.ApplicationProvider
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
import org.robolectric.annotation.Config
@RunWith(RobolectricTestRunner::class)
@Config(sdk = [33])
class SteamGuidesTest {
private val page = """
<div class="workshopBrowsePagingControls"></div>
<div data-panel="{}" role="button" id="sharedfile_1848481525_1" class="workshopItemCollectionContainer">
<a class="workshopItemCollection ugc" href="https://steamcommunity.com/sharedfiles/filedetails/?id=1848481525" data-appid="413150">
<div class="workshopItemPreviewHolder ">
<img class="workshopItemPreviewImage" src="https://images.steamusercontent.com/ugc/1/A/?imw=200&amp;imh=200">
</div>
<div class="workshopItemDetails">
<img class="fileRating" src="https://community.akamai.steamstatic.com/public/images/sharedfiles/5-star.png?v=2" />
<div class="workshopItemTitle">
Stardew &amp; You </div>
<div class="workshopItemAuthorLine">by&nbsp;<span class="workshopItemAuthorName">Farmer</span></div>
<div class="workshopItemShortDesc">Everything about
the valley...</div>
</div>
</a>
</div>
<div data-panel="{}" role="button" id="sharedfile_2_1" class="workshopItemCollectionContainer">
<a class="workshopItemCollection ugc" href="https://steamcommunity.com/sharedfiles/filedetails/?id=2">
<div class="workshopItemTitle"></div>
</a>
</div>
""".trimIndent()
@Test
fun parsesGuideCards() {
val guides = SteamGuides.parse(page)
assertEquals(1, guides.size)
val g = guides.single()
assertEquals("1848481525", g.id)
assertEquals("Stardew & You", g.title)
assertEquals("Farmer", g.author)
assertEquals("Everything about the valley...", g.summary)
assertEquals("https://images.steamusercontent.com/ugc/1/A/?imw=200&imh=200", g.preview)
assertEquals(5, g.stars)
assertEquals("https://steamcommunity.com/sharedfiles/filedetails/?id=1848481525", g.url)
}
@Test
fun remembersOnlyGuidePagesPerGame() {
val context = ApplicationProvider.getApplicationContext<android.content.Context>()
assertNull(SteamGuides.place(context, "413150"))
SteamGuides.savePlace(context, "413150", "https://example.com/", 0.5f)
assertNull(SteamGuides.place(context, "413150"))
SteamGuides.savePlace(context, "413150", "https://steamcommunity.com/sharedfiles/filedetails/?id=1#Section", 0.4f)
assertEquals(0.4f, SteamGuides.place(context, "413150")!!.scroll, 0.001f)
assertNull(SteamGuides.place(context, "620"))
SteamGuides.clear(context, "413150")
assertNull(SteamGuides.place(context, "413150"))
}
@Test
fun guideUrls() {
assertTrue(SteamGuides.isGuide("https://steamcommunity.com/sharedfiles/filedetails/?id=123"))
assertFalse(SteamGuides.isGuide("https://steamcommunity.com.evil/sharedfiles/filedetails/?id=123"))
assertFalse(SteamGuides.isGuide("http://steamcommunity.com/sharedfiles/filedetails/?id=123"))
}
}