mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-12-12 02:57:22 +00:00
add: android file transfer logic
This commit is contained in:
@@ -144,6 +144,28 @@ class FileModel extends ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
overrideFileConfirm(Map<String,dynamic> evt) async {
|
||||
final resp = await showFileConfirmDialog(
|
||||
translate("Overwrite"), "${evt['read_path']}", true);
|
||||
if (false == resp) {
|
||||
cancelJob(int.tryParse(evt['id']) ?? 0);
|
||||
} else {
|
||||
var msg = Map()
|
||||
..['id'] = evt['id']
|
||||
..['file_num'] = evt['file_num']
|
||||
..['is_upload'] = evt['is_upload']
|
||||
..['remember'] = fileConfirmCheckboxRemember.toString();
|
||||
if (resp == null) {
|
||||
// skip
|
||||
msg['need_override'] = 'false';
|
||||
} else {
|
||||
// overwrite
|
||||
msg['need_override'] = 'true';
|
||||
}
|
||||
FFI.setByName("set_confirm_override_file", jsonEncode(msg));
|
||||
}
|
||||
}
|
||||
|
||||
jobReset() {
|
||||
_jobProgress.clear();
|
||||
notifyListeners();
|
||||
@@ -392,6 +414,60 @@ class FileModel extends ChangeNotifier {
|
||||
useAnimation: false);
|
||||
}
|
||||
|
||||
bool fileConfirmCheckboxRemember = false;
|
||||
|
||||
Future<bool?> showFileConfirmDialog(
|
||||
String title, String content, bool showCheckbox) async {
|
||||
return await DialogManager.show<bool?>(
|
||||
(setState, Function(bool? v) close) => CustomAlertDialog(
|
||||
title: Row(
|
||||
children: [
|
||||
Icon(Icons.warning, color: Colors.red),
|
||||
SizedBox(width: 20),
|
||||
Text(title)
|
||||
],
|
||||
),
|
||||
content: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(translate("This file exists, skip or overwrite this file?"),
|
||||
style: TextStyle(fontWeight: FontWeight.bold)),
|
||||
SizedBox(height: 5),
|
||||
Text(content),
|
||||
showCheckbox
|
||||
? CheckboxListTile(
|
||||
contentPadding: const EdgeInsets.all(0),
|
||||
dense: true,
|
||||
controlAffinity: ListTileControlAffinity.leading,
|
||||
title: Text(
|
||||
translate("Do this for all conflicts"),
|
||||
),
|
||||
value: fileConfirmCheckboxRemember,
|
||||
onChanged: (v) {
|
||||
if (v == null) return;
|
||||
setState(() => fileConfirmCheckboxRemember = v);
|
||||
},
|
||||
)
|
||||
: SizedBox.shrink()
|
||||
]),
|
||||
actions: [
|
||||
TextButton(
|
||||
style: flatButtonStyle,
|
||||
onPressed: () => close(false),
|
||||
child: Text(translate("Cancel"))),
|
||||
TextButton(
|
||||
style: flatButtonStyle,
|
||||
onPressed: () => close(null),
|
||||
child: Text(translate("Skip"))),
|
||||
TextButton(
|
||||
style: flatButtonStyle,
|
||||
onPressed: () => close(true),
|
||||
child: Text(translate("OK"))),
|
||||
]),
|
||||
useAnimation: false);
|
||||
}
|
||||
|
||||
sendRemoveFile(String path, int fileNum, bool isLocal) {
|
||||
final msg = {
|
||||
"id": _jobId.toString(),
|
||||
|
||||
Reference in New Issue
Block a user