Skip to content

Fix iOS push notifications.#13674

Merged
arosiclair merged 1 commit intomainfrom
cristi_fix-ios-push-notifications
Dec 19, 2022
Merged

Fix iOS push notifications.#13674
arosiclair merged 1 commit intomainfrom
cristi_fix-ios-push-notifications

Conversation

@cristipaval
Copy link
Copy Markdown
Contributor

@cristipaval cristipaval commented Dec 16, 2022

cc @Julesssss @arosiclair

Details

Fixes iOS push notifications.

Fixed Issues

$ #13631

Tests

On iOS only, on physical device. See this SO to run dev builds on a physical device.

  1. Delete any existing New Expensify App version on your device.
  2. Install the App on your physical device
  3. Sign in with one account (accountA) and check that you see the prompt to allow push notifications. Tap Allow
  4. Put the App in background
  5. Sign in with another account (accountB) with any other client (desktop, web, whatever) and send a new message to accountA.
  6. Check that you get the push notification on your iOS physical device
  • Verify that no errors appear in the JS console

Offline tests

N/A

QA Steps

  1. Delete any existing New Expensify App version on your device.
  2. Install the App on your physical device
  3. Sign in with one account (accountA) and check that you see the prompt to allow push notifications. Tap Allow
  4. Put the App in background
  5. Sign in with another account (accountB) with any other client (desktop, web, whatever) and send a new message to accountA.
  6. Check that you get the push notification on your iOS physical device
  • 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:
    • iOS / native
    • Android / native
    • iOS / Safari
    • Android / Chrome
    • MacOS / Chrome
    • 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 N/A
Mobile Web - Chrome N/A
Mobile Web - Safari N/A
Desktop N/A
iOS

IMG_4265

IMG_424AC36CD3F5-1

Android N/A

@cristipaval cristipaval self-assigned this Dec 16, 2022
@cristipaval cristipaval marked this pull request as ready for review December 16, 2022 22:47
@cristipaval cristipaval requested a review from a team as a code owner December 16, 2022 22:47
@melvin-bot melvin-bot bot requested review from Santhosh-Sellavel and srikarparsi and removed request for a team December 16, 2022 22:47
@Santhosh-Sellavel
Copy link
Copy Markdown
Collaborator

Santhosh-Sellavel commented Dec 17, 2022

@cristipaval or @Julesssss or @arosiclair Can anyone build & share an IPA file So I can test this one?

Copy link
Copy Markdown
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.

Oh wow, I made a huge mistake here which seems so obvious now 😅

Thanks for fixing.

@Julesssss Julesssss removed the request for review from Santhosh-Sellavel December 19, 2022 10:01
@Expensify Expensify deleted a comment from melvin-bot bot Dec 19, 2022
@Julesssss
Copy link
Copy Markdown
Contributor

Hey @Santhosh-Sellavel I think it's going to be far simpler to just remove you as a reviewer for this one as it's easy for internal employees to test.

@Santhosh-Sellavel
Copy link
Copy Markdown
Collaborator

That makes sense too!

@Julesssss
Copy link
Copy Markdown
Contributor

Ugh, I can't build at the moment because my iOS cert has expired and XCode refused to accept the new one.

@arosiclair
Copy link
Copy Markdown
Contributor

Gimme a sec I'll run a test on iOS and Android

@arosiclair
Copy link
Copy Markdown
Contributor

Can't get passed this Onfido pod install error atm. Give it a test if you're available @srikarparsi

[!] CocoaPods could not find compatible versions for pod "Onfido":
  In Podfile:
    onfido-react-native-sdk (from `../node_modules/@onfido/react-native-sdk`) was resolved to 7.0.1, which depends on
      Onfido (= 27.0.0)

None of your spec sources contain a spec satisfying the dependency: `Onfido (= 27.0.0)`.

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

@Santhosh-Sellavel
Copy link
Copy Markdown
Collaborator

Can't get passed this Onfido pod install error atm. Give it a test if you're available @srikarparsi

[!] CocoaPods could not find compatible versions for pod "Onfido":
  In Podfile:
    onfido-react-native-sdk (from `../node_modules/@onfido/react-native-sdk`) was resolved to 7.0.1, which depends on
      Onfido (= 27.0.0)

None of your spec sources contain a spec satisfying the dependency: `Onfido (= 27.0.0)`.

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

try pod install --repo-update

1 similar comment
@Santhosh-Sellavel
Copy link
Copy Markdown
Collaborator

Can't get passed this Onfido pod install error atm. Give it a test if you're available @srikarparsi

[!] CocoaPods could not find compatible versions for pod "Onfido":
  In Podfile:
    onfido-react-native-sdk (from `../node_modules/@onfido/react-native-sdk`) was resolved to 7.0.1, which depends on
      Onfido (= 27.0.0)

None of your spec sources contain a spec satisfying the dependency: `Onfido (= 27.0.0)`.

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

try pod install --repo-update

@Julesssss
Copy link
Copy Markdown
Contributor

FINALLY.

IMG_0101
IMG_0100

