onCameraClick method
dynamic
onCameraClick()
Implementation
onCameraClick() async {
if (!availableFeatures.value.isImageAttachmentAvailable.checkNull() &&
!availableFeatures.value.isVideoAttachmentAvailable.checkNull()) {
DialogUtils.showFeatureUnavailable();
return;
}
// if (await AppPermission.askFileCameraAudioPermission()) {
var cameraPermissionStatus = await AppPermission.checkAndRequestPermissions(
permissions: [Permission.camera, Permission.microphone]
..addIf(Platform.isAndroid, Permission.notification),
permissionIcon: cameraPermission,
permissionContent: getTranslated("cameraPermissionContent"),
permissionPermanentlyDeniedContent:
getTranslated("cameraCapturePermanentlyDeniedContent"));
debugPrint("Camera Permission Status---> $cameraPermissionStatus");
if (cameraPermissionStatus) {
setOnGoingUserGone();
NavUtils.toNamed(Routes.cameraPick)?.then((photo) {
photo as XFile?;
if (photo != null) {
LogMessage.d("photo", photo.name.toString());
LogMessage.d("caption text sending-->", messageController.text);
var file = PickedAssetModel(
path: photo.path,
type: !photo.name.endsWith(".mp4") ? "image" : "video",
file: File(photo.path));
NavUtils.toNamed(Routes.mediaPreview, arguments: {
"filePath": [file],
"userName": profile.name!,
'profile': profile,
'caption': messageController.text.trim(),
'showAdd': false,
'from': 'camera_pick',
'userJid': profile.jid
})?.then((value) => setOnGoingUserAvail());
} else {
setOnGoingUserAvail();
}
});
}
}