Merge pull request #3239 from fufesou/refact/text_clipboard

build android
This commit is contained in:
RustDesk 2023-02-16 21:41:29 +08:00 committed by GitHub
commit 5b58e957f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 3 deletions

View File

@ -18,6 +18,8 @@ use sha2::{Digest, Sha256};
use uuid::Uuid;
pub use file_trait::FileManager;
#[cfg(not(any(target_os = "android", target_os = "ios")))]
use hbb_common::tokio::sync::mpsc::UnboundedSender;
use hbb_common::{
allow_err,
anyhow::{anyhow, Context},
@ -34,7 +36,7 @@ use hbb_common::{
socket_client,
sodiumoxide::crypto::{box_, secretbox, sign},
timeout,
tokio::{sync::mpsc::UnboundedSender, time::Duration},
tokio::time::Duration,
AddrMangle, ResultType, Stream,
};
pub use helper::LatencyController;
@ -1240,6 +1242,7 @@ impl LoginConfigHandler {
self.save_config(config);
}
#[cfg(feature = "flutter")]
#[cfg(not(any(target_os = "android", target_os = "ios")))]
if name == "disable-clipboard" {
crate::flutter::update_text_clipboard_required();
}

View File

@ -233,6 +233,7 @@ impl<T: InvokeUiSession> Remote<T> {
.msgbox("error", "Connection Error", &err.to_string(), "");
}
}
#[cfg(not(any(target_os = "android", target_os = "ios")))]
Client::try_stop_clipboard(&self.handler.id);
}
@ -841,13 +842,16 @@ impl<T: InvokeUiSession> Remote<T> {
let permission_config = self.handler.get_permission_config();
#[cfg(feature = "flutter")]
#[cfg(not(any(target_os = "android", target_os = "ios")))]
Client::try_start_clipboard(None);
#[cfg(not(feature = "flutter"))]
#[cfg(not(any(target_os = "android", target_os = "ios")))]
Client::try_start_clipboard(Some((
permission_config.clone(),
sender.clone(),
)));
#[cfg(not(any(target_os = "android", target_os = "ios")))]
tokio::spawn(async move {
// due to clipboard service interval time
sleep(common::CLIPBOARD_INTERVAL as f32 / 1_000.).await;
@ -1050,12 +1054,14 @@ impl<T: InvokeUiSession> Remote<T> {
match p.permission.enum_value_or_default() {
Permission::Keyboard => {
#[cfg(feature = "flutter")]
#[cfg(not(any(target_os = "android", target_os = "ios")))]
crate::flutter::update_text_clipboard_required();
*self.handler.server_keyboard_enabled.write().unwrap() = p.enabled;
self.handler.set_permission("keyboard", p.enabled);
}
Permission::Clipboard => {
#[cfg(feature = "flutter")]
#[cfg(not(any(target_os = "android", target_os = "ios")))]
crate::flutter::update_text_clipboard_required();
*self.handler.server_clipboard_enabled.write().unwrap() = p.enabled;
self.handler.set_permission("clipboard", p.enabled);

View File

@ -1,11 +1,13 @@
use crate::{
client::file_trait::FileManager,
common::make_fd_to_json,
common::{get_default_sound_input, is_keyboard_mode_supported},
common::is_keyboard_mode_supported,
flutter::{self, SESSIONS},
flutter::{session_add, session_start_},
ui_interface::{self, *},
};
#[cfg(not(any(target_os = "android", target_os = "ios")))]
use crate::common::get_default_sound_input;
use flutter_rust_bridge::{StreamSink, SyncReturn};
use hbb_common::{
config::{self, LocalConfig, PeerConfig, ONLINE},

View File

@ -5,7 +5,9 @@ use crate::common::GrabState;
use crate::flutter::{CUR_SESSION_ID, SESSIONS};
#[cfg(not(any(feature = "flutter", feature = "cli")))]
use crate::ui::CUR_SESSION;
use hbb_common::{log, message_proto::*};
use hbb_common::message_proto::*;
#[cfg(not(any(target_os = "android", target_os = "ios")))]
use hbb_common::log;
use rdev::{Event, EventType, Key};
#[cfg(any(target_os = "windows", target_os = "macos"))]
use std::sync::atomic::{AtomicBool, Ordering};

View File

@ -1,3 +1,4 @@
#[cfg(not(any(target_os = "android", target_os = "ios")))]
use std::collections::HashMap;
use std::ops::{Deref, DerefMut};
use std::str::FromStr;