Skip to content

Commit

Permalink
feat: add keys into UI list
Browse files Browse the repository at this point in the history
  • Loading branch information
madonuko committed Aug 7, 2024
1 parent da18371 commit f8b5206
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions desktop/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ struct AuthButton {
// TODO: stuff
}

impl From<maz_auth::Key> for AuthButton {
fn from(value: maz_auth::Key) -> Self {
Self {}
}
}

#[relm4::factory]
impl FactoryComponent for AuthButton {
type Init = ();
Expand Down Expand Up @@ -91,6 +97,20 @@ impl SimpleComponent for AppModel {

// TODO: populate authfactory

let lockers = crate::local::list_lockers().expect("Can't list lockers");
let locker = match &*lockers {
[] => todo!("no impl new locker UI"),
[name] => crate::local::read_offline_locker(name, crate::local::read_password(name))
.expect("Can't read offline locker"),
_ => todo!("locker chooser…?"),
};

let auths = authfactory.guard();
locker
.keys
.iter()
.for_each(|key| auths.push_back(key.into()));

let model = AppModel { authfactory };
let authbox = model.authfactory.widget();
let widgets = view_output!();
Expand Down

0 comments on commit f8b5206

Please sign in to comment.