mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-25 11:45:59 +00:00
commit
2b6aa83535
4 changed files with 135 additions and 34 deletions
|
@ -69,7 +69,13 @@ class _TransactionDetailsViewState
|
||||||
coin = widget.coin;
|
coin = widget.coin;
|
||||||
amount = Format.satoshisToAmount(_transaction.amount);
|
amount = Format.satoshisToAmount(_transaction.amount);
|
||||||
fee = Format.satoshisToAmount(_transaction.fees);
|
fee = Format.satoshisToAmount(_transaction.fees);
|
||||||
|
|
||||||
|
if ((coin == Coin.firo || coin == Coin.firoTestNet) &&
|
||||||
|
_transaction.subType == "mint") {
|
||||||
|
amountPrefix = "";
|
||||||
|
} else {
|
||||||
amountPrefix = _transaction.txType.toLowerCase() == "sent" ? "- " : "+ ";
|
amountPrefix = _transaction.txType.toLowerCase() == "sent" ? "- " : "+ ";
|
||||||
|
}
|
||||||
|
|
||||||
// if (coin == Coin.firo || coin == Coin.firoTestNet) {
|
// if (coin == Coin.firo || coin == Coin.firoTestNet) {
|
||||||
// showFeePending = true;
|
// showFeePending = true;
|
||||||
|
@ -85,6 +91,16 @@ class _TransactionDetailsViewState
|
||||||
}
|
}
|
||||||
|
|
||||||
String whatIsIt(String type) {
|
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 (type == "Received") {
|
||||||
// if (_transaction.isMinting) {
|
// if (_transaction.isMinting) {
|
||||||
// return "Minting";
|
// return "Minting";
|
||||||
|
@ -127,6 +143,66 @@ class _TransactionDetailsViewState
|
||||||
|
|
||||||
String _note = "";
|
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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
@ -224,12 +300,16 @@ class _TransactionDetailsViewState
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (!(coin == Coin.monero &&
|
if (!(coin == Coin.monero &&
|
||||||
_transaction.txType.toLowerCase() == "sent"))
|
_transaction.txType.toLowerCase() == "sent") &&
|
||||||
|
!((coin == Coin.firo || coin == Coin.firoTestNet) &&
|
||||||
|
_transaction.subType == "mint"))
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 12,
|
height: 12,
|
||||||
),
|
),
|
||||||
if (!(coin == Coin.monero &&
|
if (!(coin == Coin.monero &&
|
||||||
_transaction.txType.toLowerCase() == "sent"))
|
_transaction.txType.toLowerCase() == "sent") &&
|
||||||
|
!((coin == Coin.firo || coin == Coin.firoTestNet) &&
|
||||||
|
_transaction.subType == "mint"))
|
||||||
RoundedWhiteContainer(
|
RoundedWhiteContainer(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
@ -472,6 +552,19 @@ class _TransactionDetailsViewState
|
||||||
coin: coin,
|
coin: coin,
|
||||||
txid: _transaction.txid,
|
txid: _transaction.txid,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (ref
|
||||||
|
.read(prefsChangeNotifierProvider)
|
||||||
|
.hideBlockExplorerWarning ==
|
||||||
|
false) {
|
||||||
|
final shouldContinue =
|
||||||
|
await showExplorerWarning(uri.host);
|
||||||
|
|
||||||
|
if (!shouldContinue) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ref
|
// ref
|
||||||
// .read(
|
// .read(
|
||||||
// shouldShowLockscreenOnResumeStateProvider
|
// shouldShowLockscreenOnResumeStateProvider
|
||||||
|
|
|
@ -2769,34 +2769,12 @@ class FiroWallet extends CoinServiceAPI {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value.txType == "Received" &&
|
if (value.txType == "Received" && value.subType != "mint") {
|
||||||
!listLelantusTxData.containsKey(value.txid)) {
|
// Every receive other than a mint should be shown. Mints will be collected and shown from the send side
|
||||||
// Every receive should be listed whether minted or not.
|
|
||||||
listLelantusTxData[value.txid] = value;
|
listLelantusTxData[value.txid] = value;
|
||||||
} else if (value.txType == "Sent"
|
} else if (value.txType == "Sent") {
|
||||||
// &&
|
// all sends should be shown, mints will be displayed correctly in the ui
|
||||||
// hasAtLeastOneReceive &&
|
|
||||||
// value.subType == "mint"
|
|
||||||
) {
|
|
||||||
listLelantusTxData[value.txid] = value;
|
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
|
// create final tx map
|
||||||
midSortedTx["txid"] = txObject["txid"];
|
midSortedTx["txid"] = txObject["txid"];
|
||||||
midSortedTx["confirmed_status"] = (txObject["confirmations"] is int) &&
|
midSortedTx["confirmed_status"] = confirms >= MINIMUM_CONFIRMATIONS;
|
||||||
(txObject["confirmations"] as int > 0);
|
midSortedTx["confirmations"] = confirms;
|
||||||
midSortedTx["confirmations"] = txObject["confirmations"] ?? 0;
|
|
||||||
midSortedTx["timestamp"] = txObject["blocktime"] ??
|
midSortedTx["timestamp"] = txObject["blocktime"] ??
|
||||||
(DateTime.now().millisecondsSinceEpoch ~/ 1000);
|
(DateTime.now().millisecondsSinceEpoch ~/ 1000);
|
||||||
if (foundInSenders) {
|
if (foundInSenders) {
|
||||||
|
|
|
@ -8,8 +8,8 @@ class _CoinThemeColor {
|
||||||
Color get bitcoin => const Color(0xFFFCC17B);
|
Color get bitcoin => const Color(0xFFFCC17B);
|
||||||
Color get firo => const Color(0xFFFF897A);
|
Color get firo => const Color(0xFFFF897A);
|
||||||
Color get dogecoin => const Color(0xFFFFE079);
|
Color get dogecoin => const Color(0xFFFFE079);
|
||||||
Color get epicCash => const Color(0xFFC1C1FF);
|
Color get epicCash => const Color(0xFFC5C7CB);
|
||||||
Color get monero => const Color(0xFFB1C5FF);
|
Color get monero => const Color(0xFFF06923);
|
||||||
|
|
||||||
Color forCoin(Coin coin) {
|
Color forCoin(Coin coin) {
|
||||||
switch (coin) {
|
switch (coin) {
|
||||||
|
|
|
@ -33,6 +33,7 @@ class Prefs extends ChangeNotifier {
|
||||||
_autoBackupLocation = await _getAutoBackupLocation();
|
_autoBackupLocation = await _getAutoBackupLocation();
|
||||||
_backupFrequencyType = await _getBackupFrequencyType();
|
_backupFrequencyType = await _getBackupFrequencyType();
|
||||||
_lastAutoBackup = await _getLastAutoBackup();
|
_lastAutoBackup = await _getLastAutoBackup();
|
||||||
|
_hideBlockExplorerWarning = await _getHideBlockExplorerWarning();
|
||||||
|
|
||||||
_initialized = true;
|
_initialized = true;
|
||||||
}
|
}
|
||||||
|
@ -466,4 +467,32 @@ class Prefs extends ChangeNotifier {
|
||||||
return await DB.instance.get<dynamic>(
|
return await DB.instance.get<dynamic>(
|
||||||
boxName: DB.boxNamePrefs, key: "autoBackupFileUri") as DateTime?;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue