-
Notifications
You must be signed in to change notification settings - Fork 3k
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
fix: mWeb - Chat - Uploading an image while offline briefly shows an offline message in the preview. #43249
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] |
src/components/ImageView/index.tsx
Outdated
@@ -195,6 +195,8 @@ function ImageView({isAuthTokenRequired = false, url, fileName, onError}: ImageV | |||
}; | |||
}, [canUseTouchScreen, trackMovement, trackPointerPosition]); | |||
|
|||
const isLocalFile = url.startsWith('blob:') || url.startsWith('file:'); |
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.
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?
const isLocalFile = typeof receiptPath === 'number' || receiptPath?.startsWith('blob:') || receiptPath?.startsWith('file:') || receiptPath?.startsWith('/'); |
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Krishna2323 bump on the comments above :)
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.
will test for /
again on all platforms today
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.
bump @Krishna2323 , lets get this merged before the week closes 💪
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.
Can we move these checks to a shared helper function? @Krishna2323
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.
@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 |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
umm, if @arosiclair approves this then i would have no issue haha..., rest code LGTM!
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.
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 Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.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 and/or tagged@Expensify/design
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.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