MCSI-2 Browse installing directory #19

Merged
squid merged 5 commits from MCSI-2_browse_installing_path into main 2025-07-10 22:38:48 +08:00
2 changed files with 8 additions and 4 deletions
Showing only changes of commit 3719023cf9 - Show all commits

View File

@ -50,6 +50,6 @@ class _BasicConfigurationTabState extends State<BasicConfigurationTab> {
} }
void _downloadServerFile() { void _downloadServerFile() {
context.read<VanillaBloc>().add(VanillaServerFileDownloadedEvent()); context.read<VanillaBloc>().add(VanillaServerFileDownloadedEvent('.'));
} }
} }

View File

@ -28,7 +28,7 @@ class VanillaBloc extends Bloc<VanillaEvent, VanillaState> {
emit(state.copyWith(selectedGameVersion: event.gameVersion)); emit(state.copyWith(selectedGameVersion: event.gameVersion));
}); });
on<VanillaServerFileDownloadedEvent>((_, emit) async { on<VanillaServerFileDownloadedEvent>((event, emit) async {
final gameVersion = state.selectedGameVersion; final gameVersion = state.selectedGameVersion;
if (gameVersion == null) { if (gameVersion == null) {
return; return;
@ -37,7 +37,7 @@ class VanillaBloc extends Bloc<VanillaEvent, VanillaState> {
emit(state.copyWith(isLocked: true)); emit(state.copyWith(isLocked: true));
await _downloadServerFileUseCase( await _downloadServerFileUseCase(
gameVersion.toEntity(), gameVersion.toEntity(),
path.join('.', Constants.serverFileName), path.join(event.savePath, Constants.serverFileName),
onProgressChanged: (progress) => add(_VanillaDownloadProgressChangedEvent(progress)), onProgressChanged: (progress) => add(_VanillaDownloadProgressChangedEvent(progress)),
); );
emit(state.copyWith(isLocked: false)); emit(state.copyWith(isLocked: false));
@ -65,7 +65,11 @@ class VanillaGameVersionSelectedEvent extends VanillaEvent {
VanillaGameVersionSelectedEvent(this.gameVersion); VanillaGameVersionSelectedEvent(this.gameVersion);
} }
class VanillaServerFileDownloadedEvent extends VanillaEvent {} class VanillaServerFileDownloadedEvent extends VanillaEvent {
final String savePath;
VanillaServerFileDownloadedEvent(this.savePath);
}
class _VanillaDownloadProgressChangedEvent extends VanillaEvent { class _VanillaDownloadProgressChangedEvent extends VanillaEvent {
final double progress; final double progress;