mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-25 11:45:59 +00:00
disable broken paynym connection status caching
This commit is contained in:
parent
d8096fdf93
commit
4bd55f6ee3
1 changed files with 35 additions and 30 deletions
|
@ -696,30 +696,40 @@ mixin PaynymWalletInterface {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool?> _checkHasConnectedCache(String paymentCodeString) async {
|
// Future<bool?> _checkHasConnectedCache(String paymentCodeString) async {
|
||||||
final value = await _secureStorage.read(
|
// final value = await _secureStorage.read(
|
||||||
key: "$_connectedKeyPrefix$paymentCodeString");
|
// key: "$_connectedKeyPrefix$paymentCodeString");
|
||||||
if (value == null) {
|
// if (value == null) {
|
||||||
return null;
|
// return null;
|
||||||
} else {
|
// } else {
|
||||||
final int rawBool = int.parse(value);
|
// final int rawBool = int.parse(value);
|
||||||
return rawBool > 0;
|
// return rawBool > 0;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
Future<void> _setConnectedCache(
|
// Future<void> _setConnectedCache(
|
||||||
String paymentCodeString, bool hasConnected) async {
|
// String paymentCodeString, bool hasConnected) async {
|
||||||
await _secureStorage.write(
|
// await _secureStorage.write(
|
||||||
key: "$_connectedKeyPrefix$paymentCodeString",
|
// key: "$_connectedKeyPrefix$paymentCodeString",
|
||||||
value: hasConnected ? "1" : "0");
|
// value: hasConnected ? "1" : "0");
|
||||||
}
|
// }
|
||||||
|
|
||||||
// TODO optimize
|
// TODO optimize
|
||||||
Future<bool> hasConnected(String paymentCodeString) async {
|
Future<bool> hasConnected(String paymentCodeString) async {
|
||||||
final didConnect = await _checkHasConnectedCache(paymentCodeString);
|
// final didConnect = await _checkHasConnectedCache(paymentCodeString);
|
||||||
if (didConnect != null) {
|
// if (didConnect == true) {
|
||||||
return didConnect;
|
// return true;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
// final keys = await lookupKey(paymentCodeString);
|
||||||
|
//
|
||||||
|
// final tx = await _db
|
||||||
|
// .getTransactions(_walletId)
|
||||||
|
// .filter()
|
||||||
|
// .subTypeEqualTo(TransactionSubType.bip47Notification).and()
|
||||||
|
// .address((q) =>
|
||||||
|
// q.anyOf<String, Transaction>(keys, (q, e) => q.otherDataEqualTo(e)))
|
||||||
|
// .findAll();
|
||||||
|
|
||||||
final myNotificationAddress =
|
final myNotificationAddress =
|
||||||
await getMyNotificationAddress(DerivePathTypeExt.primaryFor(_coin));
|
await getMyNotificationAddress(DerivePathTypeExt.primaryFor(_coin));
|
||||||
|
@ -733,19 +743,14 @@ mixin PaynymWalletInterface {
|
||||||
for (final tx in txns) {
|
for (final tx in txns) {
|
||||||
if (tx.type == TransactionType.incoming &&
|
if (tx.type == TransactionType.incoming &&
|
||||||
tx.address.value?.value == myNotificationAddress.value) {
|
tx.address.value?.value == myNotificationAddress.value) {
|
||||||
PaymentCode? unBlindedPaymentCode;
|
final unBlindedPaymentCode = await unBlindedPaymentCodeFromTransaction(
|
||||||
unBlindedPaymentCode = await unBlindedPaymentCodeFromTransaction(
|
|
||||||
transaction: tx,
|
|
||||||
myNotificationAddress: myNotificationAddress,
|
|
||||||
);
|
|
||||||
unBlindedPaymentCode = await unBlindedPaymentCodeFromTransaction(
|
|
||||||
transaction: tx,
|
transaction: tx,
|
||||||
myNotificationAddress: myNotificationAddress,
|
myNotificationAddress: myNotificationAddress,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (unBlindedPaymentCode != null &&
|
if (unBlindedPaymentCode != null &&
|
||||||
paymentCodeString == unBlindedPaymentCode.toString()) {
|
paymentCodeString == unBlindedPaymentCode.toString()) {
|
||||||
await _setConnectedCache(paymentCodeString, true);
|
// await _setConnectedCache(paymentCodeString, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (tx.type == TransactionType.outgoing) {
|
} else if (tx.type == TransactionType.outgoing) {
|
||||||
|
@ -753,7 +758,7 @@ mixin PaynymWalletInterface {
|
||||||
final code =
|
final code =
|
||||||
await paymentCodeStringByKey(tx.address.value!.otherData!);
|
await paymentCodeStringByKey(tx.address.value!.otherData!);
|
||||||
if (code == paymentCodeString) {
|
if (code == paymentCodeString) {
|
||||||
await _setConnectedCache(paymentCodeString, true);
|
// await _setConnectedCache(paymentCodeString, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -761,7 +766,7 @@ mixin PaynymWalletInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
// otherwise return no
|
// otherwise return no
|
||||||
await _setConnectedCache(paymentCodeString, false);
|
// await _setConnectedCache(paymentCodeString, false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue