Android build v1.1.19
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import { lazy, Suspense, useEffect, useMemo, useState } from 'react'
|
||||
import { AuthScreen } from '../../components/AuthScreen'
|
||||
import {
|
||||
loadCpuPvpLeaderboard,
|
||||
type CpuPvpLeaderboardEntry,
|
||||
@@ -138,11 +137,21 @@ function ScreenLoading() {
|
||||
|
||||
type RoguelikeVariant = 'pve' | 'pvp'
|
||||
|
||||
function IWantToHeal1App({ onBackToGameSelect }: { onBackToGameSelect: () => void }) {
|
||||
type IWantToHeal1AppProps = {
|
||||
initialSession: AuthSession
|
||||
onAuthenticationCleared: () => void
|
||||
onBackToGameSelect: () => void
|
||||
}
|
||||
|
||||
function IWantToHeal1App({
|
||||
initialSession,
|
||||
onAuthenticationCleared,
|
||||
onBackToGameSelect,
|
||||
}: IWantToHeal1AppProps) {
|
||||
const { enabled: dualScreenEnabled } = useDualScreen()
|
||||
const [screen, setScreen] = useState<Screen>('menu')
|
||||
const [account, setAccount] = useState<Account | null>(null)
|
||||
const [profile, setProfile] = useState<CharacterProfile | null>(null)
|
||||
const [account, setAccount] = useState<Account | null>(initialSession.account)
|
||||
const [profile, setProfile] = useState<CharacterProfile | null>(initialSession.profile)
|
||||
const [authChecked, setAuthChecked] = useState(false)
|
||||
const [gameMode, setGameMode] = useState<GameMode>(getGameMode())
|
||||
const [serverMessage, setServerMessage] = useState('')
|
||||
@@ -186,6 +195,10 @@ function IWantToHeal1App({ onBackToGameSelect }: { onBackToGameSelect: () => voi
|
||||
.finally(() => setAuthChecked(true))
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
if (authChecked && (!account || !profile)) onAuthenticationCleared()
|
||||
}, [account, authChecked, onAuthenticationCleared, profile])
|
||||
|
||||
useEffect(() => {
|
||||
const handleModeChange = (event: Event) => {
|
||||
const nextMode = (event as CustomEvent<GameMode>).detail
|
||||
@@ -350,18 +363,6 @@ function IWantToHeal1App({ onBackToGameSelect }: { onBackToGameSelect: () => voi
|
||||
[leaderboardCategory, selectedActivityOption?.leaderboards, selectedDifficultyOption?.id],
|
||||
)
|
||||
|
||||
function acceptSession(session: AuthSession) {
|
||||
setAccount(session.account)
|
||||
setProfile(session.profile)
|
||||
setGameMode(getGameMode())
|
||||
setScreen('menu')
|
||||
setError('')
|
||||
setServerMessage('')
|
||||
window.requestAnimationFrame(() => {
|
||||
focusFirstControl()
|
||||
})
|
||||
}
|
||||
|
||||
async function signOut() {
|
||||
try {
|
||||
await logoutAccount()
|
||||
@@ -371,6 +372,7 @@ function IWantToHeal1App({ onBackToGameSelect }: { onBackToGameSelect: () => voi
|
||||
setScreen('menu')
|
||||
setSyncMessage('')
|
||||
setSyncComparison(null)
|
||||
onAuthenticationCleared()
|
||||
} catch (reason) {
|
||||
setError(reason instanceof Error ? reason.message : 'Unable to sign out.')
|
||||
}
|
||||
@@ -832,10 +834,13 @@ function IWantToHeal1App({ onBackToGameSelect }: { onBackToGameSelect: () => voi
|
||||
|
||||
if (!account || !profile) {
|
||||
return (
|
||||
<AuthScreen
|
||||
onAuthenticated={acceptSession}
|
||||
serverMessage={serverMessage}
|
||||
/>
|
||||
<main className="game-shell">
|
||||
<section className="message-panel">
|
||||
<p className="eyebrow">Opening Chronicle</p>
|
||||
<h1>Returning to Sign In...</h1>
|
||||
{serverMessage && <p>{serverMessage}</p>}
|
||||
</section>
|
||||
</main>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user