mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-12-12 19:17:58 +00:00
Revert "Fix/mobile connection login state"
This commit is contained in:
@@ -15,8 +15,7 @@ import '../common/formatter/id_formatter.dart';
|
||||
import '../desktop/pages/server_page.dart' as desktop;
|
||||
import '../desktop/widgets/tabbar_widget.dart';
|
||||
import '../mobile/pages/server_page.dart';
|
||||
import './model.dart';
|
||||
import './state_model.dart';
|
||||
import 'model.dart';
|
||||
|
||||
const kLoginDialogTag = "LOGIN";
|
||||
|
||||
@@ -32,6 +31,7 @@ class ServerModel with ChangeNotifier {
|
||||
bool _fileOk = false;
|
||||
bool _showElevation = false;
|
||||
bool _hideCm = false;
|
||||
int _connectStatus = 0; // Rendezvous Server status
|
||||
String _verificationMethod = "";
|
||||
String _temporaryPasswordLength = "";
|
||||
String _approveMode = "";
|
||||
@@ -61,6 +61,8 @@ class ServerModel with ChangeNotifier {
|
||||
|
||||
bool get hideCm => _hideCm;
|
||||
|
||||
int get connectStatus => _connectStatus;
|
||||
|
||||
String get verificationMethod {
|
||||
final index = [
|
||||
kUseTemporaryPassword,
|
||||
@@ -118,7 +120,15 @@ class ServerModel with ChangeNotifier {
|
||||
_serverId = IDTextEditingController(text: _emptyIdShow);
|
||||
|
||||
timerCallback() async {
|
||||
stateGlobal.updateSvcStatus();
|
||||
var status = await bind.mainGetOnlineStatue();
|
||||
if (status > 0) {
|
||||
status = 1;
|
||||
}
|
||||
if (status != _connectStatus) {
|
||||
_connectStatus = status;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
if (desktopType == DesktopType.cm) {
|
||||
final res = await bind.cmCheckClientsLength(length: _clients.length);
|
||||
if (res != null) {
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:desktop_multi_window/desktop_multi_window.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../consts.dart';
|
||||
import '../common.dart';
|
||||
|
||||
import './platform_model.dart';
|
||||
|
||||
enum SvcStatus { notReady, connecting, ready }
|
||||
|
||||
@@ -23,9 +18,7 @@ class StateGlobal {
|
||||
final RxDouble _windowBorderWidth = RxDouble(kWindowBorderWidth);
|
||||
final RxBool showRemoteToolBar = false.obs;
|
||||
final RxInt displaysCount = 0.obs;
|
||||
|
||||
final svcStatus = SvcStatus.notReady.obs;
|
||||
final svcIsUsingPublicServer = true.obs;
|
||||
|
||||
// Use for desktop -> remote toolbar -> resolution
|
||||
final Map<String, Map<int, String?>> _lastResolutionGroupValues = {};
|
||||
@@ -91,31 +84,6 @@ class StateGlobal {
|
||||
}
|
||||
}
|
||||
|
||||
updateSvcStatus() async {
|
||||
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) {
|
||||
gFFI.userModel.refreshCurrentUser();
|
||||
}
|
||||
} else {
|
||||
stateGlobal.svcStatus.value = SvcStatus.notReady;
|
||||
}
|
||||
if (stateGlobal.svcStatus.value != SvcStatus.ready) {
|
||||
gFFI.userModel.isAdmin.value = false;
|
||||
gFFI.groupModel.reset();
|
||||
}
|
||||
stateGlobal.svcIsUsingPublicServer.value =
|
||||
await bind.mainIsUsingPublicServer();
|
||||
}
|
||||
|
||||
StateGlobal._();
|
||||
|
||||
static final StateGlobal instance = StateGlobal._();
|
||||
|
||||
Reference in New Issue
Block a user