Merge branch 'new-world' into CAKE-116-all-button-validation-bug

# Conflicts:
#	lib/src/screens/send/send_page.dart
This commit is contained in:
OleksandrSobol
2020-10-09 22:45:04 +03:00
10 changed files with 207 additions and 183 deletions
@@ -27,10 +27,10 @@ class ExchangeViewModel = ExchangeViewModelBase with _$ExchangeViewModel;
abstract class ExchangeViewModelBase with Store {
ExchangeViewModelBase(
{this.wallet,
this.wallet,
this.trades,
this.exchangeTemplateStore,
this.tradesStore}) {
this._exchangeTemplateStore,
this.tradesStore) {
providerList = [
XMRTOExchangeProvider(),
ChangeNowExchangeProvider(),
@@ -54,7 +54,7 @@ abstract class ExchangeViewModelBase with Store {
final WalletBase wallet;
final Box<Trade> trades;
final ExchangeTemplateStore exchangeTemplateStore;
final ExchangeTemplateStore _exchangeTemplateStore;
final TradesStore tradesStore;
@observable
@@ -101,7 +101,7 @@ abstract class ExchangeViewModelBase with Store {
@computed
ObservableList<ExchangeTemplate> get templates =>
exchangeTemplateStore.templates;
_exchangeTemplateStore.templates;
@action
void changeProvider({ExchangeProvider provider}) {
@@ -267,6 +267,22 @@ abstract class ExchangeViewModelBase with Store {
_onPairChange();
}
void updateTemplate() => _exchangeTemplateStore.update();
void addTemplate({String amount, String depositCurrency, String receiveCurrency,
String provider, String depositAddress, String receiveAddress}) =>
_exchangeTemplateStore.addTemplate(
amount: amount,
depositCurrency: depositCurrency,
receiveCurrency: receiveCurrency,
provider: provider,
depositAddress: depositAddress,
receiveAddress: receiveAddress
);
void removeTemplate({ExchangeTemplate template}) =>
_exchangeTemplateStore.remove(template: template);
List<ExchangeProvider> providersForCurrentPair() {
return _providersForPair(from: depositCurrency, to: receiveCurrency);
}
+21 -1
View File
@@ -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 {
@@ -90,8 +93,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;
@@ -221,4 +228,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);
}
@@ -144,7 +144,7 @@ abstract class SettingsViewModelBase with Store {
RegularListItem(
title: S.current.settings_terms_and_conditions,
handler: (BuildContext context) =>
Navigator.of(context).pushNamed(Routes.disclaimer),
Navigator.of(context).pushNamed(Routes.readDisclaimer),
),
RegularListItem(
title: S.current.faq,