onGalleryClick method

dynamic onGalleryClick()

Implementation

onGalleryClick() async {
  if (!availableFeatures.value.isImageAttachmentAvailable.checkNull() &&
      !availableFeatures.value.isVideoAttachmentAvailable.checkNull()) {
    DialogUtils.showFeatureUnavailable();
    return;
  }
  var permissions = await AppPermission.getGalleryAccessPermissions();
  var permission = await AppPermission.checkAndRequestPermissions(
      permissions: permissions,
      permissionIcon: filePermission,
      permissionContent: getTranslated("filePermissionContent"),
      permissionPermanentlyDeniedContent:
          getTranslated("storagePermissionDeniedContent"));
  if (permission) {
    try {
      setOnGoingUserGone();
      NavUtils.toNamed(Routes.galleryPicker, arguments: {
        "userName": getName(profile),
        'profile': profile,
        'caption': messageController.text.trim(),
        'userJid': profile.jid
      })?.then((value) => setOnGoingUserAvail());
    } catch (e) {
      debugPrint(e.toString());
    }
  }
}