From 16cd9b6cee04ea407b5dabb198a64384b1ac8b75 Mon Sep 17 00:00:00 2001 From: julian Date: Wed, 7 Sep 2022 16:14:10 -0600 Subject: [PATCH 1/4] received jsplit not showing as confirmed in ui fix --- lib/services/coins/firo/firo_wallet.dart | 37 +++++------------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/lib/services/coins/firo/firo_wallet.dart b/lib/services/coins/firo/firo_wallet.dart index 6f42ae94d..0d5c1a6c3 100644 --- a/lib/services/coins/firo/firo_wallet.dart +++ b/lib/services/coins/firo/firo_wallet.dart @@ -2769,34 +2769,12 @@ class FiroWallet extends CoinServiceAPI { } } - if (value.txType == "Received" && - !listLelantusTxData.containsKey(value.txid)) { - // Every receive should be listed whether minted or not. + if (value.txType == "Received" && value.subType != "mint") { + // Every receive other than a mint should be shown. Mints will be collected and shown from the send side listLelantusTxData[value.txid] = value; - } else if (value.txType == "Sent" - // && - // hasAtLeastOneReceive && - // value.subType == "mint" - ) { + } else if (value.txType == "Sent") { + // all sends should be shown, mints will be displayed correctly in the ui listLelantusTxData[value.txid] = value; - - // use mint sends to update receives with user readable values. - - // int sharedFee = value.fees ~/ howManyReceiveInputs; - // - // for (var element in value.inputs) { - // if (listLelantusTxData.containsKey(element.txid) && - // listLelantusTxData[element.txid]!.txType == "Received") { - // listLelantusTxData[element.txid] = - // listLelantusTxData[element.txid]!.copyWith( - // fees: sharedFee, - // subType: "mint", - // height: value.height, - // confirmedStatus: value.confirmedStatus, - // otherData: value.txid, - // ); - // } - // } } }); @@ -3305,11 +3283,12 @@ class FiroWallet extends CoinServiceAPI { } } + final int confirms = txObject["confirmations"] as int? ?? 0; + // create final tx map midSortedTx["txid"] = txObject["txid"]; - midSortedTx["confirmed_status"] = (txObject["confirmations"] is int) && - (txObject["confirmations"] as int > 0); - midSortedTx["confirmations"] = txObject["confirmations"] ?? 0; + midSortedTx["confirmed_status"] = confirms >= MINIMUM_CONFIRMATIONS; + midSortedTx["confirmations"] = confirms; midSortedTx["timestamp"] = txObject["blocktime"] ?? (DateTime.now().millisecondsSinceEpoch ~/ 1000); if (foundInSenders) { From 6862eb389c04bc0a30adc5954b3e141c82f463f0 Mon Sep 17 00:00:00 2001 From: julian Date: Wed, 7 Sep 2022 16:29:12 -0600 Subject: [PATCH 2/4] clean up mint tx details view --- .../transaction_details_view.dart | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/lib/pages/wallet_view/transaction_views/transaction_details_view.dart b/lib/pages/wallet_view/transaction_views/transaction_details_view.dart index e117d42c3..516bdca3b 100644 --- a/lib/pages/wallet_view/transaction_views/transaction_details_view.dart +++ b/lib/pages/wallet_view/transaction_views/transaction_details_view.dart @@ -69,7 +69,13 @@ class _TransactionDetailsViewState coin = widget.coin; amount = Format.satoshisToAmount(_transaction.amount); fee = Format.satoshisToAmount(_transaction.fees); - amountPrefix = _transaction.txType.toLowerCase() == "sent" ? "- " : "+ "; + + if ((coin == Coin.firo || coin == Coin.firoTestNet) && + _transaction.subType == "mint") { + amountPrefix = ""; + } else { + amountPrefix = _transaction.txType.toLowerCase() == "sent" ? "- " : "+ "; + } // if (coin == Coin.firo || coin == Coin.firoTestNet) { // showFeePending = true; @@ -85,6 +91,16 @@ class _TransactionDetailsViewState } String whatIsIt(String type) { + if (coin == Coin.firo || coin == Coin.firoTestNet) { + if (_transaction.subType == "mint") { + if (_transaction.confirmedStatus) { + return "Minted"; + } else { + return "Minting"; + } + } + } + if (type == "Received") { // if (_transaction.isMinting) { // return "Minting"; @@ -224,12 +240,16 @@ class _TransactionDetailsViewState ), ), if (!(coin == Coin.monero && - _transaction.txType.toLowerCase() == "sent")) + _transaction.txType.toLowerCase() == "sent") && + !((coin == Coin.firo || coin == Coin.firoTestNet) && + _transaction.subType == "mint")) const SizedBox( height: 12, ), if (!(coin == Coin.monero && - _transaction.txType.toLowerCase() == "sent")) + _transaction.txType.toLowerCase() == "sent") && + !((coin == Coin.firo || coin == Coin.firoTestNet) && + _transaction.subType == "mint")) RoundedWhiteContainer( child: Column( crossAxisAlignment: CrossAxisAlignment.start, From 0cfa7240ea17bebaf005327af18f39bdc0182a6b Mon Sep 17 00:00:00 2001 From: julian Date: Wed, 7 Sep 2022 17:19:23 -0600 Subject: [PATCH 3/4] changed epic and monero base color --- lib/utilities/cfcolors.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/utilities/cfcolors.dart b/lib/utilities/cfcolors.dart index ce6097b7d..f7ea1fb56 100644 --- a/lib/utilities/cfcolors.dart +++ b/lib/utilities/cfcolors.dart @@ -8,8 +8,8 @@ class _CoinThemeColor { Color get bitcoin => const Color(0xFFFCC17B); Color get firo => const Color(0xFFFF897A); Color get dogecoin => const Color(0xFFFFE079); - Color get epicCash => const Color(0xFFC1C1FF); - Color get monero => const Color(0xFFB1C5FF); + Color get epicCash => const Color(0xFFC5C7CB); + Color get monero => const Color(0xFFF06923); Color forCoin(Coin coin) { switch (coin) { From 3c31008af8d5433661d1d5175eff1d73242d67d5 Mon Sep 17 00:00:00 2001 From: julian Date: Wed, 7 Sep 2022 17:28:33 -0600 Subject: [PATCH 4/4] added block explorer warning --- .../transaction_details_view.dart | 73 +++++++++++++++++++ lib/utilities/prefs.dart | 29 ++++++++ 2 files changed, 102 insertions(+) diff --git a/lib/pages/wallet_view/transaction_views/transaction_details_view.dart b/lib/pages/wallet_view/transaction_views/transaction_details_view.dart index 516bdca3b..62b398500 100644 --- a/lib/pages/wallet_view/transaction_views/transaction_details_view.dart +++ b/lib/pages/wallet_view/transaction_views/transaction_details_view.dart @@ -143,6 +143,66 @@ class _TransactionDetailsViewState String _note = ""; + Future showExplorerWarning(String explorer) async { + final bool? shouldContinue = await showDialog( + context: context, + barrierDismissible: false, + builder: (_) => StackDialog( + title: "Attention", + message: + "You are about to view this transaction in a block explorer. The explorer may log your IP address and link it to the transaction. Only proceed if you trust $explorer.", + icon: Row( + children: [ + Consumer(builder: (_, ref, __) { + return Checkbox( + value: ref.watch(prefsChangeNotifierProvider + .select((value) => value.hideBlockExplorerWarning)), + onChanged: (value) { + if (value is bool) { + ref + .read(prefsChangeNotifierProvider) + .hideBlockExplorerWarning = value; + setState(() {}); + } + }, + ); + }), + Text( + "Never show again", + style: STextStyles.smallMed14, + ) + ], + ), + leftButton: TextButton( + onPressed: () { + Navigator.of(context).pop(false); + }, + child: Text( + "Cancel", + style: STextStyles.button.copyWith( + color: CFColors.stackAccent, + ), + ), + ), + rightButton: TextButton( + style: Theme.of(context).textButtonTheme.style?.copyWith( + backgroundColor: MaterialStateProperty.all( + CFColors.stackAccent, + ), + ), + onPressed: () { + Navigator.of(context).pop(false); + }, + child: Text( + "Continue", + style: STextStyles.button, + ), + ), + ), + ); + return shouldContinue ?? false; + } + @override Widget build(BuildContext context) { return Scaffold( @@ -492,6 +552,19 @@ class _TransactionDetailsViewState coin: coin, txid: _transaction.txid, ); + + if (ref + .read(prefsChangeNotifierProvider) + .hideBlockExplorerWarning == + false) { + final shouldContinue = + await showExplorerWarning(uri.host); + + if (!shouldContinue) { + return; + } + } + // ref // .read( // shouldShowLockscreenOnResumeStateProvider diff --git a/lib/utilities/prefs.dart b/lib/utilities/prefs.dart index 7f6006502..cd297f121 100644 --- a/lib/utilities/prefs.dart +++ b/lib/utilities/prefs.dart @@ -33,6 +33,7 @@ class Prefs extends ChangeNotifier { _autoBackupLocation = await _getAutoBackupLocation(); _backupFrequencyType = await _getBackupFrequencyType(); _lastAutoBackup = await _getLastAutoBackup(); + _hideBlockExplorerWarning = await _getHideBlockExplorerWarning(); _initialized = true; } @@ -466,4 +467,32 @@ class Prefs extends ChangeNotifier { return await DB.instance.get( boxName: DB.boxNamePrefs, key: "autoBackupFileUri") as DateTime?; } + + + + // auto backup + + bool _hideBlockExplorerWarning = false; + + bool get hideBlockExplorerWarning => _hideBlockExplorerWarning; + + set hideBlockExplorerWarning(bool hideBlockExplorerWarning) { + if (_hideBlockExplorerWarning != hideBlockExplorerWarning) { + DB.instance + .put( + boxName: DB.boxNamePrefs, + key: "hideBlockExplorerWarning", + value: hideBlockExplorerWarning) + .then((_) { + _hideBlockExplorerWarning = hideBlockExplorerWarning; + notifyListeners(); + }); + } + } + + Future _getHideBlockExplorerWarning() async { + return await DB.instance.get( + boxName: DB.boxNamePrefs, key: "hideBlockExplorerWarning") as bool? ?? + false; + } }