From 51a2ff012addb66c51bd7bce068fdfe2df280d5b Mon Sep 17 00:00:00 2001 From: xmflsct Date: Sat, 9 Jul 2022 11:29:47 +0200 Subject: [PATCH] Warn image processing error --- ios/Podfile.lock | 6 +++--- src/components/Message.tsx | 5 +++-- src/i18n/en/screens/tabs.json | 3 ++- src/screens/Tabs/Me/Profile/Root/AvatarHeader.tsx | 10 ++++++++++ 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index c1288356..be3a2423 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -878,7 +878,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: ASN1Decoder: 6110fdeacfdb41559b1481457a1645be716610aa boost: a7c83b31436843459a1961bfd74b96033dc77234 - DoubleConversion: 831926d9b8bf8166fd87886c4abab286c2422662 + DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54 EASClient: 93565f4d024559b75eac62bc7d50acaa354614f6 EXApplication: d6562af1204162e0ac46d341a7d4e5dc720b33de EXAV: 88f61c5af8415715b7ee51f084c1020235b85c56 @@ -919,7 +919,7 @@ SPEC CHECKSUMS: FirebaseCoreDiagnostics: 92e07a649aeb66352b319d43bdd2ee3942af84cb FirebaseInstallations: 40bd9054049b2eae9a2c38ef1c3dd213df3605cd fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9 - glog: 476ee3e89abb49e07f822b48323c51c57124b572 + glog: 3d02b25ca00c2d456734d0bcff864cbc62f6ae1a GoogleAppMeasurement: 71156240babd3cc6ced03e0d54816f01a880c730 GoogleDataTransport: 5fffe35792f8b96ec8d6775f5eccd83c998d5a3b GoogleUtilities: e0913149f6b0625b553d70dae12b49fc62914fd1 @@ -928,7 +928,7 @@ SPEC CHECKSUMS: libwebp: 98a37e597e40bfdb4c911fc98f2c53d0b12d05fc nanopb: a0ba3315591a9ae0a16a309ee504766e90db0c96 PromisesObjC: ab77feca74fa2823e7af4249b8326368e61014cb - RCT-Folly: 4d8508a426467c48885f1151029bc15fa5d7b3b8 + RCT-Folly: b9d9fe1fc70114b751c076104e52f3b1b5e5a95a RCTRequired: 3e917ea5377751094f38145fdece525aa90545a0 RCTTypeSafety: c43c072a4bd60feb49a9570b0517892b4305c45e React: 176dd882de001854ced260fad41bb68a31aa4bd0 diff --git a/src/components/Message.tsx b/src/components/Message.tsx index 4fb35c62..fe706042 100644 --- a/src/components/Message.tsx +++ b/src/components/Message.tsx @@ -80,7 +80,7 @@ const displayMessage = ({ }) } else { showMessage({ - duration: type === 'error' ? 3500 : duration === 'short' ? 1500 : 2500, + duration: type === 'error' ? 8000 : duration === 'short' ? 3000 : 5000, autoHide, message, description, @@ -124,7 +124,8 @@ const Message = React.forwardRef((_, ref) => { shadowColor: colors.primaryDefault, shadowOffset: { width: 0, height: 0 }, shadowOpacity: theme === 'light' ? 0.16 : 0.24, - shadowRadius: 4 + shadowRadius: 4, + paddingRight: StyleConstants.Spacing.M * 2 }} titleStyle={{ color: colors.primaryDefault, diff --git a/src/i18n/en/screens/tabs.json b/src/i18n/en/screens/tabs.json index 8f652234..c797bf01 100644 --- a/src/i18n/en/screens/tabs.json +++ b/src/i18n/en/screens/tabs.json @@ -147,7 +147,8 @@ "group": "Group {{index}}", "label": "Label", "content": "Content" - } + }, + "mediaSelectionFailed": "Image processing failed. Please try again." }, "push": { "notAvailable": "Your phone does not support tooot's push notification", diff --git a/src/screens/Tabs/Me/Profile/Root/AvatarHeader.tsx b/src/screens/Tabs/Me/Profile/Root/AvatarHeader.tsx index 23d83b9e..227f5d17 100644 --- a/src/screens/Tabs/Me/Profile/Root/AvatarHeader.tsx +++ b/src/screens/Tabs/Me/Profile/Root/AvatarHeader.tsx @@ -1,5 +1,6 @@ import mediaSelector from '@components/mediaSelector' import { MenuRow } from '@components/Menu' +import { displayMessage } from '@components/Message' import { useActionSheet } from '@expo/react-native-action-sheet' import { useProfileMutation, useProfileQuery } from '@utils/queryHooks/profile' import { useTheme } from '@utils/styles/ThemeManager' @@ -37,6 +38,15 @@ const ProfileAvatarHeader: React.FC = ({ type, messageRef }) => { ? { width: 400, height: 400 } : { width: 1500, height: 500 } }) + if (!image[0].uri) { + displayMessage({ + ref: messageRef, + message: t('screenTabs:me.profile.mediaSelectionFailed'), + theme: theme, + type: 'error' + }) + return + } mutation.mutate({ theme, messageRef,