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

View file

@ -174,7 +174,22 @@ class NodeCreateOrEditPage extends BasePage {
caption: S.of(context).use_ssl, 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) NodeCreateOrEditViewModelBase(this._nodeSource, this._wallet)
: state = InitialExecutionState(), : state = InitialExecutionState(),
connectionState = InitialExecutionState(), connectionState = InitialExecutionState(),
useSSL = false; useSSL = false,
trusted = false;
@observable @observable
ExecutionState state; ExecutionState state;
@ -37,6 +38,9 @@ abstract class NodeCreateOrEditViewModelBase with Store {
@observable @observable
bool useSSL; bool useSSL;
@observable
bool trusted;
@computed @computed
bool get isReady => bool get isReady =>
(address?.isNotEmpty ?? false) && (port?.isNotEmpty ?? false); (address?.isNotEmpty ?? false) && (port?.isNotEmpty ?? false);
@ -64,6 +68,7 @@ abstract class NodeCreateOrEditViewModelBase with Store {
login = ''; login = '';
password = ''; password = '';
useSSL = false; useSSL = false;
trusted = false;
} }
@action @action
@ -72,7 +77,7 @@ abstract class NodeCreateOrEditViewModelBase with Store {
state = IsExecutingState(); state = IsExecutingState();
final node = final node =
Node(uri: uri, type: _wallet.type, login: login, password: password, Node(uri: uri, type: _wallet.type, login: login, password: password,
useSSL: useSSL); useSSL: useSSL, trusted: trusted);
await _nodeSource.add(node); await _nodeSource.add(node);
state = ExecutedSuccessfullyState(); state = ExecutedSuccessfullyState();
} catch (e) { } catch (e) {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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