Skip to content

Pdf view error - #14174

Merged
grgia merged 3 commits into
Expensify:mainfrom
Puneet-here:PDFView-error
Jan 13, 2023
Merged

grgia merged 3 commits into
Expensify:mainfrom
Puneet-here:PDFView-error

Conversation

@Puneet-here

Copy link
Copy Markdown
Contributor

Details

#13862 (comment)

Fixed Issues

$ #13862
PROPOSAL: #13862 (comment)

Tests

  1. Go to a chat
  2. Click +
  3. Add attachment > Select a pdf
  4. Verify you don't see a console error
  • Verify that no errors appear in the JS console

Offline tests

n/a

QA Steps

  1. Go to a chat
  2. Click +
  3. Add attachment > Select a pdf
  4. Verify you don't see a console error
  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android / native
    • Android / Chrome
    • iOS / native
    • iOS / Safari
    • MacOS / Chrome / Safari
    • MacOS / Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is correct English and approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I have checked off every checkbox in the PR author checklist, including those that don't apply to this PR.

Screenshots/Videos

Web Screenshot 2023-01-10 at 3 25 37 PM
Mobile Web - Chrome Screenshot 2023-01-10 at 4 04 18 PM
Mobile Web - Safari Screenshot 2023-01-10 at 3 52 24 PM
Desktop Screenshot 2023-01-10 at 2 50 00 PM
iOS Screenshot 2023-01-10 at 3 50 52 PM
Android Screenshot 2023-01-10 at 3 37 38 PM

@Puneet-here
Puneet-here requested a review from a team as a code owner January 10, 2023 10:36
@melvin-bot
melvin-bot Bot requested review from grgia and rushatgabhane and removed request for a team January 10, 2023 10:36
@melvin-bot

melvin-bot Bot commented Jan 10, 2023

Copy link
Copy Markdown

@grgia @rushatgabhane One of you needs to 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]

Comment thread src/components/PDFView/index.native.js Outdated
import Text from '../Text';
import PDFPasswordForm from './PDFPasswordForm';
import * as pdfViewPropTypes from './pdfViewPropTypes';
import {propTypes as basePropTypes, defaultProps} from './pdfViewPropTypes';

@rushatgabhane rushatgabhane Jan 11, 2023 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Puneet-here
NAB: just because that's how it's done everywhere else.

Suggested change
import {propTypes as basePropTypes, defaultProps} from './pdfViewPropTypes';
import {propTypes as pdfViewPropTypes, defaultProps} from './pdfViewPropTypes';

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, thanks!

@rushatgabhane rushatgabhane left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Puneet-here can you please help me on how to send attachment on iOS simulator?

Also, the screenshots attached in PR for iOS and iOS-Safari are of opening an attachment, please correct them.

@rushatgabhane

rushatgabhane commented Jan 11, 2023 •

Copy link
Copy Markdown
Member

Alright, I was using iPhone 13 simulator and I changed it to iPhone 14 pro.

I can upload attachments now.

@Puneet-here

Copy link
Copy Markdown
Contributor Author

Also, the screenshots attached in PR for iOS and iOS-Safari are of opening an attachment, please correct them.

@rushatgabhane, it was also reproducible when you open the pdf first time.

@rushatgabhane

Copy link
Copy Markdown
Member

it was also reproducible when you open the pdf first time

Oh alright, thanks for confirming :)

@rushatgabhane rushatgabhane left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@grgia LGTM! 🎉

@Puneet-here thanks for the quick PR!

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • Android / native
    • Android / Chrome
    • iOS / native
    • iOS / Safari
    • MacOS / Chrome / Safari
    • MacOS / Desktop
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is correct English and approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Web
Screen.Recording.2023-01-12.at.3.09.43.AM.mov
Mobile Web - Chrome
WhatsApp.Video.2023-01-12.at.03.08.22.mp4
Mobile Web - Safari
Screen.Recording.2023-01-12.at.3.18.33.AM.mov
image
Desktop
Screen.Recording.2023-01-12.at.3.25.01.AM.mov
iOS
Screen.Recording.2023-01-12.at.3.14.33.AM.mov
Android
WhatsApp.Video.2023-01-12.at.03.06.53.mp4

@grgia
grgia merged commit 45c39a8 into Expensify:main Jan 13, 2023
@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@github-actions

Copy link
Copy Markdown
Contributor

Performance Comparison Report 📊

Significant Changes To Duration

There are no entries

Meaningless Changes To Duration

Show entries
Name Duration
App start TTI 665.114 ms → 678.739 ms (+13.625 ms, +2.0%)
Open Search Page TTI 595.889 ms → 607.583 ms (+11.694 ms, +2.0%)
App start runJsBundle 185.844 ms → 192.344 ms (+6.500 ms, +3.5%)
App start nativeLaunch 19.233 ms → 20.938 ms (+1.704 ms, +8.9%)
App start regularAppStart 0.019 ms → 0.014 ms (-0.005 ms, -26.9%) 🟢
Show details
Name Duration
App start TTI Baseline
Mean: 665.114 ms
Stdev: 31.635 ms (4.8%)
Runs: 617.1523119998164 621.4511719997972 623.8103080000728 625.9354329998605 630.2168089998886 630.3517229999416 631.0685569997877 634.9228539997712 641.6031700000167 647.6585070001893 648.6915730000474 648.7813389999792 649.887790999841 651.9273529998027 655.4736489998177 658.7121640001424 660.8205869998783 666.6872660000809 668.356095999945 677.9429790000431 680.7521959999576 680.9312060000375 683.2715179999359 683.7882369998842 687.9139310000464 688.2400440000929 699.613898999989 703.1707190000452 709.7351299999282 709.7764229997993 729.5540729998611 735.4449570002034