@Julesssss
Copy link
Copy Markdown
Contributor

@arosiclair I know this doesn't help you, but it worked for me so has to be something on your side sadly.

@Julesssss
Copy link
Copy Markdown
Contributor

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:
    • iOS / native
    • Android / native
    • iOS / Safari
    • Android / Chrome
    • MacOS / Chrome
    • 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

Only iOS was modified, see my screenshots in the comment above.

Copy link
Copy Markdown
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 too

@arosiclair arosiclair merged commit c4317d8 into main Dec 19, 2022
@arosiclair arosiclair deleted the cristi_fix-ios-push-notifications branch December 19, 2022 16:52
@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
regularAppStart 0.016 ms → 0.015 ms (-0.001 ms, -6.9%)
nativeLaunch 9.516 ms → 9.452 ms (-0.065 ms, -0.7%)
TTI 826.140 ms → 816.897 ms (-9.243 ms, -1.1%)
runJsBundle 205.125 ms → 188.781 ms (-16.344 ms, -8.0%)
Show details
Name Duration
regularAppStart Baseline
Mean: 0.016 ms
Stdev: 0.001 ms (6.7%)
Runs: 0.014321999624371529 0.014322999864816666 0.014364000409841537 0.014403999783098698 0.01444500032812357 0.014607999473810196 0.0147299999371171 0.014770000241696835 0.014812000095844269 0.014933999627828598 0.015096000395715237 0.015137000009417534 0.015298999845981598 0.015300000086426735 0.01534000039100647 0.015421999618411064 0.015502999536693096 0.015625 0.0157880000770092 0.015949999913573265 0.016234999522566795 0.016316999681293964 0.016764000058174133 0.016846000216901302 0.0168869998306036 0.017090000212192535 0.01733400020748377 0.01737500075250864 0.017537999898195267 0.017578000202775

Current
Mean: 0.015 ms
Stdev: 0.001 ms (7.9%)
Runs: 0.013021000660955906 0.013101999647915363 0.013427999801933765 0.013427999801933765 0.0134680001065135 0.013509000651538372 0.013590999878942966 0.01371300034224987 0.013996999710798264 0.0139979999512434 0.014038999564945698 0.014201000332832336 0.014322999864816666 0.014322999864816666 0.01432300079613924 0.014363999478518963 0.014405000023543835 0.014444999396800995 0.014810999855399132 0.014812000095844269 0.0148930000141263 0.014973999932408333 0.015217999927699566 0.015341000631451607 0.015502999536693096 0.0163569999858737 0.0166830001398921 0.01680499967187643 0.017862999811768532
nativeLaunch Baseline
Mean: 9.516 ms
Stdev: 1.478 ms (15.5%)
Runs: 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 10 10 10 11 12 12 12 12 12 13

Current
Mean: 9.452 ms
Stdev: 1.542 ms (16.3%)
Runs: 7 7 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 11 11 12 12 13 13
TTI Baseline
Mean: 826.140 ms
Stdev: 49.588 ms (6.0%)
Runs: 750.8506969995797 765.2210200000554 767.4677330004051 767.9359449995682 770.8426689999178 776.8256369996816 776.9974940000102 788.1849699998274 794.3819730002433 796.6545240003616 796.9078860003501 800.051899000071 804.0394139997661 806.223492000252 814.1108870003372 815.5212209997699 819.8852770002559 825.7594910003245 836.9315710002556 841.8794949995354 843.2018100004643 843.9715830003843 854.7896039998159 858.0720260003582 863.8264119997621 869.863188999705 883.575193000026 896.0811639996246 909.1320960000157 914.3374560000375 956.8172629997134

Current
Mean: 816.897 ms
Stdev: 40.130 ms (4.9%)
Runs: 749.9002059996128 762.4906400004402 780.546772999689 781.5315399998799 782.1237509995699 782.4734840001911 782.9660809999332 787.5740740001202 787.8183429995552 788.081059999764 792.8908919999376 797.0999980000779 799.7219569999725 799.9468470001593 803.3506129998714 803.3515659999102 808.868762999773 813.9918349999934 814.9124830001965 817.790750999935 825.3798179998994 825.4112860001624 839.8838670002297 841.8667479995638 847.5077729998156 849.4899190003052 876.1970159998164 878.8937849998474 890.2177569996566 905.6919040000066 905.8318400001153
runJsBundle Baseline
Mean: 205.125 ms
Stdev: 31.596 ms (15.4%)
Runs: 154 159 167 167 168 169 175 176 177 180 181 187 194 196 197 202 206 211 211 213 219 227 227 228 230 232 235 248 248 249 253 278

Current
Mean: 188.781 ms
Stdev: 17.177 ms (9.1%)
Runs: 163 166 169 171 171 172 175 176 177 177 178 178 178 182 186 187 187 189 190 190 191 192 193 195 197 200 207 212 216 222 225 229

@OSBotify
Copy link
Copy Markdown
Contributor

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

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

@OSBotify
Copy link
Copy Markdown
Contributor

🚀 Deployed to production by @yuwenmemon in version: 1.2.42-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.

5 participants