query online on load peers

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2023-06-20 23:34:05 +08:00
parent 2c56159d6d
commit 277804feef
2 changed files with 31 additions and 12 deletions

View File

@@ -72,10 +72,13 @@ class Peer {
);
}
enum UpdateEvent { online, load }
class Peers extends ChangeNotifier {
final String name;
final String loadEvent;
List<Peer> peers;
UpdateEvent event = UpdateEvent.load;
static const _cbQueryOnlines = 'callback_query_onlines';
Peers({required this.name, required this.peers, required this.loadEvent}) {
@@ -123,6 +126,7 @@ class Peers extends ChangeNotifier {
}
});
event = UpdateEvent.online;
notifyListeners();
}
@@ -133,6 +137,7 @@ class Peers extends ChangeNotifier {
final state = onlineStates[peer.id];
peer.online = state != null && state != false;
}
event = UpdateEvent.load;
notifyListeners();
}