remove calling refreshCurrentUser when connect status become ready (#8849)

When refreshCurrentUser throw error, show check network in ab and group
tab.

Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
21pages
2024-07-28 10:15:09 +08:00
committed by GitHub
parent 9750e1409c
commit 7e8d3bd2ac
51 changed files with 90 additions and 13 deletions

View File

@@ -34,7 +34,6 @@ class _OnlineStatusWidgetState extends State<OnlineStatusWidget> {
final _svcStopped = Get.find<RxBool>(tag: 'stop-service');
final _svcIsUsingPublicServer = true.obs;
Timer? _updateTimer;
final DateTime _appStartTime = DateTime.now();
double get em => 14.0;
double? get height => bind.isIncomingOnly() ? null : em * 3;
@@ -170,17 +169,12 @@ class _OnlineStatusWidgetState extends State<OnlineStatusWidget> {
final status =
jsonDecode(await bind.mainGetConnectStatus()) as Map<String, dynamic>;
final statusNum = status['status_num'] as int;
final preStatus = stateGlobal.svcStatus.value;
if (statusNum == 0) {
stateGlobal.svcStatus.value = SvcStatus.connecting;
} else if (statusNum == -1) {
stateGlobal.svcStatus.value = SvcStatus.notReady;
} else if (statusNum == 1) {
stateGlobal.svcStatus.value = SvcStatus.ready;
if (preStatus != SvcStatus.ready &&
DateTime.now().difference(_appStartTime) > Duration(seconds: 5)) {
gFFI.userModel.refreshCurrentUser();
}
} else {
stateGlobal.svcStatus.value = SvcStatus.notReady;
}