-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[New architecture] Replace @oguzhnatly/react-native-image-manipulator
with expo-image-manipulator
#36019
[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 |
src/libs/cropOrRotateImage/utils.ts
Outdated
import {SaveFormat} from 'expo-image-manipulator'; | ||
|
||
function getSaveFormat(type: string) { | ||
switch (type) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be moved to CONST? instead of switch case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -1008,6 +1008,12 @@ const CONST = { | |||
VIDEO: 'video', | |||
}, | |||
|
|||
FILE_FORMAT: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 RNFetchBlob from 'react-native-blob-util'; | ||
import getSaveFormat from 'src/libs/cropOrRotateImage/getSaveFormat'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.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