Add toggle for disabling service bulletin (#1347)

* Add toggle for disabling service bulletin

* Make the toggle functional

* Fix + add toggle to Advanced Settings

* Remove unused variable

---------

Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
This commit is contained in:
tuxsudo 2024-03-25 14:28:45 -04:00 committed by GitHub
parent bca59ad5e4
commit 4520f583a6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
34 changed files with 78 additions and 2 deletions

View file

@ -20,6 +20,7 @@ class PreferencesKey {
static const isAppSecureKey = 'is_app_secure';
static const disableBuyKey = 'disable_buy';
static const disableSellKey = 'disable_sell';
static const disableBulletinKey = 'disable_bulletin';
static const defaultBuyProvider = 'default_buy_provider';
static const walletListOrder = 'wallet_list_order';
static const walletListAscending = 'wallet_list_ascending';

View file

@ -103,7 +103,16 @@ class _DashboardPageView extends BasePage {
Widget get endDrawer => MenuWidget(dashboardViewModel);
@override
Widget leading(BuildContext context) => ServicesUpdatesWidget(dashboardViewModel.getServicesStatus());
Widget leading(BuildContext context) {
return Observer(
builder: (context) {
if (dashboardViewModel.isEnabledBulletinAction) {
return ServicesUpdatesWidget(dashboardViewModel.getServicesStatus());
}
return const SizedBox();
},
);
}
@override
Widget middle(BuildContext context) {

View file

@ -100,6 +100,12 @@ class _AdvancedPrivacySettingsBodyState extends State<AdvancedPrivacySettingsBod
Observer(builder: (_) {
return Column(
children: [
SettingsSwitcherCell(
title: S.current.disable_bulletin,
value: widget.privacySettingsViewModel.disableBulletin,
onValueChange: (BuildContext _, bool value) {
widget.privacySettingsViewModel.setDisableBulletin(value);
}),
SettingsSwitcherCell(
title: S.current.add_custom_node,
value: widget.privacySettingsViewModel.addCustomNode,

View file

@ -80,6 +80,12 @@ class PrivacyPage extends BasePage {
onValueChange: (BuildContext _, bool value) {
_privacySettingsViewModel.setDisableSell(value);
}),
SettingsSwitcherCell(
title: S.current.disable_bulletin,
value: _privacySettingsViewModel.disableBulletin,
onValueChange: (BuildContext _, bool value) {
_privacySettingsViewModel.setDisableBulletin(value);
}),
if (_privacySettingsViewModel.canUseEtherscan)
SettingsSwitcherCell(
title: S.current.etherscan_history,

View file

@ -59,6 +59,7 @@ abstract class SettingsStoreBase with Store {
required bool initialAppSecure,
required bool initialDisableBuy,
required bool initialDisableSell,
required bool initialDisableBulletin,
required WalletListOrderType initialWalletListOrder,
required bool initialWalletListAscending,
required FiatApiMode initialFiatMode,
@ -130,6 +131,7 @@ abstract class SettingsStoreBase with Store {
isAppSecure = initialAppSecure,
disableBuy = initialDisableBuy,
disableSell = initialDisableSell,
disableBulletin = initialDisableBulletin,
walletListOrder = initialWalletListOrder,
walletListAscending = initialWalletListAscending,
shouldShowMarketPlaceInDashboard = initialShouldShowMarketPlaceInDashboard,
@ -291,6 +293,11 @@ abstract class SettingsStoreBase with Store {
(bool disableSell) =>
sharedPreferences.setBool(PreferencesKey.disableSellKey, disableSell));
reaction(
(_) => disableBulletin,
(bool disableBulletin) =>
sharedPreferences.setBool(PreferencesKey.disableBulletinKey, disableBulletin));
reaction(
(_) => walletListOrder,
(WalletListOrderType walletListOrder) =>
@ -553,6 +560,9 @@ abstract class SettingsStoreBase with Store {
@observable
bool disableSell;
@observable
bool disableBulletin;
@observable
WalletListOrderType walletListOrder;
@ -777,6 +787,7 @@ abstract class SettingsStoreBase with Store {
final isAppSecure = sharedPreferences.getBool(PreferencesKey.isAppSecureKey) ?? false;
final disableBuy = sharedPreferences.getBool(PreferencesKey.disableBuyKey) ?? false;
final disableSell = sharedPreferences.getBool(PreferencesKey.disableSellKey) ?? false;
final disableBulletin = sharedPreferences.getBool(PreferencesKey.disableBulletinKey) ?? false;
final walletListOrder =
WalletListOrderType.values[sharedPreferences.getInt(PreferencesKey.walletListOrder) ?? 0];
final walletListAscending =
@ -1029,6 +1040,7 @@ abstract class SettingsStoreBase with Store {
initialAppSecure: isAppSecure,
initialDisableBuy: disableBuy,
initialDisableSell: disableSell,
initialDisableBulletin: disableBulletin,
initialWalletListOrder: walletListOrder,
initialWalletListAscending: walletListAscending,
initialFiatMode: currentFiatApiMode,
@ -1147,6 +1159,7 @@ abstract class SettingsStoreBase with Store {
isAppSecure = sharedPreferences.getBool(PreferencesKey.isAppSecureKey) ?? isAppSecure;
disableBuy = sharedPreferences.getBool(PreferencesKey.disableBuyKey) ?? disableBuy;
disableSell = sharedPreferences.getBool(PreferencesKey.disableSellKey) ?? disableSell;
disableBulletin = sharedPreferences.getBool(PreferencesKey.disableBulletinKey) ?? disableBulletin;
walletListOrder =
WalletListOrderType.values[sharedPreferences.getInt(PreferencesKey.walletListOrder) ?? 0];
walletListAscending = sharedPreferences.getBool(PreferencesKey.walletListAscending) ?? true;

View file

@ -20,6 +20,9 @@ abstract class AdvancedPrivacySettingsViewModelBase with Store {
@computed
FiatApiMode get fiatApiMode => _settingsStore.fiatApiMode;
@computed
bool get disableBulletin => _settingsStore.disableBulletin;
@observable
bool _addCustomNode = false;
@ -64,6 +67,9 @@ abstract class AdvancedPrivacySettingsViewModelBase with Store {
@action
void setExchangeApiMode(ExchangeApiMode value) => _settingsStore.exchangeStatus = value;
@action
void setDisableBulletin(bool value) => _settingsStore.disableBulletin = value;
@action
void toggleAddCustomNode() => _addCustomNode = !_addCustomNode;

View file

@ -355,6 +355,9 @@ abstract class DashboardViewModelBase with Store {
@observable
bool hasSellAction;
@computed
bool get isEnabledBulletinAction => !settingsStore.disableBulletin;
ReactionDisposer? _onMoneroAccountChangeReaction;
ReactionDisposer? _onMoneroBalanceChangeReaction;

View file

@ -59,6 +59,9 @@ abstract class PrivacySettingsViewModelBase with Store {
@computed
bool get disableSell => _settingsStore.disableSell;
@computed
bool get disableBulletin => _settingsStore.disableBulletin;
@computed
bool get useEtherscan => _settingsStore.useEtherscan;
@ -106,6 +109,9 @@ abstract class PrivacySettingsViewModelBase with Store {
@action
void setDisableSell(bool value) => _settingsStore.disableSell = value;
@action
void setDisableBulletin(bool value) => _settingsStore.disableBulletin = value;
@action
void setLookupsTwitter(bool value) => _settingsStore.lookupsTwitter = value;

View file

@ -186,6 +186,7 @@
"digit_pin": "-رقم PIN",
"digital_and_physical_card": " بطاقة ائتمان رقمية ومادية مسبقة الدفع",
"disable": "إبطال",
"disable_bulletin": "تعطيل نشرة حالة الخدمة",
"disable_buy": "تعطيل إجراء الشراء",
"disable_cake_2fa": "تعطيل 2 عامل المصادقة",
"disable_exchange": "تعطيل التبادل",

View file

@ -186,6 +186,7 @@
"digit_pin": "-цифрен PIN",
"digital_and_physical_card": " дигитална или физическа предплатена дебитна карта",
"disable": "Деактивиране",
"disable_bulletin": "Деактивирайте бюлетина за състоянието на услугата",
"disable_buy": "Деактивирайте действието за покупка",
"disable_cake_2fa": "Деактивирайте Cake 2FA",
"disable_exchange": "Деактивиране на борса",

View file

@ -186,6 +186,7 @@
"digit_pin": "-číselný PIN",
"digital_and_physical_card": " digitální a fyzické předplacené debetní karty,",
"disable": "Zakázat",
"disable_bulletin": "Zakázat status servisního stavu",
"disable_buy": "Zakázat akci nákupu",
"disable_cake_2fa": "Zakázat Cake 2FA",
"disable_exchange": "Zakázat směnárny",

View file

@ -186,6 +186,7 @@
"digit_pin": "-stellige PIN",
"digital_and_physical_card": "digitale und physische Prepaid-Debitkarte",
"disable": "Deaktivieren",
"disable_bulletin": "Deaktivieren Sie das Bulletin des Service Status",
"disable_buy": "Kaufaktion deaktivieren",
"disable_cake_2fa": "Cake 2FA deaktivieren",
"disable_exchange": "Exchange deaktivieren",
@ -411,8 +412,8 @@
"placeholder_transactions": "Ihre Transaktionen werden hier angezeigt",
"please_fill_totp": "Bitte geben Sie den 8-stelligen Code ein, der auf Ihrem anderen Gerät vorhanden ist",
"please_make_selection": "Bitte treffen Sie unten eine Auswahl zum Erstellen oder Wiederherstellen Ihrer Wallet.",
"Please_reference_document": "Weitere Informationen finden Sie in den Dokumenten unten.",
"please_reference_document": "Bitte verweisen Sie auf die folgenden Dokumente, um weitere Informationen zu erhalten.",
"Please_reference_document": "Weitere Informationen finden Sie in den Dokumenten unten.",
"please_select": "Bitte auswählen:",
"please_select_backup_file": "Bitte wählen Sie die Sicherungsdatei und geben Sie das Sicherungskennwort ein.",
"please_try_to_connect_to_another_node": "Bitte versuchen Sie, sich mit einem anderen Knoten zu verbinden",

View file

@ -186,6 +186,7 @@
"digit_pin": "-digit PIN",
"digital_and_physical_card": " digital and physical prepaid debit card",
"disable": "Disable",
"disable_bulletin": "Disable service status bulletin",
"disable_buy": "Disable buy action",
"disable_cake_2fa": "Disable Cake 2FA",
"disable_exchange": "Disable exchange",

View file

@ -186,6 +186,7 @@
"digit_pin": "-dígito PIN",
"digital_and_physical_card": " tarjeta de débito prepago digital y física",
"disable": "Desactivar",
"disable_bulletin": "Desactivar el boletín de estado del servicio",
"disable_buy": "Desactivar acción de compra",
"disable_cake_2fa": "Desactivar pastel 2FA",
"disable_exchange": "Deshabilitar intercambio",

View file

@ -186,6 +186,7 @@
"digit_pin": " chiffres",
"digital_and_physical_card": "carte de débit prépayée numérique et physique",
"disable": "Désactiver",
"disable_bulletin": "Désactiver le bulletin de statut de service",
"disable_buy": "Désactiver l'action d'achat",
"disable_cake_2fa": "Désactiver Cake 2FA",
"disable_exchange": "Désactiver l'échange",

View file

@ -186,6 +186,7 @@
"digit_pin": "-lambar PIN",
"digital_and_physical_card": "katin zare kudi na dijital da na zahiri",
"disable": "Kashe",
"disable_bulletin": "Musaki ma'aunin sabis na sabis",
"disable_buy": "Kashe alama",
"disable_cake_2fa": "Musaki Cake 2FA",
"disable_exchange": "Kashe musanya",

View file

@ -186,6 +186,7 @@
"digit_pin": "-अंक पिन",
"digital_and_physical_card": "डिजिटल और भौतिक प्रीपेड डेबिट कार्ड",
"disable": "अक्षम करना",
"disable_bulletin": "सेवा स्थिति बुलेटिन अक्षम करें",
"disable_buy": "खरीद कार्रवाई अक्षम करें",
"disable_cake_2fa": "केक 2FA अक्षम करें",
"disable_exchange": "एक्सचेंज अक्षम करें",

View file

@ -186,6 +186,7 @@
"digit_pin": "-znamenkasti PIN",
"digital_and_physical_card": "digitalna i fizička unaprijed plaćena debitna kartica",
"disable": "Onemogući",
"disable_bulletin": "Onemogućite bilten o statusu usluge",
"disable_buy": "Onemogući kupnju",
"disable_cake_2fa": "Onemogući Cake 2FA",
"disable_exchange": "Onemogući exchange",

View file

@ -186,6 +186,7 @@
"digit_pin": "-digit PIN",
"digital_and_physical_card": " kartu debit pra-bayar digital dan fisik",
"disable": "Cacat",
"disable_bulletin": "Nonaktifkan Buletin Status Layanan",
"disable_buy": "Nonaktifkan tindakan beli",
"disable_cake_2fa": "Nonaktifkan Kue 2FA",
"disable_exchange": "Nonaktifkan pertukaran",

View file

@ -187,6 +187,7 @@
"digit_pin": "-cifre PIN",
"digital_and_physical_card": "carta di debito prepagata digitale e fisica",
"disable": "disattivare",
"disable_bulletin": "Disabilita Bollettino dello stato del servizio",
"disable_buy": "Disabilita l'azione di acquisto",
"disable_cake_2fa": "Disabilita Cake 2FA",
"disable_exchange": "Disabilita scambio",

View file

@ -186,6 +186,7 @@
"digit_pin": "桁ピン",
"digital_and_physical_card": "デジタルおよび物理プリペイドデビットカード",
"disable": "無効にする",
"disable_bulletin": "サービスステータス速報を無効にします",
"disable_buy": "購入アクションを無効にする",
"disable_cake_2fa": "Cake 2FA を無効にする",
"disable_exchange": "交換を無効にする",

View file

@ -186,6 +186,7 @@
"digit_pin": "숫자 PIN",
"digital_and_physical_card": " 디지털 및 실제 선불 직불 카드",
"disable": "장애를 입히다",
"disable_bulletin": "서비스 상태 게시판을 비활성화합니다",
"disable_buy": "구매 행동 비활성화",
"disable_cake_2fa": "케이크 2FA 비활성화",
"disable_exchange": "교환 비활성화",

View file

@ -186,6 +186,7 @@
"digit_pin": "-ဂဏန်း PIN",
"digital_and_physical_card": " ဒစ်ဂျစ်တယ်နှင့် ရုပ်ပိုင်းဆိုင်ရာ ကြိုတင်ငွေပေးချေသော ဒက်ဘစ်ကတ်",
"disable": "ပိတ်ပါ။",
"disable_bulletin": "ဝန်ဆောင်မှုအခြေအနေစာစောင်ကိုပိတ်ပါ",
"disable_buy": "ဝယ်ယူမှု လုပ်ဆောင်ချက်ကို ပိတ်ပါ။",
"disable_cake_2fa": "ကိတ်မုန့် 2FA ကို ပိတ်ပါ။",
"disable_exchange": "လဲလှယ်မှုကို ပိတ်ပါ။",

View file

@ -186,6 +186,7 @@
"digit_pin": "-cijferige PIN",
"digital_and_physical_card": "digitale en fysieke prepaid debetkaart",
"disable": "Uitzetten",
"disable_bulletin": "Schakel servicestatus Bulletin uit",
"disable_buy": "Koopactie uitschakelen",
"disable_cake_2fa": "Taart 2FA uitschakelen",
"disable_exchange": "Uitwisseling uitschakelen",

View file

@ -186,6 +186,7 @@
"digit_pin": "-znakowy PIN",
"digital_and_physical_card": " cyfrowa i fizyczna przedpłacona karta debetowa",
"disable": "Wyłączyć",
"disable_bulletin": "Wyłącz biuletyn statusu usługi",
"disable_buy": "Wyłącz akcję kupna",
"disable_cake_2fa": "Wyłącz Cake 2FA",
"disable_exchange": "Wyłącz wymianę",

View file

@ -186,6 +186,7 @@
"digit_pin": "dígitos",
"digital_and_physical_card": "cartão de débito pré-pago digital e físico",
"disable": "Desativar",
"disable_bulletin": "Desativar boletim de status de serviço",
"disable_buy": "Desativar ação de compra",
"disable_cake_2fa": "Desabilitar o Cake 2FA",
"disable_exchange": "Desativar troca",

View file

@ -186,6 +186,7 @@
"digit_pin": "-значный PIN",
"digital_and_physical_card": "цифровая и физическая предоплаченная дебетовая карта",
"disable": "Запрещать",
"disable_bulletin": "Отключить бюллетень статуса обслуживания",
"disable_buy": "Отключить действие покупки",
"disable_cake_2fa": "Отключить торт 2FA",
"disable_exchange": "Отключить обмен",

View file

@ -186,6 +186,7 @@
"digit_pin": "-หลัก PIN",
"digital_and_physical_card": "บัตรเดบิตดิจิตอลและบัตรพื้นฐาน",
"disable": "ปิดการใช้งาน",
"disable_bulletin": "ปิดการใช้งาน Bulletin สถานะบริการ",
"disable_buy": "ปิดการใช้งานการซื้อ",
"disable_cake_2fa": "ปิดการใช้งานเค้ก 2FA",
"disable_exchange": "ปิดใช้งานการแลกเปลี่ยน",

View file

@ -186,6 +186,7 @@
"digit_pin": "-digit pin",
"digital_and_physical_card": "Digital at Physical Prepaid Debit Card",
"disable": "Huwag paganahin",
"disable_bulletin": "Huwag paganahin ang Bulletin ng Katayuan ng Serbisyo",
"disable_buy": "Huwag paganahin ang pagkilos ng pagbili",
"disable_cake_2fa": "Huwag paganahin ang cake 2FA",
"disable_exchange": "Huwag paganahin ang palitan",

View file

@ -186,6 +186,7 @@
"digit_pin": " haneli PIN",
"digital_and_physical_card": " Dijital para birimleri ile para yükleyebileceğiniz ve ek bilgiye gerek olmayan",
"disable": "Devre dışı bırakmak",
"disable_bulletin": "Hizmet Durumu Bültenini Devre Dışı Bırak",
"disable_buy": "Satın alma işlemini devre dışı bırak",
"disable_cake_2fa": "Cake 2FA'yı Devre Dışı Bırak",
"disable_exchange": "Borsayı devre dışı bırak",

View file

@ -186,6 +186,7 @@
"digit_pin": "-значний PIN",
"digital_and_physical_card": " цифрова та фізична передплачена дебетова картка",
"disable": "Вимкнути",
"disable_bulletin": "Вимкнути статус послуги",
"disable_buy": "Вимкнути дію покупки",
"disable_cake_2fa": "Вимкнути Cake 2FA",
"disable_exchange": "Вимкнути exchange",

View file

@ -186,6 +186,7 @@
"digit_pin": "-ہندسوں کا پن",
"digital_and_physical_card": " ڈیجیٹل اور فزیکل پری پیڈ ڈیبٹ کارڈ",
"disable": "غیر فعال کریں۔",
"disable_bulletin": "خدمت کی حیثیت کا بلیٹن کو غیر فعال کریں",
"disable_buy": "خرید ایکشن کو غیر فعال کریں۔",
"disable_cake_2fa": "کیک 2FA کو غیر فعال کریں۔",
"disable_exchange": "تبادلے کو غیر فعال کریں۔",

View file

@ -186,6 +186,7 @@
"digit_pin": "-díjíìtì òǹkà ìdánimọ̀ àdáni",
"digital_and_physical_card": " káàdì ìrajà t'ara àti ti ayélujára",
"disable": "Ko si",
"disable_bulletin": "Mu blogti ipo ipo ṣiṣẹ",
"disable_buy": "Ko iṣọrọ ọja",
"disable_cake_2fa": "Ko 2FA Cake sii",
"disable_exchange": "Pa ilé pàṣípààrọ̀",

View file

@ -186,6 +186,7 @@
"digit_pin": "位 PIN",
"digital_and_physical_card": "数字和物理预付借记卡",
"disable": "停用",
"disable_bulletin": "禁用服务状态公告",
"disable_buy": "禁用购买操作",
"disable_cake_2fa": "禁用蛋糕 2FA",
"disable_exchange": "禁用交换",