fix (status): updating status from 'app.init_account()'
This commit is contained in:
parent
b1c0007098
commit
a7e11c6ac0
|
@ -131,6 +131,12 @@ impl App<'_> {
|
||||||
|
|
||||||
tokio::task::spawn(event::poll_matrix_events(self.channel_tx.clone(), self.matrix_listener_killer.clone(), client));
|
tokio::task::spawn(event::poll_matrix_events(self.channel_tx.clone(), self.matrix_listener_killer.clone(), client));
|
||||||
|
|
||||||
|
let account = self.account()?;
|
||||||
|
let name = account.name().clone();
|
||||||
|
let user_id = account.user_id().clone();
|
||||||
|
self.status.set_account_name(name);
|
||||||
|
self.status.set_account_user_id(user_id);
|
||||||
|
|
||||||
info!("Initializing client for the current account");
|
info!("Initializing client for the current account");
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -151,10 +157,10 @@ impl App<'_> {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn account(&self) -> Result<&Account, ()> {
|
pub fn account(&self) -> Result<&Account> {
|
||||||
let account = self.accounts_manager.current();
|
let account = self.accounts_manager.current();
|
||||||
match account {
|
match account {
|
||||||
None => Err(()),
|
None => Err(Error::msg("failed to resolve current account")),
|
||||||
Some(a) => Ok(a)
|
Some(a) => Ok(a)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,10 +28,18 @@ impl Status {
|
||||||
&self.account_name
|
&self.account_name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn set_account_name(&mut self, name: String) {
|
||||||
|
self.account_name = name;
|
||||||
|
}
|
||||||
|
|
||||||
pub fn account_user_id(&self) -> &String {
|
pub fn account_user_id(&self) -> &String {
|
||||||
&self.account_user_id
|
&self.account_user_id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn set_account_user_id(&mut self, user_id: String) {
|
||||||
|
self.account_user_id = user_id;
|
||||||
|
}
|
||||||
|
|
||||||
pub fn room(&self) -> Option<()> {
|
pub fn room(&self) -> Option<()> {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue