mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-23 15:20:55 +01:00
Merge pull request #6548 from BlueWallet/im
REF: Place network calls in InteractionManager
This commit is contained in:
commit
552fb95776
1 changed files with 54 additions and 50 deletions
|
@ -106,6 +106,7 @@ export const BlueStorageProvider = ({ children }: { children: React.ReactNode })
|
||||||
};
|
};
|
||||||
|
|
||||||
const refreshAllWalletTransactions = async (lastSnappedTo?: number, showUpdateStatusIndicator: boolean = true) => {
|
const refreshAllWalletTransactions = async (lastSnappedTo?: number, showUpdateStatusIndicator: boolean = true) => {
|
||||||
|
InteractionManager.runAfterInteractions(async () => {
|
||||||
let noErr = true;
|
let noErr = true;
|
||||||
try {
|
try {
|
||||||
await BlueElectrum.waitTillConnected();
|
await BlueElectrum.waitTillConnected();
|
||||||
|
@ -131,9 +132,11 @@ export const BlueStorageProvider = ({ children }: { children: React.ReactNode })
|
||||||
setWalletTransactionUpdateStatus(WalletTransactionsStatus.NONE);
|
setWalletTransactionUpdateStatus(WalletTransactionsStatus.NONE);
|
||||||
}
|
}
|
||||||
if (noErr) await saveToDisk(); // caching
|
if (noErr) await saveToDisk(); // caching
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchAndSaveWalletTransactions = async (walletID: string) => {
|
const fetchAndSaveWalletTransactions = async (walletID: string) => {
|
||||||
|
InteractionManager.runAfterInteractions(async () => {
|
||||||
const index = wallets.findIndex(wallet => wallet.getID() === walletID);
|
const index = wallets.findIndex(wallet => wallet.getID() === walletID);
|
||||||
let noErr = true;
|
let noErr = true;
|
||||||
try {
|
try {
|
||||||
|
@ -161,6 +164,7 @@ export const BlueStorageProvider = ({ children }: { children: React.ReactNode })
|
||||||
setWalletTransactionUpdateStatus(WalletTransactionsStatus.NONE);
|
setWalletTransactionUpdateStatus(WalletTransactionsStatus.NONE);
|
||||||
}
|
}
|
||||||
if (noErr) await saveToDisk(); // caching
|
if (noErr) await saveToDisk(); // caching
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const addWallet = (wallet: TWallet) => {
|
const addWallet = (wallet: TWallet) => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue