mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-24 07:28:07 +01:00
Merge pull request #3765 from BlueWallet/fix-storage-issues
FIX: storage issues
This commit is contained in:
commit
b0da33182b
4 changed files with 11 additions and 2 deletions
4
App.js
4
App.js
|
@ -190,6 +190,10 @@ const App = () => {
|
|||
* @private
|
||||
*/
|
||||
const processPushNotifications = async () => {
|
||||
if (!walletsInitialized) {
|
||||
console.log('not processing push notifications because wallets are not initialized');
|
||||
return;
|
||||
}
|
||||
await new Promise(resolve => setTimeout(resolve, 200));
|
||||
// sleep needed as sometimes unsuspend is faster than notification module actually saves notifications to async storage
|
||||
const notifications2process = await Notifications.getStoredNotifications();
|
||||
|
|
|
@ -60,6 +60,7 @@ function Notifications(props) {
|
|||
if (notification.data && notification.data.data) Object.assign(payload, notification.data.data);
|
||||
delete payload.data;
|
||||
// ^^^ weird, but sometimes payload data is not in `data` but in root level
|
||||
console.log('got push notification', payload);
|
||||
|
||||
await Notifications.addNotification(payload);
|
||||
|
||||
|
|
|
@ -35,7 +35,11 @@ export const BlueStorageProvider = ({ children }) => {
|
|||
return BlueApp.setIsHandoffEnabled(value);
|
||||
};
|
||||
|
||||
const saveToDisk = async () => {
|
||||
const saveToDisk = async (force = false) => {
|
||||
if (BlueApp.getWallets().length === 0 && !force) {
|
||||
console.log('not saving empty wallets array');
|
||||
return;
|
||||
}
|
||||
BlueApp.tx_metadata = txMetadata;
|
||||
await BlueApp.saveToDisk();
|
||||
setWallets([...BlueApp.getWallets()]);
|
||||
|
|
|
@ -200,7 +200,7 @@ const WalletDetails = () => {
|
|||
Notifications.unsubscribe(wallet.getAllExternalAddresses(), [], []);
|
||||
popToTop();
|
||||
deleteWallet(wallet);
|
||||
saveToDisk();
|
||||
saveToDisk(true);
|
||||
ReactNativeHapticFeedback.trigger('notificationSuccess', { ignoreAndroidSystemSettings: false });
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue