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..62b398500 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"; @@ -127,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( @@ -224,12 +300,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, @@ -472,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/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) { 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) { 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; + } }