Make the exchange receive field always editable and can be taken from QR or Address book (#1230)

This commit is contained in:
Omar Hatem 2023-12-16 03:20:56 +02:00 committed by GitHub
parent 2ff81df9e7
commit d756b367d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 1 additions and 21 deletions

View file

@ -411,10 +411,6 @@ class ExchangePage extends BasePage {
} }
}); });
reaction((_) => exchangeViewModel.isReceiveAddressEnabled, (bool isEnabled) {
receiveKey.currentState!.isAddressEditable(isEditable: isEnabled);
});
reaction((_) => exchangeViewModel.isReceiveAmountEditable, (bool isReceiveAmountEditable) { reaction((_) => exchangeViewModel.isReceiveAmountEditable, (bool isReceiveAmountEditable) {
receiveKey.currentState!.isAmountEditable(isEditable: isReceiveAmountEditable); receiveKey.currentState!.isAmountEditable(isEditable: isReceiveAmountEditable);
}); });
@ -670,7 +666,6 @@ class ExchangePage extends BasePage {
? exchangeViewModel.wallet.walletAddresses.address ? exchangeViewModel.wallet.walletAddresses.address
: exchangeViewModel.receiveAddress, : exchangeViewModel.receiveAddress,
initialIsAmountEditable: exchangeViewModel.isReceiveAmountEditable, initialIsAmountEditable: exchangeViewModel.isReceiveAmountEditable,
initialIsAddressEditable: exchangeViewModel.isReceiveAddressEnabled,
isAmountEstimated: true, isAmountEstimated: true,
isMoneroWallet: exchangeViewModel.isMoneroWallet, isMoneroWallet: exchangeViewModel.isMoneroWallet,
currencies: exchangeViewModel.receiveCurrencies, currencies: exchangeViewModel.receiveCurrencies,

View file

@ -174,8 +174,6 @@ class ExchangeTemplatePage extends BasePage {
? exchangeViewModel.wallet.walletAddresses.address ? exchangeViewModel.wallet.walletAddresses.address
: exchangeViewModel.receiveAddress, : exchangeViewModel.receiveAddress,
initialIsAmountEditable: false, initialIsAmountEditable: false,
initialIsAddressEditable:
exchangeViewModel.isReceiveAddressEnabled,
isAmountEstimated: true, isAmountEstimated: true,
isMoneroWallet: exchangeViewModel.isMoneroWallet, isMoneroWallet: exchangeViewModel.isMoneroWallet,
currencies: exchangeViewModel.receiveCurrencies, currencies: exchangeViewModel.receiveCurrencies,
@ -328,11 +326,6 @@ class ExchangeTemplatePage extends BasePage {
} }
}); });
reaction((_) => exchangeViewModel.isReceiveAddressEnabled,
(bool isEnabled) {
receiveKey.currentState!.isAddressEditable(isEditable: isEnabled);
});
reaction((_) => exchangeViewModel.provider, (ExchangeProvider? provider) { reaction((_) => exchangeViewModel.provider, (ExchangeProvider? provider) {
receiveKey.currentState!.isAmountEditable(isEditable: false); receiveKey.currentState!.isAmountEditable(isEditable: false);
}); });

View file

@ -23,7 +23,6 @@ class ExchangeCard extends StatefulWidget {
required this.initialAddress, required this.initialAddress,
required this.initialWalletName, required this.initialWalletName,
required this.initialIsAmountEditable, required this.initialIsAmountEditable,
required this.initialIsAddressEditable,
required this.isAmountEstimated, required this.isAmountEstimated,
required this.currencies, required this.currencies,
required this.onCurrencySelected, required this.onCurrencySelected,
@ -31,6 +30,7 @@ class ExchangeCard extends StatefulWidget {
this.currencyValueValidator, this.currencyValueValidator,
this.addressTextFieldValidator, this.addressTextFieldValidator,
this.title = '', this.title = '',
this.initialIsAddressEditable = true,
this.hasRefundAddress = false, this.hasRefundAddress = false,
this.isMoneroWallet = false, this.isMoneroWallet = false,
this.currencyButtonColor = Colors.transparent, this.currencyButtonColor = Colors.transparent,

View file

@ -66,7 +66,6 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with
receiveAddress = '', receiveAddress = '',
depositAddress = '', depositAddress = '',
isDepositAddressEnabled = false, isDepositAddressEnabled = false,
isReceiveAddressEnabled = false,
isReceiveAmountEditable = false, isReceiveAmountEditable = false,
_useTorOnly = false, _useTorOnly = false,
receiveCurrencies = <CryptoCurrency>[], receiveCurrencies = <CryptoCurrency>[],
@ -108,7 +107,6 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with
bestRateSync = Timer.periodic(Duration(seconds: 10), (timer) => _calculateBestRate()); bestRateSync = Timer.periodic(Duration(seconds: 10), (timer) => _calculateBestRate());
isDepositAddressEnabled = !(depositCurrency == wallet.currency); isDepositAddressEnabled = !(depositCurrency == wallet.currency);
isReceiveAddressEnabled = !(receiveCurrency == wallet.currency);
depositAmount = ''; depositAmount = '';
receiveAmount = ''; receiveAmount = '';
receiveAddress = ''; receiveAddress = '';
@ -201,9 +199,6 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with
@observable @observable
bool isDepositAddressEnabled; bool isDepositAddressEnabled;
@observable
bool isReceiveAddressEnabled;
@observable @observable
bool isReceiveAmountEntered; bool isReceiveAmountEntered;
@ -315,7 +310,6 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with
isFixedRateMode = false; isFixedRateMode = false;
_onPairChange(); _onPairChange();
isDepositAddressEnabled = !(depositCurrency == wallet.currency); isDepositAddressEnabled = !(depositCurrency == wallet.currency);
isReceiveAddressEnabled = !(receiveCurrency == wallet.currency);
} }
@action @action
@ -324,7 +318,6 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with
isFixedRateMode = false; isFixedRateMode = false;
_onPairChange(); _onPairChange();
isDepositAddressEnabled = !(depositCurrency == wallet.currency); isDepositAddressEnabled = !(depositCurrency == wallet.currency);
isReceiveAddressEnabled = !(receiveCurrency == wallet.currency);
} }
@action @action
@ -535,7 +528,6 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with
depositAddress = depositCurrency == wallet.currency ? wallet.walletAddresses.address : ''; depositAddress = depositCurrency == wallet.currency ? wallet.walletAddresses.address : '';
receiveAddress = receiveCurrency == wallet.currency ? wallet.walletAddresses.address : ''; receiveAddress = receiveCurrency == wallet.currency ? wallet.walletAddresses.address : '';
isDepositAddressEnabled = !(depositCurrency == wallet.currency); isDepositAddressEnabled = !(depositCurrency == wallet.currency);
isReceiveAddressEnabled = !(receiveCurrency == wallet.currency);
isFixedRateMode = false; isFixedRateMode = false;
_onPairChange(); _onPairChange();
} }