App icon indicating copy to clipboard operation
App copied to clipboard

[HOLD on Onyx#602] Migrate to `react-native-nitro-sqlite` in E/App and Onyx

Open chrispader opened this issue 1 year ago • 1 comments

@mountiny

Explanation of Change

Uses react-native-nitro-sqlite instead of react-native-quick-sqlite and updates Onyx to a version that also uses NitroSQLite.

Fixed Issues

$ https://github.com/Expensify/App/issues/53063 PROPOSAL:

Tests

  • [ ] Verify that no errors appear in the JS console

Offline tests

QA Steps

// TODO: These must be filled out, or the issue title must include "[No QA]."

  • [ ] 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: mWeb Chrome
    • [ ] iOS: Native
    • [ ] iOS: mWeb 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 used JaimeGPT to get English > Spanish translation. I then posted it 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 grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • [ ] 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.ts 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 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(theme.componentBG))
  • [ ] If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • [ ] 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 the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • [ ] If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • [ ] I verified that all the inputs inside a form are aligned with each other.
    • [ ] I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • [ ] 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 added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • [ ] 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.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop

chrispader avatar Nov 26 '24 17:11 chrispader

@DylanDylann Please 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]

melvin-bot[bot] avatar Nov 26 '24 17:11 melvin-bot[bot]

@chrispader Can you update the react-native-onyx version here to the latest commit from https://github.com/Expensify/react-native-onyx/pull/602; and pull main as well? It kept failing iOS & Android builds.

dominictb avatar Dec 18 '24 11:12 dominictb

@chrispader Can you update the react-native-onyx version here to the latest commit from Expensify/react-native-onyx#602; and pull main as well? It kept failing iOS & Android builds.

@dominictb done!

chrispader avatar Dec 18 '24 13:12 chrispader

~@chrispader Still no luck for me. Can you try to sync with main once again? Also please let me know which versions are your XCode and MacOS? Mine are 16.2 and 15.0 respectively.~ XCode 16.2 just kept saying:

NitroModules: Compiling for iOS 13.4, but module 'CxxStdlib' has a minimum deployment target of iOS 16.0.

I only had this problem on this branch but main branch worked fine. ~Any idea why?~

dominictb avatar Dec 23 '24 04:12 dominictb

Whoops. Seems like a bug with XCode 16.2 https://github.com/mrousavy/nitro/issues/422. I managed to run it after manually changing the minimum deployment target of NitroModules to 16.0.

dominictb avatar Dec 23 '24 05:12 dominictb

Whoops. Seems like a bug with XCode 16.2 mrousavy/nitro#422. I managed to run it after manually changing the minimum deployment target of NitroModules to 16.0.

@dominictb As Marc explained in this comment, the problem is an issue in Swift (and therefore in Xcode) itself and it only happens on iOS Simulator. Since this is an issue in Swift, we cannot fix this in Nitro and/or NitroSQLite directly, because it would mean we need to bump the iOS minimum deployment target, which would cause problems with all sorts of other project that use these libraries.

I'd suggest to either

  • use Xcode 16.1 instead of 16.2 to build the project (developers need to downgrade or install an extra Xcode version)
  • bump the minimum iOS deployment target in E/App to 16.0 via a Podfile fix (will not allow building for <16.0any longer)
  • hold this PR until the issue is fixed in Swift and shipped with a new Xcode version (might take very long)

I think holding this PR until the underlying Swift issue is fixed is still the most valid choice though, except if we don't care about iOS version <16.0 or if we don't mind, that Expensify developers need to use Xcode 16.1... cc @mountiny

chrispader avatar Dec 26 '24 14:12 chrispader

Let's see what @mountiny thinks about the above idea

dominictb avatar Dec 26 '24 17:12 dominictb

Hmm that is a bummer. I agree that downgrading for all developers is tough thing to manage and also bumping the minimum version is not that easy so I would opt to hold for now

mountiny avatar Dec 28 '24 22:12 mountiny

@mountiny Could you please remove me from this PR and add @dominictb as a reviewer instead

DylanDylann avatar Feb 06 '25 08:02 DylanDylann

Just checked, but unfortunately there's no new Swift version with the fix so far. Let's hope the next Swift version will make it into the next Xcode version, fingers crossed 🤞🏼

chrispader avatar Feb 14 '25 19:02 chrispader

:warning: This PR is possibly changing native code, it may cause problems with HybridApp. Please run an AdHoc build to verify that HybridApp will not break. :warning:

github-actions[bot] avatar Feb 27 '25 14:02 github-actions[bot]

:warning: This PR is possibly changing native code, it may cause problems with HybridApp. Please run an AdHoc build to verify that HybridApp will not break. :warning:

github-actions[bot] avatar Feb 28 '25 15:02 github-actions[bot]

:warning: This PR is possibly changing native code, it may cause problems with HybridApp. Please run an AdHoc build to verify that HybridApp will not break. :warning:

github-actions[bot] avatar Mar 05 '25 16:03 github-actions[bot]

