[New architecture] Replace @oguzhnatly/react-native-image-manipulator with expo-image-manipulator#36019
Conversation
|
EDIT: This is already fixed I'm aware about following error on web and desktop, but it's fixed in #30829 and since it's in final review and it probably will be merged soon I didn't apply same fixes here to avoid merge conflicts. |
|
Want to clarify with whatever C+ gets assigned to this issue that we'll pay a $250 bounty for the review instead of the standard $500 |
…ipulator # Conflicts: # ios/Podfile.lock
|
@mananjadhav Please 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] |
|
@kowczarz Can you add some info for the |
|
@mananjadhav done |
| import {SaveFormat} from 'expo-image-manipulator'; | ||
|
|
||
| function getSaveFormat(type: string) { | ||
| switch (type) { |
There was a problem hiding this comment.
Currently we support: jpg, jpeg, png, gif, bmp, svg. For jpg, bmp, gif the fallback as jpeg is fine, but if I upload an svg today on staging/production,
the fallback is png. With this will it be jpeg?
There was a problem hiding this comment.
It's being handled here, I just changed the library, but I tried to keep logic untouched.
| fetch(result.uri) | ||
| .then((res) => res.blob()) | ||
| .then((blob) => { | ||
| const file = new File([blob], options.name || 'fileName.jpeg', {type: options.type || 'image/jpeg'}); |
There was a problem hiding this comment.
I am wondering in which case will options.name will not be set and we'll have to fallback for fileName.jpeg? Can we use any other fallback? instead of hardcoding?
There was a problem hiding this comment.
Same here, I didn't want to change the old logic when it wasn't necessary https://github.com/Expensify/App/pull/36019/files#diff-fff63959f3cf9ee8d503ba4eeadac6e6b04a65d4fcc2a0e38f52e86b9f2f1663L80
src/libs/cropOrRotateImage/utils.ts
Outdated
|
|
||
| function getSaveFormat(type: string) { | ||
| switch (type) { | ||
| case 'image/png': |
There was a problem hiding this comment.
should this be moved to CONST? instead of switch case?
There was a problem hiding this comment.
I moved the file type to const, but I think it looks better with switch/case than if we just create an object that maps gif and bmp to jpeg.
src/CONST.ts
Outdated
| VIDEO: 'video', | ||
| }, | ||
|
|
||
| FILE_FORMAT: { |
There was a problem hiding this comment.
| FILE_FORMAT: { | |
| IMAGE_MIME_TYPES: { |
or IMAGE_FILE_FORMAT
src/libs/cropOrRotateImage/index.ts
Outdated
| * Crops and rotates the image on web | ||
| */ | ||
| import {manipulateAsync} from 'expo-image-manipulator'; | ||
| import getSaveFormat from 'src/libs/cropOrRotateImage/getSaveFormat'; |
There was a problem hiding this comment.
| import getSaveFormat from 'src/libs/cropOrRotateImage/getSaveFormat'; | |
| import getSaveFormat from './getSaveFormat'; |
This path is incorrect and breaking the build.
|
@kowczarz Can you correct the path as the build is breaking and also resolve the conflicts? I wanted to confirm one thing, did you get any console error when testing the PR? I got a console error only once |
| import RNImageManipulator from '@oguzhnatly/react-native-image-manipulator'; | ||
| import {manipulateAsync} from 'expo-image-manipulator'; | ||
| import RNFetchBlob from 'react-native-blob-util'; | ||
| import getSaveFormat from 'src/libs/cropOrRotateImage/getSaveFormat'; |
There was a problem hiding this comment.
| import getSaveFormat from 'src/libs/cropOrRotateImage/getSaveFormat'; | |
| import getSaveFormat from './getSaveFormat'; |
This comment was marked as outdated.
This comment was marked as outdated.
|
@kowczarz heads up you've got conflicts here |
|
@kowczarz lets try to resolve the conflicts @mananjadhav can you complete the checklist please once resolved |
|
@kowczarz Quick bump. |
|
Hey, we're sorry for the delay. I've resolved conflicts and addressed the review.
@mananjadhav The first time I followed the test plan I got some |
|
It's ready for review. However I'm not sure why the Gihub Actions check is failing. |
Reviewer Checklist
Screenshots/VideosAndroid: Nativeandroid-image-edit.movAndroid: mWeb Chromemweb-chrome-image-edit.moviOS: Nativeios-image-edit.moviOS: mWeb Safarimweb-safari-image-edit.movMacOS: Chrome / Safariweb-image-edit.movMacOS: Desktopdesktop-image-edit.mov |
mananjadhav
left a comment
There was a problem hiding this comment.
Changes worked fine for me, and the build too. I am not sure about the Github action. @roryabraham Can you help rerunning once?
|
I've merged main, but it also didn't help. |
|
✋ 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/roryabraham in version: 1.4.48-0 🚀
|
|
🚀 Deployed to production by https://github.com/roryabraham in version: 1.4.48-0 🚀
|
Details
Fixed Issues
$ #35984
Tests
Offline tests
Same as above
QA Steps
Same as above
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)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel so the design team can review the changes.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
Android: Native
android.native_H.265.mp4
Android: mWeb Chrome
android.web_H.265.mp4
iOS: Native
ios.native_H.265.mp4
iOS: mWeb Safari
ios.web_H.265.mp4
MacOS: Chrome / Safari
web_H.265.mp4
MacOS: Desktop
desktop_H.265.mp4