mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-11-18 09:54:01 +01:00
Fixed updating of transactions history. Added support for part formatted electrum server response
This commit is contained in:
@@ -9,44 +9,53 @@ import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
|
||||
// FIXME: terrible design
|
||||
|
||||
class WalletMenu {
|
||||
WalletMenu(this.context, this.reconnect);
|
||||
|
||||
final List<WalletMenuItem> items = [
|
||||
WalletMenuItem(
|
||||
title: S.current.reconnect,
|
||||
image: Image.asset('assets/images/reconnect_menu.png',
|
||||
height: 16, width: 16)),
|
||||
WalletMenuItem(
|
||||
title: S.current.rescan,
|
||||
image: Image.asset('assets/images/filter_icon.png',
|
||||
height: 16, width: 16)),
|
||||
WalletMenuItem(
|
||||
title: S.current.wallets,
|
||||
image: Image.asset('assets/images/wallet_menu.png',
|
||||
height: 16, width: 16)),
|
||||
WalletMenuItem(
|
||||
title: S.current.nodes,
|
||||
image:
|
||||
Image.asset('assets/images/nodes_menu.png', height: 16, width: 16)),
|
||||
WalletMenuItem(
|
||||
title: S.current.show_keys,
|
||||
image:
|
||||
Image.asset('assets/images/key_menu.png', height: 16, width: 16)),
|
||||
WalletMenuItem(
|
||||
title: S.current.address_book_menu,
|
||||
image: Image.asset('assets/images/open_book_menu.png',
|
||||
height: 16, width: 16)),
|
||||
WalletMenuItem(
|
||||
title: S.current.settings_title,
|
||||
image: Image.asset('assets/images/settings_menu.png',
|
||||
height: 16, width: 16)),
|
||||
];
|
||||
WalletMenu(this.context, this.reconnect, this.hasRescan) : items = [] {
|
||||
items.addAll([
|
||||
WalletMenuItem(
|
||||
title: S.current.reconnect,
|
||||
image: Image.asset('assets/images/reconnect_menu.png',
|
||||
height: 16, width: 16)),
|
||||
if (hasRescan)
|
||||
WalletMenuItem(
|
||||
title: S.current.rescan,
|
||||
image: Image.asset('assets/images/filter_icon.png',
|
||||
height: 16, width: 16)),
|
||||
WalletMenuItem(
|
||||
title: S.current.wallets,
|
||||
image: Image.asset('assets/images/wallet_menu.png',
|
||||
height: 16, width: 16)),
|
||||
WalletMenuItem(
|
||||
title: S.current.nodes,
|
||||
image: Image.asset('assets/images/nodes_menu.png',
|
||||
height: 16, width: 16)),
|
||||
WalletMenuItem(
|
||||
title: S.current.show_keys,
|
||||
image:
|
||||
Image.asset('assets/images/key_menu.png', height: 16, width: 16)),
|
||||
WalletMenuItem(
|
||||
title: S.current.address_book_menu,
|
||||
image: Image.asset('assets/images/open_book_menu.png',
|
||||
height: 16, width: 16)),
|
||||
WalletMenuItem(
|
||||
title: S.current.settings_title,
|
||||
image: Image.asset('assets/images/settings_menu.png',
|
||||
height: 16, width: 16)),
|
||||
]);
|
||||
}
|
||||
|
||||
final List<WalletMenuItem> items;
|
||||
final BuildContext context;
|
||||
final Future<void> Function() reconnect;
|
||||
final bool hasRescan;
|
||||
|
||||
void action(int index) {
|
||||
switch (index) {
|
||||
var indx = index;
|
||||
|
||||
if (index > 0 && !hasRescan) {
|
||||
indx += 1;
|
||||
}
|
||||
|
||||
switch (indx) {
|
||||
case 0:
|
||||
_presentReconnectAlert(context);
|
||||
break;
|
||||
|
||||
@@ -66,8 +66,10 @@ class MenuWidgetState extends State<MenuWidget> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final walletMenu =
|
||||
WalletMenu(context, () async => widget.dashboardViewModel.reconnect());
|
||||
final walletMenu = WalletMenu(
|
||||
context,
|
||||
() async => widget.dashboardViewModel.reconnect(),
|
||||
widget.dashboardViewModel.hasRescan);
|
||||
final itemCount = walletMenu.items.length;
|
||||
|
||||
moneroIcon = Image.asset('assets/images/monero_menu.png',
|
||||
@@ -148,16 +150,19 @@ class MenuWidgetState extends State<MenuWidget> {
|
||||
),
|
||||
if (widget.dashboardViewModel.subname !=
|
||||
null)
|
||||
Observer(builder: (_) => Text(
|
||||
widget.dashboardViewModel.subname,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.accentTextTheme
|
||||
.overline
|
||||
.decorationColor,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 12),
|
||||
))
|
||||
Observer(
|
||||
builder: (_) => Text(
|
||||
widget.dashboardViewModel
|
||||
.subname,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.accentTextTheme
|
||||
.overline
|
||||
.decorationColor,
|
||||
fontWeight:
|
||||
FontWeight.w500,
|
||||
fontSize: 12),
|
||||
))
|
||||
],
|
||||
),
|
||||
))
|
||||
|
||||
@@ -35,16 +35,6 @@ class TransactionDetailsPage extends BasePage {
|
||||
value: tx.feeFormatted())
|
||||
];
|
||||
|
||||
if (showRecipientAddress) {
|
||||
final recipientAddress = transactionDescriptionBox.values.firstWhere((val) => val.id == transactionInfo.id, orElse: () => null)?.recipientAddress;
|
||||
|
||||
if (recipientAddress?.isNotEmpty ?? false) {
|
||||
items.add(StandartListItem(
|
||||
title: S.current.transaction_details_recipient_address,
|
||||
value: recipientAddress));
|
||||
}
|
||||
}
|
||||
|
||||
if (tx.key?.isNotEmpty ?? null) {
|
||||
// FIXME: add translation
|
||||
items.add(StandartListItem(title: 'Transaction Key', value: tx.key));
|
||||
@@ -71,6 +61,16 @@ class TransactionDetailsPage extends BasePage {
|
||||
|
||||
_items.addAll(items);
|
||||
}
|
||||
|
||||
if (showRecipientAddress) {
|
||||
final recipientAddress = transactionDescriptionBox.values.firstWhere((val) => val.id == transactionInfo.id, orElse: () => null)?.recipientAddress;
|
||||
|
||||
if (recipientAddress?.isNotEmpty ?? false) {
|
||||
_items.add(StandartListItem(
|
||||
title: S.current.transaction_details_recipient_address,
|
||||
value: recipientAddress));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user