diff --git a/filcnaplo/android/app/src/main/AndroidManifest.xml b/filcnaplo/android/app/src/main/AndroidManifest.xml index 2877685..1a19772 100644 --- a/filcnaplo/android/app/src/main/AndroidManifest.xml +++ b/filcnaplo/android/app/src/main/AndroidManifest.xml @@ -62,6 +62,7 @@ + diff --git a/filcnaplo/lib/helpers/update_helper.dart b/filcnaplo/lib/helpers/update_helper.dart index 2199124..5aec576 100644 --- a/filcnaplo/lib/helpers/update_helper.dart +++ b/filcnaplo/lib/helpers/update_helper.dart @@ -6,6 +6,7 @@ import 'package:filcnaplo/api/client.dart'; import 'package:filcnaplo/helpers/storage_helper.dart'; import 'package:filcnaplo/models/release.dart'; import 'package:open_file/open_file.dart'; +import 'package:permission_handler/permission_handler.dart'; enum UpdateState { none, preparing, downloading, installing } @@ -32,12 +33,17 @@ extension UpdateHelper on Release { updateCallback(-1, UpdateState.installing); - var result = await OpenFile.open(apk.path); + var permStatus = + (await Permission.manageExternalStorage.request().isGranted && + await Permission.requestInstallPackages.request().isGranted); + if (permStatus) { + var result = await OpenFile.open(apk.path); - if (result.type != ResultType.done) { - // ignore: avoid_print - print("ERROR: installUpdate.openFile: ${result.message}"); - throw result.message; + if (result.type != ResultType.done) { + // ignore: avoid_print + print("ERROR: installUpdate.openFile: ${result.message}"); + throw result.message; + } } updateCallback(-1, UpdateState.none); diff --git a/filcnaplo/pubspec.yaml b/filcnaplo/pubspec.yaml index 3e9cbc2..183792a 100644 --- a/filcnaplo/pubspec.yaml +++ b/filcnaplo/pubspec.yaml @@ -3,7 +3,7 @@ description: "Nem hivatalos e-napló alkalmazás az e-Kréta rendszerhez" homepage: https://refilc.hu publish_to: "none" -version: 4.1.1+215 +version: 4.1.1+216 environment: sdk: ">=2.17.0 <3.0.0"