1
0
mirror of https://github.com/tooot-app/app synced 2024-12-22 23:58:27 +01:00
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

View File

@ -4,7 +4,7 @@ import { CameraRoll } from '@react-native-camera-roll/camera-roll'
import { RootStackParamList } from '@utils/navigation/navigators' import { RootStackParamList } from '@utils/navigation/navigators'
import * as FileSystem from 'expo-file-system' import * as FileSystem from 'expo-file-system'
import i18next from 'i18next' import i18next from 'i18next'
import { PermissionsAndroid, Platform } from 'react-native' import { Linking, PermissionsAndroid, Platform } from 'react-native'
type CommonProps = { type CommonProps = {
image: RootStackParamList['Screen-ImagesViewer']['imageUrls'][0] image: RootStackParamList['Screen-ImagesViewer']['imageUrls'][0]
@ -19,7 +19,11 @@ const saveIos = async ({ image }: CommonProps) => {
message: i18next.t('screenImageViewer:content.save.succeed') 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) { if (image.remote_url) {
CameraRoll.save(image.remote_url) CameraRoll.save(image.remote_url)
.then(() => { .then(() => {