feat(engine): implement ShowLogs event

This commit is contained in:
Federico Terzi 2021-11-15 22:31:26 +01:00
parent 334e99b343
commit c69544c1e2
2 changed files with 8 additions and 0 deletions

View File

@ -24,6 +24,7 @@ use log::error;
pub trait TextUIHandler { pub trait TextUIHandler {
fn show_text(&self, title: &str, text: &str) -> Result<()>; fn show_text(&self, title: &str, text: &str) -> Result<()>;
fn show_logs(&self) -> Result<()>;
} }
pub struct TextUIExecutor<'a> { pub struct TextUIExecutor<'a> {
@ -46,6 +47,12 @@ impl<'a> Executor for TextUIExecutor<'a> {
error!("text UI handler reported an error: {:?}", error); error!("text UI handler reported an error: {:?}", error);
} }
return true;
} else if let EventType::ShowLogs = &event.etype {
if let Err(error) = self.handler.show_logs() {
error!("text UI handler reported an error: {:?}", error);
}
return true; return true;
} }

View File

@ -102,6 +102,7 @@ pub enum EventType {
DisplaySecureInputTroubleshoot, DisplaySecureInputTroubleshoot,
ShowSearchBar, ShowSearchBar,
ShowText(ui::ShowTextEvent), ShowText(ui::ShowTextEvent),
ShowLogs,
// Other // Other
LaunchSecureInputAutoFix, LaunchSecureInputAutoFix,