diff --git a/src/virt/ui.rs b/src/virt/ui.rs index fd51f774bb1..954ebda18ed 100644 --- a/src/virt/ui.rs +++ b/src/virt/ui.rs @@ -3,6 +3,7 @@ use std::time::{Duration, Instant}; pub struct UserInterface { start_time: Instant, + user_presence_level: Level, inner: Option>, } @@ -10,12 +11,17 @@ impl UserInterface { pub fn new() -> Self { Self { start_time: Instant::now(), + user_presence_level: Level::Normal, inner: None, } } - pub fn set_inner(&mut self, inner: impl Into>) { - self.inner = Some(inner.into()); + pub fn set_user_presence_level(&mut self, level: Level) { + self.user_presence_level = level; + } + + pub fn set_inner(&mut self, inner: Box) { + self.inner = Some(inner); } pub fn take_inner(&mut self) -> Option> { @@ -34,7 +40,7 @@ impl platform::UserInterface for UserInterface { self.inner .as_mut() .map(|inner| inner.check_user_presence()) - .unwrap_or(Level::Normal) + .unwrap_or(self.user_presence_level) } fn set_status(&mut self, status: Status) {