refactor(nc-mobile): adjust ui
This commit is contained in:
Generated
+23
-188
@@ -73,15 +73,6 @@ dependencies = [
|
||||
"alloc-no-stdlib",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "android_system_properties"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.69"
|
||||
@@ -512,21 +503,6 @@ dependencies = [
|
||||
"keystream",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "chrono"
|
||||
version = "0.4.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f"
|
||||
dependencies = [
|
||||
"iana-time-zone",
|
||||
"js-sys",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
"time 0.1.45",
|
||||
"wasm-bindgen",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cipher"
|
||||
version = "0.3.0"
|
||||
@@ -628,7 +604,7 @@ dependencies = [
|
||||
"sqlx 0.6.2",
|
||||
"tap",
|
||||
"thiserror",
|
||||
"time 0.3.19",
|
||||
"time",
|
||||
"tokio",
|
||||
"tokio-stream",
|
||||
"tokio-tungstenite",
|
||||
@@ -672,16 +648,6 @@ dependencies = [
|
||||
"objc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "codespan-reporting"
|
||||
version = "0.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e"
|
||||
dependencies = [
|
||||
"termcolor",
|
||||
"unicode-width",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "color_quant"
|
||||
version = "1.1.0"
|
||||
@@ -1133,50 +1099,6 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cxx"
|
||||
version = "1.0.91"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "86d3488e7665a7a483b57e25bdd90d0aeb2bc7608c8d0346acf2ad3f1caf1d62"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"cxxbridge-flags",
|
||||
"cxxbridge-macro",
|
||||
"link-cplusplus",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cxx-build"
|
||||
version = "1.0.91"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "48fcaf066a053a41a81dfb14d57d99738b767febb8b735c3016e469fac5da690"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"codespan-reporting",
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"scratch",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cxxbridge-flags"
|
||||
version = "1.0.91"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2ef98b8b717a829ca5603af80e1f9e2e48013ab227b68ef37872ef84ee479bf"
|
||||
|
||||
[[package]]
|
||||
name = "cxxbridge-macro"
|
||||
version = "1.0.91"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "086c685979a698443656e5cf7856c95c642295a38599f12fb1ff76fb28d19892"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling"
|
||||
version = "0.13.4"
|
||||
@@ -2542,30 +2464,6 @@ dependencies = [
|
||||
"tokio-native-tls",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iana-time-zone"
|
||||
version = "0.1.53"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765"
|
||||
dependencies = [
|
||||
"android_system_properties",
|
||||
"core-foundation-sys",
|
||||
"iana-time-zone-haiku",
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iana-time-zone-haiku"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca"
|
||||
dependencies = [
|
||||
"cxx",
|
||||
"cxx-build",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ico"
|
||||
version = "0.2.0"
|
||||
@@ -2848,30 +2746,6 @@ version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
|
||||
[[package]]
|
||||
name = "libappindicator"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "89e1edfdc9b0853358306c6dfb4b77c79c779174256fe93d80c0b5ebca451a2f"
|
||||
dependencies = [
|
||||
"glib",
|
||||
"gtk",
|
||||
"gtk-sys",
|
||||
"libappindicator-sys",
|
||||
"log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libappindicator-sys"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "08fcb2bea89cee9613982501ec83eaa2d09256b24540ae463c52a28906163918"
|
||||
dependencies = [
|
||||
"gtk-sys",
|
||||
"libloading",
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.139"
|
||||
@@ -2899,16 +2773,6 @@ dependencies = [
|
||||
"pkg-config",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libloading"
|
||||
version = "0.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libm"
|
||||
version = "0.2.6"
|
||||
@@ -2947,15 +2811,6 @@ dependencies = [
|
||||
"safemem",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "link-cplusplus"
|
||||
version = "1.0.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5"
|
||||
dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "linked-hash-map"
|
||||
version = "0.5.6"
|
||||
@@ -3031,7 +2886,7 @@ dependencies = [
|
||||
"dirs-next",
|
||||
"objc-foundation",
|
||||
"objc_id",
|
||||
"time 0.3.19",
|
||||
"time",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3300,6 +3155,15 @@ dependencies = [
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num_threads"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nym-api-requests"
|
||||
version = "0.1.0"
|
||||
@@ -3376,11 +3240,10 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nym-connect"
|
||||
version = "1.1.9"
|
||||
version = "1.1.12"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bip39",
|
||||
"chrono",
|
||||
"client-core",
|
||||
"dirs",
|
||||
"eyre",
|
||||
@@ -3409,6 +3272,7 @@ dependencies = [
|
||||
"tempfile",
|
||||
"tendermint-rpc",
|
||||
"thiserror",
|
||||
"time",
|
||||
"tokio",
|
||||
"ts-rs",
|
||||
"url",
|
||||
@@ -3521,10 +3385,10 @@ dependencies = [
|
||||
"nym-contracts-common",
|
||||
"schemars",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde-json-wasm",
|
||||
"serde_repr",
|
||||
"thiserror",
|
||||
"time 0.3.19",
|
||||
"time",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4352,7 +4216,7 @@ dependencies = [
|
||||
"line-wrap",
|
||||
"quick-xml 0.26.0",
|
||||
"serde",
|
||||
"time 0.3.19",
|
||||
"time",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4955,12 +4819,6 @@ version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
||||
|
||||
[[package]]
|
||||
name = "scratch"
|
||||
version = "1.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2"
|
||||
|
||||
[[package]]
|
||||
name = "sct"
|
||||
version = "0.6.1"
|
||||
@@ -5753,7 +5611,6 @@ dependencies = [
|
||||
"core-foundation",
|
||||
"core-graphics",
|
||||
"crossbeam-channel",
|
||||
"dirs-next",
|
||||
"dispatch",
|
||||
"gdk",
|
||||
"gdk-pixbuf",
|
||||
@@ -5767,7 +5624,6 @@ dependencies = [
|
||||
"instant",
|
||||
"jni",
|
||||
"lazy_static",
|
||||
"libappindicator",
|
||||
"libc",
|
||||
"log",
|
||||
"ndk",
|
||||
@@ -5906,7 +5762,7 @@ dependencies = [
|
||||
"sha2 0.10.6",
|
||||
"tauri-utils",
|
||||
"thiserror",
|
||||
"time 0.3.19",
|
||||
"time",
|
||||
"url",
|
||||
"uuid 1.3.0",
|
||||
"walkdir",
|
||||
@@ -6046,7 +5902,7 @@ dependencies = [
|
||||
"subtle 2.4.1",
|
||||
"subtle-encoding",
|
||||
"tendermint-proto",
|
||||
"time 0.3.19",
|
||||
"time",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
@@ -6079,7 +5935,7 @@ dependencies = [
|
||||
"serde",
|
||||
"serde_bytes",
|
||||
"subtle-encoding",
|
||||
"time 0.3.19",
|
||||
"time",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -6107,7 +5963,7 @@ dependencies = [
|
||||
"tendermint-config",
|
||||
"tendermint-proto",
|
||||
"thiserror",
|
||||
"time 0.3.19",
|
||||
"time",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"url",
|
||||
@@ -6171,17 +6027,6 @@ dependencies = [
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.1.45"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"wasi 0.10.0+wasi-snapshot-preview1",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.3.19"
|
||||
@@ -6190,6 +6035,8 @@ checksum = "53250a3b3fed8ff8fd988587d8925d26a83ac3845d9e03b220b37f34c2b8d6c2"
|
||||
dependencies = [
|
||||
"itoa 1.0.5",
|
||||
"js-sys",
|
||||
"libc",
|
||||
"num_threads",
|
||||
"serde",
|
||||
"time-core",
|
||||
"time-macros",
|
||||
@@ -6542,12 +6389,6 @@ version = "1.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-width"
|
||||
version = "0.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.2.4"
|
||||
@@ -6671,7 +6512,7 @@ dependencies = [
|
||||
"rustc_version 0.4.0",
|
||||
"rustversion",
|
||||
"thiserror",
|
||||
"time 0.3.19",
|
||||
"time",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -6734,12 +6575,6 @@ version = "0.9.0+wasi-snapshot-preview1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.10.0+wasi-snapshot-preview1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.11.0+wasi-snapshot-preview1"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "nym-connect"
|
||||
version = "1.1.9"
|
||||
description = "nym-connect for Mobile"
|
||||
version = "1.1.12"
|
||||
description = "nym-connect mobile"
|
||||
authors = ["Nym Technologies SA"]
|
||||
license = ""
|
||||
repository = ""
|
||||
@@ -26,7 +26,6 @@ tauri-mobile = { git = "https://github.com/tauri-apps/tauri-mobile", branch = "
|
||||
[dependencies]
|
||||
anyhow = "1.0"
|
||||
bip39 = { version = "2.0.0", features = ["zeroize"] }
|
||||
chrono = "0.4"
|
||||
dirs = "4.0"
|
||||
eyre = "0.6.5"
|
||||
fix-path-env = { git = "https://github.com/tauri-apps/fix-path-env-rs", branch = "release"}
|
||||
@@ -42,10 +41,11 @@ serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
serde_repr = "0.1"
|
||||
tap = "1.0.1"
|
||||
# tauri = { git = "https://github.com/tauri-apps/tauri", branch = "next", features = ["clipboard-write-text", "native-tls-vendored", "notification-all", "shell-open", "system-tray", "window-close", "window-minimize", "window-start-dragging"] }
|
||||
tauri = { version = "2.0.0-alpha.3", features = ["clipboard-write-text", "native-tls-vendored", "notification-all", "shell-open", "system-tray", "window-close", "window-minimize", "window-start-dragging"] }
|
||||
# tauri = { git = "https://github.com/tauri-apps/tauri", branch = "next", features = ["clipboard-write-text", "native-tls-vendored", "notification-all", "shell-open"] }
|
||||
tauri = { version = "2.0.0-alpha.3", features = ["clipboard-write-text", "native-tls-vendored", "notification-all", "shell-open"] }
|
||||
tendermint-rpc = "0.23.0"
|
||||
thiserror = "1.0"
|
||||
time = { version = "0.3.17", features = ["local-offset"] }
|
||||
tokio = { version = "1.24.1", features = ["sync", "time"] }
|
||||
url = "2.2"
|
||||
yaml-rust = "0.4"
|
||||
|
||||
@@ -16,11 +16,6 @@ pub mod operations;
|
||||
mod state;
|
||||
mod tasks;
|
||||
|
||||
#[cfg(desktop)]
|
||||
mod menu;
|
||||
#[cfg(desktop)]
|
||||
mod window;
|
||||
|
||||
pub use state::State;
|
||||
|
||||
#[cfg(mobile)]
|
||||
|
||||
@@ -1,9 +1,26 @@
|
||||
use std::str::FromStr;
|
||||
|
||||
use fern::colors::{Color, ColoredLevelConfig};
|
||||
use serde::Serialize;
|
||||
use serde_repr::{Deserialize_repr, Serialize_repr};
|
||||
use std::str::FromStr;
|
||||
use tauri::Manager;
|
||||
use time::{format_description, OffsetDateTime};
|
||||
|
||||
fn formatted_time() -> String {
|
||||
// if we fail to obtain local time according to local offset, fallback to utc
|
||||
let _now = OffsetDateTime::now_local().unwrap_or_else(|_| OffsetDateTime::now_utc());
|
||||
|
||||
// if we're running it in the unit test, use the hardcoded value
|
||||
#[cfg(test)]
|
||||
let _now = OffsetDateTime::from_unix_timestamp(1666666666).unwrap();
|
||||
|
||||
// the unwraps are fine as we know this description is correct
|
||||
// note: the reason for this very particular format is a very simple one
|
||||
// it's what we've always been using since we copied it from the example,
|
||||
// so feel free to update it to whatever
|
||||
let format =
|
||||
format_description::parse("[[[year]-[month]-[day]][[[hour]:[minute]:[second]]").unwrap();
|
||||
_now.format(&format).unwrap()
|
||||
}
|
||||
|
||||
pub fn setup_logging(app_handle: tauri::AppHandle) -> Result<(), log::SetLoggerError> {
|
||||
let colors = ColoredLevelConfig::new()
|
||||
@@ -21,7 +38,7 @@ pub fn setup_logging(app_handle: tauri::AppHandle) -> Result<(), log::SetLoggerE
|
||||
.format(move |out, message, record| {
|
||||
out.finish(format_args!(
|
||||
"{}[{}][{}] {}",
|
||||
chrono::Local::now().format("[%Y-%m-%d][%H:%M:%S]"),
|
||||
formatted_time(),
|
||||
record.target(),
|
||||
colors.color(record.level()),
|
||||
message,
|
||||
@@ -33,7 +50,7 @@ pub fn setup_logging(app_handle: tauri::AppHandle) -> Result<(), log::SetLoggerE
|
||||
.format(move |out, message, record| {
|
||||
out.finish(format_args!(
|
||||
"{}[{}] {}",
|
||||
chrono::Local::now().format("[%Y-%m-%d][%H:%M:%S]"),
|
||||
formatted_time(),
|
||||
record.target(),
|
||||
message,
|
||||
))
|
||||
@@ -116,3 +133,15 @@ impl From<log::Level> for LogLevel {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn log_formatting() {
|
||||
let expected_chrono_formated = "[2022-10-25][02:57:46]".to_string();
|
||||
let new_time_based = formatted_time();
|
||||
assert_eq!(new_time_based, expected_chrono_formated)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,11 +6,5 @@
|
||||
use nym_connect::AppBuilder;
|
||||
|
||||
fn main() {
|
||||
// As per breaking change description here
|
||||
// https://github.com/tauri-apps/tauri/blob/feac1d193c6d618e49916ad0707201f43d5cdd36/tooling/bundler/CHANGELOG.md
|
||||
//if let Err(error) = fix_path_env::fix() {
|
||||
// log::warn!("Failed to fix PATH: {error}");
|
||||
//}
|
||||
|
||||
AppBuilder::new().run();
|
||||
}
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
use tauri::{
|
||||
AppHandle, CustomMenuItem, Menu, Submenu, SystemTray, SystemTrayEvent, SystemTrayMenu,
|
||||
SystemTrayMenuItem, Wry,
|
||||
};
|
||||
|
||||
use crate::window::window_toggle;
|
||||
|
||||
pub const SHOW_LOG_WINDOW: &str = "show_log_window";
|
||||
pub const CLEAR_STORAGE: &str = "clear_storage";
|
||||
|
||||
pub trait AddDefaultSubmenus {
|
||||
fn add_default_app_submenus(self) -> Self;
|
||||
}
|
||||
|
||||
impl AddDefaultSubmenus for Menu {
|
||||
fn add_default_app_submenus(self) -> Self {
|
||||
let submenu = Submenu::new(
|
||||
"Help",
|
||||
Menu::new().add_item(CustomMenuItem::new(SHOW_LOG_WINDOW, "Show logs")),
|
||||
);
|
||||
self.add_submenu(submenu)
|
||||
}
|
||||
}
|
||||
|
||||
pub const TRAY_MENU_QUIT: &str = "quit";
|
||||
pub const TRAY_MENU_SHOW_HIDE: &str = "show-hide";
|
||||
pub const TRAY_MENU_CONNECTION: &str = "connection";
|
||||
|
||||
pub(crate) fn create_tray_menu() -> SystemTray {
|
||||
let quit = CustomMenuItem::new(TRAY_MENU_QUIT, "Quit");
|
||||
let hide = CustomMenuItem::new(TRAY_MENU_SHOW_HIDE, "Hide");
|
||||
let connection = CustomMenuItem::new(TRAY_MENU_CONNECTION, "Connect");
|
||||
let tray_menu = SystemTrayMenu::new()
|
||||
.add_item(hide)
|
||||
.add_item(connection)
|
||||
.add_native_item(SystemTrayMenuItem::Separator)
|
||||
.add_item(quit);
|
||||
|
||||
SystemTray::new().with_menu(tray_menu)
|
||||
}
|
||||
|
||||
pub(crate) fn tray_menu_event_handler(app: &AppHandle<Wry>, event: SystemTrayEvent) {
|
||||
match event {
|
||||
SystemTrayEvent::LeftClick { position, size, .. } => {
|
||||
println!("Event {position:?} {size:?}");
|
||||
}
|
||||
SystemTrayEvent::MenuItemClick { id, .. } => {
|
||||
println!("Event {id}");
|
||||
match id.as_str() {
|
||||
TRAY_MENU_SHOW_HIDE => {
|
||||
window_toggle(app);
|
||||
}
|
||||
TRAY_MENU_QUIT => {
|
||||
// TODO: add disconnecting first
|
||||
app.exit(0);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
use crate::menu::TRAY_MENU_SHOW_HIDE;
|
||||
use tauri::{AppHandle, Manager};
|
||||
|
||||
pub(crate) fn window_hide(app: &AppHandle<tauri::Wry>) {
|
||||
let window = app.get_window("main").unwrap();
|
||||
let item_handle = app.tray_handle().get_item(TRAY_MENU_SHOW_HIDE);
|
||||
if window.is_visible().unwrap() {
|
||||
window.hide().unwrap();
|
||||
item_handle.set_title("Show").unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn window_show(app: &AppHandle<tauri::Wry>) {
|
||||
let window = app.get_window("main").unwrap();
|
||||
let item_handle = app.tray_handle().get_item(TRAY_MENU_SHOW_HIDE);
|
||||
if !window.is_visible().unwrap() {
|
||||
window.show().unwrap();
|
||||
item_handle.set_title("Hide").unwrap();
|
||||
window.set_focus().unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn window_toggle(app: &AppHandle<tauri::Wry>) {
|
||||
let window = app.get_window("main").unwrap();
|
||||
if window.is_visible().unwrap() {
|
||||
window_hide(app);
|
||||
} else {
|
||||
window_show(app);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"package": {
|
||||
"productName": "nym-connect",
|
||||
"version": "1.1.9"
|
||||
"version": "1.1.12"
|
||||
},
|
||||
"build": {
|
||||
"distDir": "../dist",
|
||||
@@ -14,7 +14,13 @@
|
||||
"active": true,
|
||||
"targets": "all",
|
||||
"identifier": "net.nymtech.connect",
|
||||
"icon": ["icons/32x32.png", "icons/128x128.png", "icons/128x128@2x.png", "icons/icon.icns", "icons/icon.ico"],
|
||||
"icon": [
|
||||
"icons/32x32.png",
|
||||
"icons/128x128.png",
|
||||
"icons/128x128@2x.png",
|
||||
"icons/icon.icns",
|
||||
"icons/icon.ico"
|
||||
],
|
||||
"resources": [],
|
||||
"externalBin": [],
|
||||
"copyright": "Copyright © 2021-2022 Nym Technologies SA",
|
||||
@@ -37,10 +43,6 @@
|
||||
"timestampUrl": ""
|
||||
}
|
||||
},
|
||||
"systemTray": {
|
||||
"iconPath": "icons/tray_icon.png",
|
||||
"iconAsTemplate": true
|
||||
},
|
||||
"updater": {
|
||||
"active": false
|
||||
},
|
||||
@@ -51,11 +53,6 @@
|
||||
"clipboard": {
|
||||
"writeText": true
|
||||
},
|
||||
"window": {
|
||||
"startDragging": true,
|
||||
"close": true,
|
||||
"minimize": true
|
||||
},
|
||||
"notification": {
|
||||
"all": true
|
||||
}
|
||||
|
||||
@@ -23,12 +23,11 @@ export const CompatibleApps = () => (
|
||||
</Typography>
|
||||
))}
|
||||
</Box>
|
||||
<Divider sx={{ mb: 3 }} />
|
||||
<Typography color="nym.highlight" fontWeight={400} sx={{ mb: 2 }}>
|
||||
Wallets
|
||||
</Typography>
|
||||
|
||||
<Divider sx={{ mb: 3 }} />
|
||||
|
||||
<Box sx={{ mb: 4 }}>
|
||||
{appsSchema.wallets.map((wallet) => (
|
||||
<Typography variant="body2" color="grey.400" sx={{ mb: 2 }} key={wallet}>
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
import React, { ChangeEvent, useState } from 'react';
|
||||
import { IdentityKeyFormField } from '@nymproject/react/mixnodes/IdentityKeyFormField';
|
||||
import { Box, FormControl, FormControlLabel, FormHelperText, Stack, Switch, Typography } from '@mui/material';
|
||||
import { useClientContext } from 'src/context/main';
|
||||
import { ConnectionStatusKind } from 'src/types';
|
||||
import { AppVersion } from 'src/components/AppVersion';
|
||||
|
||||
export const Settings = () => {
|
||||
const { userDefinedGateway, setUserDefinedGateway } = useClientContext();
|
||||
const [gatewayKey, setGatewayKey] = useState<string | undefined>(userDefinedGateway?.gateway);
|
||||
|
||||
const handleIsValidGatewayKey = (isValid: boolean) => {
|
||||
let gateway: string | undefined;
|
||||
|
||||
if (isValid) {
|
||||
gateway = gatewayKey;
|
||||
}
|
||||
|
||||
setUserDefinedGateway((current) => ({ ...current, gateway }));
|
||||
};
|
||||
|
||||
const handleChange = (e: ChangeEvent<HTMLInputElement>) => {
|
||||
console.warn('HANERE***');
|
||||
setUserDefinedGateway((current) => ({ ...current, isActive: e.target.checked }));
|
||||
};
|
||||
|
||||
const { connectionStatus } = useClientContext();
|
||||
|
||||
return (
|
||||
<Box height="100%">
|
||||
<Stack justifyContent="space-between" height="100%">
|
||||
<Box>
|
||||
<Typography fontWeight="bold" variant="body2" mb={1} fontSize="14px">
|
||||
Select your Gateway
|
||||
</Typography>
|
||||
<Typography color="grey.300" variant="body2" mb={3}>
|
||||
Use a gateway of your choice
|
||||
</Typography>
|
||||
<FormControl fullWidth>
|
||||
<FormControlLabel
|
||||
control={
|
||||
<Switch
|
||||
checked={userDefinedGateway?.isActive}
|
||||
onChange={handleChange}
|
||||
disabled={connectionStatus === ConnectionStatusKind.connected}
|
||||
size="small"
|
||||
sx={{ ml: 1 }}
|
||||
/>
|
||||
}
|
||||
label={userDefinedGateway?.isActive ? 'On' : 'Off'}
|
||||
/>
|
||||
{connectionStatus === ConnectionStatusKind.connected && (
|
||||
<FormHelperText sx={{ m: 0, my: 1 }}>This setting is disabled during an active connection</FormHelperText>
|
||||
)}
|
||||
{userDefinedGateway?.isActive && (
|
||||
<IdentityKeyFormField
|
||||
size="small"
|
||||
placeholder="Gateway identity key"
|
||||
onChanged={setGatewayKey}
|
||||
initialValue={gatewayKey}
|
||||
onValidate={handleIsValidGatewayKey}
|
||||
sx={{ mt: 3 }}
|
||||
disabled={connectionStatus === 'connected' || !userDefinedGateway?.isActive}
|
||||
/>
|
||||
)}
|
||||
</FormControl>
|
||||
</Box>
|
||||
<Box>
|
||||
<Typography variant="body2" mb={4}>
|
||||
To find a gateway go to{' '}
|
||||
<Typography variant="body2" color="nym.cta">
|
||||
explorer.nymtech.net/network-components/gateways
|
||||
</Typography>
|
||||
</Typography>
|
||||
<AppVersion />
|
||||
</Box>
|
||||
</Stack>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { ChangeEvent, useState } from 'react';
|
||||
import { IdentityKeyFormField } from '@nymproject/react/mixnodes/IdentityKeyFormField';
|
||||
import { Box, FormControl, FormControlLabel, FormHelperText, Link, Stack, Switch, Typography } from '@mui/material';
|
||||
import { Box, FormControl, FormControlLabel, FormHelperText, Stack, Switch, Typography } from '@mui/material';
|
||||
import { useClientContext } from 'src/context/main';
|
||||
import { ConnectionStatusKind } from 'src/types';
|
||||
import { AppVersion } from 'src/components/AppVersion';
|
||||
@@ -26,11 +26,11 @@ export const GatewaySettings = () => {
|
||||
return (
|
||||
<Box height="100%">
|
||||
<Stack justifyContent="space-between" height="100%">
|
||||
<Box>
|
||||
<Box mt={3}>
|
||||
<Typography fontWeight="bold" variant="body2" mb={1}>
|
||||
Select your Gateway
|
||||
</Typography>
|
||||
<Typography color="grey.300" variant="body2" mb={2}>
|
||||
<Typography color="grey.300" variant="body2" mb={3}>
|
||||
Use a gateway of your choice
|
||||
</Typography>
|
||||
<FormControl fullWidth>
|
||||
@@ -56,7 +56,7 @@ export const GatewaySettings = () => {
|
||||
onChanged={setGatewayKey}
|
||||
initialValue={gatewayKey}
|
||||
onValidate={handleIsValidGatewayKey}
|
||||
sx={{ mt: 1 }}
|
||||
sx={{ mt: 3 }}
|
||||
disabled={connectionStatus === 'connected' || !userDefinedGateway?.isActive}
|
||||
autoFocus
|
||||
/>
|
||||
@@ -64,17 +64,11 @@ export const GatewaySettings = () => {
|
||||
</FormControl>
|
||||
</Box>
|
||||
<Box>
|
||||
<Typography variant="body2" mb={3}>
|
||||
To find a gateway go to the{' '}
|
||||
<Link
|
||||
underline="none"
|
||||
target="_blank"
|
||||
href="https://explorer.nymtech.net/network-components/gateways"
|
||||
sx={{ cursor: 'pointer' }}
|
||||
color="nym.cta"
|
||||
>
|
||||
Network Explorer
|
||||
</Link>
|
||||
<Typography variant="body2" mb={4}>
|
||||
To find a gateway go to{' '}
|
||||
<Typography variant="body2" color="nym.cta">
|
||||
explorer.nymtech.net/network-components/gateways
|
||||
</Typography>
|
||||
</Typography>
|
||||
<AppVersion />
|
||||
</Box>
|
||||
|
||||
@@ -40,11 +40,11 @@ export const ServiceProviderSettings = () => {
|
||||
return (
|
||||
<Box height="100%">
|
||||
<Stack justifyContent="space-between" height="100%">
|
||||
<Box>
|
||||
<Box mt={3}>
|
||||
<Typography fontWeight="bold" variant="body2" mb={1}>
|
||||
Select your Service Provider
|
||||
</Typography>
|
||||
<Typography color="grey.300" variant="body2" mb={2}>
|
||||
<Typography color="grey.300" variant="body2" mb={3}>
|
||||
Pick a service provider from the list or enter your own
|
||||
</Typography>
|
||||
<FormControl fullWidth>
|
||||
@@ -67,7 +67,7 @@ export const ServiceProviderSettings = () => {
|
||||
<Autocomplete
|
||||
clearOnEscape
|
||||
disabled={connectionStatus === 'connected'}
|
||||
sx={{ mt: 1 }}
|
||||
sx={{ mt: 3 }}
|
||||
options={serviceProviders.map((sp) => sp.address)}
|
||||
freeSolo
|
||||
value={userDefinedSPAddress.address || ''}
|
||||
@@ -86,9 +86,9 @@ export const ServiceProviderSettings = () => {
|
||||
)}
|
||||
</FormControl>
|
||||
{userDefinedSPAddress.address && userDefinedSPAddress.isActive && (
|
||||
<Box sx={{ mt: 2 }}>
|
||||
<Box sx={{ mt: 3 }}>
|
||||
<Typography variant="body2">Name of Service Provider</Typography>
|
||||
<Typography variant="body2" sx={{ mt: 0.5 }} color="grey.400">
|
||||
<Typography variant="body2" sx={{ mt: 1 }} color="grey.400">
|
||||
{getSPDescription(userDefinedSPAddress.address)}
|
||||
</Typography>
|
||||
</Box>
|
||||
|
||||
@@ -2,7 +2,6 @@ import React from 'react';
|
||||
import { Link as RouterLink } from 'react-router-dom';
|
||||
import { Link, List, ListItem, ListItemButton, ListItemText, Stack } from '@mui/material';
|
||||
import { AppVersion } from 'src/components/AppVersion';
|
||||
import { toggleLogViewer } from 'src/utils';
|
||||
|
||||
const menuSchema = [
|
||||
{ title: 'Select your gateway', path: 'gateway' },
|
||||
@@ -11,7 +10,7 @@ const menuSchema = [
|
||||
|
||||
export const SettingsMenu = () => (
|
||||
<Stack justifyContent="space-between" height="100%">
|
||||
<List dense disablePadding>
|
||||
<List sx={{ mt: 3 }} dense disablePadding>
|
||||
{menuSchema.map((item) => (
|
||||
<Link component={RouterLink} to={item.path} underline="none" color="white" key={item.title}>
|
||||
<ListItem disablePadding>
|
||||
@@ -21,11 +20,6 @@ export const SettingsMenu = () => (
|
||||
</ListItem>
|
||||
</Link>
|
||||
))}
|
||||
<ListItem disablePadding>
|
||||
<ListItemButton onClick={toggleLogViewer}>
|
||||
<ListItemText>Logs</ListItemText>
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
</List>
|
||||
<AppVersion />
|
||||
</Stack>
|
||||
|
||||
Reference in New Issue
Block a user