Permission Issue

merge-requests/133/head
Aamir Muhammad 3 years ago
parent 1f69ee262d
commit b152f8a6d6

@ -1201,18 +1201,14 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
} }
void startRecoding(BuildContext context) async { void startRecoding(BuildContext context) async {
await Permission.microphone.request().then((PermissionStatus status) async { await Permission.microphone.request().then((PermissionStatus status) {
if (Platform.isIOS) {
if (status.isPermanentlyDenied) { if (status.isPermanentlyDenied) {
Utils.confirmDialog( Utils.confirmDialog(
context, context,
"The app needs microphone access to be able to record audio.", "The app needs microphone access to be able to record audio.",
onTap: () { onTap: () {
openAppSettings().then((bool value) {
if (status.isGranted) {
Navigator.of(context).pop(); Navigator.of(context).pop();
} openAppSettings();
});
}, },
); );
} else if (status.isDenied) { } else if (status.isDenied) {
@ -1220,11 +1216,8 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
context, context,
"The app needs microphone access to be able to record audio.", "The app needs microphone access to be able to record audio.",
onTap: () { onTap: () {
openAppSettings().then((bool value) {
if (status.isGranted) {
Navigator.of(context).pop(); Navigator.of(context).pop();
} openAppSettings();
});
}, },
); );
} else if (status.isGranted) { } else if (status.isGranted) {
@ -1232,25 +1225,6 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
} else { } else {
startRecoding(context); startRecoding(context);
} }
} else {
if (status.isPermanentlyDenied) {
Utils.confirmDialog(
context,
"The app needs microphone access to be able to record audio.",
onTap: () {
openAppSettings().then((bool value) {
if (status.isGranted) {
Navigator.of(context).pop();
}
});
},
);
} else if (status.isGranted) {
sRecoding();
} else {
startRecoding(context);
}
}
}); });
} }

Loading…
Cancel
Save