4 Commits 17ec3b9d6f ... 08c8eaaf89

Author SHA1 Message Date
  gjh 08c8eaaf89 1.0.7版本 1 week ago
  gjh c11688c0af 文件删除逻辑优化 1 week ago
  gjh 3b2c71c928 去掉对armeabi-v7a的支持 1 week ago
  gjh cc8127e7b4 申请位置权限时增加弹窗提示权限的作用 1 week ago

+ 1 - 1
android/app/build.gradle

@@ -38,7 +38,7 @@ android {
38 38
 
39 39
         ndk {
40 40
             //noinspection ChromeOsAbiSupport
41
-            abiFilters "armeabi-v7a", "arm64-v8a"
41
+            abiFilters /*"armeabi-v7a",*/ "arm64-v8a"
42 42
         }
43 43
     }
44 44
 

+ 6 - 4
android/app/src/main/java/com/eitchsyh/instrument/eitc_erm_dental_flutter/FileController.java

@@ -284,11 +284,12 @@ public class FileController implements MethodChannel.MethodCallHandler
284 284
                                 .getContentResolver()
285 285
                                 .delete(uri, null, null);
286 286
                         Log.d(TAG, "删除的数量=" + deleted);
287
-                        if (deleted <= 0)
287
+                        //有些设备即便删除成功了也会返回0,所以去掉判断
288
+                        /*if (deleted <= 0)
288 289
                         {
289 290
                             result.error("304", "删除失败", new Exception("删除失败"));
290 291
                             return;
291
-                        }
292
+                        }*/
292 293
                         result.success(null);
293 294
                     }
294 295
                     //捕获权限异常,请求权限
@@ -351,14 +352,15 @@ public class FileController implements MethodChannel.MethodCallHandler
351 352
                         .getContentResolver()
352 353
                         .delete(uri, null, null);
353 354
                 Log.d(TAG, "删除的数量=" + deleted);
354
-                if (deleted <= 0)
355
+                //有些设备即便删除成功了也会返回0,所以去掉判断
356
+                /*if (deleted <= 0)
355 357
                 {
356 358
                     if (result != null)
357 359
                     {
358 360
                         result.error("304", "删除失败", new Exception("删除失败"));
359 361
                     }
360 362
                     return;
361
-                }
363
+                }*/
362 364
                 if (result != null)
363 365
                 {
364 366
                     result.success(null);

+ 24 - 4
lib/funcs.dart

@@ -20,6 +20,7 @@ import 'package:flutter/foundation.dart';
20 20
 import 'package:flutter/material.dart';
21 21
 import 'package:flutter/services.dart';
22 22
 import 'package:flutter_riverpod/flutter_riverpod.dart';
23
+import 'package:flutter_screenutil/flutter_screenutil.dart';
23 24
 import 'package:logger/logger.dart';
24 25
 import 'package:network_info_plus/network_info_plus.dart';
25 26
 import 'package:package_info_plus/package_info_plus.dart';
@@ -287,10 +288,29 @@ Future<String?> getWifiName() async {
287 288
       logd("读取wifi名称没有位置权限且已经请求过位置权限");
288 289
       return null;
289 290
     }
290
-    logd("请求位置权限");
291
-    PermissionStatus status = await Permission.locationWhenInUse.request();
292
-    await SpUtil.setLocationPermissionRequested(true);
293
-    hasLocationPermission = status == PermissionStatus.granted;
291
+    if (navigatorKey.currentState!.mounted) {
292
+      logd("弹窗提示要请求位置权限");
293
+      await showDialog(
294
+          context: navigatorKey.currentState!.context,
295
+          builder: (ctx) {
296
+            return AlertDialog(
297
+              title: Text(getS().hint),
298
+              content: Text(getS().requestLocationHint),
299
+              actions: [
300
+                TextButton(
301
+                    onPressed: () =>
302
+                        Navigator.of(navigatorKey.currentState!.context).pop(),
303
+                    child: Text(getS().confirm))
304
+              ],
305
+              shape: RoundedRectangleBorder(
306
+                  borderRadius: BorderRadius.circular(15.r)),
307
+            );
308
+          });
309
+      logd("请求位置权限");
310
+      PermissionStatus status = await Permission.locationWhenInUse.request();
311
+      await SpUtil.setLocationPermissionRequested(true);
312
+      hasLocationPermission = status == PermissionStatus.granted;
313
+    }
294 314
   }
