From 57f1ed62b50c32f0f4c80d4de027ff16a2519d66 Mon Sep 17 00:00:00 2001 From: xmflsct Date: Sat, 14 Jan 2023 16:20:37 +0100 Subject: [PATCH] Fix #657 No need for Android, as if permission was denied last time, the next time when requesting, permission would be checked again. --- src/screens/ImageViewer/save.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/screens/ImageViewer/save.ts b/src/screens/ImageViewer/save.ts index 4fbeffef..8936ebf8 100644 --- a/src/screens/ImageViewer/save.ts +++ b/src/screens/ImageViewer/save.ts @@ -4,7 +4,7 @@ import { CameraRoll } from '@react-native-camera-roll/camera-roll' import { RootStackParamList } from '@utils/navigation/navigators' import * as FileSystem from 'expo-file-system' import i18next from 'i18next' -import { PermissionsAndroid, Platform } from 'react-native' +import { Linking, PermissionsAndroid, Platform } from 'react-native' type CommonProps = { image: RootStackParamList['Screen-ImagesViewer']['imageUrls'][0] @@ -19,7 +19,11 @@ const saveIos = async ({ image }: CommonProps) => { message: i18next.t('screenImageViewer:content.save.succeed') }) }) - .catch(() => { + .catch(err => { + if (err?.code === 'E_PHOTO_LIBRARY_AUTH_DENIED') { + Linking.openSettings() + return + } if (image.remote_url) { CameraRoll.save(image.remote_url) .then(() => {