Skip to content

Commit

Permalink
fix: cache init
Browse files Browse the repository at this point in the history
  • Loading branch information
Arenukvern committed May 4, 2024
1 parent db833e9 commit be67570
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/pack_core/global_states/global_game/global_game_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -296,12 +296,18 @@ class GlobalGameBloc extends Cubit<GlobalGameBlocState> {
status: LevelStateStatus.loading,
);
await _globalLevelLoadCompleter!.future;
if (dto.levelBloc.featuresSettings.isTechnologiesEnabled) {
Future<void> runCache() async {
final shouldUseServer = dto.onlineStatusService.isConnected &&
dto.wbwDictionary.repository.isAllowedToUseRemote;
if (!shouldUseServer) {
await dto.wbwDictionary.loadAndCache();
if (!shouldUseServer) await dto.wbwDictionary.loadAndCache();
}

if (DeviceRuntimeType.isWeb) {
if (dto.levelBloc.featuresSettings.isTechnologiesEnabled) {
await runCache();
}
} else {
await runCache();
}
dto.statesStatusesCubit.onChangeLevelStateStatus(
status: LevelStateStatus.playing,
Expand Down

0 comments on commit be67570

Please sign in to comment.