Merge pull request #1741 from fufesou/test_fix_wayland_bak

Test fix wayland
This commit is contained in:
RustDesk
2022-10-18 08:53:38 +08:00
committed by GitHub
60 changed files with 731 additions and 326 deletions

View File

@@ -18,6 +18,7 @@ import 'package:shared_preferences/shared_preferences.dart';
import 'package:window_manager/window_manager.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:window_size/window_size.dart' as window_size;
import 'package:url_launcher/url_launcher.dart';
import 'common/widgets/overlay.dart';
import 'mobile/pages/file_manager_page.dart';
@@ -618,8 +619,8 @@ class CustomAlertDialog extends StatelessWidget {
}
}
void msgBox(
String type, String title, String text, OverlayDialogManager dialogManager,
void msgBox(String type, String title, String text, String link,
OverlayDialogManager dialogManager,
{bool? hasCancel}) {
dialogManager.dismissAll();
List<Widget> buttons = [];
@@ -636,6 +637,12 @@ void msgBox(
dialogManager.dismissAll();
}
jumplink() {
if (link.startsWith('http')) {
launchUrl(Uri.parse(link));
}
}
if (type != "connecting" && type != "success" && !type.contains("nook")) {
hasOk = true;
buttons.insert(0, msgBoxButton(translate('OK'), submit));
@@ -654,9 +661,13 @@ void msgBox(
dialogManager.dismissAll();
}));
}
if (link.isNotEmpty) {
buttons.insert(0, msgBoxButton(translate('JumpLink'), jumplink));
}
dialogManager.show((setState, close) => CustomAlertDialog(
title: _msgBoxTitle(title),
content: Text(translate(text), style: const TextStyle(fontSize: 15)),
content: SelectableText(translate(text),
style: const TextStyle(fontSize: 15)),
actions: buttons,
onSubmit: hasOk ? submit : null,
onCancel: hasCancel == true ? cancel : null,

View File

@@ -414,7 +414,7 @@ class _DesktopHomePageState extends State<DesktopHomePage>
final root = await bind.mainIsRoot();
final release = await bind.mainIsRelease();
if (Platform.isWindows && release && !installed && !root) {
msgBox('custom-elevation-nocancel', 'Prompt', 'elevation_prompt',
msgBox('custom-elevation-nocancel', 'Prompt', 'elevation_prompt', '',
gFFI.dialogManager);
}
});

View File

@@ -6,7 +6,7 @@ import '../../models/model.dart';
import '../../models/platform_model.dart';
void clientClose(OverlayDialogManager dialogManager) {
msgBox('', 'Close', 'Are you sure to close the connection?', dialogManager);
msgBox('', 'Close', 'Are you sure to close the connection?', '', dialogManager);
}
void showSuccess() {

View File

@@ -222,26 +222,27 @@ class FfiModel with ChangeNotifier {
handleMsgBox(Map<String, dynamic> evt, String id) {
if (parent.target == null) return;
final dialogManager = parent.target!.dialogManager;
var type = evt['type'];
var title = evt['title'];
var text = evt['text'];
final type = evt['type'];
final title = evt['title'];
final text = evt['text'];
final link = evt['link'];
if (type == 're-input-password') {
wrongPasswordDialog(id, dialogManager);
} else if (type == 'input-password') {
enterPasswordDialog(id, dialogManager);
} else if (type == 'restarting') {
showMsgBox(id, type, title, text, false, dialogManager, hasCancel: false);
showMsgBox(id, type, title, text, link, false, dialogManager, hasCancel: false);
} else {
var hasRetry = evt['hasRetry'] == 'true';
showMsgBox(id, type, title, text, hasRetry, dialogManager);
showMsgBox(id, type, title, text, link, hasRetry, dialogManager);
}
}
/// Show a message box with [type], [title] and [text].
showMsgBox(String id, String type, String title, String text, bool hasRetry,
OverlayDialogManager dialogManager,
showMsgBox(String id, String type, String title, String text, String link,
bool hasRetry, OverlayDialogManager dialogManager,
{bool? hasCancel}) {
msgBox(type, title, text, dialogManager, hasCancel: hasCancel);
msgBox(type, title, text, link, dialogManager, hasCancel: hasCancel);
_timer?.cancel();
if (hasRetry) {
_timer = Timer(Duration(seconds: _reconnects), () {