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

[NoQA] Separate autofill logic between platforms #15295

Merged

Conversation

narefyev91
Copy link
Contributor

Details

Separation of logic between files for autfill sms instead of using Platform.select
Logical separation from this PR: #15081

Fixed Issues

$ #14853
$ #14853 (comment)

Tests

Note for Safari Mac, you need to have your phone number linked to Messages on Mac so you get the SMS message on the same device you are testing on.

  1. Start registration process with your phone number
  2. Get to verification code screen
  3. Waiting for sms appears - in keyboard should be shown suggested autofill code from SMS
  • Verify that no errors appear in the JS console

Offline tests

This feature doesn't change or is impacted by offline mode.

QA Steps

Same as above.

  • 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
      • If any non-english text was added/modified, I verified the translation was requested/reviewed in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • 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.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR author checklist, including those that don't apply to this PR.

Screenshots/Videos

All media can be found here #15081

Web
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android

@narefyev91 narefyev91 requested a review from a team as a code owner February 20, 2023 13:17
@melvin-bot melvin-bot bot requested review from mountiny and sobitneupane and removed request for a team February 20, 2023 13:17
@MelvinBot
Copy link

@mountiny @sobitneupane 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]

@mountiny
Copy link
Contributor

mountiny commented Feb 22, 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.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Confirmed the app works fine

Web image
Mobile Web - Chrome image
Mobile Web - Safari image
Desktop image
iOS

run into some issues, this is a simple refactor so not going to hold on this.

Android image

mountiny
mountiny previously approved these changes Feb 22, 2023
Copy link
Contributor

@mountiny mountiny left a comment

Choose a reason for hiding this comment

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

One comment

@sobitneupane
Copy link
Contributor

@mountiny Should I also review this PR?

@mountiny
Copy link
Contributor

@sobitneupane

@mountiny Should I also review this PR?

I think we are all good here. Thanks!

Copy link
Contributor

@mountiny mountiny left a comment

Choose a reason for hiding this comment

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

Thanks!

@mountiny mountiny changed the title Separate autofill logic between platforms [NoQa] Separate autofill logic between platforms Feb 22, 2023
@mountiny
Copy link
Contributor

I think we can make this NoQA given the nature of this PR.

@mountiny mountiny changed the title [NoQa] Separate autofill logic between platforms [NoQA] Separate autofill logic between platforms Feb 22, 2023
@mountiny mountiny merged commit 9d04b46 into Expensify:main Feb 22, 2023
@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 725.263 ms → 728.800 ms (+3.537 ms, ±0.0%)
App start nativeLaunch 20.067 ms → 20.161 ms (+0.095 ms, ±0.0%)
App start regularAppStart 0.014 ms → 0.014 ms (+0.000 ms, +1.9%)
Open Search Page TTI 614.915 ms → 607.326 ms (-7.588 ms, -1.2%)
App start runJsBundle 203.563 ms → 195.194 ms (-8.369 ms, -4.1%)
Show details
Name Duration
App start TTI Baseline
Mean: 725.263 ms
Stdev: 23.132 ms (3.2%)
Runs: 685.1364759998396 693.6001000003889 697.043243999593 697.7289770003408 698.5533370003104 702.2223829999566 706.3155779996887 708.1374709997326 712.1715390002355 712.5080260001123 713.5259649995714 714.6914560003206 715.1469160001725 716.8886390002444 718.3772489996627 720.8568759998307 722.3114229999483 723.7610550001264 724.6720829997212 728.938155000098 731.7247259998694 735.7744909999892 736.6360670002177 737.8647060003132 738.662553999573 746.1339299995452 746.8952789995819 752.172527000308 752.2695369999856 754.2950609996915 778.5214099995792 784.893441000022

Current
Mean: 728.800 ms
Stdev: 23.347 ms (3.2%)
Runs: 689.9489040002227 703.1484470004216 703.2383709996939 703.44974500034 705.4530499996617 708.6369420001283 710.7099329996854 712.2737739998847 712.6989639997482 717.3027590001002 717.7402710001916 718.3213390000165 719.5920839998871 720.6713880002499 722.9873219998553 725.0270339995623 731.14940799959 731.8793689999729 732.0303220003843 733.3432120000944 734.4393090000376 739.8987549999729 740.0985989999026 740.1621759999543 741.664808999747 750.9088669996709 757.3974479995668 757.7916080001742 790.3687330000103 791.6747040003538
App start nativeLaunch Baseline
Mean: 20.067 ms
Stdev: 1.788 ms (8.9%)
Runs: 17 17 18 18 18 19 19 19 19 19 19 19 19 20 20 20 20 21 21 21 21 21 21 21 21 21 21 24 24 24

