mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-12-01 12:04:21 +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:
@@ -34,6 +34,8 @@ abstract class SettingsStoreBase with Store {
|
||||
required BalanceDisplayMode initialBalanceDisplayMode,
|
||||
required bool initialSaveRecipientAddress,
|
||||
required bool initialAppSecure,
|
||||
required bool initialDisableBuy,
|
||||
required bool initialDisableSell,
|
||||
required FiatApiMode initialFiatMode,
|
||||
required bool initialAllowBiometricalAuthentication,
|
||||
required ExchangeApiMode initialExchangeStatus,
|
||||
@@ -57,6 +59,8 @@ abstract class SettingsStoreBase with Store {
|
||||
balanceDisplayMode = initialBalanceDisplayMode,
|
||||
shouldSaveRecipientAddress = initialSaveRecipientAddress,
|
||||
isAppSecure = initialAppSecure,
|
||||
disableBuy = initialDisableBuy,
|
||||
disableSell = initialDisableSell,
|
||||
fiatApiMode = initialFiatMode,
|
||||
allowBiometricalAuthentication = initialAllowBiometricalAuthentication,
|
||||
shouldShowMarketPlaceInDashboard = initialShouldShowMarketPlaceInDashboard,
|
||||
@@ -130,6 +134,16 @@ abstract class SettingsStoreBase with Store {
|
||||
}
|
||||
});
|
||||
|
||||
reaction(
|
||||
(_) => disableBuy,
|
||||
(bool disableBuy) => sharedPreferences.setBool(
|
||||
PreferencesKey.disableBuyKey, disableBuy));
|
||||
|
||||
reaction(
|
||||
(_) => disableSell,
|
||||
(bool disableSell) => sharedPreferences.setBool(
|
||||
PreferencesKey.disableSellKey, disableSell));
|
||||
|
||||
if (Platform.isAndroid) {
|
||||
setIsAppSecureNative(isAppSecure);
|
||||
}
|
||||
@@ -217,6 +231,12 @@ abstract class SettingsStoreBase with Store {
|
||||
@observable
|
||||
bool isAppSecure;
|
||||
|
||||
@observable
|
||||
bool disableBuy;
|
||||
|
||||
@observable
|
||||
bool disableSell;
|
||||
|
||||
@observable
|
||||
bool allowBiometricalAuthentication;
|
||||
|
||||
@@ -309,6 +329,10 @@ abstract class SettingsStoreBase with Store {
|
||||
sharedPreferences.getBool(PreferencesKey.shouldSaveRecipientAddressKey) ?? false;
|
||||
final isAppSecure =
|
||||
sharedPreferences.getBool(PreferencesKey.isAppSecureKey) ?? false;
|
||||
final disableBuy =
|
||||
sharedPreferences.getBool(PreferencesKey.disableBuyKey) ?? false;
|
||||
final disableSell =
|
||||
sharedPreferences.getBool(PreferencesKey.disableSellKey) ?? false;
|
||||
final currentFiatApiMode = FiatApiMode.deserialize(
|
||||
raw: sharedPreferences
|
||||
.getInt(PreferencesKey.currentFiatApiModeKey) ?? FiatApiMode.enabled.raw);
|
||||
@@ -388,6 +412,8 @@ abstract class SettingsStoreBase with Store {
|
||||
initialBalanceDisplayMode: currentBalanceDisplayMode,
|
||||
initialSaveRecipientAddress: shouldSaveRecipientAddress,
|
||||
initialAppSecure: isAppSecure,
|
||||
initialDisableBuy: disableBuy,
|
||||
initialDisableSell: disableSell,
|
||||
initialFiatMode: currentFiatApiMode,
|
||||
initialAllowBiometricalAuthentication: allowBiometricalAuthentication,
|
||||
initialExchangeStatus: exchangeStatus,
|
||||
@@ -435,6 +461,10 @@ abstract class SettingsStoreBase with Store {
|
||||
sharedPreferences.getBool(PreferencesKey.shouldSaveRecipientAddressKey) ?? shouldSaveRecipientAddress;
|
||||
isAppSecure =
|
||||
sharedPreferences.getBool(PreferencesKey.isAppSecureKey) ?? isAppSecure;
|
||||
disableBuy =
|
||||
sharedPreferences.getBool(PreferencesKey.disableBuyKey) ?? disableBuy;
|
||||
disableSell =
|
||||
sharedPreferences.getBool(PreferencesKey.disableSellKey) ?? disableSell;
|
||||
allowBiometricalAuthentication = sharedPreferences
|
||||
.getBool(PreferencesKey.allowBiometricalAuthenticationKey) ??
|
||||
allowBiometricalAuthentication;
|
||||
|
||||
Reference in New Issue
Block a user