diff --git a/lib/services/mixins/paynym_wallet_interface.dart b/lib/services/mixins/paynym_wallet_interface.dart index c090f663f..51ce215ff 100644 --- a/lib/services/mixins/paynym_wallet_interface.dart +++ b/lib/services/mixins/paynym_wallet_interface.dart @@ -696,30 +696,40 @@ mixin PaynymWalletInterface { } } - Future _checkHasConnectedCache(String paymentCodeString) async { - final value = await _secureStorage.read( - key: "$_connectedKeyPrefix$paymentCodeString"); - if (value == null) { - return null; - } else { - final int rawBool = int.parse(value); - return rawBool > 0; - } - } - - Future _setConnectedCache( - String paymentCodeString, bool hasConnected) async { - await _secureStorage.write( - key: "$_connectedKeyPrefix$paymentCodeString", - value: hasConnected ? "1" : "0"); - } + // Future _checkHasConnectedCache(String paymentCodeString) async { + // final value = await _secureStorage.read( + // key: "$_connectedKeyPrefix$paymentCodeString"); + // if (value == null) { + // return null; + // } else { + // final int rawBool = int.parse(value); + // return rawBool > 0; + // } + // } + // + // Future _setConnectedCache( + // String paymentCodeString, bool hasConnected) async { + // await _secureStorage.write( + // key: "$_connectedKeyPrefix$paymentCodeString", + // value: hasConnected ? "1" : "0"); + // } // TODO optimize Future hasConnected(String paymentCodeString) async { - final didConnect = await _checkHasConnectedCache(paymentCodeString); - if (didConnect != null) { - return didConnect; - } + // final didConnect = await _checkHasConnectedCache(paymentCodeString); + // if (didConnect == true) { + // return true; + // } + // + // final keys = await lookupKey(paymentCodeString); + // + // final tx = await _db + // .getTransactions(_walletId) + // .filter() + // .subTypeEqualTo(TransactionSubType.bip47Notification).and() + // .address((q) => + // q.anyOf(keys, (q, e) => q.otherDataEqualTo(e))) + // .findAll(); final myNotificationAddress = await getMyNotificationAddress(DerivePathTypeExt.primaryFor(_coin)); @@ -733,19 +743,14 @@ mixin PaynymWalletInterface { for (final tx in txns) { if (tx.type == TransactionType.incoming && tx.address.value?.value == myNotificationAddress.value) { - PaymentCode? unBlindedPaymentCode; - unBlindedPaymentCode = await unBlindedPaymentCodeFromTransaction( - transaction: tx, - myNotificationAddress: myNotificationAddress, - ); - unBlindedPaymentCode = await unBlindedPaymentCodeFromTransaction( + final unBlindedPaymentCode = await unBlindedPaymentCodeFromTransaction( transaction: tx, myNotificationAddress: myNotificationAddress, ); if (unBlindedPaymentCode != null && paymentCodeString == unBlindedPaymentCode.toString()) { - await _setConnectedCache(paymentCodeString, true); + // await _setConnectedCache(paymentCodeString, true); return true; } } else if (tx.type == TransactionType.outgoing) { @@ -753,7 +758,7 @@ mixin PaynymWalletInterface { final code = await paymentCodeStringByKey(tx.address.value!.otherData!); if (code == paymentCodeString) { - await _setConnectedCache(paymentCodeString, true); + // await _setConnectedCache(paymentCodeString, true); return true; } } @@ -761,7 +766,7 @@ mixin PaynymWalletInterface { } // otherwise return no - await _setConnectedCache(paymentCodeString, false); + // await _setConnectedCache(paymentCodeString, false); return false; }