|
@@ -6,11 +6,11 @@ import 'package:eitc_erm_dental_flutter/funcs.dart';
|
6
|
import 'package:eitc_erm_dental_flutter/widget/custom_divider.dart';
|
6
|
import 'package:eitc_erm_dental_flutter/widget/custom_divider.dart';
|
7
|
import 'package:eitc_erm_dental_flutter/widget/main_button.dart';
|
7
|
import 'package:eitc_erm_dental_flutter/widget/main_button.dart';
|
8
|
import 'package:flutter/material.dart';
|
8
|
import 'package:flutter/material.dart';
|
9
|
-import 'package:flutter/services.dart';
|
|
|
10
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
9
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
11
|
import 'package:package_info_plus/package_info_plus.dart';
|
10
|
import 'package:package_info_plus/package_info_plus.dart';
|
12
|
import 'package:path_provider/path_provider.dart';
|
11
|
import 'package:path_provider/path_provider.dart';
|
13
|
import 'package:percent_indicator/percent_indicator.dart' as pi;
|
12
|
import 'package:percent_indicator/percent_indicator.dart' as pi;
|
|
|
13
|
+import 'package:permission_handler/permission_handler.dart';
|
14
|
|
14
|
|
15
|
import '../global.dart';
|
15
|
import '../global.dart';
|
16
|
import '../http/http.dart';
|
16
|
import '../http/http.dart';
|
|
@@ -282,7 +282,14 @@ class _AppUpdateDialogState extends State<AppUpdateDialog> {
|
282
|
}
|
282
|
}
|
283
|
|
283
|
|
284
|
///安装apk
|
284
|
///安装apk
|
285
|
- void _installApk() {
|
|
|
|
|
285
|
+ void _installApk() async {
|
|
|
286
|
+ if (!await Permission.requestInstallPackages.isGranted) {
|
|
|
287
|
+ logd("app更新,没有安装apk权限,进行申请");
|
|
|
288
|
+ if (!await Permission.requestInstallPackages.request().isGranted) {
|
|
|
289
|
+ logd("app更新,申请安装apk权限被拒绝,终止安装");
|
|
|
290
|
+ return;
|
|
|
291
|
+ }
|
|
|
292
|
+ }
|
286
|
logd("app更新,安装apk,path=$_filePath");
|
293
|
logd("app更新,安装apk,path=$_filePath");
|
287
|
AppInstaller.installApk(_filePath);
|
294
|
AppInstaller.installApk(_filePath);
|
288
|
}
|
295
|
}
|