mirror of
https://github.com/jwinterm/grim.git
synced 2026-10-28 01:18:34 +01:00
ui: items rounding refactoring, external connections network content, exit modal title, update translations
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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 }
|
||||
|
||||
Reference in New Issue
Block a user