Fix(insert_modes): added the `Setup` insert mode as a workaround to log in until command based login is implemented

This commit is contained in:
antifallobst 2023-07-22 16:28:47 +02:00
parent d447eb2312
commit 993ef6af89
Signed by: antifallobst
GPG Key ID: 2B4F402172791BAF
3 changed files with 10 additions and 0 deletions

View File

@ -51,6 +51,9 @@ impl Event {
State::Insert => main::handle_insert(app, event) State::Insert => main::handle_insert(app, event)
.await .await
.with_context(|| format!("Failed to handle input event: `{:#?}`", event)), .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)),
}, },
} }
} }

View File

@ -81,6 +81,8 @@ impl App<'_> {
self.init_account().await?; self.init_account().await?;
} }
self.status.set_state(State::Normal);
loop { loop {
self.ui.update(&self.status).await?; self.ui.update(&self.status).await?;
@ -100,6 +102,8 @@ impl App<'_> {
async fn setup(&mut self) -> Result<()> { async fn setup(&mut self) -> Result<()> {
self.ui.setup_ui = Some(setup::UI::new()); self.ui.setup_ui = Some(setup::UI::new());
self.status.set_state(State::Setup);
loop { loop {
self.ui.update_setup().await?; self.ui.update_setup().await?;

View File

@ -15,6 +15,8 @@ use matrix_sdk::{
pub enum State { pub enum State {
Normal, Normal,
Insert, Insert,
/// Temporary workaround until command based login is working
Setup,
} }
pub struct Room { pub struct Room {
@ -41,6 +43,7 @@ impl fmt::Display for State {
match self { match self {
Self::Normal => write!(f, "Normal"), Self::Normal => write!(f, "Normal"),
Self::Insert => write!(f, "Insert"), Self::Insert => write!(f, "Insert"),
Self::Setup => write!(f, "Setup (!! workaround !!)"),
} }
} }
} }