From 7dee7a56b9005db1a329ab054f9ca804f97d5d41 Mon Sep 17 00:00:00 2001 From: jefry Date: Tue, 2 Aug 2022 00:17:14 +0700 Subject: [PATCH] ver.5 finish backup_restore --- android/app/src/main/AndroidManifest.xml | 7 +++--- lib/home.dart | 11 ++++++++- pubspec.lock | 42 ++++++++++++++++++++++++++++++++ pubspec.yaml | 3 ++- 4 files changed, 58 insertions(+), 5 deletions(-) diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 4a13f86..890041c 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -6,9 +6,10 @@ additional functionality it is fine to subclass or reimplement FlutterApplication and put your custom class here. --> - - - + + + { super.initState(); WidgetsBinding.instance.addPostFrameCallback((_) async { // await loadMenu(); - await util.permissionCheck(context,pHandler.Permission.manageExternalStorage,()async{print("storage permit granted!");},customMessage: " untuk menyimpan data backup"); + final androidVersion = await DeviceInfoPlugin().androidInfo; + if ((androidVersion.version.sdkInt ?? 0) >= 30) { + await util.permissionCheck(context,pHandler.Permission.manageExternalStorage,()async{print("storage permit granted!");},customMessage: " untuk menyimpan data backup"); + } else { + await util.permissionCheck(context,pHandler.Permission.storage,()async{print("storage permit granted!");},customMessage: " untuk menyimpan data backup"); + } }); } @@ -545,6 +553,7 @@ class _HomeState extends State { builder: (context)=>AlertDialog( title: Text('Sender'), content: TextField( + inputFormatters: [FilteringTextInputFormatter.allow(RegExp("[a-zA-Z0-9 ]"))], controller: sendingUser, ), actions: [ diff --git a/pubspec.lock b/pubspec.lock index 63ca6d9..96c3288 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -85,6 +85,48 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.5" + device_info_plus: + dependency: "direct main" + description: + name: device_info_plus + url: "https://pub.dartlang.org" + source: hosted + version: "4.0.1" + device_info_plus_linux: + dependency: transitive + description: + name: device_info_plus_linux + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.1" + device_info_plus_macos: + dependency: transitive + description: + name: device_info_plus_macos + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.3" + device_info_plus_platform_interface: + dependency: transitive + description: + name: device_info_plus_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.3.0+1" + device_info_plus_web: + dependency: transitive + description: + name: device_info_plus_web + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0" + device_info_plus_windows: + dependency: transitive + description: + name: device_info_plus_windows + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.1" fake_async: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 2736da1..d9c4b99 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -13,7 +13,7 @@ description: Application to check assets # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.0.3+4 +version: 1.0.3+5 environment: sdk: ">=2.7.0 <3.0.0" @@ -34,6 +34,7 @@ dependencies: # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.5 permission_handler: ^9.2.0 + device_info_plus: ^4.0.1 dev_dependencies: flutter_launcher_icons: