diff --git a/src/MainScreen.js b/src/MainScreen.js index 818ece3..4b3f8e9 100644 --- a/src/MainScreen.js +++ b/src/MainScreen.js @@ -65,6 +65,7 @@ async function init(navigation) { Globals.wallet.scanCoinbaseTransactions(Globals.preferences.scanCoinbaseTransactions); Globals.wallet.enableAutoOptimization(false); + Globals.wallet.scanPoolTransactions(false); /* Remove any previously added listeners */ Globals.wallet.removeAllListeners('incomingtx'); @@ -800,7 +801,7 @@ class BalanceComponentNoTranslation extends React.Component { const {t} = this.props; const hasBalance = (this.props.unlockedBalance + this.props.lockedBalance > 0) ? true : false; const compactBalance = response.json()) + .then(async (json) => { + + + for (transaction in json.deletedTxsIds) { + deleteKnownTransaction(json.deletedTxsIds[transaction]); + } + let addedTxs = json.addedTxs; + + Globals.logger.addLogMessage(`Found ${addedTxs.length} new messages.. 💌`); + + let transactions = addedTxs; + + for (transaction in transactions) { + + try { + + Globals.logger.addLogMessage(`Trying to decrypt message ${transaction}/${addedTxs.length}.. 💌`); + + Globals.lastSyncEvent = Date.now(); + + let thisExtra = transactions[transaction]["transactionPrefixInfo.txPrefix"].extra; + + let thisHash = transactions[transaction]["transactionPrefixInfo.txHash"]; + + if (Globals.knownTXs.indexOf(thisHash) != -1) continue; + + + if (thisExtra.length > 66) { + + + try { + let message = await getMessage(thisExtra, thisHash, navigation); + } catch (err) { + console.log(err); + } + saveKnownTransaction(thisHash); + if (Globals.knownTXs.indexOf(thisHash) === -1) Globals.knownTXs.push(thisHash); + + } else { + saveKnownTransaction(thisHash); + if (Globals.knownTXs.indexOf(thisHash) === -1) Globals.knownTXs.push(thisHash); + continue; + } + + + } catch (err) { + continue; + } + + } + Globals.logger.addLogMessage(`Found ${Globals.notificationQueue.length} messages.. 💌`); + + sendNotifications(); + Globals.initalSyncOccurred = true; + Globals.syncingMessages = false; + Globals.knownTXs = await getKnownTransactions(); + + return; + + + + }); +} catch (err) { + console.log('Message sync failed: ', err); +} try {