parent
bd6ecaeb28
commit
0416a3645a
2
gui/Cargo.lock
generated
2
gui/Cargo.lock
generated
@ -1640,7 +1640,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "liana"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/wizardsardine/liana?branch=master#f433002e91b09ab700d06026e1d94c462aca9756"
|
||||
source = "git+https://github.com/wizardsardine/liana?branch=master#bd6ecaeb285f780ea94e38e28b2d0860f1b45c97"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"base64",
|
||||
|
||||
@ -31,6 +31,7 @@ pub struct SettingsState {
|
||||
warning: Option<Error>,
|
||||
config_updated: bool,
|
||||
daemon_is_external: bool,
|
||||
daemon_version: Option<String>,
|
||||
|
||||
settings: Vec<Box<dyn Setting>>,
|
||||
current: Option<usize>,
|
||||
@ -52,6 +53,11 @@ impl SettingsState {
|
||||
};
|
||||
|
||||
SettingsState {
|
||||
daemon_version: if !daemon_is_external {
|
||||
Some(liana::VERSION.to_string())
|
||||
} else {
|
||||
None
|
||||
},
|
||||
daemon_is_external,
|
||||
warning: None,
|
||||
config_updated: false,
|
||||
@ -94,6 +100,7 @@ impl State for SettingsState {
|
||||
Message::Info(res) => match res {
|
||||
Err(e) => self.warning = Some(e),
|
||||
Ok(info) => {
|
||||
self.daemon_version = Some(info.version);
|
||||
if info.rescan_progress == Some(1.0) {
|
||||
self.settings[1].edited(true);
|
||||
}
|
||||
@ -117,6 +124,7 @@ impl State for SettingsState {
|
||||
fn view<'a>(&'a self, cache: &'a Cache) -> Element<'a, view::Message> {
|
||||
let can_edit = self.current.is_none() && !self.daemon_is_external;
|
||||
view::settings::list(
|
||||
self.daemon_version.as_ref(),
|
||||
cache,
|
||||
self.warning.as_ref(),
|
||||
self.settings
|
||||
@ -130,6 +138,17 @@ impl State for SettingsState {
|
||||
.collect(),
|
||||
)
|
||||
}
|
||||
|
||||
fn load(&self, daemon: Arc<dyn Daemon + Sync + Send>) -> Command<Message> {
|
||||
if self.daemon_version.is_none() {
|
||||
Command::perform(
|
||||
async move { daemon.get_info().map_err(|e| e.into()) },
|
||||
Message::Info,
|
||||
)
|
||||
} else {
|
||||
Command::none()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<SettingsState> for Box<dyn State> {
|
||||
|
||||
@ -24,6 +24,7 @@ use crate::{
|
||||
};
|
||||
|
||||
pub fn list<'a>(
|
||||
lianad_version: Option<&'a String>,
|
||||
cache: &'a Cache,
|
||||
warning: Option<&Error>,
|
||||
settings: Vec<Element<'a, Message>>,
|
||||
@ -54,7 +55,28 @@ pub fn list<'a>(
|
||||
.push(Space::with_width(Length::Fill))
|
||||
.push(button::primary(None, "Recover funds").on_press(Message::Menu(Menu::Recovery))),
|
||||
),
|
||||
)),
|
||||
))
|
||||
.push(
|
||||
card::simple(
|
||||
Column::new()
|
||||
.push(
|
||||
Row::new()
|
||||
.push(badge::Badge::new(icon::tooltip_icon()))
|
||||
.push(text("About").bold())
|
||||
.padding(10)
|
||||
.spacing(20)
|
||||
.align_items(Alignment::Center)
|
||||
.width(Length::Fill),
|
||||
)
|
||||
.push(separation().width(Length::Fill))
|
||||
.push(Space::with_height(Length::Units(10)))
|
||||
.push(
|
||||
Row::new().push(Space::with_width(Length::Fill)).push(Column::new()
|
||||
.push(text(format!("liana-gui v{}", crate::VERSION)))
|
||||
.push_maybe(lianad_version.map(|version| text(format!("lianad v{}", version)))))
|
||||
)
|
||||
).width(Length::Fill)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -6,3 +6,11 @@ pub mod launcher;
|
||||
pub mod loader;
|
||||
pub mod ui;
|
||||
pub mod utils;
|
||||
|
||||
use liana::Version;
|
||||
|
||||
pub const VERSION: Version = Version {
|
||||
major: 0,
|
||||
minor: 1,
|
||||
patch: 0,
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user