From 394fbeee9a30a3a440a5553a27b6ab972def95e2 Mon Sep 17 00:00:00 2001 From: David J Kordsmeier Date: Fri, 22 Mar 2024 22:07:21 -0700 Subject: [PATCH] refs #26 Fix scan layout and what data gets shown --- magnet_app/lib/app_state_model.dart | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/magnet_app/lib/app_state_model.dart b/magnet_app/lib/app_state_model.dart index adb465a..c2641b6 100644 --- a/magnet_app/lib/app_state_model.dart +++ b/magnet_app/lib/app_state_model.dart @@ -119,6 +119,7 @@ class AppState extends BLEProvider { if (device.id == deviceId) { print("--------------> Found match!!!!"); } else { + // XXX TODO: fix database dups // Create a new document. final adoc = await _db!.document(device.id); if (adoc == null) { @@ -137,8 +138,10 @@ class AppState extends BLEProvider { */ // _genericBleDevices_connected.addIf(!_genericBleDevices_connected.contains(device),device); // int sz = _devices.length; - _devices.addIf(!_devices.contains(device), { - 'id': device.id, + + _devices.addIf(!_devices.contains(device) && _devices.every((element) => element['uuid'] != device.id), { + 'id': device.id.substring(device.id.length-5), + 'uuid': device.id, 'name': device.name, 'type': device.manufacturerData.toString() });