App: [HOLD for payment 2023-02-23] [$1000] Figure out why `svg` images don't show immediately when uploading as avatar
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Action Performed:
- In
main, add'svg'to the list of allowed avatar extensions in constAVATAR_ALLOWED_EXTENSIONS: ['jpg', 'jpeg', 'png', 'gif', 'bmp'], - On Android or iOS App, navigate to Profile page
- Click avatar, choose “Upload photo”
- Select a
svgimage, then continue through the crop modal to upload the image
Expected Result:
User can immediately see the avatar image that they just uploaded
Actual Result:
- Image doesn’t show up until it uploads to the server and the URL is returned
- User needs to refresh to see the image
Workaround:
None needed
Platform:
Where is this issue occurring?
- All
Version Number: Reproducible in staging?: Y Reproducible in production?: Y GH conversation: https://github.com/Expensify/App/pull/12549#issuecomment-1326579036
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~01953030ea34ada712
- Upwork Job ID: 1622513437122138112
- Last Price Increase: 2023-02-06
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 106 (75 by maintainers)
@trjExpensify I tested extensively with many different SVG files, including the file used in https://github.com/Expensify/App/issues/15189 and couldn’t reproduce the issue.
Any thoughts @Beamanator @Santhosh-Sellavel ?
okay unassigning myself then and looking for other bugs
Ah shit, that was the weekend. Yes, you’re right! I’ve paid you $500 as a bonus.
@Ollyws Aah I see 👍 I think that default file name is only used if somehow the App can’t access the uploaded filename. So if we can do the same here that would be great 👍
And yes please add
svgto that array of constants 👍 (otherwise we won’t be able to select svgs to upload 😅 )Cool then we won’t need that name check then we could hardcode a fixed name straight away.
Looks good to me, and works well.
@Beamanator Are we fine with this hardcoded file name, do we need to do something about it? Ex: replace extension in name
@Ollyws I’m using your latest diff, that’s nice that that fixes the black background issue 👍 👍
I think it’s fine if the SVG conversion happens locally 👍
@Santhosh-Sellavel let me know what you think about @Ollyws 's latest proposal here, I think it’s pretty solid 👍
@Beamanator Yes exactly.
I believe we are converting the SVG to a PNG/JPEG locally using canvas.toBlob then uploading the resulting PNG/JPEG blob to the server, so the SVG conversion is all happening locally.
Which diff are you using where you aren’t seeing the black background? In my latest update the black background shouldn’t occur.
Will review tomorrow!
@PankajAS I updated the OP to include that step
@JmillsExpensify @trjExpensify ok I made this new issue for
bmpandgifavatar images here: https://github.com/Expensify/App/issues/14751For this issue, I think we can make this specifically be for
.svgavatar images, update the title & OP, then open externallyNice, I think you probably have the most context for the issues to create with the sleuthing to date and what we’re after upstream, so probably clearer if you go ahead and create those. 👍
@JmillsExpensify I’m 99% sure there’s nothing blocking default avatars here, just the uploading of new custom SVG avatars by users
I think it’s
I’m a bit confused trying to piece this together:
We’d probably benefit from writing up a summary of where we’re at with these moving parts, adding that to the OP, and starting a discussion on whatever decisions we need to make to go from her.
@Beamanator @trjExpensify We should move the WAQ hold in my opinion in any case.
https://github.com/Expensify/App/issues/13910 should be fixed or made not an issue by this GH when it’s done, closing the other one.
While this issue currently exists, I would prefer waiting till https://github.com/Expensify/App/pull/12549 gets merged before working on this (most likely can be external) since in that PR we’re enabling other image formats to be uploaded