FIX: Fixed WatchConnectivity undefined array log issue

This commit is contained in:
Marcos Rodriguez 2019-12-11 23:34:04 -05:00 committed by Overtorment
parent 001b814da1
commit 9dd9fb6b97
2 changed files with 10 additions and 8 deletions

View file

@ -32,7 +32,7 @@ export default class WatchConnectivity {
);
reply({ invoicePaymentRequest: createInvoiceRequest });
} else if (message.message === 'sendApplicationContext') {
await WatchConnectivity.shared.sendWalletsToWatch(WatchConnectivity.shared.wallets);
await WatchConnectivity.shared.sendWalletsToWatch();
} else if (message.message === 'fetchTransactions') {
await WatchConnectivity.shared.fetchTransactionsFunction();
}
@ -56,14 +56,16 @@ export default class WatchConnectivity {
}
}
async sendWalletsToWatch(allWallets) {
if (allWallets === undefined && WatchConnectivity.shared.wallets !== undefined) {
allWallets = WatchConnectivity.shared.wallets;
}
if (allWallets && allWallets.length === 0) {
async sendWalletsToWatch() {
const allWallets = WatchConnectivity.shared.wallets;
if (!Array.isArray(allWallets)) {
console.log('No Wallets set to sync with Watch app. Exiting...');
return;
} else if (allWallets.length === 0) {
console.log('Wallets array is set. No Wallets set to sync with Watch app. Exiting...');
return;
}
console.log('Wallets set to sync with Watch app. Continuing...');
return InteractionManager.runAfterInteractions(async () => {
if (WatchConnectivity.shared.isAppInstalled) {
let wallets = [];

View file

@ -253,7 +253,7 @@ export class AppStorage {
await this.fetchWalletTransactions();
await this.saveToDisk();
};
await WatchConnectivity.shared.sendWalletsToWatch(this.wallets);
await WatchConnectivity.shared.sendWalletsToWatch();
DeviceQuickActions.setWallets(this.wallets);
DeviceQuickActions.setQuickActions();
return true;