295 315
   if (!hasLocationPermission) {
296 316
     logd("读取wifi名称没有位置权限");

+ 2 - 0
lib/generated/intl/messages_en.dart

@@ -224,6 +224,8 @@ class MessageLookup extends MessageLookupByLibrary {
224 224
             MessageLookupByLibrary.simpleMessage("Request a cancellation"),
225 225
         "requestGrammarError":
226 226
             MessageLookupByLibrary.simpleMessage("Request syntax error"),
227
+        "requestLocationHint": MessageLookupByLibrary.simpleMessage(
228
+            "Since the application companion instrument uses WiFi connection, you need to judge whether you have connected to the WiFi of the instrument through the location permission, and request your location permission, please click Allow in the next pop-up window."),
227 229
         "requestMethodBanned": MessageLookupByLibrary.simpleMessage(
228 230
             "The request method is prohibited"),
229 231
         "requestResourceExist": MessageLookupByLibrary.simpleMessage(

+ 2 - 0
lib/generated/intl/messages_zh.dart

@@ -178,6 +178,8 @@ class MessageLookup extends MessageLookupByLibrary {
178 178
         "relation": MessageLookupByLibrary.simpleMessage("关系"),
179 179
         "requestCancel": MessageLookupByLibrary.simpleMessage("请求取消"),
180 180
         "requestGrammarError": MessageLookupByLibrary.simpleMessage("请求语法错误"),
181
+        "requestLocationHint": MessageLookupByLibrary.simpleMessage(
182
+            "因应用配套仪器使用WiFi连接,需通过位置权限判断您是否已连接仪器WiFi,请求获取您的位置权限,请在下个弹窗中点击允许。"),
181 183
         "requestMethodBanned": MessageLookupByLibrary.simpleMessage("请求方法被禁止"),
182 184
         "requestResourceExist": MessageLookupByLibrary.simpleMessage("请求资源不存在"),
183 185
         "requestTimeout": MessageLookupByLibrary.simpleMessage("请求超时"),

+ 10 - 0
lib/generated/l10n.dart

@@ -1779,6 +1779,16 @@ class S {
1779 1779
       args: [],
1780 1780
     );
1781 1781
   }
1782
+
1783
+  /// `Since the application companion instrument uses WiFi connection, you need to judge whether you have connected to the WiFi of the instrument through the location permission, and request your location permission, please click Allow in the next pop-up window.`
1784
+  String get requestLocationHint {
1785
+    return Intl.message(
1786
+      'Since the application companion instrument uses WiFi connection, you need to judge whether you have connected to the WiFi of the instrument through the location permission, and request your location permission, please click Allow in the next pop-up window.',
1787
+      name: 'requestLocationHint',
1788
+      desc: '',
1789
+      args: [],
1790
+    );
1791
+  }
1782 1792
 }
1783 1793
 
1784 1794
 class AppLocalizationDelegate extends LocalizationsDelegate<S> {

+ 2 - 1
lib/l10n/intl_en.arb

@@ -171,5 +171,6 @@
171 171
   "permissionDescDialogTitle": "User Agreement and Privacy Policy Reminder",
172 172
   "permissionDescDialogContent": "Welcome to {appName}!\n\nWe have formulated the User Agreement and Privacy Policy in accordance with relevant laws to help you understand how we collect, store and use your personal information. \n\nBased on your express authorization, we may call your device permissions, and you have the right to refuse or cancel the authorization, please refer to the \"Permission Description\" for specific permission acquisition",
173 173
   "read": "Read",
174
-  "agreeContinue": "Agree"
174
+  "agreeContinue": "Agree",
175
+  "requestLocationHint": "Since the application companion instrument uses WiFi connection, you need to judge whether you have connected to the WiFi of the instrument through the location permission, and request your location permission, please click Allow in the next pop-up window."
175 176
 }

+ 2 - 1
lib/l10n/intl_zh.arb

@@ -171,5 +171,6 @@
171 171
   "permissionDescDialogTitle": "用户协议及隐私政策提示",
172 172
   "permissionDescDialogContent": "欢迎使用{appName}!\n\n我们根据相关法律制定了《用户协议》和《隐私政策》,帮助您了解我们如何收集、保存、使用您的个人信息,请您在同意之前仔细阅读并充分理解相关条款。\n\n基于您的明示授权,我们将可能调用您的设备权限,您有权拒绝或取消授权,具体权限获取情况详见《权限说明》",
173 173
   "read": "阅读",
174
-  "agreeContinue": "同意并继续"
174
+  "agreeContinue": "同意并继续",
175
+  "requestLocationHint": "因应用配套仪器使用WiFi连接,需通过位置权限判断您是否已连接仪器WiFi,请求获取您的位置权限,请在下个弹窗中点击允许。"
175 176
 }

+ 6 - 6
lib/pages/history/vm/history_view_model.dart

@@ -77,9 +77,9 @@ class HistoryList extends _$HistoryList {
77 77
       return false;
78 78
     }
79 79
     bool isSuccess = true;
80
-    try {
81
-      var stream = Stream.fromIterable(list);
82
-      await for (HistoryItemInfo info in stream) {
80
+    var stream = Stream.fromIterable(list);
81
+    await for (HistoryItemInfo info in stream) {
82
+      try {
83 83
         logd("历史记录删除文件${info.path}");
84 84
         await fileChannel.invokeMethod("deleteFile", info.path);
85 85
         if (info.type == 0) {
@@ -87,10 +87,10 @@ class HistoryList extends _$HistoryList {
87 87
         } else {
88 88
           state.value!.videoList.remove(info);
89 89
         }
90
+      } catch (e) {
91
+        loge("删除单个历史文件异常", error: e);
92
+        isSuccess = false;
90 93
       }
91
-    } catch (e) {
92
-      loge("历史记录页面批量删除异常", error: e);
93
-      isSuccess = false;
94 94
     }
95 95
     ref.notifyListeners();
96 96
     ref.invalidate(historySelectedCountProvider);

+ 1 - 1
pubspec.yaml

@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
16 16
 # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
17 17
 # In Windows, build-name is used as the major, minor, and patch parts
18 18
 # of the product and file versions while build-number is used as the build suffix.
19
-version: 1.0.6+7
19
+version: 1.0.7+8
20 20
 
21 21
 environment:
22 22
   sdk: ^3.5.1