Skip to content

Commit 2602b11

Browse files
Added "not logged in" splash screens (utkarshdalal#844)
* Added "not logged in" splash screens * Added translations
1 parent 2010357 commit 2602b11

16 files changed

Lines changed: 221 additions & 15 deletions

File tree

app/src/main/java/app/gamenative/ui/screen/library/LibraryScreen.kt

Lines changed: 66 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,12 @@ import app.gamenative.ui.enums.PaneType
7979
import app.gamenative.ui.enums.SortOption
8080
import app.gamenative.ui.internal.fakeAppInfo
8181
import app.gamenative.ui.model.LibraryViewModel
82+
import app.gamenative.service.SteamService
8283
import app.gamenative.ui.screen.library.components.LibraryDetailPane
8384
import app.gamenative.ui.screen.library.components.LibraryListPane
8485
import app.gamenative.ui.screen.library.components.LibraryOptionsPanel
8586
import app.gamenative.ui.screen.library.components.LibrarySearchBar
87+
import app.gamenative.ui.screen.library.components.LibrarySourceNotLoggedInSplash
8688
import app.gamenative.ui.screen.library.components.LibraryTabBar
8789
import app.gamenative.ui.screen.auth.AmazonOAuthActivity
8890
import app.gamenative.ui.screen.auth.EpicOAuthActivity
@@ -91,6 +93,9 @@ import app.gamenative.ui.screen.library.components.SystemMenu
9193
import app.gamenative.ui.theme.PluviaTheme
9294
import app.gamenative.ui.util.PlatformAuthUiHelpers
9395
import app.gamenative.ui.util.PlatformLogoutCallbacks
96+
import app.gamenative.service.amazon.AmazonService
97+
import app.gamenative.service.epic.EpicService
98+
import app.gamenative.service.gog.GOGService
9499
import app.gamenative.utils.CustomGameScanner
95100
import app.gamenative.utils.PlatformOAuthHandlers
96101
import kotlinx.coroutines.launch
@@ -768,21 +773,67 @@ private fun LibraryScreenContent(
768773
if (selectedAppId == null) {
769774
// Use Box to allow content to scroll behind the tab bar
770775
Box(modifier = Modifier.fillMaxSize()) {
771-
// Library list (content scrolls behind tab bar)
772-
LibraryListPane(
773-
state = state,
774-
listState = listState,
775-
currentLayout = currentPaneType,
776-
firstGridItemFocusRequester = gridFirstItemFocusRequester,
777-
focusTargetListIndex = gridFocusTargetListIndex,
778-
onPageChange = onPageChange,
779-
onNavigate = { appId ->
780-
selectedAppId = appId
781-
selectedLibraryItem = state.appInfoList.find { it.appId == appId }
782-
},
783-
onRefresh = onRefresh,
784-
modifier = Modifier.fillMaxSize(),
785-
)
776+
// When on Steam/GOG/Epic/Amazon tab and not logged in, or LOCAL tab with no custom games, show splash
777+
val showEmptyStateSplash = when (state.currentTab) {
778+
LibraryTab.STEAM -> !SteamService.isLoggedIn
779+
LibraryTab.GOG -> !GOGService.hasStoredCredentials(context)
780+
LibraryTab.EPIC -> !EpicService.hasStoredCredentials(context)
781+
LibraryTab.AMAZON -> !AmazonService.hasStoredCredentials(context)
782+
LibraryTab.LOCAL -> PrefManager.customGamesCount == 0
783+
else -> false
784+
}
785+
if (showEmptyStateSplash) {
786+
val (messageResId, buttonResId, onAction) = when (state.currentTab) {
787+
LibraryTab.STEAM -> Triple(
788+
R.string.library_source_not_logged_in_steam,
789+
R.string.steam_sign_in,
790+
onGoOnline,
791+
)
792+
LibraryTab.GOG -> Triple(
793+
R.string.library_source_not_logged_in_gog,
794+
R.string.gog_settings_login_title,
795+
{ gogOAuthLauncher.launch(Intent(context, GOGOAuthActivity::class.java)) },
796+
)
797+
LibraryTab.EPIC -> Triple(
798+
R.string.library_source_not_logged_in_epic,
799+
R.string.epic_settings_login_title,
800+
{ epicOAuthLauncher.launch(Intent(context, EpicOAuthActivity::class.java)) },
801+
)
802+
LibraryTab.AMAZON -> Triple(
803+
R.string.library_source_not_logged_in_amazon,
804+
R.string.amazon_settings_login_title,
805+
{ amazonOAuthLauncher.launch(Intent(context, AmazonOAuthActivity::class.java)) },
806+
)
807+
LibraryTab.LOCAL -> Triple(
808+
R.string.library_source_no_custom_games,
809+
R.string.add_custom_game_dialog_title,
810+
onAddCustomGameClick,
811+
)
812+
else -> throw IllegalStateException("showEmptyStateSplash is true only for Steam/GOG/Epic/Amazon/LOCAL")
813+
}
814+
LibrarySourceNotLoggedInSplash(
815+
messageResId = messageResId,
816+
signInButtonLabelResId = buttonResId,
817+
onSignInClick = onAction,
818+
modifier = Modifier.fillMaxSize(),
819+
)
820+
} else {
821+
// Library list (content scrolls behind tab bar)
822+
LibraryListPane(
823+
state = state,
824+
listState = listState,
825+
currentLayout = currentPaneType,
826+
firstGridItemFocusRequester = gridFirstItemFocusRequester,
827+
focusTargetListIndex = gridFocusTargetListIndex,
828+
onPageChange = onPageChange,
829+
onNavigate = { appId ->
830+
selectedAppId = appId
831+
selectedLibraryItem = state.appInfoList.find { it.appId == appId }
832+
},
833+
onRefresh = onRefresh,
834+
modifier = Modifier.fillMaxSize(),
835+
)
836+
}
786837

787838
// Top overlay: Tab bar OR Search bar
788839
if (state.isSearching) {
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
package app.gamenative.ui.screen.library.components
2+
3+
import androidx.annotation.StringRes
4+
import androidx.compose.foundation.background
5+
import androidx.compose.foundation.layout.Arrangement
6+
import androidx.compose.foundation.layout.Column
7+
import androidx.compose.foundation.layout.Spacer
8+
import androidx.compose.foundation.layout.fillMaxSize
9+
import androidx.compose.foundation.layout.height
10+
import androidx.compose.foundation.layout.padding
11+
import androidx.compose.material3.Button
12+
import androidx.compose.material3.MaterialTheme
13+
import androidx.compose.material3.Text
14+
import androidx.compose.runtime.Composable
15+
import androidx.compose.ui.Alignment
16+
import androidx.compose.ui.Modifier
17+
import androidx.compose.ui.res.stringResource
18+
import androidx.compose.ui.text.style.TextAlign
19+
import androidx.compose.ui.unit.dp
20+
import app.gamenative.R
21+
22+
/**
23+
* Full-screen splash shown when the user is on a GOG/Epic/Amazon library tab
24+
* but is not logged in to that service. Shows a message and a prominent sign-in button
25+
* that launches the same OAuth flow as the system menu.
26+
*/
27+
@Composable
28+
internal fun LibrarySourceNotLoggedInSplash(
29+
@StringRes messageResId: Int,
30+
@StringRes signInButtonLabelResId: Int,
31+
onSignInClick: () -> Unit,
32+
modifier: Modifier = Modifier,
33+
) {
34+
Column(
35+
modifier = modifier
36+
.fillMaxSize()
37+
.background(MaterialTheme.colorScheme.surface)
38+
.padding(32.dp),
39+
horizontalAlignment = Alignment.CenterHorizontally,
40+
verticalArrangement = Arrangement.Center,
41+
) {
42+
Text(
43+
text = stringResource(messageResId),
44+
style = MaterialTheme.typography.titleLarge,
45+
color = MaterialTheme.colorScheme.onSurface,
46+
textAlign = TextAlign.Center,
47+
)
48+
Spacer(modifier = Modifier.height(32.dp))
49+
Button(
50+
onClick = onSignInClick,
51+
modifier = Modifier.padding(horizontal = 24.dp),
52+
) {
53+
Text(stringResource(signInButtonLabelResId))
54+
}
55+
}
56+
}

app/src/main/res/values-da/strings.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,6 +1120,13 @@
11201120
<string name="manifest_content_untrusted">Indholdet er ikke betroet og blev ikke installeret.</string>
11211121
<string name="manifest_type_mismatch">Downloadet indhold matcher ikke den forventede type.</string>
11221122
<string name="manifest_glibc_not_supported">GLIBC-builds understøttes ikke.</string>
1123+
1124+
<!-- Library: source not logged in splash -->
1125+
<string name="library_source_not_logged_in_steam">Log ind for at få adgang til din Steam-bibliotek.</string>
1126+
<string name="library_source_not_logged_in_gog">Log ind for at få adgang til din GOG-bibliotek.</string>
1127+
<string name="library_source_not_logged_in_epic">Log ind for at få adgang til din Epic-bibliotek.</string>
1128+
<string name="library_source_not_logged_in_amazon">Log ind for at få adgang til din Amazon-bibliotek.</string>
1129+
<string name="library_source_no_custom_games">Du har ikke tilføjet nogen brugerdefinerede spil.</string>
11231130
<string name="download_failed_title">Download mislykkedes</string>
11241131
<string name="download_failed_message">En nødvendig fil kunne ikke downloades. Kontrollér din netværksforbindelse, og prøv igen.</string>
11251132
<string name="install_failed_title">Installation mislykkedes</string>

app/src/main/res/values-de/strings.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,6 +1190,13 @@
11901190
<string name="manifest_content_untrusted">Inhalt ist nicht vertrauenswürdig und wurde nicht installiert.</string>
11911191
<string name="manifest_type_mismatch">Heruntergeladener Inhalt entspricht nicht dem erwarteten Typ.</string>
11921192
<string name="manifest_glibc_not_supported">GLIBC-Builds werden nicht unterstützt.</string>
1193+
1194+
<!-- Library: source not logged in splash -->
1195+
<string name="library_source_not_logged_in_steam">Melde dich an, um auf deine Steam-Bibliothek zuzugreifen.</string>
1196+
<string name="library_source_not_logged_in_gog">Melde dich an, um auf deine GOG-Bibliothek zuzugreifen.</string>
1197+
<string name="library_source_not_logged_in_epic">Melde dich an, um auf deine Epic-Bibliothek zuzugreifen.</string>
1198+
<string name="library_source_not_logged_in_amazon">Melde dich an, um auf deine Amazon-Bibliothek zuzugreifen.</string>
1199+
<string name="library_source_no_custom_games">Du hast keine benutzerdefinierten Spiele hinzugefügt.</string>
11931200
<string name="download_failed_title">Download fehlgeschlagen</string>
11941201
<string name="download_failed_message">Eine erforderliche Datei konnte nicht heruntergeladen werden. Bitte überprüfe deine Netzwerkverbindung und versuche es erneut.</string>
11951202
<string name="install_failed_title">Installation fehlgeschlagen</string>

app/src/main/res/values-es/strings.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,6 +1255,13 @@
12551255
<string name="manifest_content_untrusted">El contenido no es de confianza y no se instaló.</string>
12561256
<string name="manifest_type_mismatch">El contenido descargado no coincide con el tipo esperado.</string>
12571257
<string name="manifest_glibc_not_supported">Las versiones GLIBC no son compatibles.</string>
1258+
1259+
<!-- Library: source not logged in splash -->
1260+
<string name="library_source_not_logged_in_steam">Inicia sesión para acceder a tu biblioteca de Steam.</string>
1261+
<string name="library_source_not_logged_in_gog">Inicia sesión para acceder a tu biblioteca de GOG.</string>
1262+
<string name="library_source_not_logged_in_epic">Inicia sesión para acceder a tu biblioteca de Epic.</string>
1263+
<string name="library_source_not_logged_in_amazon">Inicia sesión para acceder a tu biblioteca de Amazon.</string>
1264+
<string name="library_source_no_custom_games">No has añadido ningún juego personalizado.</string>
12581265
<string name="download_failed_title">Error de descarga</string>
12591266
<string name="download_failed_message">No se pudo descargar un archivo necesario. Comprueba tu conexión de red e inténtalo de nuevo.</string>
12601267
<string name="install_failed_title">Error de instalación</string>

app/src/main/res/values-fr/strings.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,6 +1250,13 @@
12501250
<string name="manifest_content_untrusted">Le contenu n’est pas fiable et n’a pas été installé.</string>
12511251
<string name="manifest_type_mismatch">Le contenu téléchargé ne correspond pas au type attendu.</string>
12521252
<string name="manifest_glibc_not_supported">Les builds GLIBC ne sont pas pris en charge.</string>
1253+
1254+
<!-- Library: source not logged in splash -->
1255+
<string name="library_source_not_logged_in_steam">Connectez-vous pour accéder à votre bibliothèque Steam.</string>
1256+
<string name="library_source_not_logged_in_gog">Connectez-vous pour accéder à votre bibliothèque GOG.</string>
1257+
<string name="library_source_not_logged_in_epic">Connectez-vous pour accéder à votre bibliothèque Epic.</string>
1258+
<string name="library_source_not_logged_in_amazon">Connectez-vous pour accéder à votre bibliothèque Amazon.</string>
1259+
<string name="library_source_no_custom_games">Vous n\'avez ajouté aucun jeu personnalisé.</string>
12531260
<string name="download_failed_title">Échec du téléchargement</string>
12541261
<string name="download_failed_message">Un fichier requis n\'a pas pu être téléchargé. Veuillez vérifier votre connexion réseau et réessayer.</string>
12551262
<string name="install_failed_title">Échec de l\'installation</string>

app/src/main/res/values-it/strings.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,6 +1246,13 @@
12461246
<string name="manifest_content_untrusted">Content is not trusted and was not installed.</string>
12471247
<string name="manifest_type_mismatch">Downloaded content does not match expected type.</string>
12481248
<string name="manifest_glibc_not_supported">GLIBC builds are not supported.</string>
1249+
1250+
<!-- Library: source not logged in splash -->
1251+
<string name="library_source_not_logged_in_steam">Accedi per accedere alla tua libreria Steam.</string>
1252+
<string name="library_source_not_logged_in_gog">Accedi per accedere alla tua libreria GOG.</string>
1253+
<string name="library_source_not_logged_in_epic">Accedi per accedere alla tua libreria Epic.</string>
1254+
<string name="library_source_not_logged_in_amazon">Accedi per accedere alla tua libreria Amazon.</string>
1255+
<string name="library_source_no_custom_games">Non hai aggiunto nessun gioco personalizzato.</string>
12491256
<string name="download_failed_title">Download non riuscito</string>
12501257
<string name="download_failed_message">Non è stato possibile scaricare un file necessario. Controlla la connessione di rete e riprova.</string>
12511258
<string name="install_failed_title">Installazione non riuscita</string>

app/src/main/res/values-ko/strings.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,6 +1254,13 @@
12541254
<string name="manifest_content_untrusted">콘텐츠를 신뢰할 수 없으며 설치되지 않았습니다.</string>
12551255
<string name="manifest_type_mismatch">다운로드한 콘텐츠가 예상 유형과 일치하지 않습니다.</string>
12561256
<string name="manifest_glibc_not_supported">GLIBC 빌드는 지원되지 않습니다.</string>
1257+
1258+
<!-- Library: source not logged in splash -->
1259+
<string name="library_source_not_logged_in_steam">Steam 라이브러리에 액세스하려면 로그인하세요.</string>
1260+
<string name="library_source_not_logged_in_gog">GOG 라이브러리에 액세스하려면 로그인하세요.</string>
1261+
<string name="library_source_not_logged_in_epic">Epic 라이브러리에 액세스하려면 로그인하세요.</string>
1262+
<string name="library_source_not_logged_in_amazon">Amazon 라이브러리에 액세스하려면 로그인하세요.</string>
1263+
<string name="library_source_no_custom_games">사용자 지정 게임을 추가하지 않았습니다.</string>
12571264
<string name="download_failed_title">다운로드 실패</string>
12581265
<string name="download_failed_message">필수 파일을 다운로드할 수 없습니다. 네트워크 연결을 확인하고 다시 시도해 주세요.</string>
12591266
<string name="install_failed_title">설치 실패</string>

app/src/main/res/values-pl/strings.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,6 +1253,13 @@
12531253
<string name="manifest_content_untrusted">Zawartość nie jest zaufana i nie została zainstalowana.</string>
12541254
<string name="manifest_type_mismatch">Pobrana zawartość nie pasuje do oczekiwanego typu.</string>
12551255
<string name="manifest_glibc_not_supported">Wersje GLIBC nie są obsługiwane.</string>
1256+
1257+
<!-- Library: source not logged in splash -->
1258+
<string name="library_source_not_logged_in_steam">Zaloguj się, aby uzyskać dostęp do swojej biblioteki Steam.</string>
1259+
<string name="library_source_not_logged_in_gog">Zaloguj się, aby uzyskać dostęp do swojej biblioteki GOG.</string>
1260+
<string name="library_source_not_logged_in_epic">Zaloguj się, aby uzyskać dostęp do swojej biblioteki Epic.</string>
1261+
<string name="library_source_not_logged_in_amazon">Zaloguj się, aby uzyskać dostęp do swojej biblioteki Amazon.</string>
1262+
<string name="library_source_no_custom_games">Nie dodałeś żadnych gier niestandardowych.</string>
12561263
<string name="download_failed_title">Pobieranie nie powiodło się</string>
12571264
<string name="download_failed_message">Nie udało się pobrać wymaganego pliku. Sprawdź połączenie sieciowe i spróbuj ponownie.</string>
12581265
<string name="install_failed_title">Instalacja nie powiodła się</string>

app/src/main/res/values-pt-rBR/strings.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,6 +1120,13 @@
11201120
<string name="manifest_content_untrusted">O conteúdo não é confiável e não foi instalado.</string>
11211121
<string name="manifest_type_mismatch">O conteúdo baixado não corresponde ao tipo esperado.</string>
11221122
<string name="manifest_glibc_not_supported">Compilações GLIBC não são suportadas.</string>
1123+
1124+
<!-- Library: source not logged in splash -->
1125+
<string name="library_source_not_logged_in_steam">Faça login para acessar sua biblioteca Steam.</string>
1126+
<string name="library_source_not_logged_in_gog">Faça login para acessar sua biblioteca GOG.</string>
1127+
<string name="library_source_not_logged_in_epic">Faça login para acessar sua biblioteca Epic.</string>
1128+
<string name="library_source_not_logged_in_amazon">Faça login para acessar sua biblioteca Amazon.</string>
1129+
<string name="library_source_no_custom_games">Você não adicionou nenhum jogo personalizado.</string>
11231130
<string name="download_failed_title">Falha no Download</string>
11241131
<string name="download_failed_message">Um arquivo necessário não pôde ser baixado. Verifique sua conexão de rede e tente novamente.</string>
11251132
<string name="install_failed_title">Falha na Instalação</string>

0 commit comments

Comments
 (0)