FINALLY FIXED AUTO UPDATE

This commit is contained in:
Kima
2023-09-04 23:13:54 +02:00
parent 8feea02f68
commit fceb4e050f
2 changed files with 5 additions and 9 deletions

View File

@@ -25,14 +25,9 @@ extension UpdateHelper on Release {
if (!await apk.exists()) {
updateCallback(-1, UpdateState.downloading);
var storagePerms = await Permission.storage.request().isGranted;
if (storagePerms) {
var bytes = await download(updateCallback: updateCallback);
if (!await StorageHelper.write(apk.path, bytes)) {
throw "failed to write apk: permission denied";
}
} else {
throw storagePerms;
var bytes = await download(updateCallback: updateCallback);
if (!await StorageHelper.write(apk.path, bytes)) {
throw "failed to write apk: permission denied";
}
}