manage network state for both user info and user group

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2023-06-21 16:08:45 +08:00
parent 581e84d806
commit 10508a41b1
6 changed files with 64 additions and 33 deletions

View File

@@ -10,12 +10,13 @@ import 'package:http/http.dart' as http;
import '../common.dart';
class AbModel {
var abLoading = false.obs;
var abError = "".obs;
var tags = [].obs;
var peers = List<Peer>.empty(growable: true).obs;
final abLoading = false.obs;
final abError = "".obs;
final tags = [].obs;
final RxBool fromServer = false.obs;
final peers = List<Peer>.empty(growable: true).obs;
var selectedTags = List<String>.empty(growable: true).obs;
final selectedTags = List<String>.empty(growable: true).obs;
WeakReference<FFI> parent;
@@ -49,8 +50,10 @@ class AbModel {
}
}
}
fromServer.value = true;
return resp.body;
} else {
fromServer.value = true;
return "";
}
} catch (err) {

View File

@@ -6,6 +6,8 @@ import 'package:get/get.dart';
import '../consts.dart';
enum SvcStatus { notReady, connecting, ready }
class StateGlobal {
int _windowId = -1;
bool _fullscreen = false;
@@ -16,6 +18,7 @@ class StateGlobal {
final RxDouble _windowBorderWidth = RxDouble(kWindowBorderWidth);
final RxBool showRemoteToolBar = false.obs;
final RxInt displaysCount = 0.obs;
final svcStatus = SvcStatus.notReady.obs;
// Use for desktop -> remote toolbar -> resolution
final Map<String, Map<int, String?>> _lastResolutionGroupValues = {};

View File

@@ -14,7 +14,6 @@ import 'platform_model.dart';
class UserModel {
final RxString userName = ''.obs;
final RxBool isAdmin = false.obs;
final RxBool fromServer = false.obs;
WeakReference<FFI> parent;
UserModel(this.parent);
@@ -85,7 +84,6 @@ class UserModel {
_parseAndUpdateUser(UserPayload user) {
userName.value = user.name;
isAdmin.value = user.isAdmin;
fromServer.value = true;
}
Future<void> _updateOtherModels() async {