mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-12-04 12:34:14 +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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user