No need for Android, as if permission was denied last time, the next time when requesting, permission would be checked again.
This commit is contained in:
xmflsct 2023-01-14 16:20:37 +01:00
parent 26d2c78517
commit 57f1ed62b5
1 changed files with 6 additions and 2 deletions

View File

@ -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(() => {