-
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
[HOLD - #32109] [$500] Attachment – The corrupted PDF can be downloaded, but no download indication is displayed #32204
Comments
Job added to Upwork: https://www.upwork.com/jobs/~01a226f1589481a1b1 |
Triggered auto assignment to @strepanier03 ( |
Bug0 Triage Checklist (Main S/O)
|
Triggered auto assignment to Contributor-plus team member for initial proposal review - @akinwale ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.Attachment – The corrupted PDF can be downloaded, but no download indication is displayed What is the root cause of that problem?The main problem is that since we are using the onPress function by default App/src/components/AnchorForAttachmentsOnly/BaseAnchorForAttachmentsOnly.js Lines 48 to 62 in 67b3b59
What changes do you think we should make in order to solve the problem?Since we clearly have no information that our file is broken App/src/components/PDFView/index.js Lines 286 to 297 in a0b2197
So we can add new code here
And pass new param App/src/components/AnchorForAttachmentsOnly/BaseAnchorForAttachmentsOnly.js Lines 63 to 68 in 67b3b59
And then update code here and add onLoadError
App/src/components/PDFView/index.js Lines 286 to 297 in 67b3b59
What alternative solutions did you explore? (Optional)As an alternative we can use App/src/components/PDFView/index.js Line 295 in 67b3b59
As soon as we successfully download the element we will enable the download
As an alternative, we can update the render method to disable events coming from parent components like
App/src/components/PDFView/index.js Lines 329 to 339 in 67b3b59
|
i think this can be handled with #32109 Download feature should be indicated as if by mistake user deletes the file there is no way to get back without this feature and this can be a frustration for user, there should be a indication that user can download when clicking the preview. Why should we merge this with #32109 ?The root cause for #32109 is related to resizing of the inverted list item dynamicaly if the item is not resized (we show the loading indicator for pdf preview and currupted pdf preview same size both issue can be resolved. POC from #32109 (comment) (design specs can be discussed with design team) Screen.Recording.2023-11-29.at.3.17.08.PM.movcc- @parasharrajat |
ProposalPlease re-state the problem that we are trying to solve in this issue.The corrupted PDF can be downloaded, but no download indication is displayed What is the root cause of that problem?We are using PressableWithoutFeedback component even before PDF is loaded or failed to load here App/src/components/PDFView/index.js Lines 326 to 328 in e87d35d
What changes do you think we should make in order to solve the problem?by default we should not use the PressableWithoutFeedback component, onDocumentLoadSuccess(pdf) {
const {numPages} = pdf;
Promise.all(
_.times(numPages, (index) => {
const pageNumber = index + 1;
return pdf.getPage(pageNumber).then((page) => page.getViewport({scale: 1}));
}),
).then((pageViewports) => {
this.setState({
pageViewports,
numPages,
shouldRequestPassword: false,
isPasswordInvalid: false,
pdfLoaded:true
});
});
} and then render() {
return this.props.onPress && this.state.pdfLoaded ? Note: the reason why we should not use onLoadError is because, this would turn off the PressableWithoutFeedback component once there is an error, that means by default you can use this to download while its loading What alternative solutions did you explore? (Optional)N/A |
ProposalPlease re-state the problem that we are trying to solve in this issue.Attachment – The corrupted PDF can be downloaded, but no download indication is displayed What is the root cause of that problem?We always allow App/src/components/PDFView/index.js Lines 328 to 330 in 398590a
That's why the PDF file is always downloadable. What changes do you think we should make in order to solve the problem?The OP expectation is to show download indicator for corrupted file because it is downloadable. In other words, we should render the default attachment view with clip and download icons if the PDF is corrupted.
As such, in case the pdf is loaded with error, it would fallback to default attachment view like this (just for reference purpose, we should wait for design team to weigh in here): or: What alternative solutions did you explore? (Optional)We can forbid downloading corrupted PDF file by detecting whether the document is loaded successfully (by |
Please re-state the problem that we are trying to solve in this issue. The corrupted PDF can be downloaded, but no download indication is displayed What is the root cause of that problem? We are using PressableWithoutFeedback component before PDF is loaded or failed to load in ~/PDFView/index.js.
What changes do you think we should make in order to solve the problem? We can use the available state 'failedToLoadPDF' as an additional condition before using the PassibleWithoutFeedback component. Currently, the 'faileToLoadPDF' state is being set to false given that the pdf failed to load. We can utilize this and make a minimal change to solve this issue.
This should only enable the download onClick when the PDF is loaded properly, utilizing the 'failedtoLoadPDF' state. |
📣 @anup2230! 📣
|
Contributor details |
✅ Contributor details stored successfully. Thank you for contributing to Expensify! |
@akinwale - When you have some time we have some proposals. |
Triggered auto assignment to @chiragsalian, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
@chiragsalian I do have proposal #32109 (comment) in #32109 (proposed before this issue is created), that will solve this issue too, Please take a look and see if combining issues makes more sense |
@akinwale Could you please request a design review here as this involves design changes? |
@ishpaul777 yeah it looks like your proposal was made slightly earlier and sorta solves this issue too. I do like @tienifr proposal showing a cross with failed to load PDF file but i think that visual improvment might be a different issue. I like solving for displaying the corrupted PDT and having a download indication which you @ishpaul777 seem to solve too. Thoughts on closing this issue in favor for #32109 since it looks like the proposal there should solve this issue too right, @akinwale @parasharrajat, or am i missing something here? |
Still on hold. |
Hold GH is still open. |
HOLD GH still open. |
HOLD Gh still open. |
Hold GH looks like it's going to move forward soon as we've decided on the behavior. |
HOLD GH is still open, pausing here. |
still on hold |
HOLD GH is still open. |
Looks like the linked GH issue is closed. @akinwale @parasharrajat @strepanier03, can someone test and confirm if this issue still exists. Also can someone confirm if this is an internal or external issue. |
This issue is fixed! We are good to close this one |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: v1.4.5-3
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause-Internal Team
Slack conversation: @
Action Performed:
Expected Result:
The corrupted file should have the same preview component and download component as .mp4/docs.
Actual Result:
The corrupted PDF can be downloaded by clicking on it, but no download indication is displayed.
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Bug6294834_1701276250661.Corrupted_PDF.mp4
Corrupted PDF.pdf
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: