Skip to content
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

Show Android notifications above apps, and introduce notification channels #13694

Merged
merged 3 commits into from
Dec 20, 2022

Conversation

Julesssss
Copy link
Contributor

@Julesssss Julesssss commented Dec 19, 2022

CC @cristipaval @arosiclair

Details

Increase Android notification priority, show notifications above apps, and introduce notification channels. Makes up a part of the Reliable Notifications project. More info in the doc section here.

Fixed Issues

$ #13695

Tests

Consistent Airship Notification Delivery
Android only

  • Delays might occur with notification delivery
  • Sign into the app as userA
  • Leave the app open in the foreground
  • Sign into any other client as userB
  • As userB, send a message to userA
  • UserA should see a notification
  • As userA, minimise the app without closing it (make sure to swipe or use the home button, do not use the Android back - button)
  • As userB, send a message to userA
  • UserA should see a notification
  • As userA, kill the app (make sure to swipe up)
  • As userB, send a message to userA
  • UserA should see a notification
  • These notifications should show ABOVE other apps, instead of justhaving the icon appear in the status bar

Airship Notification Delivery of multiple messages
Android only

  • Delays might occur with notification delivery
  • Sign into the app as userA
  • Sign into any other client as userB
  • As userB, send a message to userA
  • As userB, send a message to userA
  • Wait a couple of minutes
  • As userB, send a message to userA
  • UserA should receive 3 notifications

Android notification channels

  • As a user signed into Android, receive a notification from any other user
  • Navigate to App Settings via the Android OS Settings > Apps > New Expensify
  • Tap 'Notifications'
  • You should see categorisation that matches this screenshot (unless on an older version of Android)

Screenshot_20221216_163449

Offline tests

Airship Offline Notification Delivery
Android only

  • Sign into the app as userA
  • Enable the device’s flight mode and disconnect from the network
  • On a second client, sign in as userB
  • As userB, send a message to userA
  • As userA, you should not receive a notification as you are offline
  • As userA, re-enable your device network connection
  • As userA, you should then receive the notification

QA Steps

Run above tests.

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

Only Android code was modified.

The new notification channels configuration
Screenshot_20221216_163449

Notification shown above other apps
Screenshot_20221216_155957

@Julesssss Julesssss self-assigned this Dec 19, 2022
@Julesssss Julesssss changed the title Increase Android notification priority, show notifications above apps, and introduce notification channels Show Android notifications above apps, and introduce notification channels Dec 19, 2022
@Julesssss Julesssss marked this pull request as ready for review December 20, 2022 12:21
@Julesssss Julesssss requested a review from a team as a code owner December 20, 2022 12:21
@melvin-bot melvin-bot bot requested review from robertjchen and sobitneupane and removed request for a team December 20, 2022 12:22
@melvin-bot
Copy link

melvin-bot bot commented Dec 20, 2022

@sobitneupane @robertjchen 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 sobitneupane December 20, 2022 12:22
@Julesssss
Copy link
Contributor Author

Hi @sobitneupane, keeping this review internal.

@cristipaval
Copy link
Contributor

cristipaval commented Dec 20, 2022

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 N/A
Mobile Web - Chrome N/A
Mobile Web - Safari N/A
Desktop N/A
iOS N/A
Android

Screenshot_20221220_163609_Settings

Screenshot_20221220_154038_New Expensify

Screenshot_20221220_154212_One UI Home

Screenshot_20221220_154147_One UI Home

Copy link
Contributor

@arosiclair arosiclair left a comment

Choose a reason for hiding this comment

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

LGTM and tests well!

@arosiclair arosiclair merged commit 9d357e4 into main Dec 20, 2022
@arosiclair arosiclair deleted the jules-androidNotificationPrioritisation branch December 20, 2022 18:50
@OSBotify
Copy link
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
Contributor

Performance Comparison Report 📊

Significant Changes To Duration

There are no entries

Meaningless Changes To Duration

