fix: some tui work in layout
This commit is contained in:
@@ -53,6 +53,7 @@ pub struct AuthenticationCoordinator {
|
||||
sender: Sender<AuthenticationCompletion>,
|
||||
receiver: Receiver<AuthenticationCompletion>,
|
||||
generation: u64,
|
||||
native_prompt_pending: bool,
|
||||
}
|
||||
|
||||
impl AuthenticationCoordinator {
|
||||
@@ -71,6 +72,7 @@ impl AuthenticationCoordinator {
|
||||
sender,
|
||||
receiver,
|
||||
generation: 0,
|
||||
native_prompt_pending: false,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -96,6 +98,7 @@ impl AuthenticationCoordinator {
|
||||
|
||||
fn request(&mut self, target: AuthenticationTarget) {
|
||||
self.generation = self.generation.wrapping_add(1);
|
||||
self.native_prompt_pending = self.handle.is_none();
|
||||
let generation = self.generation;
|
||||
let session = self.session.clone();
|
||||
let key = self.key.clone();
|
||||
@@ -118,6 +121,7 @@ impl AuthenticationCoordinator {
|
||||
.try_iter()
|
||||
.filter(|completion| completion.generation == self.generation)
|
||||
.last()?;
|
||||
self.native_prompt_pending = false;
|
||||
match completion.result {
|
||||
Ok(handle) => {
|
||||
self.handle = Some(handle);
|
||||
@@ -172,8 +176,13 @@ impl AuthenticationCoordinator {
|
||||
self.handle.clone()
|
||||
}
|
||||
|
||||
pub const fn native_prompt_pending(&self) -> bool {
|
||||
self.native_prompt_pending
|
||||
}
|
||||
|
||||
pub fn lock(&mut self) -> Result<(), String> {
|
||||
self.generation = self.generation.wrapping_add(1);
|
||||
self.native_prompt_pending = false;
|
||||
self.handle = None;
|
||||
self.session
|
||||
.manual_lock()
|
||||
|
||||
Reference in New Issue
Block a user