mirror of
https://github.com/Auties00/Reboot-Launcher.git
synced 2026-01-13 11:12:23 +01:00
decoupled business logic from ui
This commit is contained in:
@@ -5,9 +5,10 @@ import 'package:html/parser.dart' show parse;
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:process_run/shell.dart';
|
||||
import 'package:reboot_launcher/src/model/fortnite_build.dart';
|
||||
import 'package:reboot_launcher/src/util/binary.dart';
|
||||
import 'package:reboot_launcher/src/util/version.dart' as parser;
|
||||
|
||||
import 'os.dart';
|
||||
|
||||
const _userAgent =
|
||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36";
|
||||
|
||||
@@ -80,13 +81,13 @@ Future<List<FortniteBuild>> _fetchManifests() async {
|
||||
}
|
||||
|
||||
Future<Process> downloadManifestBuild(
|
||||
String manifestUrl, String destination, Function(double) onProgress) async {
|
||||
String manifestUrl, String destination, Function(double, String) onProgress) async {
|
||||
var buildExe = await loadBinary("build.exe", false);
|
||||
var process = await Process.start(buildExe.path, [manifestUrl, destination]);
|
||||
|
||||
process.errLines
|
||||
.where((message) => message.contains("%"))
|
||||
.forEach((message) => onProgress(double.parse(message.split("%")[0])));
|
||||
.forEach((message) => onProgress(double.parse(message.split("%")[0]), message.substring(message.indexOf(" ") + 1)));
|
||||
|
||||
return process;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user