Conversation
|
Will add screenshots once https://github.com/Expensify/Web-Expensify/pull/35489 is merged |
…icAvatarImageTypes
| isAvatarCropModalOpen: true, | ||
| imageUri: image.uri, | ||
| imageName: image.name, | ||
| imageType: image.type, |
There was a problem hiding this comment.
FYI this (image type) is the main "new thing" that we're passing down to cropOrRotateImage
| function convertCanvasToFile(canvas, options = {}) { | ||
| return new Promise((resolve) => { | ||
| canvas.toBlob((blob) => { | ||
| const file = new File([blob], `${options.name || 'fileName'}.jpg`, {type: 'image/jpeg'}); |
There was a problem hiding this comment.
Idk why we were appending .jpg to every file name before 😅
|
@Santhosh-Sellavel @jasperhuangg 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] |
|
Ready for review! Have fun testing uploading images :D |
|
@Beamanator jpg is shown jpeg refer to the video below! Initially, I checked Look at the timestamp 0:22 to 0:40 in the video below, that's where I'm checking .jpg extension. Screen.Recording.2022-11-14.at.11.03.27.PM.mov |
|
@Santhosh-Sellavel interesting catch, I'll check that out now! |
|
@Santhosh-Sellavel apparently JPG and JPEG are the same actually 😅 I found lots of articles explaining, here's just one: https://www.howtogeek.com/796389/jpg-vs.-jpeg-are-they-the-same-thing/ So I don't think this is a blocker 👍 |
|
Let's update that in pr description jpg/jpeg will shown as jpeg in url |
|
Ok I'll update the OP @Santhosh-Sellavel but can you please finish your review & add the checklist?? 🙏 |
|
Will test today, but this PR is time-consuming 😅 |
|
Screen.Recording.2022-11-16.at.10.36.42.PM.mov |
|
Offline case does not work as expected Offline_Desktop_Web.mov |
Error is thrown while uploading BMP in iOSSimulator.Screen.Recording.-.iPhone.14.-.2022-11-16.at.23.35.16.mp4GIF extension not maintained while testing in iOS refer hereMObile_Test.movConsole error is thrown while uploading gif in Android, unable to upload here.cc: @Beamanator |
|
Wow thanks so much for the thorough tests @Santhosh-Sellavel - I'd definitely recommend requested increased compensation for this review :D Sadly I'm going OOO till Monday so I won't be able to fix the items you mentioned till early next week |
|
@Beamanator 😞 Sorry, I was waiting for the discussion outcome! Will add it soon! |
Reviewer Checklist
Screenshots/VideosWebWeb.movMobile Web - ChromeAndroid.mWeb.movMobile Web - SafariiOS_All_Files_as_JPEG.movDesktopDesktop.moviOSiOS.movAndroidAndroid.mov |
|
No worries @Santhosh-Sellavel thanks for sticking with me 😅 |
|
AH Finally completed, After double-checking multiple times, crazy PR! Tested Formats PNG, GIF, JPEG, and BMP. Web, Desktop - all works fine maintained file typed even after uploading. Uploaded Images Loading fine on all platforms. Android & iOS - Only tested PNG and JPEG. All is good here too. Mobile Web things went crazy here, after verifying multiple times Android mWebOld Story, Android Chrome uploading works after updating the chrome from the play store. PNG, GIF, JPEG - Formats works as expected file types are maintained after upload. Android_Mweb_bmp.moviOS mWebAble to upload all formats, but all are converted as JPEG and uploaded. Is converting to jPEG an issue? @Beamanator iOS_All_Files_as_JPEG.mov |
Santhosh-Sellavel
left a comment
There was a problem hiding this comment.
Checklist: #12549 (comment)
Need clarification on this #12549 (comment), otherwise looks good!
|
Thanks again for the comprehensive notes & review @Santhosh-Sellavel - the one thing I don't like about turning all image types into |
|
Hmm so I just tested iPhone 13 simulator (iOS v15.5), Safari - and I successfully uploaded a Actually the funny thing is on the same iPhone ^ sim, I uploaded bmp & gifs, and the URL extensions were correct 🤷 (same as what I reported here). Maybe @jasperhuangg can help us test just on this platform to see what results he gets? Tested Android Chrome (updated my simulator's Chrome app & SDK version too): Got same result as you (everything worked, except |
|
So I'd say the next steps should be:
|
|
Please try in latest iOS Version. I tested on 16.1 |
|
We are in a never ending loop here. |
|
Lol! Ok I'll work on getting upgraded sims 👍 |
|
@Santhosh-Sellavel are you testing on a simulator with iOS 16.1 or a physical device? Please let me know which device as well |
|
@Beamanator NVM it's working as expected for me now on iOS mWEB, I'm not sure what I did wrong yesterday. I did the same thing today but verified it on the actual device's local storage of iOS mWeb. As updating in one platform should update in another platform I used desktop app storage, which worked right for all other platforms. Maybe it had some sync issues, as my network was also unstable yesterday. So All looks good! PNG_BMPBMP_PNG_iOS_mWEB.movJPEG_GIFJPEG_GIF_iOSMWeb.mov |
|
@Beamanator But BMP to JPEG on Android mWEB still occurring for me though, I believe we are okay with it! Screen.Recording.2022-12-01.at.9.38.32.PM.mov |
Santhosh-Sellavel
left a comment
There was a problem hiding this comment.
Looks good to me!
|
Hey @Beamanator! I was able to successfully upload a I also repeated with The only issue I'm seeing is that the background of the cropping modal is black, which can conflict with transparent images that have black elements (as in the recording). This can probably be fixed in a followup issue. Untitled.mov |
|
Merging via [2] from #12549 (comment) |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
Niceee thanks y'all 👍 Will look at the other weird things y'all mentioned tomorrow 😅 |
|
@jasperhuangg - FYI i made a new issue about the black background when editing images here: #13266 Feel free to add your thoughts, I referenced your vid! |
|
🚀 Deployed to staging by @jasperhuangg in version: 1.2.36-0 🚀
|
|
🚀 Deployed to production by @francoisl in version: 1.2.36-4 🚀
|


Details
The main purpose of this PR is to allow users to upload multiple types of images as avatars (workspace & user avatars). Ideally we'd support at least
jpg,jpeg(which are the same asjpg),gif,png, andbmp. However, I investigated some errors found by @Santhosh-Sellavel here (my investigation here) where I found thatRNImageManipulatorcurrently only supportspngandjpgimage types so on native we can currently only upload those types of avatar images on native.In order to not let this PR stay open for too long, I'm proposing we don't worry about those cases for now, and we create follow up issues to support those image types in that Library, or at least investigate what we should do for those image types (maybe we'd be ok just saving them as
jpgs? To be discussed later).Fixed Issues
$ #11063
Tests
jpg,jpeg,gif, andbmpfiles from this site: https://filesamples.com/formats/bmp (or use your own if you have any). Also get apngfile with some transparent part (use this image if you need: https://user-images.githubusercontent.com/3885503/196921487-45bf3d63-7e42-4f4c-83d1-e8b40e519bf6.png)pngimage, the image URL should end with.png)png, make sure the image has some transparent part, and that the transparency is preserved.jpgandjpegare the same so uploading ajpgfile will change to ajpegfile extensiononyxApiUpdategifandbmpfiles have issues (see investigation) so please don't worry about testing those image types on those platforms, we'll handle them in a follow-up issue. For this PR, follow steps 2 & 3 for Native devices, trying to uploadjpg,jpeg, andpngimages onlyOffline
QA Steps
Same as above tests - Note: after uploading on mobile, you can use Chrome to check that the uploaded image URL is correct (has the correct extension at the end) like this:
keyvaluepairs, search for keypersonalDetails, expand your username, findavatarjpgandjpegare the same so uploading ajpgfile will change to ajpegfile extensionPR Author Checklist
### Fixed Issuessection aboveTestssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*filesWaiting 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 */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)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)PR Reviewer Checklist
The reviewer will copy/paste it into a new comment and complete it after the author checklist is completed
### Fixed Issuessection aboveTestssectionQA stepssectiontoggleReportand notonIconClick).src/languages/*filesWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarhave been tested & I retested again)/** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)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)Screenshots
Web & iOS App
Screen.Recording.2022-11-11.at.12.02.09.PM.mov
Mobile Web - Chrome & Mobile Web - Safari
Screen.Recording.2022-11-11.at.12.26.09.PM.mov
Desktop & Android
Screen.Recording.2022-11-11.at.3.11.48.PM.mov