Image Web/Desktop: Add support for http headers#13036
Image Web/Desktop: Add support for http headers#13036Beamanator merged 6 commits intoExpensify:mainfrom
Conversation
8ddbaa0 to
efdf4d2
Compare
|
Holding on this as we try to get the upstream |
ac2598f to
2dbbf10
Compare
2dbbf10 to
4ddff74
Compare
|
I've cherry picked this commit in order to test the new Image functionality: 34d941d92742dda5e383a19b759ef60247e5376a Details about the related PR here: #12603 (comment) |
|
Thanks for this @kidroca!
Note: There's a draft PR to re-implement the iOS / Android caching: #13304 but we're not planning to move forward with that for another week (assuming the maintainer of https://github.com/DylanVann/react-native-fast-image/ doesn't respond sooner) So if we get your |
c4b7588 to
39a5238
Compare
|
@Beamanator @aimane-chnaif One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
reviewing today |
|
@aimane-chnaif I'm sorry if you've already started reviewing, but we're still going through a few revisions on the |
Beamanator
left a comment
There was a problem hiding this comment.
Love what I've seen so far, got a few initial comments
39a5238 to
9e0a124
Compare
This comment was marked as outdated.
This comment was marked as outdated.
b8cf933 to
75e5c63
Compare
|
@aimane-chnaif FYI the changes in the related fork PR are very close to being approved, so feel free to jump in and start testing this when you have a chance 👍 🙏 |
This patch focuses on resolving issues encountered with avatar image loading, specifically addressing the challenges related to CORS (Cross-Origin Resource Sharing) errors. Changes: - Removed the `isAuthTokenRequired` flag from the `AttachmentModal` component in various files, including `ProfilePage.js`, `RoomHeaderAvatars.js`, and `DetailsPage.js`. This change is crucial for loading of avatar images that are hosted externally. Rationale: - The primary purpose of this modification is to streamline the loading process for avatars by removing the unnecessary inclusion of authentication tokens in requests for external images. This approach aligns with standard practices for handling externally hosted content and aims to enhance compatibility and performance. - Raised a question here as whether there are cases of avatar images that need authentication: https://github.com/Expensify/App/pull/24425/files#r1404352872 This update is expected to resolve the CORS errors associated with avatar image loading, thereby improving the overall functionality and user experience in our application.
061ee6e to
cc49208
Compare
Done |
aimane-chnaif
left a comment
There was a problem hiding this comment.
LGTM! Some minor feedback
| }, | ||
| })(Image); | ||
| ImageWithOnyx.resizeMode = RESIZE_MODES; | ||
| ImageWithOnyx.resolveDimensions = resolveDimensions; |
There was a problem hiding this comment.
Reviewer Checklist
Screenshots/VideosAndroid: Nativeandroid.movAndroid: mWeb Chromemchrome.moviOS: Nativeios.moviOS: mWeb Safarimsafari.movMacOS: Chrome / Safariweb.movMacOS: Desktopdesktop.mov |
|
Pushed a commit to address the code style issues |
|
can you please also pull main and retest? almost 1k commits behind |
I've synced and re-tested - everything seems good, though there seems to be a Typescript error unrelated to my changes src/libs/actions/Link.ts:103:29 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'AllRoutes | undefined'. |
It's being discussed here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/Beamanator in version: 1.4.9-0 🚀
|
|
🚀 Deployed to staging by https://github.com/Beamanator in version: 1.4.9-0 🚀
|
|
🚀 Deployed to production by https://github.com/yuwenmemon in version: 1.4.9-5 🚀
|






Details
This PR refactors the
Imagecomponent, aligning the web/desktop and native implementations for better consistency and maintainability.Changes:
Introduced
BaseImageComponent:src/components/Image/BaseImage.jsonLoadevent, it ensures that both web and native platforms have the same signature.Native Implementation Update:
src/components/Image/BaseImage.native.jsreact-native-fast-image.Unified Image Component for Web/Desktop and Native:
src/components/Image/index.jsImagecomponent has been refactored to use the newBaseImage.Removed Redundant Native Specific Implementation:
src/components/Image/index.native.jsPatch for
react-native-webpatches/react-native-web+0.19.9+005+image-header-support.patchFixed Issues
$ #12603
PROPOSAL: N/A
Tests
Verify the Image component works on all platforms
X-Chat-Attachment-Tokenheader.X-Chat-Attachment-Tokenvalue changes.Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Web
Screen.Recording.2023-11-06.at.9.14.20.mp4
Mobile Web - Chrome
Mobile Web - Safari
Desktop
Screen.Recording.2023-11-06.at.10.27.12.mov
iOS
Android