Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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";
Expand Down Expand Up @@ -127,6 +143,66 @@ class _TransactionDetailsViewState

String _note = "";

Future<bool> showExplorerWarning(String explorer) async {
final bool? shouldContinue = await showDialog<bool>(
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<Color>(
CFColors.stackAccent,
),
),
onPressed: () {
Navigator.of(context).pop(false);
},
child: Text(
"Continue",
style: STextStyles.button,
),
),
),
);
return shouldContinue ?? false;
}

@override
Widget build(BuildContext context) {
return Scaffold(
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down
37 changes: 8 additions & 29 deletions lib/services/coins/firo/firo_wallet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
// );
// }
// }
}
});

Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions lib/utilities/cfcolors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
29 changes: 29 additions & 0 deletions lib/utilities/prefs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class Prefs extends ChangeNotifier {
_autoBackupLocation = await _getAutoBackupLocation();
_backupFrequencyType = await _getBackupFrequencyType();
_lastAutoBackup = await _getLastAutoBackup();
_hideBlockExplorerWarning = await _getHideBlockExplorerWarning();

_initialized = true;
}
Expand Down Expand Up @@ -466,4 +467,32 @@ class Prefs extends ChangeNotifier {
return await DB.instance.get<dynamic>(
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<dynamic>(
boxName: DB.boxNamePrefs,
key: "hideBlockExplorerWarning",
value: hideBlockExplorerWarning)
.then((_) {
_hideBlockExplorerWarning = hideBlockExplorerWarning;
notifyListeners();
});
}
}

Future<bool> _getHideBlockExplorerWarning() async {
return await DB.instance.get<dynamic>(
boxName: DB.boxNamePrefs, key: "hideBlockExplorerWarning") as bool? ??
false;
}
}