new: more battery data & fix: auto reload

This commit is contained in:
lollipopkit
2023-12-20 17:26:04 +08:00
parent 7283c968ae
commit 4a93b326db
26 changed files with 247 additions and 147 deletions

View File

@@ -155,16 +155,6 @@ class ServerProvider extends ChangeNotifier {
}
}
void setNotBusy([String? id]) {
if (id == null) {
for (final s in _servers.values) {
s.isBusy = false;
}
return;
}
_servers[id]?.isBusy = false;
}
bool get isAutoRefreshOn => _timer != null;
void setDisconnected() {
@@ -248,15 +238,6 @@ class ServerProvider extends ChangeNotifier {
void _setServerState(Server s, ServerState ss) {
s.state = ss;
/// Only set [Sever.isBusy] to false when err occurs or finished.
switch (ss) {
case ServerState.failed || ServerState.finished:
s.isBusy = false;
break;
default:
break;
}
notifyListeners();
}
@@ -275,11 +256,6 @@ class ServerProvider extends ChangeNotifier {
s.status.err = null;
/// If busy, it may be because of network reasons that the last request
/// has not been completed, and the request should not be made again at this time.
if (s.isBusy) return;
s.isBusy = true;
if (s.needGenClient || (s.client?.isClosed ?? true)) {
_setServerState(s, ServerState.connecting);