@@ -79,10 +79,12 @@ import app.gamenative.ui.enums.PaneType
7979import app.gamenative.ui.enums.SortOption
8080import app.gamenative.ui.internal.fakeAppInfo
8181import app.gamenative.ui.model.LibraryViewModel
82+ import app.gamenative.service.SteamService
8283import app.gamenative.ui.screen.library.components.LibraryDetailPane
8384import app.gamenative.ui.screen.library.components.LibraryListPane
8485import app.gamenative.ui.screen.library.components.LibraryOptionsPanel
8586import app.gamenative.ui.screen.library.components.LibrarySearchBar
87+ import app.gamenative.ui.screen.library.components.LibrarySourceNotLoggedInSplash
8688import app.gamenative.ui.screen.library.components.LibraryTabBar
8789import app.gamenative.ui.screen.auth.AmazonOAuthActivity
8890import app.gamenative.ui.screen.auth.EpicOAuthActivity
@@ -91,6 +93,9 @@ import app.gamenative.ui.screen.library.components.SystemMenu
9193import app.gamenative.ui.theme.PluviaTheme
9294import app.gamenative.ui.util.PlatformAuthUiHelpers
9395import 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
9499import app.gamenative.utils.CustomGameScanner
95100import app.gamenative.utils.PlatformOAuthHandlers
96101import 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) {
0 commit comments