From 993ef6af8960e54b594f140ddaf3e370d9fe0aae Mon Sep 17 00:00:00 2001 From: antifallobst Date: Sat, 22 Jul 2023 16:28:47 +0200 Subject: [PATCH] Fix(insert_modes): added the `Setup` insert mode as a workaround to log in until command based login is implemented --- src/app/events/event_types/event/mod.rs | 3 +++ src/app/mod.rs | 4 ++++ src/app/status.rs | 3 +++ 3 files changed, 10 insertions(+) diff --git a/src/app/events/event_types/event/mod.rs b/src/app/events/event_types/event/mod.rs index f1293ef..c279439 100644 --- a/src/app/events/event_types/event/mod.rs +++ b/src/app/events/event_types/event/mod.rs @@ -51,6 +51,9 @@ impl Event { State::Insert => main::handle_insert(app, event) .await .with_context(|| format!("Failed to handle input event: `{:#?}`", event)), + State::Setup => setup::handle(app, event) + .await + .with_context(|| format!("Failed to handle input event: `{:#?}`", event)), }, } } diff --git a/src/app/mod.rs b/src/app/mod.rs index e7d97a0..18da6aa 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -81,6 +81,8 @@ impl App<'_> { self.init_account().await?; } + self.status.set_state(State::Normal); + loop { self.ui.update(&self.status).await?; @@ -100,6 +102,8 @@ impl App<'_> { async fn setup(&mut self) -> Result<()> { self.ui.setup_ui = Some(setup::UI::new()); + self.status.set_state(State::Setup); + loop { self.ui.update_setup().await?; diff --git a/src/app/status.rs b/src/app/status.rs index f297e3b..0334301 100644 --- a/src/app/status.rs +++ b/src/app/status.rs @@ -15,6 +15,8 @@ use matrix_sdk::{ pub enum State { Normal, Insert, + /// Temporary workaround until command based login is working + Setup, } pub struct Room { @@ -41,6 +43,7 @@ impl fmt::Display for State { match self { Self::Normal => write!(f, "Normal"), Self::Insert => write!(f, "Insert"), + Self::Setup => write!(f, "Setup (!! workaround !!)"), } } }