Permission Issue

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

@ -1201,55 +1201,29 @@ 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: () { Navigator.of(context).pop();
openAppSettings().then((bool value) { openAppSettings();
if (status.isGranted) { },
Navigator.of(context).pop(); );
} } else if (status.isDenied) {
}); Utils.confirmDialog(
}, context,
); "The app needs microphone access to be able to record audio.",
} else if (status.isDenied) { onTap: () {
Utils.confirmDialog( Navigator.of(context).pop();
context, openAppSettings();
"The app needs microphone access to be able to record audio.", },
onTap: () { );
openAppSettings().then((bool value) { } else if (status.isGranted) {
if (status.isGranted) { sRecoding();
Navigator.of(context).pop();
}
});
},
);
} else if (status.isGranted) {
sRecoding();
} else {
startRecoding(context);
}
} else { } else {
if (status.isPermanentlyDenied) { startRecoding(context);
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