don't re-hide when a request comes in while showing approval screen

This commit is contained in:
Joseph Montanaro
2023-04-21 11:18:20 -07:00
parent e0c4c849dc
commit fd60899f16
2 changed files with 14 additions and 5 deletions

View File

@ -67,12 +67,13 @@ impl Handler {
// only hide the window if a) it was hidden to start with
// and b) there are no other pending requests
let state = self.app.state::<AppState>();
let delay = {
let config = state.config.read().unwrap();
Duration::from_millis(config.rehide_ms)
};
sleep(delay).await;
if !starting_visibility && state.req_count() == 0 {
let delay = {
let config = state.config.read().unwrap();
Duration::from_millis(config.rehide_ms)
};
sleep(delay).await;
let window = self.app.get_window("main").ok_or(RequestError::NoMainWindow)?;
window.hide()?;
}