ui: items rounding refactoring, external connections network content, exit modal title, update translations

This commit is contained in:
ardocrat
2023-08-05 22:39:42 +03:00
parent 4e42650160
commit 92c7ab62c2
16 changed files with 551 additions and 111 deletions
+23 -1
View File
@@ -63,6 +63,10 @@ impl ConnectionsConfig {
/// Save external connection for the wallet in app config.
pub fn add_external_connection(conn: ExternalConnection) {
// Do not update default connection.
if conn.url == ExternalConnection::DEFAULT_EXTERNAL_NODE_URL {
return;
}
let mut w_config = CONNECTIONS_STATE.write().unwrap();
let mut exists = false;
for mut c in w_config.external.iter_mut() {
@@ -75,7 +79,25 @@ impl ConnectionsConfig {
}
// Create new connection if URL not exists.
if !exists {
w_config.external.insert(0, conn);
w_config.external.push(conn);
}
w_config.save();
}
/// Save external connection for the wallet in app config.
pub fn update_external_connection(conn: ExternalConnection, updated: ExternalConnection) {
// Do not update default connection.
if conn.url == ExternalConnection::DEFAULT_EXTERNAL_NODE_URL {
return;
}
let mut w_config = CONNECTIONS_STATE.write().unwrap();
for mut c in w_config.external.iter_mut() {
// Update connection if URL exists.
if c.url == conn.url {
c.url = updated.url.clone();
c.secret = updated.secret.clone();
break;
}
}
w_config.save();
}
+1 -1
View File
@@ -25,7 +25,7 @@ pub struct ExternalConnection {
impl ExternalConnection {
/// Default external node URL.
const DEFAULT_EXTERNAL_NODE_URL: &'static str = "https://grinnnode.live:3413";
pub const DEFAULT_EXTERNAL_NODE_URL: &'static str = "https://grinnnode.live:3413";
pub fn new(url: String, secret: Option<String>) -> Self {
Self { url, secret }