Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 49974 attachment infinite loading #50511

Closed
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions assets/images/attachment-not-found.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, {useContext, useState} from 'react';
import type {StyleProp, ViewStyle} from 'react-native';
import {View} from 'react-native';
import AttachmentView from '@components/Attachments/AttachmentView';
import * as Expensicons from '@components/Icon/Expensicons';
import type {Attachment} from '@components/Attachments/types';
import Button from '@components/Button';
import PressableWithoutFeedback from '@components/Pressable/PressableWithoutFeedback';
Expand Down Expand Up @@ -83,6 +84,7 @@ function CarouselItem({item, onPress, isFocused, isModalHovered}: CarouselItemPr
isHovered={isModalHovered}
isFocused={isFocused}
duration={item.duration}
fallbackSource={Expensicons.AttachmentNotFound}
/>
</View>

Expand Down
20 changes: 13 additions & 7 deletions src/components/Attachments/AttachmentView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import type {Attachment, AttachmentSource} from '@components/Attachments/types';
import DistanceEReceipt from '@components/DistanceEReceipt';
import EReceipt from '@components/EReceipt';
import Icon from '@components/Icon';
import Text from '@components/Text';
import * as Expensicons from '@components/Icon/Expensicons';
import ScrollView from '@components/ScrollView';
import {usePlaybackContext} from '@components/VideoPlayerContexts/PlaybackContext';
Expand Down Expand Up @@ -222,15 +223,20 @@ function AttachmentView({
if (isFileImage) {
if (imageError && (typeof fallbackSource === 'number' || typeof fallbackSource === 'function')) {
return (
<Icon
src={fallbackSource}
height={variables.defaultAvatarPreviewSize}
width={variables.defaultAvatarPreviewSize}
additionalStyles={[styles.alignItemsCenter, styles.justifyContentCenter, styles.flex1]}
fill={theme.border}
/>
<View style={[styles.flexColumn, styles.alignItemsCenter, styles.justifyContentCenter]}>
<Icon
src={fallbackSource}
width={variables.iconSizeSuperLarge}
height={variables.iconSizeSuperLarge}
fill={theme.border}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider making this theme.icons instead

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thx for the feedback

I tried theme.icon but it"s still light as you can see in the pic below
Capture d’écran de 2024-10-18 20-50-47

but a theme that seems to match better the "Attachment not found" text in both light and dark modes is theme.iconHovered as you can see in the pic below

Capture d’écran de 2024-10-18 20-57-58

What do you think ? also @dannymcclain

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first pic (theme.icon) looks correct!
image

Copy link
Contributor Author

@Kalydosos Kalydosos Oct 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok @dannymcclain thx for the feedback 👍 , @shawnborton i will update the code if it's ok with you

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, Danny is correct!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shawnborton yes, i have updated the code already. thx for the feedback 👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

/>
<View>
<Text style={[styles.notFoundTextHeader]}>{translate('attachmentView.attachmentNotFound')}</Text>
</View>
</View>
Kalydosos marked this conversation as resolved.
Show resolved Hide resolved
);
}

let imageSource = imageError && fallbackSource ? (fallbackSource as string) : (source as string);

if (isHighResolution) {
Expand Down
2 changes: 2 additions & 0 deletions src/components/Icon/Expensicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import ArrowDownLong from '@assets/images/arrow-down-long.svg';
import ArrowRightLong from '@assets/images/arrow-right-long.svg';
import ArrowRight from '@assets/images/arrow-right.svg';
import ArrowUpLong from '@assets/images/arrow-up-long.svg';
import AttachmentNotFound from '@assets/images/attachment-not-found.svg';
import UpArrow from '@assets/images/arrow-up.svg';
import ArrowsUpDown from '@assets/images/arrows-updown.svg';
import AdminRoomAvatar from '@assets/images/avatars/admin-room.svg';
Expand Down Expand Up @@ -214,6 +215,7 @@ export {
ArrowsUpDown,
ArrowUpLong,
ArrowDownLong,
AttachmentNotFound,
Wrench,
BackArrow,
Bank,
Expand Down
1 change: 1 addition & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1940,6 +1940,7 @@ const translations = {
afterLinkText: 'to view it.',
formLabel: 'View PDF',
},
attachmentNotFound: 'Attachment not found'
},
messages: {
errorMessageInvalidPhone: `Please enter a valid phone number without brackets or dashes. If you're outside the US, please include your country code (e.g. ${CONST.EXAMPLE_PHONE_NUMBER}).`,
Expand Down
1 change: 1 addition & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1959,6 +1959,7 @@ const translations = {
afterLinkText: 'para verlo.',
formLabel: 'Ver PDF',
},
attachmentNotFound: 'Adjunto no encontrado'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
attachmentNotFound: 'Adjunto no encontrado'
attachmentNotFound: 'Archivo adjunto no encontrado'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, got it. Thx a lot

},
messages: {
errorMessageInvalidPhone: `Por favor, introduce un número de teléfono válido sin paréntesis o guiones. Si reside fuera de Estados Unidos, por favor incluye el prefijo internacional (p. ej. ${CONST.EXAMPLE_PHONE_NUMBER}).`,
Expand Down
Loading