From 82822254e50d8df8b85fbf51446460044947072e Mon Sep 17 00:00:00 2001 From: tienifr Date: Fri, 14 Apr 2023 15:09:19 +0700 Subject: [PATCH 1/7] fix: 16528 upload gif image fluctuate --- src/components/AttachmentModal.js | 7 +++++++ src/components/ImageView/index.js | 6 +++--- src/libs/actions/PersonalDetails.js | 2 ++ src/pages/DetailsPage.js | 1 + src/styles/StyleUtils.js | 12 +++++------- 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/components/AttachmentModal.js b/src/components/AttachmentModal.js index 86eb8c56345e..eb8b9e4a08d2 100755 --- a/src/components/AttachmentModal.js +++ b/src/components/AttachmentModal.js @@ -56,6 +56,9 @@ const propTypes = { /** The ID of the report that has this attachment */ reportID: PropTypes.string, + /** Filename of the attachment */ + fileName: PropTypes.string, + ...withLocalizePropTypes, ...windowDimensionsPropTypes, @@ -65,6 +68,7 @@ const defaultProps = { source: '', onConfirm: null, originalFileName: '', + fileName: '', isAuthTokenRequired: false, allowDownload: false, headerTitle: null, @@ -86,6 +90,9 @@ class AttachmentModal extends PureComponent { modalType: CONST.MODAL.MODAL_TYPE.CENTERED_UNSWIPEABLE, isConfirmButtonDisabled: false, confirmButtonFadeAnimation: new Animated.Value(1), + file: props.fileName ? { + name: props.fileName, + } : undefined, }; this.submitAndClose = this.submitAndClose.bind(this); diff --git a/src/components/ImageView/index.js b/src/components/ImageView/index.js index 8c48da7833cd..ef23243f80a7 100644 --- a/src/components/ImageView/index.js +++ b/src/components/ImageView/index.js @@ -275,7 +275,7 @@ class ImageView extends PureComponent { = 1 ? styles.pRelative : styles.pAbsolute, ...styles.flex1, @@ -285,10 +285,10 @@ class ImageView extends PureComponent { > {({show}) => ( Date: Fri, 14 Apr 2023 18:12:30 +0700 Subject: [PATCH 2/7] fix: improve code --- src/components/ImageView/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ImageView/index.js b/src/components/ImageView/index.js index ef23243f80a7..b05be361c9e1 100644 --- a/src/components/ImageView/index.js +++ b/src/components/ImageView/index.js @@ -35,7 +35,7 @@ class ImageView extends PureComponent { this.trackPointerPosition = this.trackPointerPosition.bind(this); this.state = { - isLoading: false, + isLoading: true, containerHeight: 0, containerWidth: 0, isZoomed: false, From b05be87734d5080cdcc83b4058a0f6d314f4ffba Mon Sep 17 00:00:00 2001 From: tienifr Date: Mon, 17 Apr 2023 17:47:23 +0700 Subject: [PATCH 3/7] fix: remove filename --- src/components/AttachmentModal.js | 10 +++------- src/pages/DetailsPage.js | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/components/AttachmentModal.js b/src/components/AttachmentModal.js index eb8b9e4a08d2..dd1b4708b6a8 100755 --- a/src/components/AttachmentModal.js +++ b/src/components/AttachmentModal.js @@ -56,9 +56,6 @@ const propTypes = { /** The ID of the report that has this attachment */ reportID: PropTypes.string, - /** Filename of the attachment */ - fileName: PropTypes.string, - ...withLocalizePropTypes, ...windowDimensionsPropTypes, @@ -68,7 +65,6 @@ const defaultProps = { source: '', onConfirm: null, originalFileName: '', - fileName: '', isAuthTokenRequired: false, allowDownload: false, headerTitle: null, @@ -90,9 +86,9 @@ class AttachmentModal extends PureComponent { modalType: CONST.MODAL.MODAL_TYPE.CENTERED_UNSWIPEABLE, isConfirmButtonDisabled: false, confirmButtonFadeAnimation: new Animated.Value(1), - file: props.fileName ? { - name: props.fileName, - } : undefined, + file: props.originalFileName && { + name: props.originalFileName, + }, }; this.submitAndClose = this.submitAndClose.bind(this); diff --git a/src/pages/DetailsPage.js b/src/pages/DetailsPage.js index 2017e73c72cb..6d728b9595ad 100755 --- a/src/pages/DetailsPage.js +++ b/src/pages/DetailsPage.js @@ -130,7 +130,7 @@ class DetailsPage extends React.PureComponent { headerTitle={isSMSLogin ? this.props.toLocalPhone(details.displayName) : details.displayName} source={ReportUtils.getFullSizeAvatar(details.avatar, details.login)} isAuthTokenRequired - fileName={details.avatarFileName} + originalFileName={details.avatarFileName} > {({show}) => ( Date: Mon, 17 Apr 2023 22:26:24 +0700 Subject: [PATCH 4/7] fix: change avatarFileName to originalFileName --- src/libs/actions/PersonalDetails.js | 4 ++-- src/pages/DetailsPage.js | 2 +- src/styles/StyleUtils.js | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/libs/actions/PersonalDetails.js b/src/libs/actions/PersonalDetails.js index 6ae4622a6c4d..02643fb78e91 100644 --- a/src/libs/actions/PersonalDetails.js +++ b/src/libs/actions/PersonalDetails.js @@ -289,13 +289,13 @@ function updateAvatar(file) { [currentUserEmail]: { avatar: file.uri, avatarThumbnail: file.uri, - avatarFileName: file.name, + originalFileName: file.name, errorFields: { avatar: null, }, pendingFields: { avatar: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE, - avatarFileName: null, + originalFileName: null, }, }, }, diff --git a/src/pages/DetailsPage.js b/src/pages/DetailsPage.js index 6d728b9595ad..e51ab137d5dd 100755 --- a/src/pages/DetailsPage.js +++ b/src/pages/DetailsPage.js @@ -130,7 +130,7 @@ class DetailsPage extends React.PureComponent { headerTitle={isSMSLogin ? this.props.toLocalPhone(details.displayName) : details.displayName} source={ReportUtils.getFullSizeAvatar(details.avatar, details.login)} isAuthTokenRequired - originalFileName={details.avatarFileName} + originalFileName={details.originalFileName} > {({show}) => ( Date: Tue, 18 Apr 2023 22:58:25 +0700 Subject: [PATCH 5/7] fix: change returns type --- src/styles/StyleUtils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/styles/StyleUtils.js b/src/styles/StyleUtils.js index e20eb3b452e7..2a9243e59168 100644 --- a/src/styles/StyleUtils.js +++ b/src/styles/StyleUtils.js @@ -197,7 +197,7 @@ function getZoomCursorStyle(isZoomed, isDragging) { * @param {Number} containerHeight * @param {Number} containerWidth * @param {Boolean} isLoading - * @returns {Object | null} + * @returns {Object | undefined} */ function getZoomSizingStyle(isZoomed, imgWidth, imgHeight, zoomScale, containerHeight, containerWidth, isLoading) { // Hide image until finished loading to prevent showing preview with wrong dimensions From 40bc8b0de63e4bd30ecd4cea529bebdc65e3b7f5 Mon Sep 17 00:00:00 2001 From: tienifr Date: Fri, 21 Apr 2023 17:19:57 +0700 Subject: [PATCH 6/7] fix: error type --- src/components/AttachmentModal.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/AttachmentModal.js b/src/components/AttachmentModal.js index dd1b4708b6a8..2dfdb991f9f2 100755 --- a/src/components/AttachmentModal.js +++ b/src/components/AttachmentModal.js @@ -86,9 +86,9 @@ class AttachmentModal extends PureComponent { modalType: CONST.MODAL.MODAL_TYPE.CENTERED_UNSWIPEABLE, isConfirmButtonDisabled: false, confirmButtonFadeAnimation: new Animated.Value(1), - file: props.originalFileName && { + file: props.originalFileName ? { name: props.originalFileName, - }, + } : undefined, }; this.submitAndClose = this.submitAndClose.bind(this); From 63e759948e4155972b7bb7074752097533cee61c Mon Sep 17 00:00:00 2001 From: tienifr Date: Wed, 26 Apr 2023 20:51:12 +0700 Subject: [PATCH 7/7] fix: disable auth token for local image --- src/components/AttachmentView.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/AttachmentView.js b/src/components/AttachmentView.js index 5e5221482350..731ccbbae55c 100755 --- a/src/components/AttachmentView.js +++ b/src/components/AttachmentView.js @@ -81,9 +81,10 @@ const AttachmentView = (props) => { // For this check we use both source and file.name since temporary file source is a blob // both PDFs and images will appear as images when pasted into the the text field - if (Str.isImage(props.source) || (props.file && Str.isImage(props.file.name))) { + const isImage = Str.isImage(props.source); + if (isImage || (props.file && Str.isImage(props.file.name))) { return ( - + ); }