feat: android, controlled side, clipboard text (#8677)

Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
fufesou 2024-07-11 12:02:19 +08:00 committed by GitHub
parent ef4d84657b
commit b5a7165015
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2049,11 +2049,27 @@ impl Connection {
}
self.update_auto_disconnect_timer();
}
Some(message::Union::Clipboard(_cb)) =>
{
#[cfg(not(any(target_os = "android", target_os = "ios")))]
Some(message::Union::Clipboard(cb)) => {
if self.clipboard {
update_clipboard(_cb, None);
#[cfg(not(any(target_os = "android", target_os = "ios")))]
update_clipboard(cb, None);
#[cfg(all(feature = "flutter", target_os = "android"))]
{
let content = if cb.compress {
hbb_common::compress::decompress(&cb.content)
} else {
cb.content.into()
};
if let Ok(content) = String::from_utf8(content) {
let data = HashMap::from([
("name", "clipboard"),
("content", &content),
]);
if let Ok(data) = serde_json::to_string(&data) {
let _ = crate::flutter::push_global_event(crate::flutter::APP_TYPE_MAIN, data);
}
}
}
}
}
Some(message::Union::Cliprdr(_clip)) =>