Merge remote-tracking branch 'rustdesk/master' into flutter_desktop

# Conflicts:
#	Cargo.lock
#	Cargo.toml
#	build.rs
#	flutter/.gitignore
#	flutter/lib/common.dart
#	flutter/lib/mobile/pages/remote_page.dart
#	flutter/lib/models/model.dart
#	flutter/lib/models/native_model.dart
#	flutter/lib/models/server_model.dart
#	flutter/pubspec.lock
#	flutter/pubspec.yaml
#	src/client.rs
#	src/client/file_trait.rs
#	src/flutter.rs
#	src/mobile_ffi.rs
#	src/ui.rs
This commit is contained in:
Kingtous
2022-06-27 11:18:53 +08:00
138 changed files with 5534 additions and 798 deletions

View File

@@ -236,7 +236,7 @@ class AccessibilityListener extends StatelessWidget {
}
},
onPointerUp: (evt) {
if (evt.size == 1 && GestureBinding.instance != null) {
if (evt.size == 1) {
GestureBinding.instance.handlePointerEvent(PointerUpEvent(
pointer: evt.pointer + offset,
size: 0.1,
@@ -246,7 +246,7 @@ class AccessibilityListener extends StatelessWidget {
}
},
onPointerMove: (evt) {
if (evt.size == 1 && GestureBinding.instance != null) {
if (evt.size == 1) {
GestureBinding.instance.handlePointerEvent(PointerMoveEvent(
pointer: evt.pointer + offset,
size: 0.1,

View File

@@ -113,8 +113,8 @@ class _ConnectionPageState extends State<ConnectionPage> {
: InkWell(
onTap: () async {
final url = _updateUrl + '.apk';
if (await canLaunch(url)) {
await launch(url);
if (await canLaunchUrl(Uri.parse(url))) {
await launchUrl(Uri.parse(url));
}
},
child: Container(
@@ -275,7 +275,7 @@ class _ConnectionPageState extends State<ConnectionPage> {
? []
: [
PopupMenuItem<String>(
child: Text(translate('File transfer')), value: 'file')
child: Text(translate('Transfer File')), value: 'file')
]),
elevation: 8,
);

View File

@@ -35,6 +35,7 @@ class _RemotePageState extends State<RemotePage> {
String _value = '';
double _scale = 1;
double _mouseScrollIntegral = 0; // mouse scroll speed controller
Orientation? _currentOrientation;
var _more = true;
var _fn = false;
@@ -127,7 +128,7 @@ class _RemotePageState extends State<RemotePage> {
common < oldValue.length &&
common < newValue.length &&
newValue[common] == oldValue[common];
++common);
++common) {}
for (i = 0; i < oldValue.length - common; ++i) {
gFFI.inputKey('VK_BACK');
}
@@ -260,12 +261,22 @@ class _RemotePageState extends State<RemotePage> {
color: Colors.black,
child: isWebDesktop
? getBodyForDesktopWithListener(keyboard)
: SafeArea(
child: Container(
: SafeArea(child:
OrientationBuilder(builder: (ctx, orientation) {
if (_currentOrientation != orientation) {
debugPrint("on orientation changed");
Timer(Duration(milliseconds: 200), () {
resetMobileActionsOverlay();
_currentOrientation = orientation;
FFI.canvasModel.updateViewStyle();
});
}
return Container(
color: MyTheme.canvasColor,
child: _isPhysicalMouse
? getBodyForMobile()
: getBodyForMobileWithGesture())));
: getBodyForMobileWithGesture());
})));
})
],
))),

View File

@@ -204,7 +204,7 @@ class _PermissionCheckerState extends State<PermissionChecker> {
serverModel.toggleService),
PermissionRow(translate("Input Control"), serverModel.inputOk,
serverModel.toggleInput),
PermissionRow(translate("File Transfer"), serverModel.fileOk,
PermissionRow(translate("Transfer File"), serverModel.fileOk,
serverModel.toggleFile),
hasAudioPermission
? PermissionRow(translate("Audio Capture"), serverModel.audioOk,

View File

@@ -70,8 +70,8 @@ class _SettingsState extends State<SettingsPage> {
tiles: [
SettingsTile.navigation(
onPressed: (context) async {
if (await canLaunch(url)) {
await launch(url);
if (await canLaunchUrl(Uri.parse(url))) {
await launchUrl(Uri.parse(url));
}
},
title: Text(translate("Version: ") + version),
@@ -107,8 +107,8 @@ void showAbout() {
InkWell(
onTap: () async {
const url = 'https://rustdesk.com/';
if (await canLaunch(url)) {
await launch(url);
if (await canLaunchUrl(Uri.parse(url))) {
await launchUrl(Uri.parse(url));
}
},
child: Padding(
@@ -151,7 +151,7 @@ fetch('http://localhost:21114/api/login', {
'uuid': gFFI.getByName('uuid')
};
try {
final response = await http.post(Uri.parse('${url}/api/login'),
final response = await http.post(Uri.parse('$url/api/login'),
headers: {"Content-Type": "application/json"}, body: json.encode(body));
return parseResp(response.body);
} catch (e) {
@@ -189,7 +189,7 @@ void refreshCurrentUser() async {
'uuid': gFFI.getByName('uuid')
};
try {
final response = await http.post(Uri.parse('${url}/api/currentUser'),
final response = await http.post(Uri.parse('$url/api/currentUser'),
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer $token"
@@ -215,7 +215,7 @@ void logout() async {
'uuid': gFFI.getByName('uuid')
};
try {
await http.post(Uri.parse('${url}/api/logout'),
await http.post(Uri.parse('$url/api/logout'),
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer $token"
@@ -245,7 +245,7 @@ String getUrl() {
url = 'http://${tmp[0]}:$port';
}
} else {
url = 'http://${url}:21114';
url = 'http://$url:21114';
}
}
}

View File

@@ -594,10 +594,7 @@ class _TapTracker {
required this.entry,
required Duration doubleTapMinTime,
required this.gestureSettings,
}) : assert(doubleTapMinTime != null),
assert(event != null),
assert(event.buttons != null),
pointer = event.pointer,
}) : pointer = event.pointer,
_initialGlobalPosition = event.position,
initialButtons = event.buttons,
_doubleTapMinTimeCountdown =
@@ -643,7 +640,7 @@ class _TapTracker {
/// CountdownZoned tracks whether the specified duration has elapsed since
/// creation, honoring [Zone].
class _CountdownZoned {
_CountdownZoned({required Duration duration}) : assert(duration != null) {
_CountdownZoned({required Duration duration}) {
Timer(duration, _onTimeout);
}

View File

@@ -228,6 +228,12 @@ class DraggableMobileActions extends StatelessWidget {
}
}
resetMobileActionsOverlay() {
if (mobileActionsOverlayEntry == null) return;
hideMobileActionsOverlay();
showMobileActionsOverlay();
}
showMobileActionsOverlay() {
if (mobileActionsOverlayEntry != null) return;
if (globalKey.currentContext == null ||

View File

@@ -621,15 +621,7 @@ class FileFetcher {
tryCompleteTask(String? msg, String? isLocalStr) {
if (msg == null || isLocalStr == null) return;
late final isLocal;
late final tasks;
if (isLocalStr == "true") {
isLocal = true;
} else if (isLocalStr == "false") {
isLocal = false;
} else {
return;
}
try {
final fd = FileDirectory.fromJson(jsonDecode(msg));
if (fd.id > 0) {

View File

@@ -229,6 +229,7 @@ class FfiModel with ChangeNotifier {
}
void handleSwitchDisplay(Map<String, dynamic> evt) {
final oldOrientation = _display.width > _display.height;
var old = _pi.currentDisplay;
_pi.currentDisplay = int.parse(evt['display']);
_display.x = double.parse(evt['x']);
@@ -237,6 +238,11 @@ class FfiModel with ChangeNotifier {
_display.height = int.parse(evt['height']);
if (old != _pi.currentDisplay)
parent.target?.cursorModel.updateDisplayOrigin(_display.x, _display.y);
// remote is mobile, and orientation changed
if ((_display.width > _display.height) != oldOrientation) {
gFFI.canvasModel.updateViewStyle();
}
notifyListeners();
}

View File

@@ -56,7 +56,6 @@ class ServerModel with ChangeNotifier {
* 2. check config
* audio true by default (if permission on) (false default < Android 10)
* file true by default (if permission on)
* input false by default (it need turning on manually everytime)
*/
await Future.delayed(Duration(seconds: 1));

View File

@@ -1,3 +1,5 @@
// ignore_for_file: avoid_web_libraries_in_flutter
import 'dart:convert';
import 'dart:typed_data';
import 'dart:js';