mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-12-12 11:06:57 +00:00
cancel cm hidden timer when active
This commit is contained in:
@@ -5,6 +5,7 @@ import 'dart:io';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hbb/models/platform_model.dart';
|
||||
import 'package:wakelock/wakelock.dart';
|
||||
import 'package:window_manager/window_manager.dart';
|
||||
|
||||
import '../common.dart';
|
||||
import '../common/formatter/id_formatter.dart';
|
||||
@@ -37,6 +38,8 @@ class ServerModel with ChangeNotifier {
|
||||
|
||||
final List<Client> _clients = [];
|
||||
|
||||
Timer? cmHiddenTimer;
|
||||
|
||||
bool get isStart => _isStart;
|
||||
|
||||
bool get mediaOk => _mediaOk;
|
||||
@@ -353,13 +356,7 @@ class ServerModel with ChangeNotifier {
|
||||
for (var clientJson in clientsJson) {
|
||||
final client = Client.fromJson(clientJson);
|
||||
_clients.add(client);
|
||||
tabController.add(
|
||||
TabInfo(
|
||||
key: client.id.toString(),
|
||||
label: client.name,
|
||||
closable: false,
|
||||
page: Desktop.buildConnectionCard(client)),
|
||||
authorized: client.authorized);
|
||||
_addTab(client);
|
||||
}
|
||||
notifyListeners();
|
||||
} catch (e) {
|
||||
@@ -384,13 +381,7 @@ class ServerModel with ChangeNotifier {
|
||||
}
|
||||
_clients.add(client);
|
||||
}
|
||||
tabController.add(
|
||||
TabInfo(
|
||||
key: client.id.toString(),
|
||||
label: client.name,
|
||||
closable: false,
|
||||
page: Desktop.buildConnectionCard(client)),
|
||||
authorized: client.authorized);
|
||||
_addTab(client);
|
||||
// remove disconnected
|
||||
final index_disconnected = _clients
|
||||
.indexWhere((c) => c.disconnected && c.peerId == client.peerId);
|
||||
@@ -406,6 +397,23 @@ class ServerModel with ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
void _addTab(Client client) {
|
||||
tabController.add(TabInfo(
|
||||
key: client.id.toString(),
|
||||
label: client.name,
|
||||
closable: false,
|
||||
page: Desktop.buildConnectionCard(client)));
|
||||
Future.delayed(Duration.zero, () async {
|
||||
window_on_top(null);
|
||||
});
|
||||
if (client.authorized) {
|
||||
cmHiddenTimer = Timer(const Duration(seconds: 3), () {
|
||||
windowManager.minimize();
|
||||
cmHiddenTimer = null;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void showLoginDialog(Client client) {
|
||||
parent.target?.dialogManager.show((setState, close) {
|
||||
cancel() {
|
||||
|
||||
Reference in New Issue
Block a user