mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-11-19 10:04:17 +01:00
CW-370-add-options-to-enable-disable-buy-and-sell-actions (#920)
* feat: In the privacy settings screen, add 2 options to Enable/Disable Buy and Sell actions * fix: add strings * fix: add the rest of the strings * fix: disable instead of hide buy & sell buttons * fix: use disableSell * fix: main actions able to be onTapped even when disabled
This commit is contained in:
@@ -46,9 +46,7 @@ abstract class DashboardViewModelBase with Store {
|
||||
required this.anonpayTransactionsStore})
|
||||
: isOutdatedElectrumWallet = false,
|
||||
hasSellAction = false,
|
||||
isEnabledSellAction = false,
|
||||
hasBuyAction = false,
|
||||
isEnabledBuyAction = false,
|
||||
hasExchangeAction = false,
|
||||
isShowFirstYatIntroduction = false,
|
||||
isShowSecondYatIntroduction = false,
|
||||
@@ -287,14 +285,19 @@ abstract class DashboardViewModelBase with Store {
|
||||
@observable
|
||||
bool hasExchangeAction;
|
||||
|
||||
@observable
|
||||
bool isEnabledBuyAction;
|
||||
@computed
|
||||
bool get isEnabledBuyAction =>
|
||||
!settingsStore.disableBuy && wallet.type != WalletType.haven;
|
||||
|
||||
@observable
|
||||
bool hasBuyAction;
|
||||
|
||||
@observable
|
||||
bool isEnabledSellAction;
|
||||
@computed
|
||||
bool get isEnabledSellAction =>
|
||||
!settingsStore.disableSell &&
|
||||
wallet.type != WalletType.haven &&
|
||||
wallet.type != WalletType.monero &&
|
||||
wallet.type != WalletType.litecoin;
|
||||
|
||||
@observable
|
||||
bool hasSellAction;
|
||||
@@ -398,11 +401,7 @@ abstract class DashboardViewModelBase with Store {
|
||||
|
||||
void updateActions() {
|
||||
hasExchangeAction = !isHaven;
|
||||
isEnabledBuyAction = wallet.type != WalletType.haven;
|
||||
hasBuyAction = !isHaven;
|
||||
isEnabledSellAction = wallet.type != WalletType.haven
|
||||
&& wallet.type != WalletType.monero
|
||||
&& wallet.type != WalletType.litecoin;
|
||||
hasSellAction = !isHaven;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,12 @@ abstract class PrivacySettingsViewModelBase with Store {
|
||||
@computed
|
||||
bool get isAppSecure => _settingsStore.isAppSecure;
|
||||
|
||||
@computed
|
||||
bool get disableBuy => _settingsStore.disableBuy;
|
||||
|
||||
@computed
|
||||
bool get disableSell => _settingsStore.disableSell;
|
||||
|
||||
@action
|
||||
void setShouldSaveRecipientAddress(bool value) => _settingsStore.shouldSaveRecipientAddress = value;
|
||||
|
||||
@@ -36,4 +42,10 @@ abstract class PrivacySettingsViewModelBase with Store {
|
||||
@action
|
||||
void setIsAppSecure(bool value) => _settingsStore.isAppSecure = value;
|
||||
|
||||
@action
|
||||
void setDisableBuy(bool value) => _settingsStore.disableBuy = value;
|
||||
|
||||
@action
|
||||
void setDisableSell(bool value) => _settingsStore.disableSell = value;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user