Browse Source

[fix]调整ios录音权限流程

Destiny 1 year ago
parent
commit
f17351bb19
1 changed files with 17 additions and 9 deletions
  1. 17 9
      lib/module/record/record_handler.dart

+ 17 - 9
lib/module/record/record_handler.dart

@@ -238,18 +238,26 @@ class RecordHandler {
   }
 
   Future<void> startOrContinueRecord() async {
-    var isGranted = await Permission.microphone.status;
-    if (isGranted == PermissionStatus.granted) {
-      await Permission.microphone.request();
-    } else {
-      bool isAllow = await _showRequestPermissionDialog();
-      if (isAllow) {
-        var status = await Permission.microphone.request();
-        if (status != PermissionStatus.granted) {
+    if (GetPlatform.isAndroid) {
+      var isGranted = await Permission.microphone.status;
+      if (isGranted == PermissionStatus.granted) {
+        await Permission.microphone.request();
+      } else {
+        bool isAllow = await _showRequestPermissionDialog();
+        if (isAllow) {
+          var status = await Permission.microphone.request();
+          if (status != PermissionStatus.granted) {
+            _onRecordPermissionDenied();
+            return;
+          }
+        } else {
           _onRecordPermissionDenied();
           return;
         }
-      } else {
+      }
+    } else {
+      var status = await Permission.microphone.request();
+      if (status != PermissionStatus.granted) {
         _onRecordPermissionDenied();
         return;
       }