Merge branch 'staging' into simpleswap

This commit is contained in:
julian 2022-10-02 13:37:17 -06:00
commit 28d41cc5ab
2 changed files with 43 additions and 25 deletions

View file

@ -260,7 +260,11 @@ class _ExchangeViewState extends ConsumerState<ExchangeView> {
.read(fixedRateExchangeFormProvider) .read(fixedRateExchangeFormProvider)
.setFromAmountAndCalculateToAmount(Decimal.zero, true); .setFromAmountAndCalculateToAmount(Decimal.zero, true);
} }
_receiveController.text = ""; _receiveController.text =
ref.read(prefsChangeNotifierProvider).exchangeRateType ==
ExchangeRateType.estimated
? "-"
: "";
} }
} }
}); });
@ -325,7 +329,7 @@ class _ExchangeViewState extends ConsumerState<ExchangeView> {
: fixedRateExchangeFormProvider.select( : fixedRateExchangeFormProvider.select(
(value) => value.toAmountString), (previous, String next) { (value) => value.toAmountString), (previous, String next) {
if (!_receiveFocusNode.hasFocus) { if (!_receiveFocusNode.hasFocus) {
_receiveController.text = isEstimated ? "-" : next; _receiveController.text = isEstimated && next.isEmpty ? "-" : next;
debugPrint("RECEIVE AMOUNT LISTENER ACTIVATED"); debugPrint("RECEIVE AMOUNT LISTENER ACTIVATED");
if (_swapLock) { if (_swapLock) {
_sendController.text = isEstimated _sendController.text = isEstimated
@ -345,7 +349,12 @@ class _ExchangeViewState extends ConsumerState<ExchangeView> {
debugPrint("SEND AMOUNT LISTENER ACTIVATED"); debugPrint("SEND AMOUNT LISTENER ACTIVATED");
if (_swapLock) { if (_swapLock) {
_receiveController.text = isEstimated _receiveController.text = isEstimated
? "-" //ref.read(estimatedRateExchangeFormProvider).toAmountString ? ref
.read(estimatedRateExchangeFormProvider)
.toAmountString
.isEmpty
? "-"
: ref.read(estimatedRateExchangeFormProvider).toAmountString
: ref.read(fixedRateExchangeFormProvider).toAmountString; : ref.read(fixedRateExchangeFormProvider).toAmountString;
} }
} }
@ -424,7 +433,7 @@ class _ExchangeViewState extends ConsumerState<ExchangeView> {
.setFromAmountAndCalculateToAmount( .setFromAmountAndCalculateToAmount(
Decimal.zero, false); Decimal.zero, false);
} }
_receiveController.text = ""; _receiveController.text = isEstimated ? "-" : "";
} }
}, },
keyboardType: const TextInputType.numberWithOptions( keyboardType: const TextInputType.numberWithOptions(

View file

@ -271,7 +271,11 @@ class _WalletInitiatedExchangeViewState
.read(fixedRateExchangeFormProvider) .read(fixedRateExchangeFormProvider)
.setFromAmountAndCalculateToAmount(Decimal.zero, true); .setFromAmountAndCalculateToAmount(Decimal.zero, true);
} }
_receiveController.text = ""; _receiveController.text =
ref.read(prefsChangeNotifierProvider).exchangeRateType ==
ExchangeRateType.estimated
? "-"
: "";
} }
} }
}); });
@ -329,7 +333,7 @@ class _WalletInitiatedExchangeViewState
: fixedRateExchangeFormProvider.select( : fixedRateExchangeFormProvider.select(
(value) => value.toAmountString), (previous, String next) { (value) => value.toAmountString), (previous, String next) {
if (!_receiveFocusNode.hasFocus) { if (!_receiveFocusNode.hasFocus) {
_receiveController.text = isEstimated ? "-" : next; _receiveController.text = isEstimated && next.isEmpty ? "-" : next;
debugPrint("RECEIVE AMOUNT LISTENER ACTIVATED"); debugPrint("RECEIVE AMOUNT LISTENER ACTIVATED");
if (_swapLock) { if (_swapLock) {
_sendController.text = isEstimated _sendController.text = isEstimated
@ -349,7 +353,12 @@ class _WalletInitiatedExchangeViewState
debugPrint("SEND AMOUNT LISTENER ACTIVATED"); debugPrint("SEND AMOUNT LISTENER ACTIVATED");
if (_swapLock) { if (_swapLock) {
_receiveController.text = isEstimated _receiveController.text = isEstimated
? "-" //ref.read(estimatedRateExchangeFormProvider).toAmountString ? ref
.read(estimatedRateExchangeFormProvider)
.toAmountString
.isEmpty
? "-"
: ref.read(estimatedRateExchangeFormProvider).toAmountString
: ref.read(fixedRateExchangeFormProvider).toAmountString; : ref.read(fixedRateExchangeFormProvider).toAmountString;
} }
} }
@ -469,7 +478,7 @@ class _WalletInitiatedExchangeViewState
.setFromAmountAndCalculateToAmount( .setFromAmountAndCalculateToAmount(
Decimal.zero, false); Decimal.zero, false);
} }
_receiveController.text = ""; _receiveController.text = isEstimated ? "-" : "";
} }
}, },
keyboardType: const TextInputType.numberWithOptions( keyboardType: const TextInputType.numberWithOptions(
@ -1281,23 +1290,23 @@ class _WalletInitiatedExchangeViewState
.exchangeRateType == .exchangeRateType ==
ExchangeRateType.estimated; ExchangeRateType.estimated;
final ft = isEstimated // final ft = isEstimated
? ref // ? ref
.read( // .read(
estimatedRateExchangeFormProvider) // estimatedRateExchangeFormProvider)
.from // .from
?.ticker ?? // ?.ticker ??
"" // ""
: ref // : ref
.read( // .read(
fixedRateExchangeFormProvider) // fixedRateExchangeFormProvider)
.market // .market
?.from ?? // ?.from ??
""; // "";
//
final manager = ref // final manager = ref
.read(walletsChangeNotifierProvider) // .read(walletsChangeNotifierProvider)
.getManager(walletId); // .getManager(walletId);
final sendAmount = Decimal.parse(ref final sendAmount = Decimal.parse(ref
.read(estimatedRateExchangeFormProvider) .read(estimatedRateExchangeFormProvider)
.fromAmountString); .fromAmountString);