mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 20:09:23 +00:00
no caching or switching of currencies based on exchange selection
This commit is contained in:
parent
7616538248
commit
ae697928a6
1 changed files with 0 additions and 74 deletions
|
@ -5,10 +5,8 @@ import 'package:stackwallet/models/exchange/response_objects/estimate.dart';
|
||||||
import 'package:stackwallet/models/isar/exchange_cache/currency.dart';
|
import 'package:stackwallet/models/isar/exchange_cache/currency.dart';
|
||||||
import 'package:stackwallet/models/isar/exchange_cache/pair.dart';
|
import 'package:stackwallet/models/isar/exchange_cache/pair.dart';
|
||||||
import 'package:stackwallet/pages/exchange_view/sub_widgets/exchange_rate_sheet.dart';
|
import 'package:stackwallet/pages/exchange_view/sub_widgets/exchange_rate_sheet.dart';
|
||||||
import 'package:stackwallet/services/exchange/change_now/change_now_exchange.dart';
|
|
||||||
import 'package:stackwallet/services/exchange/exchange.dart';
|
import 'package:stackwallet/services/exchange/exchange.dart';
|
||||||
import 'package:stackwallet/services/exchange/exchange_data_loading_service.dart';
|
import 'package:stackwallet/services/exchange/exchange_data_loading_service.dart';
|
||||||
import 'package:stackwallet/services/exchange/majestic_bank/majestic_bank_exchange.dart';
|
|
||||||
import 'package:stackwallet/utilities/logger.dart';
|
import 'package:stackwallet/utilities/logger.dart';
|
||||||
|
|
||||||
class ExchangeFormState extends ChangeNotifier {
|
class ExchangeFormState extends ChangeNotifier {
|
||||||
|
@ -175,16 +173,6 @@ class ExchangeFormState extends ChangeNotifier {
|
||||||
.rateTypeEqualTo(SupportedRateType.estimated))
|
.rateTypeEqualTo(SupportedRateType.estimated))
|
||||||
.findFirst();
|
.findFirst();
|
||||||
}
|
}
|
||||||
if (_sendCurrency == null) {
|
|
||||||
switch (exchange.name) {
|
|
||||||
case ChangeNowExchange.exchangeName:
|
|
||||||
_sendCurrency = _cachedSendCN;
|
|
||||||
break;
|
|
||||||
case MajesticBankExchange.exchangeName:
|
|
||||||
_sendCurrency = _cachedSendMB;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_receiveCurrency != null) {
|
if (_receiveCurrency != null) {
|
||||||
_receiveCurrency = await ExchangeDataLoadingService
|
_receiveCurrency = await ExchangeDataLoadingService
|
||||||
|
@ -206,23 +194,6 @@ class ExchangeFormState extends ChangeNotifier {
|
||||||
.findFirst();
|
.findFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_receiveCurrency == null) {
|
|
||||||
switch (exchange.name) {
|
|
||||||
case ChangeNowExchange.exchangeName:
|
|
||||||
_receiveCurrency = _cachedReceivingCN;
|
|
||||||
break;
|
|
||||||
case MajesticBankExchange.exchangeName:
|
|
||||||
_receiveCurrency = _cachedReceivingMB;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_updateCachedCurrencies(
|
|
||||||
exchangeName: exchange.name,
|
|
||||||
send: _sendCurrency,
|
|
||||||
receiving: _receiveCurrency,
|
|
||||||
);
|
|
||||||
|
|
||||||
await _updateRangesAndEstimate(
|
await _updateRangesAndEstimate(
|
||||||
shouldNotifyListeners: false,
|
shouldNotifyListeners: false,
|
||||||
);
|
);
|
||||||
|
@ -236,11 +207,6 @@ class ExchangeFormState extends ChangeNotifier {
|
||||||
void setCurrencies(Currency from, Currency to) {
|
void setCurrencies(Currency from, Currency to) {
|
||||||
_sendCurrency = from;
|
_sendCurrency = from;
|
||||||
_receiveCurrency = to;
|
_receiveCurrency = to;
|
||||||
_updateCachedCurrencies(
|
|
||||||
exchangeName: exchange.name,
|
|
||||||
send: _sendCurrency,
|
|
||||||
receiving: _receiveCurrency,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset({
|
void reset({
|
||||||
|
@ -324,12 +290,6 @@ class ExchangeFormState extends ChangeNotifier {
|
||||||
_minSendAmount = null;
|
_minSendAmount = null;
|
||||||
_maxSendAmount = null;
|
_maxSendAmount = null;
|
||||||
|
|
||||||
_updateCachedCurrencies(
|
|
||||||
exchangeName: exchange.name,
|
|
||||||
send: _sendCurrency,
|
|
||||||
receiving: _receiveCurrency,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (_receiveCurrency == null) {
|
if (_receiveCurrency == null) {
|
||||||
_rate = null;
|
_rate = null;
|
||||||
} else {
|
} else {
|
||||||
|
@ -354,12 +314,6 @@ class ExchangeFormState extends ChangeNotifier {
|
||||||
_minReceiveAmount = null;
|
_minReceiveAmount = null;
|
||||||
_maxReceiveAmount = null;
|
_maxReceiveAmount = null;
|
||||||
|
|
||||||
_updateCachedCurrencies(
|
|
||||||
exchangeName: exchange.name,
|
|
||||||
send: _sendCurrency,
|
|
||||||
receiving: _receiveCurrency,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (_sendCurrency == null) {
|
if (_sendCurrency == null) {
|
||||||
_rate = null;
|
_rate = null;
|
||||||
} else {
|
} else {
|
||||||
|
@ -391,12 +345,6 @@ class ExchangeFormState extends ChangeNotifier {
|
||||||
_sendCurrency = receiveCurrency;
|
_sendCurrency = receiveCurrency;
|
||||||
_receiveCurrency = tmp;
|
_receiveCurrency = tmp;
|
||||||
|
|
||||||
_updateCachedCurrencies(
|
|
||||||
exchangeName: exchange.name,
|
|
||||||
send: _sendCurrency,
|
|
||||||
receiving: _receiveCurrency,
|
|
||||||
);
|
|
||||||
|
|
||||||
await _updateRangesAndEstimate(
|
await _updateRangesAndEstimate(
|
||||||
shouldNotifyListeners: false,
|
shouldNotifyListeners: false,
|
||||||
);
|
);
|
||||||
|
@ -542,28 +490,6 @@ class ExchangeFormState extends ChangeNotifier {
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
Currency? _cachedReceivingMB;
|
|
||||||
Currency? _cachedSendMB;
|
|
||||||
Currency? _cachedReceivingCN;
|
|
||||||
Currency? _cachedSendCN;
|
|
||||||
|
|
||||||
void _updateCachedCurrencies({
|
|
||||||
required String exchangeName,
|
|
||||||
required Currency? send,
|
|
||||||
required Currency? receiving,
|
|
||||||
}) {
|
|
||||||
switch (exchangeName) {
|
|
||||||
case ChangeNowExchange.exchangeName:
|
|
||||||
_cachedSendCN = send ?? _cachedSendCN;
|
|
||||||
_cachedReceivingCN = receiving ?? _cachedReceivingCN;
|
|
||||||
break;
|
|
||||||
case MajesticBankExchange.exchangeName:
|
|
||||||
_cachedSendMB = send ?? _cachedSendMB;
|
|
||||||
_cachedReceivingMB = receiving ?? _cachedReceivingMB;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void _notify() {
|
void _notify() {
|
||||||
debugPrint("ExFState NOTIFY: ${toString()}");
|
debugPrint("ExFState NOTIFY: ${toString()}");
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
|
Loading…
Reference in a new issue