transaction view model refactoring

This commit is contained in:
Serhii 2023-02-07 14:00:55 +02:00
parent 2103aa06bf
commit 3fc1263ad4
5 changed files with 6 additions and 6 deletions

View file

@ -41,4 +41,5 @@ class TransactionInfoRow extends Struct {
bool getIsPending() => isPending != 0;
String getHash() => hash.toDartString();
String getPaymentId() => paymentId.toDartString();
int getUnlockTime() => unlockTime * 2;
}

View file

@ -19,7 +19,7 @@ class MoneroTransactionInfo extends TransactionInfo {
amount = row.getAmount(),
accountIndex = row.subaddrAccount,
addressIndex = row.subaddrIndex,
unlockTime = row.unlockTime,
unlockTime = row.getUnlockTime(),
key = getTxKey(row.getHash()),
fee = row.fee {
additionalInfo = <String, dynamic>{
@ -59,14 +59,13 @@ class MoneroTransactionInfo extends TransactionInfo {
@override
String? unlockTimeFormatted() {
final formattedTime = unlockTime * 2;
if (direction == TransactionDirection.outgoing || unlockTime == 0) {
return null;
}
if (formattedTime > 500000) {
if (unlockTime > 500000) {
return '>1 year';
}
return '~ $formattedTime minutes';
return '~ $unlockTime minutes';
}
}

View file

@ -112,7 +112,7 @@ import 'package:cake_wallet/view_model/restore_from_backup_view_model.dart';
import 'package:cake_wallet/view_model/send/send_template_view_model.dart';
import 'package:cake_wallet/view_model/setup_pin_code_view_model.dart';
import 'package:cake_wallet/view_model/support_view_model.dart';
import 'package:cake_wallet/view_model/transaction_details_view_model.dart';
import 'package:cake_wallet/view_model/transactions/transaction_details_view_model.dart';
import 'package:cake_wallet/view_model/trade_details_view_model.dart';
import 'package:cake_wallet/view_model/unspent_coins/unspent_coins_details_view_model.dart';
import 'package:cake_wallet/view_model/unspent_coins/unspent_coins_item.dart';

View file

@ -2,7 +2,7 @@ import 'package:cake_wallet/src/screens/transaction_details/textfield_list_item.
import 'package:cake_wallet/src/screens/transaction_details/widgets/textfield_list_row.dart';
import 'package:cake_wallet/src/widgets/standard_list.dart';
import 'package:cake_wallet/utils/show_bar.dart';
import 'package:cake_wallet/view_model/transaction_details_view_model.dart';
import 'package:cake_wallet/view_model/transactions/transaction_details_view_model.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:cake_wallet/generated/i18n.dart';