Permission Issue

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

@ -1201,19 +1201,18 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
} }
void startRecoding(BuildContext context) async { void startRecoding(BuildContext context) async {
// if (await Permission.microphone.request().isGranted) { await Permission.microphone.request().then((PermissionStatus status) async {
// sRecoding(); if (Platform.isIOS) {
// } else {
// Utils.showToast("Permission Issue");
// openAppSettings();
// }
await Permission.microphone.request().then((PermissionStatus status) {
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(); openAppSettings().then((bool value) {
if (status.isGranted) {
Navigator.of(context).pop();
}
});
}, },
); );
} else if (status.isDenied) { } else if (status.isDenied) {
@ -1221,7 +1220,29 @@ 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(); openAppSettings().then((bool value) {
if (status.isGranted) {
Navigator.of(context).pop();
}
});
},
);
} else if (status.isGranted) {
sRecoding();
} else {
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) { } else if (status.isGranted) {
@ -1229,19 +1250,10 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
} else { } else {
startRecoding(context); startRecoding(context);
} }
}
}); });
} }
// else {
// isVoiceMsg = true;
// recorderController.reset();
// await recorderController.record(path);
// _recodeDuration = 0;
// _startTimer();
// isRecoding = !isRecoding;
// notifyListeners();
// }
void sRecoding() async { void sRecoding() async {
isVoiceMsg = true; isVoiceMsg = true;
recorderController.reset(); recorderController.reset();

Loading…
Cancel
Save