Current
Mean: 678.739 ms
Stdev: 39.175 ms (5.8%)
Runs: 615.0013080001809 628.1050370000303 628.1299149999395 630.5397620000876 637.7004549996927 638.7587720002048 643.876960999798 647.0289590000175 650.0840469999239 650.9997589997947 651.5813919999637 655.3313989997841 658.161660999991 665.6974289999343 667.3872440000996 671.2643679999746 672.2006540000439 680.6686260001734 684.816252999939 692.4990849997848 699.1993920002133 700.5245089996606 701.8636320000514 702.4738309998065 706.5405359999277 707.600542999804 719.8674590000883 720.6267389999703 723.0656670001335 731.4717779997736 755.1789290001616 781.3895800001919
Open Search Page TTI Baseline
Mean: 595.889 ms
Stdev: 18.052 ms (3.0%)
Runs: 561.7640390000306 566.3051760001108 568.6436769999564 578.6879070000723 579.4238279997371 579.5828860001639 582.3821610002778 582.7765709999949 582.888469000347 584.2784020002 585.6001389999874 585.9630939997733 587.5647789998911 589.0628259996884 593.5297440001741 595.0227059996687 596.9118650001474 597.1769210002385 598.8942060000263 599.5401619998738 599.6361080002971 600.2482509999536 603.6645920001902 607.9245199998841 609.46875 610.7365320003591 611.3851320003159 612.8380130003206 618.4365650000982 626.5176599998958 635.7509360001422 635.8472090000287

Current
Mean: 607.583 ms
Stdev: 18.139 ms (3.0%)
Runs: 565.1742759998888 579.562173999846 580.6470129992813 583.9532879991457 586.7142739994451 589.1591389998794 589.4215899994597 594.7490639993921 595.4573969999328 598.171875 598.2918699998409 600.2179359998554 602.1267910003662 605.0160320000723 605.097779000178 608.7230230001733 610.5363770006225 611.6746009998024 612.8103429991752 612.9950360003859 613.4727380005643 613.7109380001202 615.5726319998503 616.4627679996192 618.8087160000578 620.7673749998212 623.1765549993142 624.521972999908 625.8375660004094 626.166300999932 632.4559329999611 635.2761230003089 653.5121659999713
App start runJsBundle Baseline
Mean: 185.844 ms
Stdev: 17.978 ms (9.7%)
Runs: 154 156 162 165 167 167 168 168 169 174 174 174 176 181 186 186 187 188 190 191 194 196 198 200 203 205 205 206 210 214 215 218

Current
Mean: 192.344 ms
Stdev: 24.785 ms (12.9%)
Runs: 163 163 163 166 168 168 169 171 175 175 178 179 180 182 183 187 189 189 192 193 194 195 196 198 209 213 225 230 233 237 237 255
App start nativeLaunch Baseline
Mean: 19.233 ms
Stdev: 2.044 ms (10.6%)
Runs: 17 17 17 17 17 17 18 18 18 18 18 18 19 19 19 19 19 19 19 19 19 20 20 20 21 21 22 23 24 25

Current
Mean: 20.938 ms
Stdev: 2.968 ms (14.2%)
Runs: 18 18 18 18 18 18 18 18 19 19 19 19 19 19 20 20 20 21 21 21 21 21 22 23 23 23 24 24 25 27 27 29
App start regularAppStart Baseline
Mean: 0.019 ms
Stdev: 0.002 ms (8.6%)
Runs: 0.016642000060528517 0.017456000205129385 0.01761800004169345 0.017659999895840883 0.01769999973475933 0.0177819998934865 0.0181470001116395 0.018391999881714582 0.01839200034737587 0.018432999961078167 0.0185139998793602 0.0185139998793602 0.018717000260949135 0.01904299994930625 0.019084000028669834 0.019164999946951866 0.019450000021606684 0.019530999939888716 0.019532000180333853 0.019733999855816364 0.020060000009834766 0.020426000002771616 0.020548999775201082 0.0206300001591444 0.021077000070363283 0.02128099976107478 0.021321000065654516 0.021851000376045704 0.022867999970912933 0.02404800010845065

Current
Mean: 0.014 ms
Stdev: 0.001 ms (4.5%)
Runs: 0.013062000274658203 0.013590000104159117 0.013671999797224998 0.013672000262886286 0.013672000262886286 0.013712999876588583 0.013712999876588583 0.013712999876588583 0.01375299971550703 0.01375299971550703 0.013794000260531902 0.013794000260531902 0.0138349998742342 0.013956999871879816 0.014037999790161848 0.014078999869525433 0.014078999869525433 0.014119000174105167 0.014119000174105167 0.014403999783098698 0.014444999862462282 0.014526000246405602 0.014688999857753515 0.0147299999371171 0.014810999855399132 0.01509599993005395 0.01509599993005395 0.015462999697774649 0.015544000081717968 0.015583999920636415

@OSBotify OSBotify mentioned this pull request Jan 13, 2023
13 tasks done
@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by @grgia in version: 1.2.54-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by @AndrewGable in version: 1.2.54-2 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants