MCSI-2 Browse installing directory #19
@ -50,6 +50,6 @@ class _BasicConfigurationTabState extends State<BasicConfigurationTab> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _downloadServerFile() {
|
void _downloadServerFile() {
|
||||||
context.read<VanillaBloc>().add(VanillaServerFileDownloadedEvent());
|
context.read<VanillaBloc>().add(VanillaServerFileDownloadedEvent('.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user