mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-22 19:49:22 +00:00
CW-227 Add Disable Exchange option to settings (#642)
* Add Disable Exchange option to settings
This commit is contained in:
parent
bcf09b048c
commit
9b32c9c956
20 changed files with 50 additions and 20 deletions
|
@ -11,6 +11,7 @@ class PreferencesKey {
|
|||
static const shouldSaveRecipientAddressKey = 'save_recipient_address';
|
||||
static const allowBiometricalAuthenticationKey =
|
||||
'allow_biometrical_authentication';
|
||||
static const disableExchangeKey = 'disable_exchange';
|
||||
static const currentTheme = 'current_theme';
|
||||
static const isDarkThemeLegacy = 'dark_theme';
|
||||
static const displayActionListModeKey = 'display_list_mode';
|
||||
|
|
|
@ -315,6 +315,8 @@ class DashboardPage extends BasePage {
|
|||
}
|
||||
|
||||
Future<void> _onClickExchangeButton(BuildContext context) async {
|
||||
await Navigator.of(context).pushNamed(Routes.exchange);
|
||||
if (walletViewModel.isEnabledExchangeAction) {
|
||||
await Navigator.of(context).pushNamed(Routes.exchange);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ abstract class SettingsStoreBase with Store {
|
|||
required BalanceDisplayMode initialBalanceDisplayMode,
|
||||
required bool initialSaveRecipientAddress,
|
||||
required bool initialAllowBiometricalAuthentication,
|
||||
required bool initialExchangeEnabled,
|
||||
required ThemeBase initialTheme,
|
||||
required int initialPinLength,
|
||||
required String initialLanguageCode,
|
||||
|
@ -47,6 +48,7 @@ abstract class SettingsStoreBase with Store {
|
|||
balanceDisplayMode = initialBalanceDisplayMode,
|
||||
shouldSaveRecipientAddress = initialSaveRecipientAddress,
|
||||
allowBiometricalAuthentication = initialAllowBiometricalAuthentication,
|
||||
disableExchange = initialExchangeEnabled,
|
||||
currentTheme = initialTheme,
|
||||
pinCodeLength = initialPinLength,
|
||||
languageCode = initialLanguageCode,
|
||||
|
@ -143,6 +145,9 @@ abstract class SettingsStoreBase with Store {
|
|||
@observable
|
||||
bool allowBiometricalAuthentication;
|
||||
|
||||
@observable
|
||||
bool disableExchange;
|
||||
|
||||
@observable
|
||||
ThemeBase currentTheme;
|
||||
|
||||
|
@ -221,6 +226,8 @@ abstract class SettingsStoreBase with Store {
|
|||
final allowBiometricalAuthentication = sharedPreferences
|
||||
.getBool(PreferencesKey.allowBiometricalAuthenticationKey) ??
|
||||
false;
|
||||
final disableExchange = sharedPreferences
|
||||
.getBool(PreferencesKey.disableExchangeKey) ?? false;
|
||||
final legacyTheme =
|
||||
(sharedPreferences.getBool(PreferencesKey.isDarkThemeLegacy) ?? false)
|
||||
? ThemeType.dark.index
|
||||
|
@ -284,6 +291,7 @@ abstract class SettingsStoreBase with Store {
|
|||
initialBalanceDisplayMode: currentBalanceDisplayMode,
|
||||
initialSaveRecipientAddress: shouldSaveRecipientAddress,
|
||||
initialAllowBiometricalAuthentication: allowBiometricalAuthentication,
|
||||
initialExchangeEnabled: disableExchange,
|
||||
initialTheme: savedTheme,
|
||||
actionlistDisplayMode: actionListDisplayMode,
|
||||
initialPinLength: pinLength,
|
||||
|
|
|
@ -53,7 +53,6 @@ abstract class DashboardViewModelBase with Store {
|
|||
hasBuyAction = false,
|
||||
isEnabledBuyAction = false,
|
||||
hasExchangeAction = false,
|
||||
isEnabledExchangeAction = false,
|
||||
isShowFirstYatIntroduction = false,
|
||||
isShowSecondYatIntroduction = false,
|
||||
isShowThirdYatIntroduction = false,
|
||||
|
@ -249,8 +248,8 @@ abstract class DashboardViewModelBase with Store {
|
|||
void furtherShowYatPopup(bool shouldShow) =>
|
||||
settingsStore.shouldShowYatPopup = shouldShow;
|
||||
|
||||
@observable
|
||||
bool isEnabledExchangeAction;
|
||||
@computed
|
||||
bool get isEnabledExchangeAction => !settingsStore.disableExchange;
|
||||
|
||||
@observable
|
||||
bool hasExchangeAction;
|
||||
|
@ -365,7 +364,6 @@ abstract class DashboardViewModelBase with Store {
|
|||
}
|
||||
|
||||
void updateActions() {
|
||||
isEnabledExchangeAction = true;
|
||||
hasExchangeAction = !isHaven;
|
||||
isEnabledBuyAction = wallet.type != WalletType.haven
|
||||
&& wallet.type != WalletType.monero;
|
||||
|
|
|
@ -208,6 +208,12 @@ abstract class SettingsViewModelBase with Store {
|
|||
setAllowBiometricalAuthentication(value);
|
||||
}
|
||||
}),
|
||||
SwitcherListItem(
|
||||
title: S.current.disable_exchange,
|
||||
value: () => _settingsStore.disableExchange,
|
||||
onValueChange: (BuildContext context, bool value) {
|
||||
_settingsStore.disableExchange = value;
|
||||
}),
|
||||
ChoicesListItem(
|
||||
title: S.current.color_theme,
|
||||
items: ThemeList.all,
|
||||
|
|
|
@ -651,5 +651,6 @@
|
|||
"ignor": "Ignorieren",
|
||||
"use_suggested": "Vorgeschlagen verwenden",
|
||||
"do_not_share_warning_text" : "Teilen Sie diese nicht mit anderen, einschließlich des Supports.\n\nSie werden Ihr Geld stehlen!",
|
||||
"help": "hilfe"
|
||||
"help": "hilfe",
|
||||
"disable_exchange": "Exchange deaktivieren"
|
||||
}
|
||||
|
|
|
@ -651,5 +651,6 @@
|
|||
"ignor": "Ignore",
|
||||
"use_suggested": "Use Suggested",
|
||||
"do_not_share_warning_text" : "Do not share these with anyone else, including support.\n\nThey will steal your money!",
|
||||
"help": "help"
|
||||
"help": "help",
|
||||
"disable_exchange": "Disable exchange"
|
||||
}
|
||||
|
|
|
@ -651,5 +651,6 @@
|
|||
"ignor": "Pasar por alto",
|
||||
"use_suggested": "Usar sugerido",
|
||||
"do_not_share_warning_text" : "No comparta estos con nadie más, incluido el soporte.\n\n¡Te robarán tu dinero!",
|
||||
"help": "ayuda"
|
||||
"help": "ayuda",
|
||||
"disable_exchange": "Deshabilitar intercambio"
|
||||
}
|
||||
|
|
|
@ -649,5 +649,6 @@
|
|||
"ignor": "Ignorer",
|
||||
"use_suggested": "Utilisation suggérée",
|
||||
"do_not_share_warning_text" : "Ne les partagez avec personne d'autre, y compris avec l'assistance.\n\nIls vont voler votre argent!",
|
||||
"help": "aider"
|
||||
"help": "aider",
|
||||
"disable_exchange": "Désactiver l'échange"
|
||||
}
|
||||
|
|
|
@ -651,5 +651,6 @@
|
|||
"ignor": "नज़रअंदाज़ करना",
|
||||
"use_suggested": "सुझाए गए का प्रयोग करें",
|
||||
"do_not_share_warning_text" : "इन्हें समर्थन सहित किसी और के साथ साझा न करें।\n\nवे आपका पैसा चुरा लेंगे!",
|
||||
"help": "मदद करना"
|
||||
"help": "मदद करना",
|
||||
"disable_exchange": "एक्सचेंज अक्षम करें"
|
||||
}
|
||||
|
|
|
@ -651,5 +651,6 @@
|
|||
"ignor": "Zanemariti",
|
||||
"use_suggested": "Koristite predloženo",
|
||||
"do_not_share_warning_text" : "Nemojte ih dijeliti ni s kim, uključujući podršku.\n\nUkrast će vam novac!",
|
||||
"help": "pomozite"
|
||||
"help": "pomozite",
|
||||
"disable_exchange": "Onemogući exchange"
|
||||
}
|
||||
|
|
|
@ -651,5 +651,6 @@
|
|||
"ignor": "Ignorare",
|
||||
"use_suggested": "Usa suggerito",
|
||||
"do_not_share_warning_text" : "Non condividerli con nessun altro, incluso il supporto.\n\nTi ruberanno i soldi!",
|
||||
"help": "aiuto"
|
||||
"help": "aiuto",
|
||||
"disable_exchange": "Disabilita scambio"
|
||||
}
|
||||
|
|
|
@ -651,5 +651,6 @@
|
|||
"ignor": "無視",
|
||||
"use_suggested": "推奨を使用",
|
||||
"do_not_share_warning_text" : "サポートを含め、これらを他の誰とも共有しないでください。\n\n彼らはあなたのお金を盗みます!",
|
||||
"help": "ヘルプ"
|
||||
"help": "ヘルプ",
|
||||
"disable_exchange": "交換を無効にする"
|
||||
}
|
||||
|
|
|
@ -651,5 +651,6 @@
|
|||
"ignor": "무시하다",
|
||||
"use_suggested": "추천 사용",
|
||||
"do_not_share_warning_text" : "지원을 포함하여 다른 사람과 이러한 정보를 공유하지 마십시오.\n\n그들은 당신의 돈을 훔칠 것입니다!",
|
||||
"help": "돕다"
|
||||
"help": "돕다",
|
||||
"disable_exchange": "교환 비활성화"
|
||||
}
|
||||
|
|
|
@ -651,5 +651,6 @@
|
|||
"ignor": "Negeren",
|
||||
"use_suggested": "Gebruik aanbevolen",
|
||||
"do_not_share_warning_text" : "Deel deze met niemand anders, ook niet met support.\n\nZe zullen je geld stelen!",
|
||||
"help": "helpen"
|
||||
"help": "helpen",
|
||||
"disable_exchange": "Uitwisseling uitschakelen"
|
||||
}
|
||||
|
|
|
@ -651,5 +651,6 @@
|
|||
"ignor": "Ignorować",
|
||||
"use_suggested": "Użyj sugerowane",
|
||||
"do_not_share_warning_text" : "Nie udostępniaj ich nikomu innemu, w tym wsparcia.\n\nUkradną twoje pieniądze!",
|
||||
"help": "pomoc"
|
||||
"help": "pomoc",
|
||||
"disable_exchange": "Wyłącz wymianę"
|
||||
}
|
||||
|
|
|
@ -651,5 +651,6 @@
|
|||
"ignor": "Ignorar",
|
||||
"use_suggested": "Uso sugerido",
|
||||
"do_not_share_warning_text" : "Não os compartilhe com mais ninguém, incluindo suporte.\n\nEles vão roubar seu dinheiro!",
|
||||
"help": "ajuda"
|
||||
"help": "ajuda",
|
||||
"disable_exchange": "Desativar troca"
|
||||
}
|
||||
|
|
|
@ -651,5 +651,6 @@
|
|||
"ignor": "Игнорировать",
|
||||
"use_suggested": "Использовать предложенный",
|
||||
"do_not_share_warning_text" : "Не делитесь ими с кем-либо еще, в том числе со службой поддержки.\n\nОни украдут ваши деньги!",
|
||||
"help": "помощь"
|
||||
"help": "помощь",
|
||||
"disable_exchange": "Отключить обмен"
|
||||
}
|
||||
|
|
|
@ -650,5 +650,6 @@
|
|||
"ignor": "Ігнорувати",
|
||||
"use_suggested": "Використати запропоноване",
|
||||
"do_not_share_warning_text" : "Не повідомляйте їх нікому, включно зі службою підтримки.\n\nВони вкрадуть ваші гроші!",
|
||||
"help": "допомога"
|
||||
"help": "допомога",
|
||||
"disable_exchange": "Вимкнути exchange"
|
||||
}
|
||||
|
|
|
@ -649,5 +649,6 @@
|
|||
"ignor": "忽视",
|
||||
"use_suggested": "使用建议",
|
||||
"do_not_share_warning_text" : "不要與其他任何人分享這些內容,包括支持。\n\n他們會偷你的錢!",
|
||||
"help": "帮助"
|
||||
"help": "帮助",
|
||||
"disable_exchange": "禁用交换"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue