Allow marking Monero Nodes as trusted

This commit is contained in:
OmarHatem 2022-10-04 14:54:39 +02:00
parent 40e4f7de1f
commit d748f12e44
18 changed files with 47 additions and 6 deletions

View file

@ -20,7 +20,8 @@ class Node extends HiveObject with Keyable {
@required WalletType type,
this.login,
this.password,
this.useSSL}) {
this.useSSL,
this.trusted}) {
uriRaw = uri;
this.type = type;
}
@ -30,7 +31,8 @@ class Node extends HiveObject with Keyable {
login = map['login'] as String,
password = map['password'] as String,
typeRaw = map['typeRaw'] as int,
useSSL = map['useSSL'] as bool;
useSSL = map['useSSL'] as bool,
trusted = map['trusted'] as bool ?? false;
static const typeId = 1;
static const boxName = 'Nodes';
@ -50,8 +52,13 @@ class Node extends HiveObject with Keyable {
@HiveField(4)
bool useSSL;
@HiveField(5)
bool trusted;
bool get isSSL => useSSL ?? false;
bool get isTrusted => trusted ?? false;
Uri get uri {
switch (type) {
case WalletType.monero:

View file

@ -174,7 +174,22 @@ class NodeCreateOrEditPage extends BasePage {
caption: S.of(context).use_ssl,
))
],
))
)),
Padding(
padding: EdgeInsets.only(top: 20),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: [
Observer(
builder: (_) => StandardCheckbox(
value: nodeCreateOrEditViewModel.trusted,
onChanged: (value) =>
nodeCreateOrEditViewModel.trusted = value,
caption: S.of(context).trusted,
))
],
)),
]
],
)),

View file

@ -14,7 +14,8 @@ abstract class NodeCreateOrEditViewModelBase with Store {
NodeCreateOrEditViewModelBase(this._nodeSource, this._wallet)
: state = InitialExecutionState(),
connectionState = InitialExecutionState(),
useSSL = false;
useSSL = false,
trusted = false;
@observable
ExecutionState state;
@ -37,6 +38,9 @@ abstract class NodeCreateOrEditViewModelBase with Store {
@observable
bool useSSL;
@observable
bool trusted;
@computed
bool get isReady =>
(address?.isNotEmpty ?? false) && (port?.isNotEmpty ?? false);
@ -64,6 +68,7 @@ abstract class NodeCreateOrEditViewModelBase with Store {
login = '';
password = '';
useSSL = false;
trusted = false;
}
@action
@ -72,7 +77,7 @@ abstract class NodeCreateOrEditViewModelBase with Store {
state = IsExecutingState();
final node =
Node(uri: uri, type: _wallet.type, login: login, password: password,
useSSL: useSSL);
useSSL: useSSL, trusted: trusted);
await _nodeSource.add(node);
state = ExecutedSuccessfullyState();
} catch (e) {

View file

@ -436,6 +436,7 @@
"provider_error" : "${provider}-Fehler",
"use_ssl" : "SSL verwenden",
"trusted" : "Vertrauenswürdige",
"color_theme" : "Farbthema",
"light_theme" : "Hell",

View file

@ -436,6 +436,7 @@
"provider_error" : "${provider} error",
"use_ssl" : "Use SSL",
"trusted" : "Trusted",
"color_theme" : "Color theme",
"light_theme" : "Light",

View file

@ -436,6 +436,7 @@
"provider_error" : "${provider} error",
"use_ssl" : "Utilice SSL",
"trusted" : "de confianza",
"color_theme" : "Tema de color",
"light_theme" : "Ligera",

View file

@ -434,6 +434,7 @@
"provider_error" : "Erreur de ${provider}",
"use_ssl" : "Utiliser SSL",
"trusted" : "de confiance",
"color_theme" : "Thème",
"light_theme" : "Clair",

View file

@ -436,6 +436,7 @@
"provider_error" : "${provider} त्रुटि",
"use_ssl" : "उपयोग SSL",
"trusted" : "भरोसा",
"color_theme" : "रंग विषय",
"light_theme" : "रोशनी",

View file

@ -436,6 +436,7 @@
"provider_error" : "${provider} greška",
"use_ssl" : "Koristi SSL",
"trusted" : "vjerovao",
"color_theme" : "Shema boja",
"light_theme" : "Svijetla",

View file

@ -436,6 +436,7 @@
"provider_error" : "${provider} errore",
"use_ssl" : "Usa SSL",
"trusted" : "di fiducia",
"color_theme" : "Colore tema",
"light_theme" : "Bianco",

View file

@ -436,6 +436,7 @@
"provider_error" : "${provider} エラー",
"use_ssl" : "SSLを使用する",
"trusted" : "信頼できる",
"color_theme" : "カラーテーマ",
"light_theme" : "光",

View file

@ -436,6 +436,7 @@
"provider_error" : "${provider} 오류",
"use_ssl" : "SSL 사용",
"trusted" : "신뢰할 수 있는",
"color_theme" : "색상 테마",
"light_theme" : "빛",

View file

@ -436,6 +436,7 @@
"provider_error" : "${provider} fout",
"use_ssl" : "Gebruik SSL",
"trusted" : "vertrouwd",
"color_theme" : "Kleur thema",
"light_theme" : "Licht",

View file

@ -436,6 +436,7 @@
"provider_error" : "${provider} pomyłka",
"use_ssl" : "Użyj SSL",
"trusted" : "zaufany",
"color_theme" : "Motyw kolorystyczny",
"light_theme" : "Lekki",

View file

@ -436,6 +436,7 @@
"provider_error" : "${provider} erro",
"use_ssl" : "Use SSL",
"trusted" : "confiável",
"color_theme" : "Tema de cor",
"light_theme" : "Luz",
@ -544,7 +545,6 @@
"create_account": "Criar conta",
"privacy_policy": "Política de privacidade",
"welcome_to_cakepay": "Bem-vindo ao Cake Pay!",
"create_account": "Registar-se",
"forgot_password": "Esqueci a senha",
"reset_password": "Redefinir senha",
"gift_cards": "Cartões de presente",

View file

@ -436,6 +436,7 @@
"provider_error" : "${provider} ошибка",
"use_ssl" : "Использовать SSL",
"trusted" : "доверенный",
"color_theme" : "Цветовая тема",
"light_theme" : "Светлая",

View file

@ -435,6 +435,7 @@
"provider_error" : "${provider} помилка",
"use_ssl" : "Використати SSL",
"trusted" : "довіряють",
"color_theme" : "Кольорова тема",
"light_theme" : "Світла",

View file

@ -435,6 +435,7 @@
"provider_error" : "${provider} 错误",
"use_ssl" : "使用SSL",
"trusted" : "值得信赖",
"color_theme" : "主题",
"light_theme" : "艳丽",