mirror of
https://github.com/rustdesk/rustdesk.git
synced 2024-11-24 04:12:20 +08:00
refact, mobile, connection state
Signed-off-by: dignow <linlong1265@gmail.com>
This commit is contained in:
parent
71db0e99b5
commit
811293b261
@ -11,6 +11,7 @@ import '../../common/widgets/dialog.dart';
|
||||
import '../../consts.dart';
|
||||
import '../../models/platform_model.dart';
|
||||
import '../../models/server_model.dart';
|
||||
import '../../models/state_model.dart';
|
||||
import 'home_page.dart';
|
||||
|
||||
class ServerPage extends StatefulWidget implements PageShape {
|
||||
@ -216,28 +217,29 @@ class ServerInfo extends StatelessWidget {
|
||||
showToast(translate('Copied'));
|
||||
}
|
||||
|
||||
Widget ConnectionStateNotification() {
|
||||
if (serverModel.connectStatus == -1) {
|
||||
return Row(children: [
|
||||
const Icon(Icons.warning_amber_sharp,
|
||||
color: colorNegative, size: iconSize)
|
||||
.marginOnly(right: iconMarginRight),
|
||||
Expanded(child: Text(translate('not_ready_status')))
|
||||
]);
|
||||
} else if (serverModel.connectStatus == 0) {
|
||||
return Row(children: [
|
||||
SizedBox(width: 20, height: 20, child: CircularProgressIndicator())
|
||||
.marginOnly(left: 4, right: iconMarginRight),
|
||||
Expanded(child: Text(translate('connecting_status')))
|
||||
]);
|
||||
} else {
|
||||
return Row(children: [
|
||||
const Icon(Icons.check, color: colorPositive, size: iconSize)
|
||||
.marginOnly(right: iconMarginRight),
|
||||
Expanded(child: Text(translate('Ready')))
|
||||
]);
|
||||
}
|
||||
}
|
||||
Widget ConnectionStateNotification() => Obx(() {
|
||||
if (stateGlobal.svcStatus.value == SvcStatus.notReady) {
|
||||
return Row(children: [
|
||||
const Icon(Icons.warning_amber_sharp,
|
||||
color: colorNegative, size: iconSize)
|
||||
.marginOnly(right: iconMarginRight),
|
||||
Expanded(child: Text(translate('not_ready_status')))
|
||||
]);
|
||||
} else if (stateGlobal.svcStatus.value == SvcStatus.connecting) {
|
||||
return Row(children: [
|
||||
SizedBox(
|
||||
width: 20, height: 20, child: CircularProgressIndicator())
|
||||
.marginOnly(left: 4, right: iconMarginRight),
|
||||
Expanded(child: Text(translate('connecting_status')))
|
||||
]);
|
||||
} else {
|
||||
return Row(children: [
|
||||
const Icon(Icons.check, color: colorPositive, size: iconSize)
|
||||
.marginOnly(right: iconMarginRight),
|
||||
Expanded(child: Text(translate('Ready')))
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
return PaddingCard(
|
||||
title: translate('Your Device'),
|
||||
|
@ -31,7 +31,6 @@ 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,8 +60,6 @@ class ServerModel with ChangeNotifier {
|
||||
|
||||
bool get hideCm => _hideCm;
|
||||
|
||||
int get connectStatus => _connectStatus;
|
||||
|
||||
String get verificationMethod {
|
||||
final index = [
|
||||
kUseTemporaryPassword,
|
||||
@ -120,15 +117,6 @@ class ServerModel with ChangeNotifier {
|
||||
_serverId = IDTextEditingController(text: _emptyIdShow);
|
||||
|
||||
timerCallback() async {
|
||||
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) {
|
||||
|
@ -998,10 +998,6 @@ pub fn main_get_fingerprint() -> String {
|
||||
get_fingerprint()
|
||||
}
|
||||
|
||||
pub fn main_get_online_statue() -> i64 {
|
||||
get_online_statue()
|
||||
}
|
||||
|
||||
pub fn cm_get_clients_state() -> String {
|
||||
crate::ui_cm_interface::get_clients_state()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user