更新文件
This commit is contained in:
parent
8cae1ffd7d
commit
aad1c8d82f
|
|
@ -1,7 +1,19 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<manifest xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<uses-permission android:name="android.permission.READ_CALL_LOG" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<!-- read permissions for external storage -->
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<!-- installation package permissions -->
|
||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||
<!-- write permissions for external storage -->
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<!-- Install/delete permissions, only granted to system apps -->
|
||||
<uses-permission android:name="android.permission.INSTALL_PACKAGES"
|
||||
tools:ignore="ProtectedPermissions" />
|
||||
<uses-permission android:name="android.permission.DELETE_PACKAGES"
|
||||
tools:ignore="ProtectedPermissions" />
|
||||
|
||||
<application
|
||||
android:label="银收客订餐"
|
||||
|
|
@ -34,6 +46,17 @@
|
|||
<meta-data
|
||||
android:name="flutterEmbedding"
|
||||
android:value="2" />
|
||||
|
||||
<!-- Provider -->
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="${applicationId}.fileProvider"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/file_paths" />
|
||||
</provider>
|
||||
</application>
|
||||
<!-- Required to query activities that can process text, see:
|
||||
https://developer.android.com/training/package-visibility and
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<paths>
|
||||
<external-path path="Android/data/com.czg.cashier_reserve/" name="files_root" />
|
||||
<external-path path="." name="external_storage_root" />
|
||||
</paths>
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
import 'package:cashier_reserve/common/print/print.dart';
|
||||
import 'package:cashier_reserve/data_model/version/update_version_model.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_app_installer/flutter_app_installer.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:percent_indicator/percent_indicator.dart';
|
||||
|
||||
|
|
@ -198,13 +198,13 @@ class _UpdateVersionViewState extends State<UpdateVersionView> {
|
|||
progressText = "${(currentProgress * 100).toStringAsFixed(2)}%";
|
||||
progress = double.parse(currentProgress.toStringAsFixed(2));
|
||||
});
|
||||
yjPrint(progress);
|
||||
|
||||
_cancelToken = null;
|
||||
yjPrint(progressText);
|
||||
}
|
||||
}, cancelToken: _cancelToken);
|
||||
|
||||
yjPrint("文件下载成功");
|
||||
_cancelToken = null;
|
||||
installApk("$savePath$appName");
|
||||
} catch (e) {
|
||||
yjPrint("文件下载失败:$e");
|
||||
}
|
||||
|
|
@ -214,4 +214,11 @@ class _UpdateVersionViewState extends State<UpdateVersionView> {
|
|||
final directory = await getExternalStorageDirectory();
|
||||
return directory?.path ?? '';
|
||||
}
|
||||
|
||||
installApk(String apkPath) async {
|
||||
final FlutterAppInstaller flutterAppInstaller = FlutterAppInstaller();
|
||||
flutterAppInstaller.installApk(
|
||||
filePath: apkPath,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -219,6 +219,14 @@ packages:
|
|||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_app_installer:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_app_installer
|
||||
sha256: b71f7c3f6c5712b6f9bdcde798bbb8a0c4047cab47c4364f7252de8c95d67358
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
flutter_cache_manager:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ dependencies:
|
|||
url_launcher: ^6.3.1
|
||||
easy_refresh: ^3.4.0
|
||||
package_info_plus: ^8.1.1
|
||||
flutter_app_installer: ^1.0.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
|
|
|||
Loading…
Reference in New Issue