1
0
Fork 0
trinitrix/src/main.rs

41 lines
1.0 KiB
Rust
Raw Normal View History

2023-06-14 21:49:20 +00:00
mod ui;
mod accounts;
mod app;
2023-06-14 21:49:20 +00:00
use crate::ui::UI;
use matrix_sdk::ruma::exports::serde_json;
use tokio::time::{sleep, Duration};
use std::{io, thread};
use log::{error, warn, info, LevelFilter};
use log4rs::append::file::FileAppender;
use log4rs::encode::pattern::PatternEncoder;
use log4rs::config::{Appender, Config, Root};
2023-06-14 21:49:20 +00:00
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let logfile = FileAppender::builder()
.encoder(Box::new(PatternEncoder::new("{l} - {m}\n")))
.build("userdata/output.log")?;
let config = Config::builder()
.appender(Appender::builder().build("logfile", Box::new(logfile)))
.build(Root::builder()
.appender("logfile")
.build(LevelFilter::Info))?;
log4rs::init_config(config)?;
let mut app = app::App::new();
2023-06-23 03:41:26 +00:00
app.fill_test_data();
2023-06-23 03:41:26 +00:00
let mut ui = UI::new();
if app.accounts_manager.num_accounts() == 0 {
info!("No saved sessions found -> jumping into setup");
ui.setup(&mut app).await?;
}
ui.main(&mut app).await?;
2023-06-14 21:49:20 +00:00
Ok(())
}