refactor(legacy): make guardDeviceCommand async with stale TTL refetch

Convert the shared command guard to an async check that refetches
/devices when the cached state is older than 30s, so the isDisconnect
flag reflects reality before a command runs. A TopSnackBar explains the
check only if the fetch takes longer than 400ms, avoiding noise on fast
responses. Update all 44 call sites to await the guard.
This commit is contained in:
2026-04-17 09:43:52 +02:00
parent ecbb6d1e76
commit 0b160758e2
35 changed files with 163 additions and 90 deletions

View File

@@ -691,6 +691,7 @@
"errorContactsMax": "Maximale Kontaktanzahl für dieses Gerät erreicht",
"errorPositions": "Positionen konnten nicht geladen werden",
"errorDeviceDisconnected": "Die Uhr ist getrennt und kann keine Befehle empfangen",
"checkingDeviceConnection": "Verbindung des Geräts wird überprüft...",
"errorSosContactsMax": "Maximale SOS-Kontaktanzahl für dieses Gerät erreicht",
"customBackground": "Benutzerdefiniertes Hintergrundbild",
"backgroundImageDescription": "Legen Sie ein Foto als benutzerdefinierten Bildschirmschoner für das Gerät fest",

View File

@@ -859,6 +859,7 @@
"errorContactsMax": "Maximum contacts reached for this device",
"errorPositions": "Could not load positions",
"errorDeviceDisconnected": "The watch is disconnected and cannot receive commands",
"checkingDeviceConnection": "Checking if the device is connected...",
"errorSosContactsMax": "Maximum SOS contacts reached for this device",
"customBackground": "Custom background image",
"backgroundImageDescription": "Set a photo as a custom screensaver for the device",

View File

@@ -860,6 +860,7 @@
"errorContactsMax": "Se ha alcanzado el máximo de contactos para este dispositivo",
"errorPositions": "No se pudieron cargar las posiciones",
"errorDeviceDisconnected": "El reloj está desconectado y no puede recibir comandos",
"checkingDeviceConnection": "Revisando si el dispositivo está conectado...",
"errorSosContactsMax": "Se ha alcanzado el máximo de contactos SOS para este dispositivo",
"customBackground": "Fondo de pantalla personalizado",
"backgroundImageDescription": "Configura una foto como protector de pantalla exclusivo para el dispositivo",

View File

@@ -691,6 +691,7 @@
"errorContactsMax": "Nombre maximum de contacts atteint pour cet appareil",
"errorPositions": "Impossible de charger les positions",
"errorDeviceDisconnected": "La montre est déconnectée et ne peut pas recevoir de commandes",
"checkingDeviceConnection": "Vérification de la connexion de l'appareil...",
"errorSosContactsMax": "Nombre maximum de contacts SOS atteint pour cet appareil",
"customBackground": "Image de fond personnalisée",
"backgroundImageDescription": "Définissez une photo comme écran de veille personnalisé pour l'appareil",

View File

@@ -691,6 +691,7 @@
"errorContactsMax": "Numero massimo di contatti raggiunto per questo dispositivo",
"errorPositions": "Impossibile caricare le posizioni",
"errorDeviceDisconnected": "L'orologio è disconnesso e non può ricevere comandi",
"checkingDeviceConnection": "Verifica della connessione del dispositivo...",
"errorSosContactsMax": "Numero massimo di contatti SOS raggiunto per questo dispositivo",
"customBackground": "Immagine di sfondo personalizzata",
"backgroundImageDescription": "Imposta una foto come screensaver personalizzato per il dispositivo",

View File

@@ -691,6 +691,7 @@
"errorContactsMax": "Número máximo de contactos atingido para este dispositivo",
"errorPositions": "Não foi possível carregar as posições",
"errorDeviceDisconnected": "O relógio está desconectado e não pode receber comandos",
"checkingDeviceConnection": "A verificar se o dispositivo está conectado...",
"errorSosContactsMax": "Número máximo de contactos SOS atingido para este dispositivo",
"customBackground": "Imagem de fundo personalizada",
"backgroundImageDescription": "Defina uma foto como protetor de ecrã personalizado para o dispositivo",

View File

@@ -395,6 +395,7 @@ class I18n {
static const String errorContactsMax = 'errorContactsMax';
static const String errorPositions = 'errorPositions';
static const String errorDeviceDisconnected = 'errorDeviceDisconnected';
static const String checkingDeviceConnection = 'checkingDeviceConnection';
static const String errorSosContactsMax = 'errorSosContactsMax';
static const String errorContactsMin = 'errorContactsMin';
static const String errorDisableFunctions = 'errorDisableFunctions';