mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-25 12:06:05 +00:00
CAKE-143 | added status parameter to exchange_view_model.dart; called alert when user tries exchange deposit xmr currency but wallet is not synchronized
This commit is contained in:
parent
5524efb44d
commit
7ce30e08b0
2 changed files with 29 additions and 13 deletions
|
@ -1,4 +1,5 @@
|
||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
|
import 'package:cake_wallet/entities/sync_status.dart';
|
||||||
import 'package:dotted_border/dotted_border.dart';
|
import 'package:dotted_border/dotted_border.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
@ -398,15 +399,26 @@ class ExchangePage extends BasePage {
|
||||||
text: S.of(context).exchange,
|
text: S.of(context).exchange,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (_formKey.currentState.validate()) {
|
if (_formKey.currentState.validate()) {
|
||||||
|
if ((exchangeViewModel.depositCurrency == CryptoCurrency.xmr)
|
||||||
|
&&(!(exchangeViewModel.status is SyncedSyncStatus))) {
|
||||||
|
showPopUp<void>(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertWithOneAction(
|
||||||
|
alertTitle: S.of(context).exchange,
|
||||||
|
alertContent: 'Please wait until your wallet is synchronized',
|
||||||
|
buttonText: S.of(context).ok,
|
||||||
|
buttonAction: () => Navigator.of(context).pop());
|
||||||
|
});
|
||||||
|
} else {
|
||||||
exchangeViewModel.createTrade();
|
exchangeViewModel.createTrade();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
color:
|
color: Theme.of(context).accentTextTheme.body2.color,
|
||||||
Theme.of(context).accentTextTheme.body2.color,
|
|
||||||
textColor: Colors.white,
|
textColor: Colors.white,
|
||||||
isLoading: exchangeViewModel.tradeState
|
isLoading: exchangeViewModel.tradeState
|
||||||
is TradeIsCreating,
|
is TradeIsCreating)),
|
||||||
)),
|
|
||||||
]),
|
]),
|
||||||
)),
|
)),
|
||||||
));
|
));
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import 'package:cake_wallet/core/wallet_base.dart';
|
import 'package:cake_wallet/core/wallet_base.dart';
|
||||||
import 'package:cake_wallet/entities/crypto_currency.dart';
|
import 'package:cake_wallet/entities/crypto_currency.dart';
|
||||||
|
import 'package:cake_wallet/entities/sync_status.dart';
|
||||||
import 'package:cake_wallet/entities/wallet_type.dart';
|
import 'package:cake_wallet/entities/wallet_type.dart';
|
||||||
import 'package:cake_wallet/exchange/exchange_provider.dart';
|
import 'package:cake_wallet/exchange/exchange_provider.dart';
|
||||||
import 'package:cake_wallet/exchange/limits.dart';
|
import 'package:cake_wallet/exchange/limits.dart';
|
||||||
|
@ -100,6 +101,9 @@ abstract class ExchangeViewModelBase with Store {
|
||||||
|
|
||||||
NumberFormat _cryptoNumberFormat;
|
NumberFormat _cryptoNumberFormat;
|
||||||
|
|
||||||
|
@computed
|
||||||
|
SyncStatus get status => wallet.syncStatus;
|
||||||
|
|
||||||
@computed
|
@computed
|
||||||
ObservableList<ExchangeTemplate> get templates =>
|
ObservableList<ExchangeTemplate> get templates =>
|
||||||
_exchangeTemplateStore.templates;
|
_exchangeTemplateStore.templates;
|
||||||
|
|
Loading…
Reference in a new issue