Show entries
Name Duration
TTI 812.714 ms → 828.224 ms (+15.510 ms, +1.9%)
runJsBundle 191.719 ms → 203.625 ms (+11.906 ms, +6.2%)
nativeLaunch 9.138 ms → 9.167 ms (+0.029 ms, ±0.0%)
regularAppStart 0.014 ms → 0.014 ms (-0.000 ms, -2.4%)
Show details
Name Duration
TTI Baseline
Mean: 812.714 ms
Stdev: 39.463 ms (4.9%)
Runs: 747.4909569998272 756.5466990000568 763.7512699998915 763.9726510001346 772.4688530000858 773.6124229999259 783.5393059998751 787.052370000165 791.2951259999536 792.8158320002258 792.8623689999804 795.1593980002217 795.7198939998634 796.9435250000097 799.9065270000137 800.2415559999645 800.9114239998162 810.0124900001101 813.4102549999952 819.2306610001251 820.7604229999706 825.740509999916 826.6734589999542 843.5915379999205 862.4255710002035 866.16179500008 866.7900519999675 868.511295999866 876.5748330000788 884.2324080001563 895.7351359999739

Current
Mean: 828.224 ms
Stdev: 40.123 ms (4.8%)
Runs: 759.901391999796 768.0747190001421 771.841870999895 782.5096749998629 788.7640990000218 789.6369900000282 791.8212649999186 792.9501490001567 796.0748560000211 809.0990369999781 813.7968419999816 814.7820740002207 817.5166629999876 817.8362960000522 818.1421360000968 820.6098650000058 832.5642749997787 836.3230209997855 843.5723100001924 843.9270779998042 844.2322149998508 844.7072769999504 845.4931830000132 845.9114489997737 846.5208470001817 864.8304220000282 864.9419990000315 871.818876999896 897.350045000203 905.1551910000853 934.2374260001816
runJsBundle Baseline
Mean: 191.719 ms
Stdev: 21.054 ms (11.0%)
Runs: 163 164 166 169 169 169 172 174 177 178 180 180 182 185 185 188 189 190 190 192 197 198 198 206 210 210 210 216 218 231 233 246

Current
Mean: 203.625 ms
Stdev: 25.080 ms (12.3%)
Runs: 163 165 177 180 180 184 185 185 186 186 187 189 190 191 192 195 197 199 207 207 210 210 214 218 225 226 227 230 246 252 255 258
nativeLaunch Baseline
Mean: 9.138 ms
Stdev: 0.937 ms (10.3%)
Runs: 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 11 11 11

Current
Mean: 9.167 ms
Stdev: 1.157 ms (12.6%)
Runs: 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 12 12 12
regularAppStart Baseline
Mean: 0.014 ms
Stdev: 0.001 ms (9.5%)
Runs: 0.0125730000436306 0.012695000041276217 0.012898000422865152 0.012940000277012587 0.01318400027230382 0.01318400027230382 0.01318400027230382 0.013265000190585852 0.013508999720215797 0.013549999799579382 0.01355000026524067 0.013590000104159117 0.013671999797224998 0.013672000262886286 0.013672000262886286 0.013956999871879816 0.013957000337541103 0.014038000255823135 0.01411899970844388 0.01444500032812357 0.014606999699026346 0.014932999853044748 0.014973999932408333 0.015054999850690365 0.015339999925345182 0.015747999772429466 0.015829000156372786 0.01590999960899353 0.0165200000628829 0.01660200022161007 0.01696799974888563 0.01823000004515052

Current
Mean: 0.014 ms
Stdev: 0.001 ms (4.8%)
Runs: 0.012451000045984983 0.012775999959558249 0.013224000111222267 0.0133050000295043 0.013346000108867884 0.013346000108867884 0.013508999720215797 0.013508999720215797 0.013509000185877085 0.013672000262886286 0.0138349998742342 0.014038000255823135 0.014160000253468752 0.014160000253468752 0.014200999867171049 0.014242000412195921 0.014323000330477953 0.0143630001693964 0.014444999862462282 0.014444999862462282 0.01444500032812357 0.014527000021189451 0.014688999857753515 0.014730000402778387 0.014771000016480684 0.014811000321060419 0.015054999850690365 0.015217999927699566

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by @arosiclair in version: 1.2.43-0 🚀

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

@OSBotify
Copy link
Contributor

🚀 Deployed to production by @chiragsalian in version: 1.2.43-1 🚀

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