clear the accessible devices tab when retrieving accessible devices disabled (#11913)

* clear the accessible devices tab when retrieving accessible devices is disabled

Signed-off-by: 21pages <sunboeasy@gmail.com>

* Update group_model.dart

---------

Signed-off-by: 21pages <sunboeasy@gmail.com>
Co-authored-by: RustDesk <71636191+rustdesk@users.noreply.github.com>
This commit is contained in:
21pages 2025-05-29 17:07:32 +08:00 committed by GitHub
parent 4e1a814aeb
commit ec0456e606
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -47,7 +47,10 @@ class GroupModel {
}
try {
await _pull();
} catch (_) {}
_tryHandlePullError();
} catch (e) {
print("pull accessibles error: $e");
}
groupLoading.value = false;
initialized = true;
platformFFI.tryHandle({'name': LoadEvent.group});
@ -361,4 +364,14 @@ class GroupModel {
void removePeerUpdateListener(String key) {
_peerIdUpdateListeners.remove(key);
}
void _tryHandlePullError() {
String errorMessage = groupLoadError.value;
// The error message is "Retrieving accessible devices is disabled."
if (errorMessage.toLowerCase().contains('disabled')) {
users.clear();
peers.clear();
deviceGroups.clear();
}
}
}