App icon indicating copy to clipboard operation
App copied to clipboard

[HOLD for payment 2021-12-06] [Pay on Tuesday 23rd Nov] Chat - Unable to scroll PDF file more than 2 pages in Preview page before sending

Open kavimuru opened this issue 5 years ago • 28 comments

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Action Performed:

  1. Lunch the app
  2. Log in with any account
  3. Select any user
  4. Click on plus button
  5. Select Add Attachment
  6. Select Documents
  7. Select PDF with two and more pages, but don't send it
  8. Start scrolling the pages in Preview Page

Expected Result:

Able scroll PDF file more than 2 pages in Preview page before sending

Actual Result:

Unable scroll PDF file more than 2 pages in Preview page before sending

Workaround:

Unknown

Platform:

Where is this issue occurring?

  • Android

Version Number: 1.0.99-0 Logs: https://stackoverflow.com/c/expensify/questions/4856 Notes/Photos/Videos:

https://user-images.githubusercontent.com/43996225/133540977-6e19470e-9ccd-4939-a627-c64c87249144.mp4

Expensify/Expensify Issue URL: Issue reported by: Slack conversation:

View all open jobs on GitHub

kavimuru avatar Sep 16 '21 02:09 kavimuru

:wave: Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open StagingDeployCash deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

OSBotify avatar Sep 16 '21 02:09 OSBotify

Triggered auto assignment to @Julesssss (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

MelvinBot avatar Sep 16 '21 02:09 MelvinBot

Okay, I can reproduce this on Android. iOS Web and Desktop are fine. As the user is not blocked from sending PDFs and it only occurs on one platform I'm removing the deployBlocker label.

Julesssss avatar Sep 16 '21 13:09 Julesssss

Viewing a previously shared attachment works fine, when sending an attachment you are able to scroll for about a second, and then it becomes slow and janky.

Julesssss avatar Sep 16 '21 13:09 Julesssss

I can't see any recent change which would have introduced this. This PR from a month ago fixed PDF pan and zoom and may have been the cause.

It was originally fixed here by @rdjuric, so maybe you would like to look into this issue too, once I make it external?

Julesssss avatar Sep 16 '21 13:09 Julesssss

Triggered auto assignment to @JmillsExpensify (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

MelvinBot avatar Sep 16 '21 13:09 MelvinBot

Issue reproducible during KI retests.

isagoico avatar Sep 20 '21 15:09 isagoico

Whoops, I've been in the trenches of N6. Just posted to Upwork: https://www.upwork.com/jobs/~01b0af8ac91b6afc7b

JmillsExpensify avatar Sep 21 '21 05:09 JmillsExpensify

Issue reproducible during KI retests.

isagoico avatar Sep 27 '21 15:09 isagoico

Issue reproducible during KI retests.

isagoico avatar Oct 04 '21 16:10 isagoico

Awaiting proposals

Julesssss avatar Oct 06 '21 08:10 Julesssss

Issue reproducible during KI retests.

mvtglobally avatar Oct 11 '21 17:10 mvtglobally

Still awaiting proposals

Julesssss avatar Oct 15 '21 16:10 Julesssss

Issue reproducible during KI retests.

mvtglobally avatar Oct 18 '21 16:10 mvtglobally

Issue reproducible during KI retests.

mvtglobally avatar Oct 26 '21 01:10 mvtglobally

Still awaiting proposals

Julesssss avatar Oct 27 '21 17:10 Julesssss

The problem lies inside a Modal component used in AttachmentModal. If attachment is PDF we pass CONST.MODAL.MODAL_TYPE.CENTERED_UNSWIPEABLE as Modal type, otherwise CONST.MODAL.MODAL_TYPE.CENTERED. This works correctly and passes 'centered_unswipeable' when we select PDF attachment. However, modal seems to ignore it, since scrolling is unavailable. If we just hardcode 'centered_unswipeable' as modal type, everything works as expected, scroll is available. I'm not sure what kind of magic is happening here, since in both cases we pass identical strings, but I wasn't able to track the root cause of this issue. However, if we store modalType in state and update it every time file changes, scrolling starts working.

Proposal:

  1. Add modalType key to state
this.state = {
    isModalOpen: false,
    isConfirmModalOpen: false,
    file: null,
    sourceURL: props.sourceURL,
    modalType: CONST.MODAL.MODAL_TYPE.CENTERED_UNSWIPEABLE,
};
  1. Implement getModalType method inside AttachmentModal component
getModalType(sourceUrl, file) {
    const modalType = (sourceUrl
        && (Str.isPDF(sourceUrl) || (file && Str.isPDF(file.name || this.props.translate('attachmentView.unknownFilename')))))
        ? CONST.MODAL.MODAL_TYPE.CENTERED_UNSWIPEABLE
        : CONST.MODAL.MODAL_TYPE.CENTERED;
    return modalType;
}
  1. Update modal type inside displayFileInModal
displayFileInModal: ({file}) => {
    if (!this.isValidSize(file)) {
        this.setState({isConfirmModalOpen: true});
        return;
    }
    if (file instanceof File) {
        const source = URL.createObjectURL(file);
        const modalType = this.getModalType(source, file);
        this.setState({
            isModalOpen: true,
            sourceURL: source,
            file,
            modalType,
        });
    } else {
        const modalType = this.getModalType(file.uri, file);
        this.setState({
            isModalOpen: true,
            sourceURL: file.uri,
            file,
            modalType,
        });
    }
},

https://user-images.githubusercontent.com/9059945/139555069-035c3e50-cd00-41a7-9cf6-671ec37a89de.mp4

https://user-images.githubusercontent.com/9059945/139555124-a33f655c-e80f-40ed-9ac5-ef9b92a7c44f.mp4

eVoloshchak avatar Oct 30 '21 18:10 eVoloshchak

Issue reproducible during KI retests.

mvtglobally avatar Nov 02 '21 00:11 mvtglobally

@Julesssss can you review @eVoloshchak proposal above? https://github.com/Expensify/App/issues/5291#issuecomment-955576485

Created new job in Upwork, other had expired Doubled price to $500 https://www.upwork.com/jobs/~01ff20b40c42f9bf74

mallenexpensify avatar Nov 02 '21 19:11 mallenexpensify

@Julesssss , please @eVoloshchak proposal above https://github.com/Expensify/App/issues/5291#issuecomment-955576485

We are placing all non-critical issues on hold while we're on a company offsite. The hold is expected to be lifted on 11/19 (but could go longer). For any PRs that are submitted before or during the hold, we will add a $250 bonus payment.

mallenexpensify avatar Nov 08 '21 18:11 mallenexpensify