mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-11-25 11:03:55 +01:00
CAKE-92 | fixed templates saving bug on send and exchange pages; added comma for keyboard on templates pages; added fiat amount controller to send page; added crypto amount and fiat amount controllers to send template pages; added send template store to send view model; added updateTemplate(), addTemplate(), removeTemplate() to send view model and exchange view model; fixed remove template alert on send and exchange pages
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import 'package:cake_wallet/entities/openalias_record.dart';
|
||||
import 'package:cake_wallet/entities/template.dart';
|
||||
import 'package:cake_wallet/store/templates/send_template_store.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:cake_wallet/core/template_validator.dart';
|
||||
@@ -29,7 +31,8 @@ class SendViewModel = SendViewModelBase with _$SendViewModel;
|
||||
|
||||
abstract class SendViewModelBase with Store {
|
||||
SendViewModelBase(
|
||||
this._wallet, this._settingsStore, this._fiatConversationStore)
|
||||
this._wallet, this._settingsStore, this._sendTemplateStore,
|
||||
this._fiatConversationStore)
|
||||
: state = InitialExecutionState(),
|
||||
_cryptoNumberFormat = NumberFormat(),
|
||||
sendAll = false {
|
||||
@@ -88,8 +91,12 @@ abstract class SendViewModelBase with Store {
|
||||
@computed
|
||||
bool get isReadyForSend => _wallet.syncStatus is SyncedSyncStatus;
|
||||
|
||||
@computed
|
||||
ObservableList<Template> get templates => _sendTemplateStore.templates;
|
||||
|
||||
final WalletBase _wallet;
|
||||
final SettingsStore _settingsStore;
|
||||
final SendTemplateStore _sendTemplateStore;
|
||||
final FiatConversionStore _fiatConversationStore;
|
||||
final NumberFormat _cryptoNumberFormat;
|
||||
|
||||
@@ -219,4 +226,17 @@ abstract class SendViewModelBase with Store {
|
||||
|
||||
_cryptoNumberFormat.maximumFractionDigits = maximumFractionDigits;
|
||||
}
|
||||
|
||||
void updateTemplate() => _sendTemplateStore.update();
|
||||
|
||||
void addTemplate({String name, String address, String cryptoCurrency,
|
||||
String amount}) => _sendTemplateStore
|
||||
.addTemplate(
|
||||
name: name,
|
||||
address: address,
|
||||
cryptoCurrency: cryptoCurrency,
|
||||
amount: amount);
|
||||
|
||||
void removeTemplate({Template template}) =>
|
||||
_sendTemplateStore.remove(template: template);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user