-
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
fixes blankArea-for-corruptedPDF #34302
fixes blankArea-for-corruptedPDF #34302
Conversation
@parasharrajat 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] |
@parasharrajat I'll take care of the remaining checklist in a while, Can you proceed with the code review in mean time if you get the chance. Thanks! |
183d11f
to
a712f60
Compare
Please don't do force pushes. We prefer merge commits. |
Actually. i pushed a unsigned commit by mistake, the way i know rectify this currently is:
Let me know if there's a better way 🙇♂️ |
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.
Couple of initial requests.
@parasharrajat Please hold your review found some unaccounted major issues on android |
@parasharrajat I am facing this bug https://expensify.slack.com/archives/C049HHMV9SM/p1706234706816449 on main, blocking me to test the android Can you confirm if this is reproducible for you too? |
still held on this issue #35808 |
@parasharrajat Can you check issue should be resolved, also if you are satisfied with response of above review comments can i mark them as resolved? |
@parasharrajat friendly bump! |
Back on this PR. Catching up with details. I will have an update by tomorrow. |
merged main but not yet tested (going offline for today 😴 |
src/components/Attachments/AttachmentView/AttachmentViewPdf/index.android.js
Outdated
Show resolved
Hide resolved
There are conflicts i'll resolve them when i got chance asap. (not able to priortize today sorry) |
Currently, I am not getting a good gut feeling about the code. My mind says that we should refactor this. |
What is it that you think needs a change, i agree the changes seems a little messy than i expected initially but i think evey change is important |
Solution is still the same as proposed initially:
|
I will spend some time looking at the code from a different perspective and let you know. |
{/* We are rendering the loading indicator here because we are invisbly rendering the PDF component to validate if it is not corrupted */} | ||
{shouldShowLoadingIndicator && isUsedAsMessageAttachment && ( | ||
<View style={[themeStyles.chatItemAttachmentPlaceholder, themeStyles.bgTransparent, StyleUtils.getWidthAndHeightStyle(200, 200)]}> | ||
<FullScreenLoadingIndicator style={[themeStyles.opacity1, themeStyles.bgTransparent]} /> | ||
</View> | ||
)} |
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.
So I am still unsure why we have to load the PDF invisibly. I know you have answered this before but can you please explain this again? The comment above does not explain anything moreover creates more confusion.
- What is the issue?
- How does this solve that issue?
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'll adress this concern after the refactoring 🙇♂️ if its still valid
<AttachmentViewPdf | ||
source={source} | ||
file={file} | ||
isFocused={isFocused} | ||
isAuthTokenRequired={isAuthTokenRequired} | ||
encryptedSourceUrl={encryptedSourceUrl} | ||
onPress={onPress} | ||
onToggleKeyboard={onToggleKeyboard} | ||
onLoadComplete={() => !loadComplete && setLoadComplete(true)} | ||
errorLabelStyles={isUsedInAttachmentModal ? [styles.textLabel, styles.textLarge] : [styles.cursorAuto]} | ||
style={isUsedInAttachmentModal ? styles.imageModalPDF : styles.flex1} | ||
isUsedInCarousel={isUsedInCarousel} | ||
renderFallbackAttachmentView={renderFallbackAttachmentView} | ||
isUsedInAttachmentModal={isUsedInAttachmentModal} | ||
/> |
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.
After giving a deep thought, I think it will be much better to render the fallback UI here in this component by detecting the error. This is already happening at the last thing at the component. let's try to hoist the error state till this component via callback onError
.
We should disable the error UI in the PDFView completely. What do you think?
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.
This will save us from making a lot of unnecessary changes like.
- AttachmentViewPdf/index.android.js
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.
seems like a very good idea, i'll spend some time refactoring later today or tomorrow for sure 👍
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.
Thank you.
@ishpaul777 Any updates? |
Srry no update yet, i'll provide a update tommorrow I really apologize for delay |
No problem. |
@parasharrajat I just came across a issue closed a week ago #34601, which seems to conflict for what we are doin here, it suggests the expected that if a pdf fails to load it should show the placeholder image, it seems you were also involved in the issue so do you think we should do the same here? asking becuase if follow this expected behaviour we will not have touch any other unncessary file and not need change AUTOSCROLL_TO_TOP_THRESHOLD |
That PR adds a fallback when an image or thumbnail fails to load. But this is interesting. We have two conflicting behaviors. Let's take a pause here and go back to discussing the solution. Do you mind raising this on slack or initiating a new discussion on the issue and tagging the design team as well? |
i'll bring this to discussion once i have some bandwidth to actively work on this one, hope you understand 🙇 A quick update i have refactored locally based on your idea here #34302 (comment) and it works 🎉 what's left is to decide on what's the expected behaviour once the Pdf fails to load whether to show default view or failed thumbnail state |
Can you please push the changes @ishpaul777 ? |
Sorry i missed the ping, pushing all the changes with the failed state thumbnail and defaukt attachement view both for now then we'll get the approval from design team on which way to go |
97ce0a8
to
5404018
Compare
New PR #38010, conflicts was brutal 😭 |
Details
WIP will add later...
Fixed Issues
$ #32109
PROPOSAL: #32109 (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 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
Record_2024-02-07-17-20-44.mp4
Android: mWeb Chrome
VIDEO-2024-02-18-03-04-16.mp4
iOS: Native
Screen.Recording.2024-01-22.at.9.09.30.PM-1.mov
iOS: mWeb Safari
Screen.Recording.2024-01-22.at.9.20.28.PM-1.mov
MacOS: Chrome / Safari
Screen.Recording.2024-01-22.at.9.23.15.PM-1.mov
MacOS: Desktop
Screen.Recording.2024-01-22.at.9.35.23.PM-1.mov