Permission Issue

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

@ -1201,47 +1201,59 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
}
void startRecoding(BuildContext context) async {
// if (await Permission.microphone.request().isGranted) {
// sRecoding();
// } else {
// Utils.showToast("Permission Issue");
// openAppSettings();
// }
await Permission.microphone.request().then((PermissionStatus status) {
if (status.isPermanentlyDenied) {
Utils.confirmDialog(
context,
"The app needs microphone access to be able to record audio.",
onTap: () {
openAppSettings();
},
);
} else if (status.isDenied) {
Utils.confirmDialog(
context,
"The app needs microphone access to be able to record audio.",
onTap: () {
openAppSettings();
},
);
} else if (status.isGranted) {
sRecoding();
await Permission.microphone.request().then((PermissionStatus status) async {
if (Platform.isIOS) {
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.isDenied) {
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);
}
} else {
startRecoding(context);
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);
}
}
});
}
// else {
// isVoiceMsg = true;
// recorderController.reset();
// await recorderController.record(path);
// _recodeDuration = 0;
// _startTimer();
// isRecoding = !isRecoding;
// notifyListeners();
// }
void sRecoding() async {
isVoiceMsg = true;
recorderController.reset();

Loading…
Cancel
Save