Merge pull request #5442 from 21pages/ab

restore online status after pullAb
This commit is contained in:
RustDesk 2023-08-19 15:30:43 +08:00 committed by GitHub
commit 535e1bd2ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -93,6 +93,8 @@ class AbModel {
} catch (e) {}
final data = jsonDecode(json['data']);
if (data != null) {
final oldOnlineIDs =
peers.where((e) => e.online).map((e) => e.id).toList();
tags.clear();
peers.clear();
if (data['tags'] is List) {
@ -106,6 +108,11 @@ class AbModel {
if (isFull(false)) {
peers.removeRange(licensedDevices, peers.length);
}
// restore online
peers
.where((e) => oldOnlineIDs.contains(e.id))
.map((e) => e.online = true)
.toList();
_saveCache(); // save on success
}
}