fix: mWeb - Chat - Uploading an image while offline briefly shows an offline message in the preview.#43249
Conversation
…offline message in the preview. Signed-off-by: Krishna Gupta <belivethatkg@gmail.com>
|
@allgandalf 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] |
| }; | ||
| }, [canUseTouchScreen, trackMovement, trackPointerPosition]); | ||
|
|
||
| const isLocalFile = url.startsWith('blob:') || url.startsWith('file:'); |
There was a problem hiding this comment.
Do you think the above two cases cover every type?
For example, here's one example from IOURequestStepConfirmation.tsx, they have extra type check and / check, is the same applicable here?
Note
I haven't reviewed the code from laptop cause i'm a little under the weather, so might take the day off, but if you address the above comments of whether those additional checks are necessary, i will try to review the PR over the weekend.
There was a problem hiding this comment.
I'm not completely sure about the other checks, with the current changes it works fine on all platforms but we can consider adding those checks also, WDYT?
There was a problem hiding this comment.
i think the typeof check would unnecessary here because it will always be true i checked the type ofurl it's string so then isLocalFile would always be true so no need to be redundant.
But startsWith('/') is something i'm not sure about, can you check and see if that is needed? if not then the current implementation is complete, and i will complete the checklist then, let me know :)
There was a problem hiding this comment.
will test for / again on all platforms today
There was a problem hiding this comment.
bump @Krishna2323 , lets get this merged before the week closes 💪
There was a problem hiding this comment.
Can we move these checks to a shared helper function? @Krishna2323
There was a problem hiding this comment.
@arosiclair, I've updated the code to add a util function for determining local files. @allgandalf, could you please take a look at the updated code? Thanks.
|
@allgandalf, I have already replied to your comment, looks like I started a review instead of adding a comment, sorry for that.
|
|
Ahh that is alright, will review this today 👍 |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-06-15.at.1.19.00.PM.movAndroid: mWeb ChromeScreen.Recording.2024-06-15.at.1.22.06.PM.moviOS: NativeScreen.Recording.2024-06-15.at.1.07.43.PM.moviOS: mWeb SafariScreen.Recording.2024-06-15.at.1.04.49.PM.movMacOS: Chrome / SafariScreen.Recording.2024-06-15.at.1.01.51.PM.movMacOS: Desktopafs.mov |
allgandalf
left a comment
There was a problem hiding this comment.
Code LGTM, tests well on all platforms 👍
Signed-off-by: Krishna Gupta <belivethatkg@gmail.com>
| if (!receiptUri) { | ||
| return false; | ||
| } | ||
| return typeof receiptUri === 'number' || receiptUri?.startsWith('blob:') || receiptUri?.startsWith('file:') || receiptUri?.startsWith('/'); |
There was a problem hiding this comment.
I am not sure with the type check here @Krishna2323 @arosiclair ?
What are the cases where a URI would be a number ?!
There was a problem hiding this comment.
@allgandalf, we can leave that as it is. This isn't added in our PR, and it is an optional check, so it won't affect our use case.
There was a problem hiding this comment.
umm, if @arosiclair approves this then i would have no issue haha..., rest code LGTM!
There was a problem hiding this comment.
IIRC it's a number on some platforms (iOS/Android I think). It should be fine to keep that 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/arosiclair in version: 1.4.86-0 🚀
|
1 similar comment
|
🚀 Deployed to staging by https://github.com/arosiclair in version: 1.4.86-0 🚀
|
|
🚀 Deployed to staging by https://github.com/arosiclair in version: 1.4.86-0 🚀
|
|
🚀 Deployed to production by https://github.com/AndrewGable in version: 9.0.0-9 🚀
|

Details
Fixed Issues
$ #42657
PROPOSAL: #42657 (comment)
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodSTYLE.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 and/or tagged@Expensify/designso 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.mp4
Android: mWeb Chrome
android_chrome.mp4
iOS: Native
ios_native.mp4
iOS: mWeb Safari
ios_safari.mp4
MacOS: Chrome / Safari
web_chrome.mp4
MacOS: Desktop
desktop_app.mp4