Skip to content

Improve handling of new report actions from Pusher#14224

Merged
Julesssss merged 5 commits intomainfrom
arosiclair-notify-new-report-action
Jan 16, 2023
Merged

Improve handling of new report actions from Pusher#14224
Julesssss merged 5 commits intomainfrom
arosiclair-notify-new-report-action

Conversation

@arosiclair
Copy link
Contributor

@arosiclair arosiclair commented Jan 11, 2023

Details

Uses a new shouldNotify flag to recognize and notify for new report actions that were received over Pusher.

Fixed Issues

$ https://github.com/Expensify/Expensify/issues/228194

Tests

  1. Log into NewDot on Web or Desktop
  2. Send this user a message (make sure the chat is not already open)
  3. Verify the message is received and a notification displays for the message
  4. Delete the message
  5. Verify no notification is shown for the deleted message
  • Verify that no errors appear in the JS console

Offline tests

None

QA Steps

Same as Tests

  • 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 4 51 11 PM

Mobile Web - Chrome
Mobile Web - Safari
Desktop

Screenshot 2023-01-10 at 5 06 40 PM

iOS
Android

@arosiclair arosiclair self-assigned this Jan 11, 2023
@arosiclair arosiclair marked this pull request as ready for review January 11, 2023 21:59
@arosiclair arosiclair requested a review from a team as a code owner January 11, 2023 21:59
@melvin-bot melvin-bot bot requested review from eVoloshchak and nkuoch and removed request for a team January 11, 2023 21:59
@melvin-bot
Copy link

melvin-bot bot commented Jan 11, 2023

@eVoloshchak @nkuoch 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]

@Julesssss Julesssss removed the request for review from eVoloshchak January 16, 2023 10:53
@Julesssss
Copy link
Contributor

taking over from @eVoloshchak to get this merged today 👍

Copy link
Contributor

@Julesssss Julesssss left a comment

Choose a reason for hiding this comment

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

I'm not receiving notifications on either Desktop or web, but that Onyx data is being updated correctly. I recall you mentioning in another PR that there is some way of resolving this?

@Julesssss
Copy link
Contributor

Julesssss commented Jan 16, 2023

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

Screenshot 2023-01-16 at 15 24 00

Desktop

Screenshot 2023-01-16 at 15 22 47

@arosiclair
Copy link
Contributor Author

I'm not receiving notifications on either Desktop or web, but that Onyx data is being updated correctly. I recall you mentioning in another PR that there is some way of resolving this?

On web visit 127.0.0.1. You should get prompted for notification permission there. On desktop I had to go into settings and enable notification permission manually.

@Julesssss Julesssss added the InternalQA This pull request required internal QA label Jan 16, 2023
Copy link
Contributor

@Julesssss Julesssss left a comment

Choose a reason for hiding this comment

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

Managed to test successfully.

@Julesssss Julesssss merged commit a109d85 into main Jan 16, 2023
@Julesssss Julesssss deleted the arosiclair-notify-new-report-action branch January 16, 2023 15:35
@github-actions
Copy link
Contributor

Performance Comparison Report 📊

Significant Changes To Duration

There are no entries

Meaningless Changes To Duration

Show entries
Name Duration
App start TTI 674.038 ms → 684.122 ms (+10.084 ms, +1.5%)
Open Search Page TTI 601.407 ms → 609.493 ms (+8.085 ms, +1.3%)
App start nativeLaunch 20.000 ms → 20.133 ms (+0.133 ms, +0.7%)
App start regularAppStart 0.020 ms → 0.017 ms (-0.003 ms, -17.3%) 🟢
App start runJsBundle 189.031 ms → 188.188 ms (-0.844 ms, ±0.0%)
Show details
Name Duration
App start TTI Baseline
Mean: 674.038 ms
Stdev: 30.666 ms (4.5%)
Runs: 625.6154539999552 629.7919399999082 634.9577730000019 636.8413030002266 638.570092999842 639.662376999855 644.1082759997807 645.4011829998344 646.1072410000488 647.1567950001918 648.6330590001307 650.0021199998446 655.7373350001872 662.296372000128 667.6154559999704 669.6534750000574 676.9510479997844 682.5872769998387 686.1102370000444 691.6564299999736 696.3640560000204 696.6089070001617 696.9212059997953 697.1228370000608 698.3598690000363 700.4693729998544 708.3991080000997 712.2381699997932 714.802393999882 717.88585099997 718.4665740001947 732.1208640001714

