From d203c002799e96e0ffa2e042befaa3d5b9b261af Mon Sep 17 00:00:00 2001 From: xmflsct Date: Sun, 30 Oct 2022 15:05:40 +0100 Subject: [PATCH] Fixed #417 --- src/Screens.tsx | 6 +----- src/screens/ImageViewer/save.ts | 15 ++------------- src/screens/ImagesViewer.tsx | 11 ++--------- 3 files changed, 5 insertions(+), 27 deletions(-) diff --git a/src/Screens.tsx b/src/Screens.tsx index 6eaedabc..82408307 100644 --- a/src/Screens.tsx +++ b/src/Screens.tsx @@ -326,11 +326,7 @@ const Screens: React.FC = ({ localCorrupt }) => { theme: Theme image: RootStackParamList['Screen-ImagesViewer']['imageUrls'][0] } -const saveIos = async ({ messageRef, theme, image }: CommonProps) => { +const saveIos = async ({ theme, image }: CommonProps) => { CameraRoll.save(image.url) .then(() => { haptics('Success') displayMessage({ - ref: messageRef, theme, type: 'success', message: i18next.t('screenImageViewer:content.save.succeed') @@ -32,7 +28,6 @@ const saveIos = async ({ messageRef, theme, image }: CommonProps) => { .then(() => { haptics('Success') displayMessage({ - ref: messageRef, theme, type: 'success', message: i18next.t('screenImageViewer:content.save.succeed') @@ -41,7 +36,6 @@ const saveIos = async ({ messageRef, theme, image }: CommonProps) => { .catch(() => { haptics('Error') displayMessage({ - ref: messageRef, theme, type: 'error', message: i18next.t('screenImageViewer:content.save.failed') @@ -50,7 +44,6 @@ const saveIos = async ({ messageRef, theme, image }: CommonProps) => { } else { haptics('Error') displayMessage({ - ref: messageRef, theme, type: 'error', message: i18next.t('screenImageViewer:content.save.failed') @@ -59,7 +52,7 @@ const saveIos = async ({ messageRef, theme, image }: CommonProps) => { }) } -const saveAndroid = async ({ messageRef, theme, image }: CommonProps) => { +const saveAndroid = async ({ theme, image }: CommonProps) => { const fileUri: string = `${FileSystem.documentDirectory}${image.id}.jpg` const downloadedFile: FileSystem.FileSystemDownloadResult = await FileSystem.downloadAsync(image.url, fileUri) @@ -67,7 +60,6 @@ const saveAndroid = async ({ messageRef, theme, image }: CommonProps) => { if (downloadedFile.status != 200) { haptics('Error') displayMessage({ - ref: messageRef, theme, type: 'error', message: i18next.t('screenImageViewer:content.save.failed') @@ -83,7 +75,6 @@ const saveAndroid = async ({ messageRef, theme, image }: CommonProps) => { if (status !== 'granted') { haptics('Error') displayMessage({ - ref: messageRef, theme, type: 'error', message: i18next.t('screenImageViewer:content.save.failed') @@ -96,7 +87,6 @@ const saveAndroid = async ({ messageRef, theme, image }: CommonProps) => { .then(() => { haptics('Success') displayMessage({ - ref: messageRef, theme, type: 'success', message: i18next.t('screenImageViewer:content.save.succeed') @@ -105,7 +95,6 @@ const saveAndroid = async ({ messageRef, theme, image }: CommonProps) => { .catch(() => { haptics('Error') displayMessage({ - ref: messageRef, theme, type: 'error', message: i18next.t('screenImageViewer:content.save.failed') diff --git a/src/screens/ImagesViewer.tsx b/src/screens/ImagesViewer.tsx index 295c9c22..3c6a3032 100644 --- a/src/screens/ImagesViewer.tsx +++ b/src/screens/ImagesViewer.tsx @@ -1,7 +1,6 @@ import analytics from '@components/analytics' import GracefullyImage from '@components/GracefullyImage' import { HeaderCenter, HeaderLeft, HeaderRight } from '@components/Header' -import { Message } from '@components/Message' import { useActionSheet } from '@expo/react-native-action-sheet' import { RootStackScreenProps } from '@utils/navigation/navigators' import { useTheme } from '@utils/styles/ThemeManager' @@ -51,7 +50,6 @@ const ScreenImagesViewer = ({ const initialIndex = imageUrls.findIndex(image => image.id === id) const [currentIndex, setCurrentIndex] = useState(initialIndex) - const listRef = useRef(null) const messageRef = useRef(null) const { showActionSheetWithOptions } = useActionSheet() @@ -71,7 +69,7 @@ const ScreenImagesViewer = ({ switch (buttonIndex) { case 0: analytics('imageviewer_more_save_press') - saveImage({ messageRef, theme, image: imageUrls[currentIndex] }) + saveImage({ theme, image: imageUrls[currentIndex] }) break case 1: analytics('imageviewer_more_share_press') @@ -193,11 +191,7 @@ const ScreenImagesViewer = ({ switch (buttonIndex) { case 0: analytics('imageviewer_more_save_press') - saveImage({ - messageRef, - theme, - image: imageUrls[currentIndex] - }) + saveImage({ theme, image: imageUrls[currentIndex] }) break case 1: analytics('imageviewer_more_share_press') @@ -236,7 +230,6 @@ const ScreenImagesViewer = ({ /> - ) }