Fix conflicts

This commit is contained in:
NicKoehler
2023-03-08 16:57:51 +01:00
52 changed files with 525 additions and 135 deletions

View File

@@ -623,7 +623,7 @@ class MainService : Service() {
.setAutoCancel(true)
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
.setContentTitle(DEFAULT_NOTIFY_TITLE)
.setContentText(translate(DEFAULT_NOTIFY_TEXT) + '!')
.setContentText(translate(DEFAULT_NOTIFY_TEXT))
.setOnlyAlertOnce(true)
.setContentIntent(pendingIntent)
.setColor(ContextCompat.getColor(this, R.color.primary))
@@ -689,7 +689,7 @@ class MainService : Service() {
private fun setTextNotification(_title: String?, _text: String?) {
val title = _title ?: DEFAULT_NOTIFY_TITLE
val text = _text ?: translate(DEFAULT_NOTIFY_TEXT) + '!'
val text = _text ?: translate(DEFAULT_NOTIFY_TEXT)
val notification = notificationBuilder
.clearActions()
.setStyle(null)

View File

@@ -368,7 +368,7 @@ class MyTheme {
static void changeDarkMode(ThemeMode mode) async {
Get.changeThemeMode(mode);
if (desktopType == DesktopType.main) {
if (desktopType == DesktopType.main || isAndroid || isIOS) {
if (mode == ThemeMode.system) {
await bind.mainSetLocalOption(key: kCommConfKeyTheme, value: '');
} else {
@@ -946,7 +946,6 @@ Widget msgboxContent(String type, String title, String text) {
void msgBoxCommon(OverlayDialogManager dialogManager, String title,
Widget content, List<Widget> buttons,
{bool hasCancel = true}) {
dialogManager.dismissAll();
dialogManager.show((setState, close) => CustomAlertDialog(
title: Text(
translate(title),

View File

@@ -1130,7 +1130,7 @@ void _rdpDialog(String id) async {
}
return CustomAlertDialog(
title: Text('RDP ${translate('Settings')}'),
title: Text(translate('RDP Settings')),
content: ConstrainedBox(
constraints: const BoxConstraints(minWidth: 500),
child: Column(
@@ -1141,56 +1141,67 @@ void _rdpDialog(String id) async {
),
Row(
children: [
ConstrainedBox(
constraints: const BoxConstraints(minWidth: 140),
child: Text(
"${translate('Port')}:",
textAlign: TextAlign.right,
).marginOnly(right: 10)),
isDesktop
? ConstrainedBox(
constraints: const BoxConstraints(minWidth: 140),
child: Text(
"${translate('Port')}:",
textAlign: TextAlign.right,
).marginOnly(right: 10))
: SizedBox.shrink(),
Expanded(
child: TextField(
inputFormatters: [
FilteringTextInputFormatter.allow(RegExp(
r'^([0-9]|[1-9]\d|[1-9]\d{2}|[1-9]\d{3}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[0-5])$'))
],
decoration: const InputDecoration(
border: OutlineInputBorder(), hintText: '3389'),
decoration: InputDecoration(
labelText: isDesktop ? null : translate('Port'),
border: isDesktop ? const OutlineInputBorder() : null,
hintText: '3389'),
controller: portController,
autofocus: true,
),
),
],
).marginOnly(bottom: 8),
).marginOnly(bottom: isDesktop ? 8 : 0),
Row(
children: [
ConstrainedBox(
constraints: const BoxConstraints(minWidth: 140),
child: Text(
"${translate('Username')}:",
textAlign: TextAlign.right,
).marginOnly(right: 10)),
isDesktop
? ConstrainedBox(
constraints: const BoxConstraints(minWidth: 140),
child: Text(
"${translate('Username')}:",
textAlign: TextAlign.right,
).marginOnly(right: 10))
: SizedBox.shrink(),
Expanded(
child: TextField(
decoration:
const InputDecoration(border: OutlineInputBorder()),
decoration: InputDecoration(
labelText: isDesktop ? null : translate('Username'),
border: isDesktop ? const OutlineInputBorder() : null),
controller: userController,
),
),
],
).marginOnly(bottom: 8),
).marginOnly(bottom: isDesktop ? 8 : 0),
Row(
children: [
ConstrainedBox(
constraints: const BoxConstraints(minWidth: 140),
child: Text(
"${translate('Password')}:",
textAlign: TextAlign.right,
).marginOnly(right: 10)),
isDesktop
? ConstrainedBox(
constraints: const BoxConstraints(minWidth: 140),
child: Text(
"${translate('Password')}:",
textAlign: TextAlign.right,
).marginOnly(right: 10))
: SizedBox.shrink(),
Expanded(
child: Obx(() => TextField(
obscureText: secure.value,
decoration: InputDecoration(
border: const OutlineInputBorder(),
labelText: isDesktop ? null : translate('Password'),
border:
isDesktop ? const OutlineInputBorder() : null,
suffixIcon: IconButton(
onPressed: () => secure.value = !secure.value,
icon: Icon(secure.value
@@ -1200,7 +1211,7 @@ void _rdpDialog(String id) async {
)),
),
],
).marginOnly(bottom: 8),
).marginOnly(bottom: isDesktop ? 8 : 0),
],
),
),

View File

@@ -14,7 +14,10 @@ const String kPeerPlatformAndroid = "Android";
/// [kAppTypeMain] used by 'Desktop Main Page' , 'Mobile (Client and Server)', "Install Page"
const String kAppTypeMain = "main";
/// [kAppTypeConnectionManager] only for 'Desktop CM Page'
const String kAppTypeConnectionManager = "cm";
const String kAppTypeDesktopRemote = "remote";
const String kAppTypeDesktopFileTransfer = "file transfer";
const String kAppTypeDesktopPortForward = "port forward";

View File

@@ -1,3 +1,5 @@
import 'dart:io';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';
import 'package:flutter_hbb/common.dart';
@@ -63,6 +65,7 @@ class _InstallPageBodyState extends State<_InstallPageBody>
late final TextEditingController controller;
final RxBool startmenu = true.obs;
final RxBool desktopicon = true.obs;
final RxBool driverCert = true.obs;
final RxBool showProgress = false.obs;
final RxBool btnEnabled = true.obs;
@@ -145,25 +148,62 @@ class _InstallPageBodyState extends State<_InstallPageBody>
.marginOnly(left: em))
],
).marginSymmetric(vertical: 2 * em),
Row(
children: [
Obx(() => Checkbox(
value: startmenu.value,
onChanged: (b) {
if (b != null) startmenu.value = b;
})),
Text(translate('Create start menu shortcuts'))
],
TextButton(
onPressed: () => startmenu.value = !startmenu.value,
child: Row(
children: [
Obx(() => Checkbox(
value: startmenu.value,
onChanged: (b) {
if (b != null) startmenu.value = b;
})),
RichText(
text: TextSpan(
text: translate('Create start menu shortcuts'),
style: DefaultTextStyle.of(context).style,
),
),
],
),
),
Row(
children: [
Obx(() => Checkbox(
value: desktopicon.value,
onChanged: (b) {
if (b != null) desktopicon.value = b;
})),
Text(translate('Create desktop icon'))
],
TextButton(
onPressed: () => desktopicon.value = !desktopicon.value,
child: Row(
children: [
Obx(() => Checkbox(
value: desktopicon.value,
onChanged: (b) {
if (b != null) desktopicon.value = b;
})),
RichText(
text: TextSpan(
text: translate('Create desktop icon'),
style: DefaultTextStyle.of(context).style,
),
),
],
),
),
Offstage(
offstage: !Platform.isWindows,
child: TextButton(
onPressed: () => driverCert.value = !driverCert.value,
child: Row(
children: [
Obx(() => Checkbox(
value: driverCert.value,
onChanged: (b) {
if (b != null) driverCert.value = b;
})),
RichText(
text: TextSpan(
text: translate('idd_driver_tip'),
style: DefaultTextStyle.of(context).style,
),
),
],
),
),
),
GestureDetector(
onTap: () => launchUrlString('http://rustdesk.com/privacy'),
@@ -225,12 +265,47 @@ class _InstallPageBodyState extends State<_InstallPageBody>
}
void install() {
btnEnabled.value = false;
showProgress.value = true;
String args = '';
if (startmenu.value) args += ' startmenu';
if (desktopicon.value) args += ' desktopicon';
bind.installInstallMe(options: args, path: controller.text);
do_install() {
btnEnabled.value = false;
showProgress.value = true;
String args = '';
if (startmenu.value) args += ' startmenu';
if (desktopicon.value) args += ' desktopicon';
if (driverCert.value) args += ' driverCert';
bind.installInstallMe(options: args, path: controller.text);
}
if (driverCert.isTrue) {
final tag = 'install-info-install-cert-confirm';
final btns = [
dialogButton(
'Cancel',
onPressed: () => gFFI.dialogManager.dismissByTag(tag),
isOutline: true,
),
dialogButton(
'OK',
onPressed: () {
gFFI.dialogManager.dismissByTag(tag);
do_install();
},
isOutline: false,
),
];
gFFI.dialogManager.show(
(setState, close) => CustomAlertDialog(
title: null,
content: SelectionArea(
child:
msgboxContent('info', 'Warning', 'confirm_idd_driver_tip')),
actions: btns,
onCancel: close,
),
tag: tag,
);
} else {
do_install();
}
}
void selectInstallPath() async {

View File

@@ -263,8 +263,11 @@ class ServerModel with ChangeNotifier {
toggleInput() {
if (_inputOk) {
parent.target?.invokeMethod("stop_input");
bind.mainSetOption(key: "enable-keyboard", value: 'N');
} else {
if (parent.target != null) {
/// the result of toggle-on depends on user actions in the settings page.
/// handle result, see [ServerModel.changeStatue]
showInputWarnAlert(parent.target!);
}
}