code enhancement

Signed-off-by: Hamidi Mohammed <mr.hammiddi@gmail.com>
This commit is contained in:
Hamidi Mohammed
2022-06-19 17:15:37 +01:00
parent 086c8e43d7
commit 5a051ae3b6
8 changed files with 17 additions and 27 deletions

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';
}
}
}