diff --git a/cli/cli.ts b/cli/cli.ts index 841c9575d58..b60d53d5e90 100644 --- a/cli/cli.ts +++ b/cli/cli.ts @@ -1906,6 +1906,12 @@ ${gcards.map(gcard => `[${gcard.name}](${gcard.url})`).join(',\n')} if (game.subtitle) targetStrings[`{id:game-subtitle}${game.subtitle}`] = game.subtitle; } + const kioskGames = targetConfig?.kiosk?.games; + for (const game of (kioskGames ?? [])) { + if (game.name) targetStrings[`{id:game-name}${game.name}`] = game.name; + if (game.description) targetStrings[`{id:game-description}${game.description}`] = game.description; + } + const approvedRepoLib = targetConfig?.packages?.approvedRepoLib; for (const [extension, repoData] of Object.entries(approvedRepoLib ?? {})) { for (const tag of (repoData.tags ?? [])) { diff --git a/kiosk/src/App.tsx b/kiosk/src/App.tsx index 9ed5567bf75..b25e4dc9161 100644 --- a/kiosk/src/App.tsx +++ b/kiosk/src/App.tsx @@ -16,7 +16,7 @@ import { useLocationHash, usePromise } from "./Hooks"; import { launchGame } from "./Transforms/launchGame"; import { navigate } from "./Transforms/navigate"; import { AppStateContext, AppStateReady } from "./State/AppStateContext"; -import { downloadGameListAsync } from "./Transforms/downloadGameListAsync"; +import { downloadTargetConfigAsync } from "./Transforms/downloadTargetConfigAsync"; import * as Actions from "./State/Actions"; import * as SimHost from "./Services/SimHostService"; import * as NotificationService from "./Services/NotificationService"; @@ -40,14 +40,22 @@ function App() { // Load persistent state from local storage. dispatch(Actions.loadHighScores()); dispatch(Actions.loadKioskCode()); - // Download the game list from the server and set it in the app state. - downloadGameListAsync().then(gameList => { - dispatch(Actions.setGameList(gameList)); - // Load user-added games from local storage. - dispatch(Actions.loadUserAddedGames()); - // Select the first game in the list. - dispatch(Actions.setSelectedGameId(gameList[0].id)); - }); + // Download targetconfig.json, then initialize game list. + downloadTargetConfigAsync().then(cfg => { + if (cfg) { + dispatch(Actions.setTargetConfig(cfg)); + if (cfg.kiosk) { + dispatch(Actions.setGameList(cfg.kiosk.games)); + // Load user-added games from local storage. + dispatch(Actions.loadUserAddedGames()); + // Select the first game in the list. + dispatch(Actions.setSelectedGameId(cfg.kiosk.games[0].id)); + } + } else { + // TODO: Handle this better + dispatch(Actions.setTargetConfig({})); + } + }); // Init subsystems. SimHost.initialize(); NotificationService.initialize(); diff --git a/kiosk/src/Components/MainMenu.tsx b/kiosk/src/Components/MainMenu.tsx index 6dfdada413c..5eb9eba851a 100644 --- a/kiosk/src/Components/MainMenu.tsx +++ b/kiosk/src/Components/MainMenu.tsx @@ -22,18 +22,20 @@ const MainMenu: React.FC = ({}) => { launchAddGame(); }; + const canShowMainMenu = ready && kiosk.targetConfig; + return ( <> - {!ready && ( + {!canShowMainMenu && (
)} - {ready && ( + {canShowMainMenu && (