-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Merged
mountiny
merged 67 commits into
Expensify:main
from
software-mansion-labs:@zfurtak/introduce-wallet-to-expensify
May 14, 2025
Merged
Changes from all commits
Commits
Show all changes
67 commits
Select commit
Hold shift + click to select a range
87d8b01
Exclude wallet from autolinking in new dot standalone
zfurtak 5970980
Adjust react-native-config
zfurtak 42ab989
Make import conditional for ND
zfurtak ca76692
Merge branch 'main' into @zfurtak/introduce-wallet-to-expensify
zfurtak 62202d4
Complete android add card to wallet flow
zfurtak c6225c6
Merge main
zfurtak e9b38c5
Adjust code
zfurtak 83865b2
Remove console logs
zfurtak 120b01a
Fix test
zfurtak 0be0d26
Add new version of module
zfurtak 7ab0bad
Fix
zfurtak e6f2c07
Fix
zfurtak 8ca4728
Fix
zfurtak d669d49
Revert webpack changes
zfurtak 785043e
Merge branch '@Skalakid/add-to-apple-wallet' into @zfurtak/introduce-…
zfurtak a1b9441
Checkout package lock
zfurtak fefa35c
Merge branch '@Skalakid/add-to-apple-wallet' into @zfurtak/introduce-…
zfurtak 1614221
Merge branch '@Skalakid/add-to-apple-wallet' into @zfurtak/introduce-…
zfurtak 862e7bd
Add missing functions to Wallet utils
Skalakid 58c3e57
Update module
Skalakid ea68213
Merge remote-tracking branch 'origin' into @zfurtak/introduce-wallet-…
zfurtak 81bd99c
Merge remote-tracking branch 'origin/@zfurtak/introduce-wallet-to-exp…
zfurtak ccd9c0b
Temporary solution for standalone android
zfurtak 3a7ad33
Merge branch '@Skalakid/add-to-apple-wallet' into @zfurtak/introduce-…
zfurtak 39288c5
Change file from ios to native
zfurtak af5c9cf
Merge branch 'main' into @zfurtak/introduce-wallet-to-expensify
zfurtak 74ce3e4
Stop utolinking when sdk not available
zfurtak 3c2a86c
Adjustments
zfurtak 2d49a19
Fix checks
zfurtak d7740a8
Add card check
zfurtak c312a13
Fix eslint check
zfurtak 03f3215
Adjustments
zfurtak c2cbd3e
Update library package
zfurtak 50b1ac2
Adjust to review comments
zfurtak 4543508
Remove blank line
zfurtak 3a9b5c0
Adjust type imports
zfurtak b169ecd
Commit package-lock
zfurtak 14a383b
Merge branch 'main' into @zfurtak/introduce-wallet-to-expensify
zfurtak 0d500b0
Merge branch 'main' into @zfurtak/introduce-wallet-to-expensify
zfurtak 1058708
Change requestWithSideEffects to API.write
zfurtak 0a3feab
Adjust API call
zfurtak b243165
Adjust Mobile-Expensify version
zfurtak dd3b6fc
Adjustments:
zfurtak c13b0eb
Remove logs
zfurtak 7477bfc
Fix multiple opening
zfurtak 18a135b
Merge branch 'main' into @zfurtak/introduce-wallet-to-expensify
zfurtak 0509fdc
Adjust api call
zfurtak 0e66333
Adjust config
zfurtak 7a9aa51
Adjustments
zfurtak cd826ac
Add comment
zfurtak 50d7faf
Adjusted to review
zfurtak 8912849
Update Mobile-Expensify version
zfurtak 968f3dc
Add loading indicator
zfurtak 2170dd6
Adjustments
zfurtak 63463fb
Merge branch 'main' into @zfurtak/introduce-wallet-to-expensify
zfurtak dfc9dad
Adjustments
zfurtak 9475767
Merge branch 'main' into @zfurtak/introduce-wallet-to-expensify
zfurtak 302d3e6
Adjust label after adding card
zfurtak 403f9d5
Adjust Mobile-Expensify version
zfurtak 2944f32
Move checking wallet to button function
zfurtak 29697ab
Make status check use last 4 digits
zfurtak cbbad79
Merge branch 'main' into @zfurtak/introduce-wallet-to-expensify
zfurtak 52e0a88
Merge main and update MobileExpensify version
zfurtak 217918a
Update Mobile-Expensify version
zfurtak 734d295
Merge branch 'main' into @zfurtak/introduce-wallet-to-expensify
zfurtak ea77fc1
Revert to useEffect check
zfurtak 72632f1
Repeat the test flowD
zfurtak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,18 @@ | ||
| module.exports = { | ||
| const isHybrid = process.env.IS_HYBRID_APP === 'true' ? true : false; | ||
|
|
||
| const config = { | ||
| assets: ['./assets/fonts/native'], | ||
| dependencies: { | ||
| // We need to unlink the react-native-wallet package from the android build | ||
| // because it's not supported yet and we want to prevent the build from failing | ||
| // due to missing Google TapAndPay SDK | ||
| '@expensify/react-native-wallet': { | ||
| platforms: { | ||
| android: null, | ||
| }, | ||
| }, | ||
| }, | ||
| dependencies: {}, | ||
| }; | ||
|
|
||
| // We need to unlink the react-native-wallet package from the android standalone build | ||
| // to prevent the build from failing due to missing Google TapAndPay SDK | ||
| if (!isHybrid) { | ||
| config.dependencies['@expensify/react-native-wallet'] = { | ||
| platforms: { | ||
| android: null, | ||
| }, | ||
| }; | ||
| } | ||
|
|
||
| module.exports = config; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| type CreateDigitalAppleWalletParams = { | ||
| platform: 'ios'; | ||
| appVersion: string; | ||
| // stringified {"certificates": string[]} object | ||
| certificates: string; | ||
| nonce: string; | ||
| nonceSignature: string; | ||
| }; | ||
|
|
||
| type CreateDigitalGoogleWalletParams = { | ||
| platform: 'android'; | ||
| appVersion: string; | ||
| walletAccountID: string; | ||
| deviceID: string; | ||
| }; | ||
|
|
||
| type CreateDigitalWalletParams = CreateDigitalAppleWalletParams | CreateDigitalGoogleWalletParams; | ||
|
|
||
| export type {CreateDigitalAppleWalletParams, CreateDigitalGoogleWalletParams}; | ||
| export default CreateDigitalWalletParams; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zfurtak marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| import {addCardToGoogleWallet, checkWalletAvailability, getCardStatusBySuffix, getSecureWalletInfo} from '@expensify/react-native-wallet'; | ||
| import type {AndroidCardData, AndroidWalletData, CardStatus, TokenizationStatus} from '@expensify/react-native-wallet'; | ||
| import {Alert} from 'react-native'; | ||
| import {openWalletPage} from '@libs/actions/PaymentMethods'; | ||
| import {createDigitalGoogleWallet} from '@libs/actions/Wallet'; | ||
| import Log from '@libs/Log'; | ||
| import type {Card} from '@src/types/onyx'; | ||
|
|
||
| function checkIfWalletIsAvailable(): Promise<boolean> { | ||
| return checkWalletAvailability(); | ||
| } | ||
|
|
||
| function handleAddCardToWallet(card: Card, cardHolderName: string, cardDescription: string, onFinished?: () => void) { | ||
| getSecureWalletInfo() | ||
| .then((walletData: AndroidWalletData) => { | ||
| createDigitalGoogleWallet({cardHolderName, ...walletData}) | ||
| .then((cardData: AndroidCardData) => { | ||
| addCardToGoogleWallet(cardData) | ||
| .then((status: TokenizationStatus) => { | ||
| if (status === 'success') { | ||
| Log.info('Card added to wallet'); | ||
| openWalletPage(); | ||
| } else { | ||
| onFinished?.(); | ||
| } | ||
| }) | ||
| .catch((error) => { | ||
| Log.warn(`addCardToGoogleWallet error: ${error}`); | ||
| Alert.alert('Failed to add card to wallet.', 'Please try again later.'); | ||
| }); | ||
| }) | ||
|
|
||
| .catch((error) => Log.warn(`createDigitalWallet error: ${error}`)); | ||
| }) | ||
| .catch((error) => Log.warn(`getSecureWalletInfo error: ${error}`)); | ||
| } | ||
|
|
||
| function isCardInWallet(card: Card): Promise<boolean> { | ||
| if (!card.lastFourPAN) { | ||
| return Promise.resolve(false); | ||
| } | ||
| return getCardStatusBySuffix(card.lastFourPAN) | ||
| .then((status: CardStatus) => { | ||
| Log.info(`Card status: ${status}`); | ||
| return status === 'active'; | ||
| }) | ||
| .catch((error) => { | ||
| Log.warn(`getCardTokenStatus error: ${error}`); | ||
| return false; | ||
| }); | ||
| } | ||
|
|
||
| export {handleAddCardToWallet, isCardInWallet, checkIfWalletIsAvailable}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.