fix: formatting
This commit is contained in:
+29
-58
@@ -13,9 +13,7 @@ class UpdateChecker {
|
||||
|
||||
_hasChecked = true;
|
||||
|
||||
final updater = AppUpdateUtil(
|
||||
serverUrl: "https://updater.brammie15.dev",
|
||||
);
|
||||
final updater = AppUpdateUtil(serverUrl: "https://updater.brammie15.dev");
|
||||
|
||||
try {
|
||||
final update = await updater.checkForUpdate();
|
||||
@@ -35,10 +33,7 @@ class UpdateChecker {
|
||||
}
|
||||
}
|
||||
|
||||
static void _showUpdateDialog(
|
||||
BuildContext context,
|
||||
UpdateInfo update,
|
||||
) {
|
||||
static void _showUpdateDialog(BuildContext context, UpdateInfo update) {
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: !update.mandatory,
|
||||
@@ -80,64 +75,40 @@ Future<void> _downloadAndInstall(UpdateInfo update) async {
|
||||
: "https://updater.brammie15.dev${update.download}";
|
||||
OtaUpdate()
|
||||
.execute(
|
||||
url,
|
||||
destinationFilename: "update.apk",
|
||||
sha256checksum: update.sha256,
|
||||
)
|
||||
.listen(
|
||||
(OtaEvent event) {
|
||||
url,
|
||||
destinationFilename: "update.apk",
|
||||
sha256checksum: update.sha256,
|
||||
)
|
||||
.listen((OtaEvent event) {
|
||||
debugPrint("OTA status: ${event.status}");
|
||||
|
||||
debugPrint(
|
||||
"OTA status: ${event.status}",
|
||||
);
|
||||
debugPrint("OTA value: ${event.value}");
|
||||
|
||||
debugPrint(
|
||||
"OTA value: ${event.value}",
|
||||
);
|
||||
switch (event.status) {
|
||||
case OtaStatus.DOWNLOADING:
|
||||
final progress = double.tryParse(event.value ?? "0") ?? 0;
|
||||
|
||||
switch(event.status) {
|
||||
debugPrint("Downloading ${progress.toStringAsFixed(0)}%");
|
||||
|
||||
case OtaStatus.DOWNLOADING:
|
||||
final progress =
|
||||
double.tryParse(event.value ?? "0") ?? 0;
|
||||
break;
|
||||
|
||||
debugPrint(
|
||||
"Downloading ${progress.toStringAsFixed(0)}%",
|
||||
);
|
||||
case OtaStatus.INSTALLING:
|
||||
debugPrint("Installing update");
|
||||
break;
|
||||
|
||||
break;
|
||||
case OtaStatus.INSTALLATION_ERROR:
|
||||
debugPrint("Installation error: ${event.value}");
|
||||
break;
|
||||
|
||||
case OtaStatus.DOWNLOAD_ERROR:
|
||||
debugPrint("Download error: ${event.value}");
|
||||
break;
|
||||
|
||||
case OtaStatus.INSTALLING:
|
||||
debugPrint(
|
||||
"Installing update",
|
||||
);
|
||||
break;
|
||||
|
||||
|
||||
case OtaStatus.INSTALLATION_ERROR:
|
||||
debugPrint(
|
||||
"Installation error: ${event.value}",
|
||||
);
|
||||
break;
|
||||
|
||||
|
||||
case OtaStatus.DOWNLOAD_ERROR:
|
||||
debugPrint(
|
||||
"Download error: ${event.value}",
|
||||
);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
debugPrint(
|
||||
"OTA update failed: $e",
|
||||
);
|
||||
debugPrint("OTA update failed: $e");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user