fix: fixed disks duplicating on startup (could also happen with Bluetooth and GPU devices)

This commit is contained in:
Serhiy Mytrovtsiy
2022-07-15 17:36:38 +02:00
parent 3f95347d4a
commit c7a1a92490
3 changed files with 6 additions and 9 deletions

View File

@@ -49,7 +49,7 @@ internal class Popup: NSStackView, Popup_p {
}
list.reversed().forEach { (ble: BLEDevice) in
if let view = views.first(where: { $0.address == ble.address }) {
if let view = self.subviews.filter({ $0 is BLEView }).map({ $0 as! BLEView }).first(where: { $0.address == ble.address }) {
view.update(ble.batteryLevel)
} else {
self.addArrangedSubview(BLEView(