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 '../../consts.dart';
|
||||||
import '../../models/platform_model.dart';
|
import '../../models/platform_model.dart';
|
||||||
import '../../models/server_model.dart';
|
import '../../models/server_model.dart';
|
||||||
|
import '../../models/state_model.dart';
|
||||||
import 'home_page.dart';
|
import 'home_page.dart';
|
||||||
|
|
||||||
class ServerPage extends StatefulWidget implements PageShape {
|
class ServerPage extends StatefulWidget implements PageShape {
|
||||||
@ -216,17 +217,18 @@ class ServerInfo extends StatelessWidget {
|
|||||||
showToast(translate('Copied'));
|
showToast(translate('Copied'));
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget ConnectionStateNotification() {
|
Widget ConnectionStateNotification() => Obx(() {
|
||||||
if (serverModel.connectStatus == -1) {
|
if (stateGlobal.svcStatus.value == SvcStatus.notReady) {
|
||||||
return Row(children: [
|
return Row(children: [
|
||||||
const Icon(Icons.warning_amber_sharp,
|
const Icon(Icons.warning_amber_sharp,
|
||||||
color: colorNegative, size: iconSize)
|
color: colorNegative, size: iconSize)
|
||||||
.marginOnly(right: iconMarginRight),
|
.marginOnly(right: iconMarginRight),
|
||||||
Expanded(child: Text(translate('not_ready_status')))
|
Expanded(child: Text(translate('not_ready_status')))
|
||||||
]);
|
]);
|
||||||
} else if (serverModel.connectStatus == 0) {
|
} else if (stateGlobal.svcStatus.value == SvcStatus.connecting) {
|
||||||
return Row(children: [
|
return Row(children: [
|
||||||
SizedBox(width: 20, height: 20, child: CircularProgressIndicator())
|
SizedBox(
|
||||||
|
width: 20, height: 20, child: CircularProgressIndicator())
|
||||||
.marginOnly(left: 4, right: iconMarginRight),
|
.marginOnly(left: 4, right: iconMarginRight),
|
||||||
Expanded(child: Text(translate('connecting_status')))
|
Expanded(child: Text(translate('connecting_status')))
|
||||||
]);
|
]);
|
||||||
@ -237,7 +239,7 @@ class ServerInfo extends StatelessWidget {
|
|||||||
Expanded(child: Text(translate('Ready')))
|
Expanded(child: Text(translate('Ready')))
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
return PaddingCard(
|
return PaddingCard(
|
||||||
title: translate('Your Device'),
|
title: translate('Your Device'),
|
||||||
|
@ -31,7 +31,6 @@ class ServerModel with ChangeNotifier {
|
|||||||
bool _fileOk = false;
|
bool _fileOk = false;
|
||||||
bool _showElevation = false;
|
bool _showElevation = false;
|
||||||
bool _hideCm = false;
|
bool _hideCm = false;
|
||||||
int _connectStatus = 0; // Rendezvous Server status
|
|
||||||
String _verificationMethod = "";
|
String _verificationMethod = "";
|
||||||
String _temporaryPasswordLength = "";
|
String _temporaryPasswordLength = "";
|
||||||
String _approveMode = "";
|
String _approveMode = "";
|
||||||
@ -61,8 +60,6 @@ class ServerModel with ChangeNotifier {
|
|||||||
|
|
||||||
bool get hideCm => _hideCm;
|
bool get hideCm => _hideCm;
|
||||||
|
|
||||||
int get connectStatus => _connectStatus;
|
|
||||||
|
|
||||||
String get verificationMethod {
|
String get verificationMethod {
|
||||||
final index = [
|
final index = [
|
||||||
kUseTemporaryPassword,
|
kUseTemporaryPassword,
|
||||||
@ -120,15 +117,6 @@ class ServerModel with ChangeNotifier {
|
|||||||
_serverId = IDTextEditingController(text: _emptyIdShow);
|
_serverId = IDTextEditingController(text: _emptyIdShow);
|
||||||
|
|
||||||
timerCallback() async {
|
timerCallback() async {
|
||||||
var status = await bind.mainGetOnlineStatue();
|
|
||||||
if (status > 0) {
|
|
||||||
status = 1;
|
|
||||||
}
|
|
||||||
if (status != _connectStatus) {
|
|
||||||
_connectStatus = status;
|
|
||||||
notifyListeners();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (desktopType == DesktopType.cm) {
|
if (desktopType == DesktopType.cm) {
|
||||||
final res = await bind.cmCheckClientsLength(length: _clients.length);
|
final res = await bind.cmCheckClientsLength(length: _clients.length);
|
||||||
if (res != null) {
|
if (res != null) {
|
||||||
|
@ -998,10 +998,6 @@ pub fn main_get_fingerprint() -> String {
|
|||||||
get_fingerprint()
|
get_fingerprint()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn main_get_online_statue() -> i64 {
|
|
||||||
get_online_statue()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn cm_get_clients_state() -> String {
|
pub fn cm_get_clients_state() -> String {
|
||||||
crate::ui_cm_interface::get_clients_state()
|
crate::ui_cm_interface::get_clients_state()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user