just format
This commit is contained in:
parent
bb21435faa
commit
ba2b30f488
@ -50,8 +50,9 @@ class ServerModel with ChangeNotifier {
|
||||
// audio
|
||||
if (androidVersion < 30 || !await PermissionManager.check("audio")) {
|
||||
_audioOk = false;
|
||||
FFI.setByName('option', jsonEncode(
|
||||
Map()
|
||||
FFI.setByName(
|
||||
'option',
|
||||
jsonEncode(Map()
|
||||
..["name"] = "enable-audio"
|
||||
..["value"] = "N"));
|
||||
} else {
|
||||
@ -62,8 +63,9 @@ class ServerModel with ChangeNotifier {
|
||||
// file
|
||||
if (!await PermissionManager.check("file")) {
|
||||
_fileOk = false;
|
||||
FFI.setByName('option', jsonEncode(
|
||||
Map()
|
||||
FFI.setByName(
|
||||
'option',
|
||||
jsonEncode(Map()
|
||||
..["name"] = "enable-file-transfer"
|
||||
..["value"] = "N"));
|
||||
} else {
|
||||
@ -124,7 +126,8 @@ class ServerModel with ChangeNotifier {
|
||||
|
||||
toggleService() async {
|
||||
if (_isStart) {
|
||||
final res = await DialogManager.show<bool>((setState, close) => CustomAlertDialog(
|
||||
final res =
|
||||
await DialogManager.show<bool>((setState, close) => CustomAlertDialog(
|
||||
title: Row(children: [
|
||||
Icon(Icons.warning_amber_sharp,
|
||||
color: Colors.redAccent, size: 28),
|
||||
@ -133,15 +136,20 @@ class ServerModel with ChangeNotifier {
|
||||
]),
|
||||
content: Text(translate("android_stop_service_tip")),
|
||||
actions: [
|
||||
TextButton(onPressed: ()=>close(), child: Text(translate("Cancel"))),
|
||||
ElevatedButton(onPressed: ()=>close(true), child: Text(translate("OK"))),
|
||||
TextButton(
|
||||
onPressed: () => close(),
|
||||
child: Text(translate("Cancel"))),
|
||||
ElevatedButton(
|
||||
onPressed: () => close(true),
|
||||
child: Text(translate("OK"))),
|
||||
],
|
||||
));
|
||||
if (res == true) {
|
||||
stopService();
|
||||
}
|
||||
} else {
|
||||
final res = await DialogManager.show<bool>((setState, close) => CustomAlertDialog(
|
||||
final res =
|
||||
await DialogManager.show<bool>((setState, close) => CustomAlertDialog(
|
||||
title: Row(children: [
|
||||
Icon(Icons.warning_amber_sharp,
|
||||
color: Colors.redAccent, size: 28),
|
||||
@ -150,8 +158,12 @@ class ServerModel with ChangeNotifier {
|
||||
]),
|
||||
content: Text(translate("android_service_will_start_tip")),
|
||||
actions: [
|
||||
TextButton(onPressed: ()=>close(), child: Text(translate("Cancel"))),
|
||||
ElevatedButton(onPressed: ()=>close(true), child: Text(translate("OK"))),
|
||||
TextButton(
|
||||
onPressed: () => close(),
|
||||
child: Text(translate("Cancel"))),
|
||||
ElevatedButton(
|
||||
onPressed: () => close(true),
|
||||
child: Text(translate("OK"))),
|
||||
],
|
||||
));
|
||||
if (res == true) {
|
||||
@ -240,7 +252,6 @@ class ServerModel with ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
|
||||
changeStatue(String name, bool value) {
|
||||
debugPrint("changeStatue value $value");
|
||||
switch (name) {
|
||||
@ -283,11 +294,14 @@ class ServerModel with ChangeNotifier {
|
||||
final client = Client.fromJson(jsonDecode(evt["client"]));
|
||||
final Map<String, dynamic> response = Map();
|
||||
response["id"] = client.id;
|
||||
DialogManager.show((setState, close) => CustomAlertDialog(
|
||||
DialogManager.show(
|
||||
(setState, close) => CustomAlertDialog(
|
||||
title: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(translate(client.isFileTransfer?"File Connection":"Screen Connection")),
|
||||
Text(translate(client.isFileTransfer
|
||||
? "File Connection"
|
||||
: "Screen Connection")),
|
||||
IconButton(onPressed: close, icon: Icon(Icons.close))
|
||||
]),
|
||||
content: Column(
|
||||
@ -297,7 +311,10 @@ class ServerModel with ChangeNotifier {
|
||||
children: [
|
||||
Text(translate("Do you accept?")),
|
||||
clientInfo(client),
|
||||
Text(translate("android_new_connection_tip"),style: TextStyle(color: Colors.black54),),
|
||||
Text(
|
||||
translate("android_new_connection_tip"),
|
||||
style: TextStyle(color: Colors.black54),
|
||||
),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
@ -322,7 +339,10 @@ class ServerModel with ChangeNotifier {
|
||||
notifyListeners();
|
||||
close();
|
||||
}),
|
||||
],onWillPop: ()async=>true,),barrierDismissible: true);
|
||||
],
|
||||
onWillPop: () async => true,
|
||||
),
|
||||
barrierDismissible: true);
|
||||
} catch (e) {
|
||||
debugPrint("loginRequest failed,error:$e");
|
||||
}
|
||||
@ -335,9 +355,7 @@ class ServerModel with ChangeNotifier {
|
||||
DialogManager.reset();
|
||||
_clients[client.id] = client;
|
||||
notifyListeners();
|
||||
}catch(e){
|
||||
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
void onClientRemove(Map<String, dynamic> evt) {
|
||||
@ -375,7 +393,8 @@ class Client {
|
||||
bool audio = false;
|
||||
late ChatUser chatUser;
|
||||
|
||||
Client(this.authorized, this.isFileTransfer, this.name, this.peerId,this.keyboard,this.clipboard,this.audio);
|
||||
Client(this.authorized, this.isFileTransfer, this.name, this.peerId,
|
||||
this.keyboard, this.clipboard, this.audio);
|
||||
|
||||
Client.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
|
Loading…
x
Reference in New Issue
Block a user