Skip to content

Setup react-native-wallet on Android #60270

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

Conversation

zfurtak
Copy link
Contributor

@zfurtak zfurtak commented Apr 15, 2025

Explanation of Change

This PR introduces and tests react-native-wallet library on Android in Expensify App.

Because of limited access to Google Push Provisioning SDK we didn't add it to main Expensify repo, instead we use SDK already present in Mobile-Expensify. Therefore, usage of react-native-wallet library is possible only on hybrid app, the module is not linked on standalone build.

The whole feature is hidden behind wallet beta, because of difficulties in testing iOS PR.
After both platforms are confirmed and working, we will publish the library to npm and change the tgz local module for the one from npm.

Important

For this PR to work we need to make changes in Mobile-Expensify build.gradle and merge it at once. ⚠️
Here is the raised PR to Mobile-Expensify

Note

This PR add an In-App Provisioning for Android only, iOS one was already added in this PR.
The feature is hidden behind the special beta flag, so we can test it properly before launching it for everybody.

Fixed Issues

$ #36957
PROPOSAL:

Tests

Tip

To be able to test and use In-App Provisioning you need to use physical Android device and signed app.
It must be a hybrid app build. (Make sure to clean cache carefully between switching testing standalone and hybrid)
To test it on debug build changes are needed in Mobile-Expensify/Android/build.gradle

Note

On other platforms (web, desktop, mWeb) and also on standalone app the Add to Google Wallet button shouldn't be visible.

  1. Open the app
  2. Go to Settings > Wallet
  3. Select any card
  4. Verify if the Add to Google Wallet button is available
  5. Press it
  6. Verify
  7. Press Cancel and verify if no error appears and the native modal hides
  8. Press Add to Google Wallet again
  9. ...
  10. Verify if the card is successfully added to the wallet
  11. Verify if the Add to Google Wallet button isn't visible on the page when the specified card is already in the wallet. On dev build Could Not Add Card alert appears at the end. On prod everything should be fine
  • Verify that no errors appear in the JS console

Offline tests

QA Steps

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: 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-demo.mov
Android: mWeb Chrome
android_mweb.mov
iOS: Native
ios.mp4
iOS: mWeb Safari
ios_mweb.mp4
MacOS: Chrome / Safari
web.mov
MacOS: Desktop
desktop.mov

zfurtak and others added 30 commits March 31, 2025 18:11
…ensify' into @zfurtak/introduce-wallet-to-expensify
@brunovjk
Copy link
Contributor

brunovjk commented May 9, 2025

@brunovjk the beta is in place image

How strange @mountiny, because the button doesn't appear for me:
unnamed

I used this adhoc, it should be possible to see the button, right?

@brunovjk
Copy link
Contributor

brunovjk commented May 9, 2025

I noticed a detail in the debug build, if I'm not logged in with a Google account, when I enter in one card I'm redirected to "Google sign in", does this happen in production? Should it be intentional?

I do not think that should be expected/ needed, right?

I agree, I don't know if @zfurtak has taken a look at the comment yet.

@zfurtak
Copy link
Contributor Author

zfurtak commented May 12, 2025

As was said in the slack thread, this is not expected and I'm fixing it right now.
This screen should appear when the button is clicked

@zfurtak
Copy link
Contributor Author

zfurtak commented May 12, 2025

I used this #60270 (comment), it should be possible to see the button, right?

I'm not 100% sure so @mountiny you can correct me, however I think the problem might be in the applicationSuffix, because for debug in order to work we had to change it from ".dev" to "" because debug is not whitelisted in Google.
And for adhoc applicationIdSuffix ".adhoc", maybe adhoc is not whitelisted either?

cc: @brunovjk

@brunovjk
Copy link
Contributor

Reviewing in a moment

@brunovjk
Copy link
Contributor

The problem we had when we were not logged in with a Google account is no longer reproducible.

I updated the Screenshots/Videos from my checklist, you can get back to them to better understand the results:

  1. On iOS, the button appears and I get an error immediately after clicking it, after dismissing the error the "loading" status indicator does not disappear until I go to another page and come back. @zfurtak I believe this may be expected, since we are testing a PR that implements only the logic for Android, but can you confirm for me? Thanks.
  2. On Android everything looks good to me. I was only able to test in Debug build, on the physical device the button does not appear.
  3. On the web platforms everything works fine.

@mountiny
Copy link
Contributor

@brunovjk nice, I think we can test most of this internally then and its behind beta. Let us know when you approve this

@mountiny mountiny added the InternalQA This pull request required internal QA label May 12, 2025
@zfurtak
Copy link
Contributor Author

zfurtak commented May 13, 2025

I believe this may be expected, since we are testing a PR that implements only the logic for Android, but can you confirm for me? Thanks.

@brunovjk I think we should go ahead with merging the PR if android part is ok, @Skalakid will address those iOS issues in a follow-up as soon as this PR is merged 😊

@brunovjk
Copy link
Contributor

@brunovjk I think we should go ahead with merging the PR if android part is ok, @Skalakid will address those iOS issues in a follow-up as soon as this PR is merged 😊

I will give a last review now and approve if the android part is ok :D

@zfurtak
Copy link
Contributor Author

zfurtak commented May 14, 2025

There is 1 edge case left, (showed in this comment) when user enters ExpensifyCardPage and is not logged to Google Account on their phone, they will be redirected to google log in.
I will address this issue in a follow up that is already in progress.

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 merged commit ee29608 into Expensify:main May 14, 2025
19 checks passed
@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.

@mountiny mountiny removed the InternalQA This pull request required internal QA label May 16, 2025
@mountiny
Copy link
Contributor

Actually this one might be QA-able by QA

@mountiny
Copy link
Contributor

Will have to be QAed in production (its behind beta) because the the staging setup

Copy link
Contributor

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

platform result
🖥 desktop 🖥 success ✅
🕸 web 🕸 success ✅
🤖 android 🤖 failure ❌
🍎 iOS 🍎 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.

6 participants