Merge pull request #818 from hammiddi/master

code enhancement
This commit is contained in:
RustDesk 2022-06-20 11:37:18 +08:00 committed by GitHub
commit c1906914a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 17 additions and 27 deletions

View File

@ -233,7 +233,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,
@ -243,7 +243,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

@ -593,15 +593,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

@ -21,7 +21,6 @@ typedef F2 = Pointer<Utf8> Function(Pointer<Utf8>, Pointer<Utf8>);
typedef F3 = void Function(Pointer<Utf8>, Pointer<Utf8>);
class PlatformFFI {
static Pointer<RgbaFrame>? _lastRgbaFrame;
static String _dir = '';
static String _homeDir = '';
static F2? _getByName;

View File

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

View File

@ -100,8 +100,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(

View File

@ -126,7 +126,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) {
FFI.inputKey('VK_BACK');
}

View File

@ -68,8 +68,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),
@ -105,8 +105,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(
@ -149,7 +149,7 @@ fetch('http://localhost:21114/api/login', {
'uuid': FFI.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) {
@ -186,7 +186,7 @@ void refreshCurrentUser() async {
'uuid': FFI.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"
@ -212,7 +212,7 @@ void logout() async {
'uuid': FFI.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"
@ -242,7 +242,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);
}