mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-21 06:18:42 +02:00
add Disable fiat mode
This commit is contained in:
@@ -71,6 +71,9 @@ abstract class BalanceViewModelBase with Store {
|
||||
@computed
|
||||
BalanceDisplayMode get savedDisplayMode => settingsStore.balanceDisplayMode;
|
||||
|
||||
@computed
|
||||
bool get disableFiat => settingsStore.shouldDisableFiat;
|
||||
|
||||
@computed
|
||||
String get asset {
|
||||
final typeFormatted = walletTypeToString(appStore.wallet!.type);
|
||||
@@ -180,8 +183,8 @@ abstract class BalanceViewModelBase with Store {
|
||||
return MapEntry(key, BalanceRecord(
|
||||
availableBalance: '---',
|
||||
additionalBalance: '---',
|
||||
fiatAdditionalBalance: '---',
|
||||
fiatAvailableBalance: '---',
|
||||
fiatAdditionalBalance: disableFiat ? '' : '---',
|
||||
fiatAvailableBalance: disableFiat ? '' : '---',
|
||||
asset: key,
|
||||
formattedAssetTitle: _formatterAsset(key)));
|
||||
}
|
||||
@@ -192,17 +195,17 @@ abstract class BalanceViewModelBase with Store {
|
||||
// throw Exception('Price is null for: $key');
|
||||
// }
|
||||
|
||||
final additionalFiatBalance = fiatCurrency.toString()
|
||||
+ ' '
|
||||
final additionalFiatBalance = disableFiat ? '' : (fiatCurrency.toString()
|
||||
+ ' '
|
||||
+ _getFiatBalance(
|
||||
price: price,
|
||||
cryptoAmount: value.formattedAdditionalBalance);
|
||||
cryptoAmount: value.formattedAdditionalBalance));
|
||||
|
||||
final availableFiatBalance = fiatCurrency.toString()
|
||||
+ ' '
|
||||
final availableFiatBalance = disableFiat ? '' : (fiatCurrency.toString()
|
||||
+ ' '
|
||||
+ _getFiatBalance(
|
||||
price: price,
|
||||
cryptoAmount: value.formattedAvailableBalance);
|
||||
cryptoAmount: value.formattedAvailableBalance));
|
||||
|
||||
return MapEntry(key, BalanceRecord(
|
||||
availableBalance: value.formattedAvailableBalance,
|
||||
|
||||
@@ -61,7 +61,6 @@ abstract class SettingsViewModelBase with Store {
|
||||
: itemHeaders = {},
|
||||
_walletType = wallet.type,
|
||||
_biometricAuth = BiometricAuth(),
|
||||
sections = <List<SettingsListItem>>[],
|
||||
currentVersion = '' {
|
||||
PackageInfo.fromPlatform().then(
|
||||
(PackageInfo packageInfo) => currentVersion = packageInfo.version);
|
||||
@@ -98,7 +97,7 @@ abstract class SettingsViewModelBase with Store {
|
||||
//}
|
||||
|
||||
|
||||
sections = [
|
||||
getSections = () => [
|
||||
[
|
||||
SwitcherListItem(
|
||||
title: S.current.settings_display_balance,
|
||||
@@ -111,7 +110,7 @@ abstract class SettingsViewModelBase with Store {
|
||||
}
|
||||
},
|
||||
),
|
||||
if (!isHaven)
|
||||
if (!isHaven && !shouldDisableFiat)
|
||||
PickerListItem(
|
||||
title: S.current.settings_currency,
|
||||
searchHintText: S.current.search_currency,
|
||||
@@ -183,6 +182,11 @@ abstract class SettingsViewModelBase with Store {
|
||||
return LanguageService.list[code]?.toLowerCase().contains(searchText) ?? false;
|
||||
},
|
||||
),
|
||||
SwitcherListItem(
|
||||
title: 'S.current.disable_fiat',
|
||||
value: () => shouldDisableFiat,
|
||||
onValueChange: (_, bool value) =>
|
||||
setShouldDisableFiat(value)),
|
||||
SwitcherListItem(
|
||||
title: S.current.settings_allow_biometrical_authentication,
|
||||
value: () => allowBiometricalAuthentication,
|
||||
@@ -208,6 +212,7 @@ abstract class SettingsViewModelBase with Store {
|
||||
setAllowBiometricalAuthentication(value);
|
||||
}
|
||||
}),
|
||||
|
||||
ChoicesListItem(
|
||||
title: S.current.color_theme,
|
||||
items: ThemeList.all,
|
||||
@@ -275,6 +280,10 @@ abstract class SettingsViewModelBase with Store {
|
||||
bool get shouldSaveRecipientAddress =>
|
||||
_settingsStore.shouldSaveRecipientAddress;
|
||||
|
||||
@computed
|
||||
bool get shouldDisableFiat =>
|
||||
_settingsStore.shouldDisableFiat;
|
||||
|
||||
@computed
|
||||
bool get allowBiometricalAuthentication =>
|
||||
_settingsStore.allowBiometricalAuthentication;
|
||||
@@ -285,7 +294,7 @@ abstract class SettingsViewModelBase with Store {
|
||||
bool get isBitcoinBuyEnabled => _settingsStore.isBitcoinBuyEnabled;
|
||||
|
||||
final Map<String, String> itemHeaders;
|
||||
List<List<SettingsListItem>> sections;
|
||||
late List<List<SettingsListItem>> Function() getSections;
|
||||
final SettingsStore _settingsStore;
|
||||
final YatStore _yatStore;
|
||||
final WalletType _walletType;
|
||||
@@ -303,6 +312,10 @@ abstract class SettingsViewModelBase with Store {
|
||||
void setShouldSaveRecipientAddress(bool value) =>
|
||||
_settingsStore.shouldSaveRecipientAddress = value;
|
||||
|
||||
@action
|
||||
void setShouldDisableFiat(bool value) =>
|
||||
_settingsStore.shouldDisableFiat = value;
|
||||
|
||||
@action
|
||||
void setAllowBiometricalAuthentication(bool value) =>
|
||||
_settingsStore.allowBiometricalAuthentication = value;
|
||||
|
||||
Reference in New Issue
Block a user