Merge branch 'master' into master
This commit is contained in:
commit
41870b50c2
@ -202,6 +202,28 @@ class RemoteCountState {
|
||||
static RxInt find() => Get.find<RxInt>(tag: tag());
|
||||
}
|
||||
|
||||
class PeerBoolOption {
|
||||
static String tag(String id, String opt) => 'peer_{$opt}_$id';
|
||||
|
||||
static void init(String id, String opt, bool Function() init_getter) {
|
||||
final key = tag(id, opt);
|
||||
if (!Get.isRegistered(tag: key)) {
|
||||
final RxBool value = RxBool(init_getter());
|
||||
Get.put(value, tag: key);
|
||||
}
|
||||
}
|
||||
|
||||
static void delete(String id, String opt) {
|
||||
final key = tag(id, opt);
|
||||
if (Get.isRegistered(tag: key)) {
|
||||
Get.delete(tag: key);
|
||||
}
|
||||
}
|
||||
|
||||
static RxBool find(String id, String opt) =>
|
||||
Get.find<RxBool>(tag: tag(id, opt));
|
||||
}
|
||||
|
||||
class PeerStringOption {
|
||||
static String tag(String id, String opt) => 'peer_{$opt}_$id';
|
||||
|
||||
|
@ -51,6 +51,7 @@ class _RemotePageState extends State<RemotePage>
|
||||
String keyboardMode = "legacy";
|
||||
final _cursorOverImage = false.obs;
|
||||
late RxBool _showRemoteCursor;
|
||||
late RxBool _zoomCursor;
|
||||
late RxBool _remoteCursorMoved;
|
||||
late RxBool _keyboardEnabled;
|
||||
|
||||
@ -68,6 +69,10 @@ class _RemotePageState extends State<RemotePage>
|
||||
KeyboardEnabledState.init(id);
|
||||
ShowRemoteCursorState.init(id);
|
||||
RemoteCursorMovedState.init(id);
|
||||
final optZoomCursor = 'zoom-cursor';
|
||||
PeerBoolOption.init(id, optZoomCursor,
|
||||
() => bind.sessionGetToggleOptionSync(id: id, arg: optZoomCursor));
|
||||
_zoomCursor = PeerBoolOption.find(id, optZoomCursor);
|
||||
_showRemoteCursor = ShowRemoteCursorState.find(id);
|
||||
_keyboardEnabled = KeyboardEnabledState.find(id);
|
||||
_remoteCursorMoved = RemoteCursorMovedState.find(id);
|
||||
@ -216,6 +221,7 @@ class _RemotePageState extends State<RemotePage>
|
||||
});
|
||||
return ImagePaint(
|
||||
id: widget.id,
|
||||
zoomCursor: _zoomCursor,
|
||||
cursorOverImage: _cursorOverImage,
|
||||
keyboardEnabled: _keyboardEnabled,
|
||||
remoteCursorMoved: _remoteCursorMoved,
|
||||
@ -233,6 +239,7 @@ class _RemotePageState extends State<RemotePage>
|
||||
visible: _showRemoteCursor.isTrue && _remoteCursorMoved.isTrue,
|
||||
child: CursorPaint(
|
||||
id: widget.id,
|
||||
zoomCursor: _zoomCursor,
|
||||
))));
|
||||
paints.add(QualityMonitor(_ffi.qualityMonitorModel));
|
||||
paints.add(RemoteMenubar(
|
||||
@ -253,6 +260,7 @@ class _RemotePageState extends State<RemotePage>
|
||||
|
||||
class ImagePaint extends StatefulWidget {
|
||||
final String id;
|
||||
final Rx<bool> zoomCursor;
|
||||
final Rx<bool> cursorOverImage;
|
||||
final Rx<bool> keyboardEnabled;
|
||||
final Rx<bool> remoteCursorMoved;
|
||||
@ -261,6 +269,7 @@ class ImagePaint extends StatefulWidget {
|
||||
ImagePaint(
|
||||
{Key? key,
|
||||
required this.id,
|
||||
required this.zoomCursor,
|
||||
required this.cursorOverImage,
|
||||
required this.keyboardEnabled,
|
||||
required this.remoteCursorMoved,
|
||||
@ -277,6 +286,7 @@ class _ImagePaintState extends State<ImagePaint> {
|
||||
final ScrollController _vertical = ScrollController();
|
||||
|
||||
String get id => widget.id;
|
||||
Rx<bool> get zoomCursor => widget.zoomCursor;
|
||||
Rx<bool> get cursorOverImage => widget.cursorOverImage;
|
||||
Rx<bool> get keyboardEnabled => widget.keyboardEnabled;
|
||||
Rx<bool> get remoteCursorMoved => widget.remoteCursorMoved;
|
||||
@ -357,7 +367,7 @@ class _ImagePaintState extends State<ImagePaint> {
|
||||
if (cache == null) {
|
||||
return MouseCursor.defer;
|
||||
} else {
|
||||
final key = cache.updateGetKey(scale);
|
||||
final key = cache.updateGetKey(scale, zoomCursor.value);
|
||||
cursor.addKey(key);
|
||||
return FlutterCustomMemoryImageCursor(
|
||||
pixbuf: cache.data,
|
||||
@ -500,8 +510,13 @@ class _ImagePaintState extends State<ImagePaint> {
|
||||
|
||||
class CursorPaint extends StatelessWidget {
|
||||
final String id;
|
||||
final RxBool zoomCursor;
|
||||
|
||||
const CursorPaint({Key? key, required this.id}) : super(key: key);
|
||||
const CursorPaint({
|
||||
Key? key,
|
||||
required this.id,
|
||||
required this.zoomCursor,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -516,13 +531,21 @@ class CursorPaint extends StatelessWidget {
|
||||
hoty = m.defaultImage!.height / 2;
|
||||
}
|
||||
}
|
||||
return CustomPaint(
|
||||
painter: ImagePainter(
|
||||
image: m.image ?? m.defaultImage,
|
||||
x: m.x - hotx + c.x / c.scale,
|
||||
y: m.y - hoty + c.y / c.scale,
|
||||
scale: c.scale),
|
||||
);
|
||||
return zoomCursor.isTrue
|
||||
? CustomPaint(
|
||||
painter: ImagePainter(
|
||||
image: m.image ?? m.defaultImage,
|
||||
x: m.x - hotx + c.x / c.scale,
|
||||
y: m.y - hoty + c.y / c.scale,
|
||||
scale: c.scale),
|
||||
)
|
||||
: CustomPaint(
|
||||
painter: ImagePainter(
|
||||
image: m.image ?? m.defaultImage,
|
||||
x: (m.x - hotx) * c.scale + c.x,
|
||||
y: (m.y - hoty) * c.scale + c.y,
|
||||
scale: 1.0),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,8 @@ class MenubarState {
|
||||
}
|
||||
|
||||
_initSet(bool s, bool p) {
|
||||
show = RxBool(s);
|
||||
// Show remubar when connection is established.
|
||||
show = RxBool(true);
|
||||
_pin = RxBool(p);
|
||||
}
|
||||
|
||||
@ -1109,6 +1110,25 @@ class _RemoteMenubarState extends State<RemoteMenubar> {
|
||||
);
|
||||
}());
|
||||
|
||||
/// Show remote cursor
|
||||
displayMenu.add(() {
|
||||
final opt = 'zoom-cursor';
|
||||
final state = PeerBoolOption.find(widget.id, opt);
|
||||
return MenuEntrySwitch2<String>(
|
||||
switchType: SwitchType.scheckbox,
|
||||
text: translate('Zoom cursor'),
|
||||
getter: () {
|
||||
return state;
|
||||
},
|
||||
setter: (bool v) async {
|
||||
state.value = v;
|
||||
await bind.sessionToggleOption(id: widget.id, value: opt);
|
||||
},
|
||||
padding: padding,
|
||||
dismissOnClicked: true,
|
||||
);
|
||||
}());
|
||||
|
||||
/// Show quality monitor
|
||||
displayMenu.add(MenuEntrySwitch<String>(
|
||||
switchType: SwitchType.scheckbox,
|
||||
|
@ -696,6 +696,8 @@ class CursorData {
|
||||
final img2.Image? image;
|
||||
double scale;
|
||||
Uint8List? data;
|
||||
final double hotxOrigin;
|
||||
final double hotyOrigin;
|
||||
double hotx;
|
||||
double hoty;
|
||||
final int width;
|
||||
@ -707,45 +709,53 @@ class CursorData {
|
||||
required this.image,
|
||||
required this.scale,
|
||||
required this.data,
|
||||
required this.hotx,
|
||||
required this.hoty,
|
||||
required this.hotxOrigin,
|
||||
required this.hotyOrigin,
|
||||
required this.width,
|
||||
required this.height,
|
||||
});
|
||||
}) : hotx = hotxOrigin * scale,
|
||||
hoty = hotxOrigin * scale;
|
||||
|
||||
int _doubleToInt(double v) => (v * 10e6).round().toInt();
|
||||
|
||||
double _checkUpdateScale(double scale) {
|
||||
// Update data if scale changed.
|
||||
if (Platform.isWindows) {
|
||||
final tgtWidth = (width * scale).toInt();
|
||||
final tgtHeight = (width * scale).toInt();
|
||||
if (tgtWidth < kMinCursorSize || tgtHeight < kMinCursorSize) {
|
||||
double sw = kMinCursorSize.toDouble() / width;
|
||||
double sh = kMinCursorSize.toDouble() / height;
|
||||
scale = sw < sh ? sh : sw;
|
||||
double _checkUpdateScale(double scale, bool shouldScale) {
|
||||
double oldScale = this.scale;
|
||||
if (!shouldScale) {
|
||||
scale = 1.0;
|
||||
} else {
|
||||
// Update data if scale changed.
|
||||
if (Platform.isWindows) {
|
||||
final tgtWidth = (width * scale).toInt();
|
||||
final tgtHeight = (width * scale).toInt();
|
||||
if (tgtWidth < kMinCursorSize || tgtHeight < kMinCursorSize) {
|
||||
double sw = kMinCursorSize.toDouble() / width;
|
||||
double sh = kMinCursorSize.toDouble() / height;
|
||||
scale = sw < sh ? sh : sw;
|
||||
}
|
||||
}
|
||||
if (_doubleToInt(this.scale) != _doubleToInt(scale)) {
|
||||
}
|
||||
|
||||
if (Platform.isWindows) {
|
||||
if (_doubleToInt(oldScale) != _doubleToInt(scale)) {
|
||||
data = img2
|
||||
.copyResize(
|
||||
image!,
|
||||
width: (width * scale).toInt(),
|
||||
height: (height * scale).toInt(),
|
||||
interpolation: img2.Interpolation.average,
|
||||
)
|
||||
.getBytes(format: img2.Format.bgra);
|
||||
}
|
||||
}
|
||||
|
||||
this.scale = scale;
|
||||
if (hotx > 0 && hoty > 0) {
|
||||
// default cursor data
|
||||
hotx = (width * scale) / 2;
|
||||
hoty = (height * scale) / 2;
|
||||
}
|
||||
hotx = hotxOrigin * scale;
|
||||
hoty = hotyOrigin * scale;
|
||||
return scale;
|
||||
}
|
||||
|
||||
String updateGetKey(double scale) {
|
||||
scale = _checkUpdateScale(scale);
|
||||
String updateGetKey(double scale, bool shouldScale) {
|
||||
scale = _checkUpdateScale(scale, shouldScale);
|
||||
return '${peerId}_${id}_${_doubleToInt(width * scale)}_${_doubleToInt(height * scale)}';
|
||||
}
|
||||
}
|
||||
@ -811,8 +821,6 @@ class CursorModel with ChangeNotifier {
|
||||
if (_defaultCache == null) {
|
||||
Uint8List data;
|
||||
double scale = 1.0;
|
||||
double hotx = (defaultCursorImage!.width * scale) / 2;
|
||||
double hoty = (defaultCursorImage!.height * scale) / 2;
|
||||
if (Platform.isWindows) {
|
||||
data = defaultCursorImage!.getBytes(format: img2.Format.bgra);
|
||||
} else {
|
||||
@ -825,8 +833,8 @@ class CursorModel with ChangeNotifier {
|
||||
image: defaultCursorImage?.clone(),
|
||||
scale: scale,
|
||||
data: data,
|
||||
hotx: hotx,
|
||||
hoty: hoty,
|
||||
hotxOrigin: defaultCursorImage!.width / 2,
|
||||
hotyOrigin: defaultCursorImage!.height / 2,
|
||||
width: defaultCursorImage!.width,
|
||||
height: defaultCursorImage!.height,
|
||||
);
|
||||
@ -996,10 +1004,8 @@ class CursorModel with ChangeNotifier {
|
||||
image: Platform.isWindows ? img2.Image.fromBytes(w, h, data) : null,
|
||||
scale: 1.0,
|
||||
data: data,
|
||||
hotx: 0,
|
||||
hoty: 0,
|
||||
// hotx: _hotx,
|
||||
// hoty: _hoty,
|
||||
hotxOrigin: _hotx,
|
||||
hotyOrigin: _hoty,
|
||||
width: w,
|
||||
height: h,
|
||||
);
|
||||
|
@ -380,7 +380,7 @@ impl TransferJob {
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn write(&mut self, block: FileTransferBlock, raw: Option<&[u8]>) -> ResultType<()> {
|
||||
pub async fn write(&mut self, block: FileTransferBlock) -> ResultType<()> {
|
||||
if block.id != self.id {
|
||||
bail!("Wrong id");
|
||||
}
|
||||
@ -402,20 +402,15 @@ impl TransferJob {
|
||||
let path = format!("{}.download", get_string(&path));
|
||||
self.file = Some(File::create(&path).await?);
|
||||
}
|
||||
let data = if let Some(data) = raw {
|
||||
data
|
||||
} else {
|
||||
&block.data
|
||||
};
|
||||
if block.compressed {
|
||||
let tmp = decompress(data);
|
||||
let tmp = decompress(&block.data);
|
||||
self.file.as_mut().unwrap().write_all(&tmp).await?;
|
||||
self.finished_size += tmp.len() as u64;
|
||||
} else {
|
||||
self.file.as_mut().unwrap().write_all(data).await?;
|
||||
self.finished_size += data.len() as u64;
|
||||
self.file.as_mut().unwrap().write_all(&block.data).await?;
|
||||
self.finished_size += block.data.len() as u64;
|
||||
}
|
||||
self.transferred += data.len() as u64;
|
||||
self.transferred += block.data.len() as u64;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -915,13 +915,8 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
}
|
||||
}
|
||||
Some(file_response::Union::Block(block)) => {
|
||||
log::info!(
|
||||
"file response block, file id:{}, file num: {}",
|
||||
block.id,
|
||||
block.file_num
|
||||
);
|
||||
if let Some(job) = fs::get_job(block.id, &mut self.write_jobs) {
|
||||
if let Err(_err) = job.write(block, None).await {
|
||||
if let Err(_err) = job.write(block).await {
|
||||
// to-do: add "skip" for writing job
|
||||
}
|
||||
self.update_jobs_status();
|
||||
|
@ -389,5 +389,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("or", "或"),
|
||||
("Continue with", "使用"),
|
||||
("Elevate", "提权"),
|
||||
("Zoom cursor", "缩放鼠标"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -389,5 +389,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("or", ""),
|
||||
("Continue with", ""),
|
||||
("Elevate", ""),
|
||||
("Zoom cursor", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -389,5 +389,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("or", ""),
|
||||
("Continue with", ""),
|
||||
("Elevate", ""),
|
||||
("Zoom cursor", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -389,5 +389,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("or", ""),
|
||||
("Continue with", ""),
|
||||
("Elevate", ""),
|
||||
("Zoom cursor", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -389,5 +389,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("or", ""),
|
||||
("Continue with", ""),
|
||||
("Elevate", ""),
|
||||
("Zoom cursor", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -389,5 +389,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("or", "o"),
|
||||
("Continue with", "Continuar con"),
|
||||
("Elevate", ""),
|
||||
("Zoom cursor", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -388,5 +388,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("This PC", "This PC"),
|
||||
("or", "یا"),
|
||||
("Continue with", "ادامه با"),
|
||||
("Zoom cursor", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -389,5 +389,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("or", "ou"),
|
||||
("Continue with", "Continuer avec"),
|
||||
("Elevate", ""),
|
||||
("Zoom cursor", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -389,5 +389,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("or", "vagy"),
|
||||
("Continue with", "Folytatás a következővel"),
|
||||
("Elevate", ""),
|
||||
("Zoom cursor", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -389,5 +389,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("or", ""),
|
||||
("Continue with", ""),
|
||||
("Elevate", ""),
|
||||
("Zoom cursor", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -389,5 +389,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("or", ""),
|
||||
("Continue with", ""),
|
||||
("Elevate", ""),
|
||||
("Zoom cursor", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -389,5 +389,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("or", ""),
|
||||
("Continue with", ""),
|
||||
("Elevate", ""),
|
||||
("Zoom cursor", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -389,5 +389,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("or", ""),
|
||||
("Continue with", ""),
|
||||
("Elevate", ""),
|
||||
("Zoom cursor", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -389,5 +389,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("or", ""),
|
||||
("Continue with", ""),
|
||||
("Elevate", ""),
|
||||
("Zoom cursor", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -389,5 +389,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("or", "albo"),
|
||||
("Continue with", "Kontynuuj z"),
|
||||
("Elevate", ""),
|
||||
("Zoom cursor", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -389,5 +389,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("or", ""),
|
||||
("Continue with", ""),
|
||||
("Elevate", ""),
|
||||
("Zoom cursor", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -389,5 +389,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("or", "ou"),
|
||||
("Continue with", "Continuar com"),
|
||||
("Elevate", ""),
|
||||
("Zoom cursor", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -389,5 +389,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("or", "или"),
|
||||
("Continue with", "Продолжить с"),
|
||||
("Elevate", ""),
|
||||
("Zoom cursor", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -389,5 +389,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("or", ""),
|
||||
("Continue with", ""),
|
||||
("Elevate", ""),
|
||||
("Zoom cursor", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -389,5 +389,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("or", ""),
|
||||
("Continue with", ""),
|
||||
("Elevate", ""),
|
||||
("Zoom cursor", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -389,5 +389,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("or", "veya"),
|
||||
("Continue with", "bununla devam et"),
|
||||
("Elevate", "Yükseltme"),
|
||||
("Zoom cursor", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -389,5 +389,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("or", ""),
|
||||
("Continue with", ""),
|
||||
("Elevate", "提權"),
|
||||
("Zoom cursor", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -389,5 +389,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("or", ""),
|
||||
("Continue with", ""),
|
||||
("Elevate", ""),
|
||||
("Zoom cursor", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -389,5 +389,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("or", ""),
|
||||
("Continue with", ""),
|
||||
("Elevate", ""),
|
||||
("Zoom cursor", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -1629,7 +1629,8 @@ async fn start_ipc(
|
||||
file_num,
|
||||
data,
|
||||
compressed}) = data {
|
||||
stream.send(&Data::FS(ipc::FS::WriteBlock{id, file_num, data, compressed})).await?;
|
||||
stream.send(&Data::FS(ipc::FS::WriteBlock{id, file_num, data: Bytes::new(), compressed})).await?;
|
||||
stream.send_raw(data).await?;
|
||||
} else {
|
||||
stream.send(&data).await?;
|
||||
}
|
||||
|
@ -1,3 +1,5 @@
|
||||
#[cfg(any(target_os = "android", target_os = "ios", feature = "flutter"))]
|
||||
use std::iter::FromIterator;
|
||||
#[cfg(windows)]
|
||||
use std::sync::Arc;
|
||||
use std::{
|
||||
@ -8,8 +10,6 @@ use std::{
|
||||
RwLock,
|
||||
},
|
||||
};
|
||||
#[cfg(any(target_os = "android", target_os = "ios", feature = "flutter"))]
|
||||
use std::iter::FromIterator;
|
||||
|
||||
#[cfg(windows)]
|
||||
use clipboard::{cliprdr::CliprdrClientContext, empty_clipboard, set_conn_enabled, ContextSend};
|
||||
@ -343,8 +343,15 @@ impl<T: InvokeUiCM> IpcTaskRunner<T> {
|
||||
Data::ChatMessage { text } => {
|
||||
self.cm.new_message(self.conn_id, text);
|
||||
}
|
||||
Data::FS(fs) => {
|
||||
handle_fs(fs, &mut write_jobs, &self.tx).await;
|
||||
Data::FS(mut fs) => {
|
||||
if let ipc::FS::WriteBlock { id, file_num, data: _, compressed } = fs {
|
||||
if let Ok(bytes) = self.stream.next_raw().await {
|
||||
fs = ipc::FS::WriteBlock{id, file_num, data:bytes.into(), compressed};
|
||||
handle_fs(fs, &mut write_jobs, &self.tx).await;
|
||||
}
|
||||
} else {
|
||||
handle_fs(fs, &mut write_jobs, &self.tx).await;
|
||||
}
|
||||
}
|
||||
#[cfg(windows)]
|
||||
Data::ClipbaordFile(_clip) => {
|
||||
@ -597,16 +604,13 @@ async fn handle_fs(fs: ipc::FS, write_jobs: &mut Vec<fs::TransferJob>, tx: &Unbo
|
||||
} => {
|
||||
if let Some(job) = fs::get_job(id, write_jobs) {
|
||||
if let Err(err) = job
|
||||
.write(
|
||||
FileTransferBlock {
|
||||
id,
|
||||
file_num,
|
||||
data,
|
||||
compressed,
|
||||
..Default::default()
|
||||
},
|
||||
None,
|
||||
)
|
||||
.write(FileTransferBlock {
|
||||
id,
|
||||
file_num,
|
||||
data,
|
||||
compressed,
|
||||
..Default::default()
|
||||
})
|
||||
.await
|
||||
{
|
||||
send_raw(fs::new_error(id, err, file_num), &tx);
|
||||
|
Loading…
x
Reference in New Issue
Block a user