restore online status after pullAb
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
parent
cdb264d47b
commit
df02292338
@ -93,6 +93,8 @@ class AbModel {
|
|||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
final data = jsonDecode(json['data']);
|
final data = jsonDecode(json['data']);
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
|
final oldOnlineIDs =
|
||||||
|
peers.where((e) => e.online).map((e) => e.id).toList();
|
||||||
tags.clear();
|
tags.clear();
|
||||||
peers.clear();
|
peers.clear();
|
||||||
if (data['tags'] is List) {
|
if (data['tags'] is List) {
|
||||||
@ -106,6 +108,11 @@ class AbModel {
|
|||||||
if (isFull(false)) {
|
if (isFull(false)) {
|
||||||
peers.removeRange(licensedDevices, peers.length);
|
peers.removeRange(licensedDevices, peers.length);
|
||||||
}
|
}
|
||||||
|
// restore online
|
||||||
|
peers
|
||||||
|
.where((e) => oldOnlineIDs.contains(e.id))
|
||||||
|
.map((e) => e.online = true)
|
||||||
|
.toList();
|
||||||
_saveCache(); // save on success
|
_saveCache(); // save on success
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user