mirror of
https://github.com/pythops/bluetui.git
synced 2026-05-06 21:42:28 +08:00
fix
This commit is contained in:
@@ -24,6 +24,7 @@ pub enum Event {
|
||||
Resize(u16, u16),
|
||||
Notification(Notification),
|
||||
NewPairedDevice(Address),
|
||||
FailedPairing(Address),
|
||||
RequestConfirmation(Confirmation),
|
||||
ConfirmationSubmitted,
|
||||
RequestEnterPinCode(EnterPinCode),
|
||||
|
||||
@@ -140,6 +140,7 @@ async fn pair(app: &mut App, sender: UnboundedSender<Event>) {
|
||||
NotificationLevel::Error,
|
||||
sender.clone(),
|
||||
);
|
||||
let _ = sender.send(Event::FailedPairing(device.address()));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
10
src/main.rs
10
src/main.rs
@@ -113,6 +113,16 @@ async fn main() -> AppResult<()> {
|
||||
app.focused_block = bluetui::app::FocusedBlock::PairedDevices;
|
||||
}
|
||||
|
||||
Event::FailedPairing(address) => {
|
||||
if let Some(req) = &app.requests.display_passkey
|
||||
&& req.device == address
|
||||
{
|
||||
app.requests.display_passkey = None;
|
||||
}
|
||||
|
||||
app.focused_block = bluetui::app::FocusedBlock::PairedDevices;
|
||||
}
|
||||
|
||||
Event::Mouse(_) | Event::Resize(_, _) => {}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user