mirror of
https://github.com/dz0ny/meshcore-sar.git
synced 2026-08-11 16:30:28 +00:00
Show values in sensor fields
This commit is contained in:
@@ -270,25 +270,10 @@ class AppProvider with ChangeNotifier {
|
||||
}
|
||||
|
||||
Future<void> _checkLowBatteryAlerts() async {
|
||||
final recoveredIds = <String>{};
|
||||
|
||||
final deviceBattery = connectionProvider.deviceInfo.batteryPercent;
|
||||
if (deviceBattery != null &&
|
||||
deviceBattery > _lowBatteryResetThresholdPercent) {
|
||||
recoveredIds.add('device');
|
||||
}
|
||||
|
||||
for (final contact in contactsProvider.contacts) {
|
||||
if (contact.isChannel) continue;
|
||||
final battery = contact.displayBattery;
|
||||
if (battery == null) continue;
|
||||
if (battery > _lowBatteryResetThresholdPercent) {
|
||||
recoveredIds.add(contact.publicKeyHex);
|
||||
}
|
||||
}
|
||||
|
||||
if (recoveredIds.isNotEmpty) {
|
||||
_lowBatteryNotifiedNodeIds.removeAll(recoveredIds);
|
||||
_lowBatteryNotifiedNodeIds.remove('device');
|
||||
}
|
||||
|
||||
if (connectionProvider.deviceInfo.isConnected && deviceBattery != null) {
|
||||
@@ -302,19 +287,6 @@ class AppProvider with ChangeNotifier {
|
||||
isCurrentDevice: true,
|
||||
);
|
||||
}
|
||||
|
||||
for (final contact in contactsProvider.contacts) {
|
||||
if (contact.isChannel) continue;
|
||||
final battery = contact.displayBattery;
|
||||
if (battery == null) continue;
|
||||
|
||||
await _notifyLowBatteryIfNeeded(
|
||||
nodeId: contact.publicKeyHex,
|
||||
nodeName: contact.displayName,
|
||||
batteryPercent: battery,
|
||||
isCurrentDevice: false,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _notifyLowBatteryIfNeeded({
|
||||
|
||||
Reference in New Issue
Block a user