Merge pull request #7092 from BlueWallet/interac

FIX: Make FContainer load first
This commit is contained in:
GLaDOS 2024-10-06 17:57:16 +00:00 committed by GitHub
commit b0187a18dd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 34 additions and 20 deletions

View File

@ -128,17 +128,23 @@ const WalletTransactions: React.FC<WalletTransactionsProps> = ({ route }) => {
}
}, [wallet, isElectrumDisabled, isLoading, saveToDisk, pageSize]);
useEffect(() => {
if (wallet && wallet.getLastTxFetch() === 0) {
refreshTransactions();
}
}, [wallet, refreshTransactions]);
useFocusEffect(
useCallback(() => {
const task = InteractionManager.runAfterInteractions(() => {
if (wallet && wallet.getLastTxFetch() === 0) {
refreshTransactions();
}
});
return () => task.cancel();
}, [refreshTransactions, wallet]),
);
useEffect(() => {
if (wallet) {
setSelectedWalletID(wallet.getID());
setSelectedWalletID(walletID);
}
}, [wallet, setSelectedWalletID]);
}, [wallet, setSelectedWalletID, walletID]);
const isLightning = (): boolean => wallet?.chain === Chain.OFFCHAIN || false;
@ -173,7 +179,7 @@ const WalletTransactions: React.FC<WalletTransactionsProps> = ({ route }) => {
navigate('SendDetailsRoot', {
screen: 'SendDetails',
params: {
walletID: wallet?.getID(),
walletID,
},
});
};
@ -182,8 +188,8 @@ const WalletTransactions: React.FC<WalletTransactionsProps> = ({ route }) => {
assert(wallet?.type === LightningCustodianWallet.type, `internal error, wallet is not ${LightningCustodianWallet.type}`);
navigate('WalletTransactions', {
walletType: wallet?.type,
walletID: wallet?.getID(),
key: `WalletTransactions-${wallet?.getID()}`,
walletID,
key: `WalletTransactions-${walletID}`,
}); // navigating back to ln wallet screen
// getting refill address, either cached or from the server:
@ -252,7 +258,7 @@ const WalletTransactions: React.FC<WalletTransactionsProps> = ({ route }) => {
if (!isLoading) {
setIsLoading(true);
const params = {
walletID: wallet?.getID(),
walletID,
uri: ret?.data ? ret.data : ret,
};
if (wallet?.chain === Chain.ONCHAIN) {
@ -263,7 +269,7 @@ const WalletTransactions: React.FC<WalletTransactionsProps> = ({ route }) => {
setIsLoading(false);
}
},
[wallet, navigate, isLoading],
[isLoading, walletID, wallet?.chain, navigate],
);
const choosePhoto = () => {
@ -288,7 +294,7 @@ const WalletTransactions: React.FC<WalletTransactionsProps> = ({ route }) => {
const sendButtonPress = () => {
if (wallet?.chain === Chain.OFFCHAIN) {
return navigate('ScanLndInvoiceRoot', { screen: 'ScanLndInvoice', params: { walletID: wallet.getID() } });
return navigate('ScanLndInvoiceRoot', { screen: 'ScanLndInvoice', params: { walletID } });
}
if (wallet?.type === WatchOnlyWallet.type && wallet.isHd() && !wallet.useWithHardwareWalletEnabled()) {
@ -407,7 +413,7 @@ const WalletTransactions: React.FC<WalletTransactionsProps> = ({ route }) => {
navigate('WalletExportRoot', {
screen: 'WalletExport',
params: {
walletID: wallet!.getID(),
walletID,
},
});
});
@ -460,9 +466,9 @@ const WalletTransactions: React.FC<WalletTransactionsProps> = ({ route }) => {
text={loc.receive.header}
onPress={() => {
if (wallet.chain === Chain.OFFCHAIN) {
navigate('LNDCreateInvoiceRoot', { screen: 'LNDCreateInvoice', params: { walletID: wallet.getID() } });
navigate('LNDCreateInvoiceRoot', { screen: 'LNDCreateInvoice', params: { walletID } });
} else {
navigate('ReceiveDetailsRoot', { screen: 'ReceiveDetails', params: { walletID: wallet.getID() } });
navigate('ReceiveDetailsRoot', { screen: 'ReceiveDetails', params: { walletID } });
}
}}
icon={

View File

@ -178,6 +178,7 @@ describe('BlueWallet UI Tests - no wallets', () => {
await yo('WalletsList');
await expect(element(by.id('cr34t3d'))).toBeVisible();
await element(by.id('cr34t3d')).tap();
await yo('ReceiveButton');
await element(by.id('ReceiveButton')).tap();
await element(by.text('Yes, I have.')).tap();
try {
@ -506,7 +507,7 @@ describe('BlueWallet UI Tests - no wallets', () => {
await element(by.id('CreateButton')).tap();
await yo('Multisig Vault');
await element(by.id('Multisig Vault')).tap(); // go inside the wallet
await yo('ReceiveButton');
await element(by.id('ReceiveButton')).tap();
await element(by.text('Yes, I have.')).tap();
try {
@ -571,6 +572,7 @@ describe('BlueWallet UI Tests - no wallets', () => {
// sending...
await yo('SendButton');
await element(by.id('SendButton')).tap();
await element(by.id('AddressInput')).replaceText('bc1q063ctu6jhe5k4v8ka99qac8rcm2tzjjnuktyrl');

View File

@ -40,6 +40,7 @@ describe('BlueWallet UI Tests - import BIP84 wallet', () => {
await element(by.text('Imported HD SegWit (BIP84 Bech32 Native)')).tap();
// lets create real transaction:
await yo('SendButton');
await element(by.id('SendButton')).tap();
await element(by.id('AddressInput')).replaceText('bc1q063ctu6jhe5k4v8ka99qac8rcm2tzjjnuktyrl');
await element(by.id('BitcoinAmountInput')).typeText('0.0001\n');
@ -188,6 +189,7 @@ describe('BlueWallet UI Tests - import BIP84 wallet', () => {
// go inside the wallet
await element(by.text('Imported HD SegWit (BIP84 Bech32 Native)')).tap();
await yo('SendButton');
await element(by.id('SendButton')).tap();
// lets create real transaction:
@ -262,7 +264,7 @@ describe('BlueWallet UI Tests - import BIP84 wallet', () => {
// go inside the wallet
await element(by.text('Imported HD SegWit (BIP84 Bech32 Native)')).tap();
await yo('SendButton');
await element(by.id('SendButton')).tap();
// set fee rate
@ -332,6 +334,7 @@ describe('BlueWallet UI Tests - import BIP84 wallet', () => {
// go inside the wallet
await element(by.text('Imported HD SegWit (BIP84 Bech32 Native)')).tap();
await yo('SendButton');
await element(by.id('SendButton')).tap();
await element(by.id('HeaderMenuButton')).tap();
@ -391,6 +394,7 @@ describe('BlueWallet UI Tests - import BIP84 wallet', () => {
// go to receive screen and check that payment code is there
await yo('ReceiveButton');
await element(by.id('ReceiveButton')).tap();
try {
@ -451,6 +455,8 @@ describe('BlueWallet UI Tests - import BIP84 wallet', () => {
await device.pressBack();
await device.pressBack();
await element(by.text('Imported HD SegWit (BIP84 Bech32 Native)')).tap();
await yo('SendButton');
await element(by.id('SendButton')).tap();
await element(by.id('HeaderMenuButton')).tap();
await element(by.text('Insert Contact')).tap();
@ -600,6 +606,7 @@ describe('BlueWallet UI Tests - import BIP84 wallet', () => {
await device.launchApp({ newInstance: true });
await yo('WalletsList');
await element(by.text('Imported HD SegWit (BIP84 Bech32 Native)')).tap();
await yo('SendButton');
await element(by.id('SendButton')).tap();
await element(by.id('HeaderMenuButton')).tap();
await element(by.text('Coin Control')).tap();
@ -647,6 +654,7 @@ describe('BlueWallet UI Tests - import BIP84 wallet', () => {
await device.pressBack();
// create tx with unfrozen input
await yo('SendButton');
await element(by.id('SendButton')).tap();
await element(by.id('AddressInput')).replaceText('bc1q063ctu6jhe5k4v8ka99qac8rcm2tzjjnuktyrl');
await element(by.id('HeaderMenuButton')).tap();

View File

@ -29,7 +29,6 @@ describe('BlueWallet UI Tests - import Watch-only wallet (zpub)', () => {
'0.0001',
);
await sleep(15000);
await element(by.id('ReceiveButton')).tap();
try {
// in case emulator has no google services and doesnt support pushes
@ -51,7 +50,6 @@ describe('BlueWallet UI Tests - import Watch-only wallet (zpub)', () => {
await expect(element(by.text('bitcoin:bc1qc8wun6lf9vcajpddtgdpd2pdrp0kwp29j6upgv?amount=1&label=Test'))).toBeVisible();
await device.pressBack();
await element(by.id('SendButton')).tap();
await element(by.text('OK')).tap();