feat: connecting animation and error dialog

This commit is contained in:
2024-07-16 22:19:17 +08:00
parent 09e2ab50bb
commit ad1125af3e
13 changed files with 298 additions and 47 deletions

View File

@@ -154,10 +154,16 @@ impl BleConnection {
.emit_all("device-discovered", Some(device))
.unwrap();
}
DeviceDisconnected(_) => {
// 在这里引用 self
let mut peripheral = self_clone.peripheral.lock().await;
*peripheral = None;
DeviceDisconnected(peripheral) => {
let mut p = self_clone.peripheral.lock().await;
if let Some(peri) = p.as_ref() {
if peri.id() == peripheral {
app_handle
.emit_all("device-disconnected", peripheral.to_string())
.unwrap();
*p = None;
}
}
}
_ => {}
}