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)
.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)),
},
}
}

View File

@ -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?;

View File

@ -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 !!)"),
}
}
}