@@ -3,7 +3,10 @@ import { useDisclosure } from "@heroui/react";
33import { Events } from "@wailsio/runtime" ;
44import { useNavigate } from "react-router-dom" ;
55import { compareVersions } from "@/utils/version" ;
6- import { readCurrentVersionName , saveCurrentVersionName } from "@/utils/currentVersion" ;
6+ import {
7+ readCurrentVersionName ,
8+ saveCurrentVersionName ,
9+ } from "@/utils/currentVersion" ;
710import * as minecraft from "bindings/github.com/liteldev/LeviLauncher/minecraft" ;
811import {
912 EnsureGameInputInteractive ,
@@ -21,10 +24,30 @@ import { GetMods } from "bindings/github.com/liteldev/LeviLauncher/modsservice";
2124import { getPlayerGamertagMap , listPlayers } from "@/utils/content" ;
2225import { ROUTES } from "@/constants/routes" ;
2326
24- let __didCheckGameInput = false ;
25- let __didCheckGamingServices = false ;
26- let __didCheckVcRuntime = false ;
2727const IGNORE_GS_KEY = "ll.ignore.gs" ;
28+ const DEPENDENCY_CHECK_SESSION_KEYS = {
29+ gameInput : "ll.session.dependency-check.gameinput" ,
30+ gamingServices : "ll.session.dependency-check.gamingservices" ,
31+ vcRuntime : "ll.session.dependency-check.vcruntime" ,
32+ } as const ;
33+
34+ const hasSessionDependencyCheckRun = (
35+ key : ( typeof DEPENDENCY_CHECK_SESSION_KEYS ) [ keyof typeof DEPENDENCY_CHECK_SESSION_KEYS ] ,
36+ ) : boolean => {
37+ try {
38+ return window . sessionStorage . getItem ( key ) === "1" ;
39+ } catch {
40+ return false ;
41+ }
42+ } ;
43+
44+ const markSessionDependencyCheckRun = (
45+ key : ( typeof DEPENDENCY_CHECK_SESSION_KEYS ) [ keyof typeof DEPENDENCY_CHECK_SESSION_KEYS ] ,
46+ ) => {
47+ try {
48+ window . sessionStorage . setItem ( key , "1" ) ;
49+ } catch { }
50+ } ;
2851
2952const getNextRandomTipIndex = ( currentIndex : number , totalTips : number ) => {
3053 const normalizedTotal = Math . max ( 1 , totalTips ) ;
@@ -282,8 +305,7 @@ export const useLauncher = (args: any) => {
282305 try {
283306 const mods = ( ( await ( GetMods as any ) ?.( name ) ) || [ ] ) as any [ ] ;
284307 installed = mods . some (
285- ( m : any ) =>
286- String ( m ?. name || "" ) . toLowerCase ( ) === "levilamina" ,
308+ ( m : any ) => String ( m ?. name || "" ) . toLowerCase ( ) === "levilamina" ,
287309 ) ;
288310 } catch { }
289311
@@ -612,8 +634,10 @@ export const useLauncher = (args: any) => {
612634 useEffect ( ( ) => {
613635 if ( ! hasBackend ) return ;
614636 const timer = setTimeout ( ( ) => {
615- if ( ! __didCheckVcRuntime ) {
616- __didCheckVcRuntime = true ;
637+ if (
638+ ! hasSessionDependencyCheckRun ( DEPENDENCY_CHECK_SESSION_KEYS . vcRuntime )
639+ ) {
640+ markSessionDependencyCheckRun ( DEPENDENCY_CHECK_SESSION_KEYS . vcRuntime ) ;
617641 try {
618642 ( minecraft as any ) ?. IsVcRuntimeInstalled ?.( ) . then ( ( ok : boolean ) => {
619643 if ( ! ok ) {
@@ -622,8 +646,10 @@ export const useLauncher = (args: any) => {
622646 } ) ;
623647 } catch { }
624648 }
625- if ( ! __didCheckGameInput ) {
626- __didCheckGameInput = true ;
649+ if (
650+ ! hasSessionDependencyCheckRun ( DEPENDENCY_CHECK_SESSION_KEYS . gameInput )
651+ ) {
652+ markSessionDependencyCheckRun ( DEPENDENCY_CHECK_SESSION_KEYS . gameInput ) ;
627653 try {
628654 minecraft ?. IsGameInputInstalled ?.( ) . then ( ( ok : boolean ) => {
629655 if ( ! ok ) {
@@ -632,8 +658,14 @@ export const useLauncher = (args: any) => {
632658 } ) ;
633659 } catch { }
634660 }
635- if ( ! __didCheckGamingServices ) {
636- __didCheckGamingServices = true ;
661+ if (
662+ ! hasSessionDependencyCheckRun (
663+ DEPENDENCY_CHECK_SESSION_KEYS . gamingServices ,
664+ )
665+ ) {
666+ markSessionDependencyCheckRun (
667+ DEPENDENCY_CHECK_SESSION_KEYS . gamingServices ,
668+ ) ;
637669 try {
638670 const ig = String ( localStorage . getItem ( IGNORE_GS_KEY ) || "" ) === "1" ;
639671 if ( ! ig ) {
@@ -647,7 +679,12 @@ export const useLauncher = (args: any) => {
647679 }
648680 } , 0 ) ;
649681 return ( ) => clearTimeout ( timer ) ;
650- } , [ hasBackend , gameInputMissingDisclosure , gamingServicesMissingDisclosure ] ) ;
682+ } , [
683+ hasBackend ,
684+ gameInputMissingDisclosure ,
685+ gamingServicesMissingDisclosure ,
686+ vcRuntimeMissingDisclosure ,
687+ ] ) ;
651688
652689 useEffect ( ( ) => {
653690 const unlistenGiStart = Events . On ( "gameinput.ensure.start" , ( ) => {
@@ -1256,5 +1293,3 @@ export const useLauncher = (args: any) => {
12561293 handleGdkMissingGoSettings,
12571294 } ;
12581295} ;
1259-
1260-
0 commit comments