:warning: This PR is possibly changing native code and/or updating libraries, it may cause problems with HybridApp. Please check if any patch updates are required in the HybridApp repo and run an AdHoc build to verify that HybridApp will not break. Ask Contributor Plus for help if you are not sure how to handle this. :warning:

github-actions[bot] avatar Apr 07 '25 11:04 github-actions[bot]

Reviewer Checklist

  • [x] I have verified the author checklist is complete (all boxes are checked off).
  • [x] I verified the correct issue is linked in the ### Fixed Issues section above
  • [x] I verified testing steps are clear and they cover the changes made in this PR
    • [x] I verified the steps for local testing are in the Tests section
    • [x] I verified the steps for Staging and/or Production testing are in the QA steps section
    • [x] 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)
    • [x] 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)
  • [x] I checked that screenshots or videos are included for tests on all platforms
  • [x] I included screenshots or videos for tests on all platforms
  • [x] I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • [x] I verified tests pass on all platforms & I tested again on:
    • [x] Android: HybridApp
    • [x] Android: mWeb Chrome
    • [x] iOS: HybridApp
    • [x] iOS: mWeb Safari
    • [x] MacOS: Chrome / Safari
    • [x] MacOS: Desktop
  • [x] 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
  • [x] I verified there are no new alerts related to the canBeMissing param for useOnyx
  • [x] I verified proper code patterns were followed (see Reviewing the code)
    • [x] 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).
    • [x] I verified that comments were added to code that is not self explanatory
    • [x] 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.
    • [x] I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • [x] I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • [x] I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • [x] 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.
    • [x] I verified the JSDocs style guidelines (in STYLE.md) were followed
  • [x] If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • [x] I verified that this PR follows the guidelines as stated in the Review Guidelines
  • [x] 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)
  • [x] I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • [x] I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • [x] If a new component is created I verified that:
    • [x] A similar component doesn't exist in the codebase
    • [x] All props are defined accurately and each prop has a /** comment above it */
    • [x] The file is named correctly
    • [x] The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • [x] The only data being stored in the state is data necessary for rendering and nothing else
    • [x] 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)
    • [x] 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)
    • [x] All JSX used for rendering exists in the render method
    • [x] 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
  • [x] If any new file was added I verified that:
    • [x] 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
  • [x] If a new CSS style is added I verified that:
    • [x] A similar style doesn't already exist
    • [x] The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • [x] If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • [x] 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)
  • [x] 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.
  • [x] If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • [x] If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • [x] I verified that all the inputs inside a form are aligned with each other.
    • [x] I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • [x] 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.
  • [x] For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • [x] 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.
  • [x] I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
Android: mWeb Chrome
iOS: HybridApp
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop

dominictb avatar May 08 '25 09:05 dominictb

@mountiny @dominictb i think this should be ready to merge? 🙌🏼

chrispader avatar May 11 '25 19:05 chrispader

@chrispader @dominictb did you confirm this works well for the hybrid app and standalone too? no changes in the oldApp required?

mountiny avatar May 12 '25 15:05 mountiny

🚧 @mountiny has triggered a test app build. You can view the workflow run here.

github-actions[bot] avatar May 12 '25 15:05 github-actions[bot]

:test_tube::test_tube: Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! :test_tube::test_tube:

Android :robot: iOS :apple:
Android :robot::arrows_counterclockwise: iOS :apple::arrows_counterclockwise:
https://ad-hoc-expensify-cash.s3.amazonaws.com/android/53149-hybrid/index.html https://ad-hoc-expensify-cash.s3.amazonaws.com/ios/53149-hybrid/index.html
Android iOS
Desktop :computer: Web :spider_web:
https://ad-hoc-expensify-cash.s3.amazonaws.com/desktop/53149/NewExpensify.dmg https://53149.pr-testing.expensify.com
Desktop Web

:eyes: View the workflow run that generated this build :eyes:

github-actions[bot] avatar May 12 '25 16:05 github-actions[bot]

@chrispader @dominictb did you confirm this works well for the hybrid app and standalone too? no changes in the oldApp required?

Any updates about this?

fabioh8010 avatar May 15 '25 10:05 fabioh8010

@chrispader @dominictb did you confirm this works well for the hybrid app and standalone too? no changes in the oldApp required?

@mountiny just tested it on HybridApp, everything works fine! 🙌🏼

chrispader avatar May 15 '25 14:05 chrispader

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

OSBotify avatar May 15 '25 17:05 OSBotify

🚀 Deployed to production by https://github.com/mountiny in version: 9.1.46-12 🚀

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

github-actions[bot] avatar May 20 '25 09:05 github-actions[bot]

@chrispader @shubham1206agra noted he can see a diff in a podfile in the hybridApp, can you make sure to update it there correctly too? thanks!

mountiny avatar May 20 '25 13:05 mountiny

@chrispader @shubham1206agra noted he can see a diff in a podfile in the hybridApp, can you make sure to update it there correctly too? thanks!

@shubham1206agra thanks for the catch! @mountiny PR is up here: https://github.com/Expensify/Mobile-Expensify/pull/13571

chrispader avatar May 20 '25 14:05 chrispader