Current
Mean: 20.161 ms
Stdev: 2.629 ms (13.0%)
Runs: 17 18 18 18 18 18 18 18 18 18 18 18 19 19 19 19 19 20 20 21 21 21 21 22 22 22 23 23 25 27 27
App start regularAppStart Baseline
Mean: 0.014 ms
Stdev: 0.001 ms (5.2%)
Runs: 0.012695000506937504 0.013101999647915363 0.013101999647915363 0.013102000579237938 0.013224000111222267 0.013306000269949436 0.013426999561488628 0.0134680001065135 0.013509000651538372 0.013591000810265541 0.013631000183522701 0.013834000565111637 0.013875999487936497 0.013915999792516232 0.013957000337541103 0.0139979999512434 0.014079000800848007 0.014119000174105167 0.014201000332832336 0.014241999946534634 0.014241999946534634 0.014403999783098698 0.014405000023543835 0.014525999315083027 0.01464799977838993 0.01464799977838993 0.0147299999371171 0.015461999922990799 0.01619499921798706

Current
Mean: 0.014 ms
Stdev: 0.001 ms (5.3%)
Runs: 0.012981000356376171 0.01318300049751997 0.013224000111222267 0.013224000111222267 0.013345999643206596 0.013671000488102436 0.013671999797224998 0.013672000728547573 0.013712000101804733 0.013875000178813934 0.013956000097095966 0.014078999869525433 0.014159999787807465 0.0142000000923872 0.014201000332832336 0.014201000332832336 0.014241999946534634 0.014241999946534634 0.014405000023543835 0.01444500032812357 0.014526000246405602 0.014566999860107899 0.014607999473810196 0.01464799977838993 0.014649000018835068 0.014932999387383461 0.015421000309288502 0.015625 0.015625 0.016112999990582466
Open Search Page TTI Baseline
Mean: 614.915 ms
Stdev: 26.753 ms (4.4%)
Runs: 579.281413000077 581.7625740002841 582.5767419999465 588.8720709998161 589.5952559998259 590.1245120000094 595.4551190007478 598.0068359998986 598.8733320003375 599.4394119996578 600.3937169993296 600.9581709997728 603.3799639996141 606.0707600004971 606.075032999739 606.4189450005069 607.1371669992805 610.0254319999367 610.0677910000086 613.0208339998499 618.3173430003226 619.8476159991696 621.8789060004056 623.8638919992372 627.5517180003226 635.6396490000188 637.4485680004582 640.0296640004963 652.1479089995846 663.077961999923 677.8201899994165 692.1110029993579

Current
Mean: 607.326 ms
Stdev: 13.704 ms (2.3%)
Runs: 584.8904220005497 585.9701739996672 588.3068450000137 594.206828000024 594.3153900001198 597.3768719993532 597.4528810000047 598.893391999416 599.3289389992133 601.0193689996377 601.4306229995564 601.7064610002562 602.9156910004094 603.2499190000817 604.2869059992954 605.0453290008008 606.5101319998503 607.2488200003281 607.3129480006173 608.4163410002366 608.899943000637 609.3827319992706 609.8813079996035 613.4085289994255 617.496012000367 617.812541000545 619.1124269999564 629.4440510002896 630.6138909999281 637.2448330000043 643.938152000308
App start runJsBundle Baseline
Mean: 203.563 ms
Stdev: 19.620 ms (9.6%)
Runs: 168 168 172 182 182 182 186 186 189 189 195 195 197 201 202 203 205 209 210 211 211 213 213 213 217 221 225 225 229 234 240 241

Current
Mean: 195.194 ms
Stdev: 16.819 ms (8.6%)
Runs: 168 169 171 174 176 177 178 181 184 188 188 190 190 190 191 193 194 194 195 203 204 204 206 209 211 214 214 219 224 225 227

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by https://github.com/mountiny in version: 1.2.76-0 🚀

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

@OSBotify
Copy link
Contributor

🚀 Deployed to production by https://github.com/yuwenmemon in version: 1.2.76-7 🚀

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

1 similar comment
@OSBotify
Copy link
Contributor

🚀 Deployed to production by https://github.com/yuwenmemon in version: 1.2.76-7 🚀

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

@OSBotify
Copy link
Contributor

🚀 Deployed to production by https://github.com/yuwenmemon in version: 1.2.76-7 🚀

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

@hayata-suenaga
Copy link
Contributor

@narefyev91 I'm working on an issue to add the hash in SMS magic link messages. I see you passed sms-opt to TextInput but I was wondering if we need to talk to Retriever API to actually start listening for SMS messages. Did you find something about this in your research for this PR?

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.

6 participants