Current
Mean: 684.122 ms
Stdev: 29.808 ms (4.4%)
Runs: 637.5511260000058 641.6131589999422 645.9830550001934 646.3656319999136 649.5886280001141 650.6854019998573 654.5857810000889 661.6637169998139 663.2025850000791 666.0107599999756 672.6844179998152 673.5221629999578 678.9463570001535 679.6079620001838 680.484645999968 681.3329900000244 682.0391469998285 682.4360779998824 688.0975080002099 689.1458499999717 689.5676190000959 696.431675999891 699.9355000001378 702.2491259998642 703.3326909998432 712.124063000083 715.8904760000296 732.4228889998049 737.6705109998584 743.2944180001505 749.3282710001804
Open Search Page TTI Baseline
Mean: 601.407 ms
Stdev: 23.135 ms (3.8%)
Runs: 567.7681480003521 575.4963789996691 577.2205399996601 577.5723880003206 579.3822840000503 583.0682789999992 584.8074140003882 584.8501389999874 584.9230140000582 585.1822509998456 586.9074699999765 587.1151940003037 588.4086919999681 591.6022950001061 593.6787930000573 594.5925699998625 594.6746430001222 596.8445229995996 600.6127519998699 605.8045649998821 606.0552980001085 606.5974540002644 607.7029220000841 609.4187019998208 612.8012700001709 616.7238769996911 620.2551679997705 625.0629480001517 635.9755049999803 645.1477060001343 651.371826000046 667.4096689997241

Current
Mean: 609.493 ms
Stdev: 24.481 ms (4.0%)
Runs: 564.0574550000019 565.1474199998192 578.2204189999029 578.7626149998978 580.7821049997583 584.1058760001324 584.8090010001324 588.9978439998813 589.8297120002098 594.3706060000695 596.7622480001301 599.3398440000601 602.6563730002381 603.3708910001442 603.5761719997972 605.8701169998385 608.3134770002216 610.712728000246 615.946411000099 616.2826339998282 617.2021889998578 617.3241779999807 618.1905930000357 620.5392660000362 625.5480960002169 627.3062340002507 632.0176189998165 639.9643969996832 641.8868819996715 642.0703130001202 648.9954019999132 649.93802900007 660.356853000354
App start nativeLaunch Baseline
Mean: 20.000 ms
Stdev: 2.411 ms (12.1%)
Runs: 17 17 17 17 18 18 18 18 18 18 18 18 19 19 19 19 19 19 20 20 20 22 22 23 23 23 23 23 23 23 24 25

Current
Mean: 20.133 ms
Stdev: 1.839 ms (9.1%)
Runs: 18 18 18 18 18 19 19 19 19 19 19 19 19 19 20 20 20 20 20 20 20 21 21 22 22 22 23 23 24 25
App start regularAppStart Baseline
Mean: 0.020 ms
Stdev: 0.002 ms (8.1%)
Runs: 0.017375000286847353 0.017578000202775 0.01766000036150217 0.01831099996343255 0.018352000042796135 0.018554999958723783 0.0186769999563694 0.018962000031024218 0.01912499964237213 0.019286999944597483 0.019328000023961067 0.019328000023961067 0.019450000021606684 0.019856000319123268 0.02010100008919835 0.020141000393778086 0.020182000007480383 0.02022299962118268 0.020711000077426434 0.02099600015208125 0.0213620001450181 0.021402999758720398 0.021403000224381685 0.021443000063300133 0.021566000301390886 0.021768999751657248 0.02217599982395768 0.024779999628663063

Current
Mean: 0.017 ms
Stdev: 0.001 ms (6.7%)
Runs: 0.015015000011771917 0.015015000011771917 0.015177000313997269 0.015178000088781118 0.015298999845981598 0.015339999925345182 0.015868999995291233 0.015910000074654818 0.015950999688357115 0.015951000154018402 0.015951000154018402 0.016234999988228083 0.016276000067591667 0.016398000065237284 0.016439000144600868 0.016480000223964453 0.01652099983766675 0.016764999832957983 0.01704900013282895 0.01725299982354045 0.017455999739468098 0.01761800004169345 0.0176189998164773 0.017741000279784203 0.017985000275075436 0.018962000031024218 0.01912399986758828
App start runJsBundle Baseline
Mean: 189.031 ms
Stdev: 21.957 ms (11.6%)
Runs: 157 158 159 162 164 165 166 167 171 172 173 181 182 182 185 188 189 190 191 195 196 197 200 203 204 214 215 217 218 226 227 235

Current
Mean: 188.188 ms
Stdev: 21.713 ms (11.5%)
Runs: 156 157 160 162 166 168 174 174 175 175 175 176 178 179 182 183 183 186 186 189 189 195 201 202 202 202 203 224 224 230 232 234

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by @Julesssss in version: 1.2.55-0 🚀

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

@arosiclair
Copy link
Contributor Author

Verified on staging ✅

Screen Shot 2023-01-18 at 11 43 27 AM

Screen Shot 2023-01-18 at 11 54 42 AM

@OSBotify
Copy link
Contributor

🚀 Deployed to production by @AndrewGable in version: 1.2.55-0 🚀

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

InternalQA This pull request required internal QA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants