fix: hook for pc only

This commit is contained in:
Kingtous 2023-04-17 00:54:34 +08:00
parent 05ac93ec40
commit f56fc6fdb0
3 changed files with 11 additions and 5 deletions

View File

@ -400,7 +400,7 @@ jobs:
shell: bash shell: bash
run: | run: |
pushd /opt pushd /opt
git clone https://github.com/Kingtous/rustdesk_thirdparty_lib.git --depth=1 sudo git clone https://github.com/Kingtous/rustdesk_thirdparty_lib.git --depth=1
- name: Restore bridge files - name: Restore bridge files
uses: actions/download-artifact@master uses: actions/download-artifact@master
@ -422,8 +422,9 @@ jobs:
key: ${{ matrix.job.target }}-${{ matrix.job.extra-build-features }} key: ${{ matrix.job.target }}-${{ matrix.job.extra-build-features }}
- name: Disable rust bridge build - name: Disable rust bridge build
shell: bash
run: | run: |
sed -i "s/gen_flutter_rust_bridge();/\/\//g" build.rs sed -i build.rs.bak "s/gen_flutter_rust_bridge();/\/\//g" build.rs
- name: Build rustdesk lib - name: Build rustdesk lib
env: env:

View File

@ -1,5 +1,4 @@
use crate::{ use crate::{
api::SessionHook,
client::*, client::*,
flutter_ffi::EventToUI, flutter_ffi::EventToUI,
ui_session_interface::{io_loop, InvokeUiSession, Session}, ui_session_interface::{io_loop, InvokeUiSession, Session},
@ -147,7 +146,8 @@ pub struct FlutterHandler {
notify_rendered: Arc<RwLock<bool>>, notify_rendered: Arc<RwLock<bool>>,
renderer: Arc<RwLock<VideoRenderer>>, renderer: Arc<RwLock<VideoRenderer>>,
peer_info: Arc<RwLock<PeerInfo>>, peer_info: Arc<RwLock<PeerInfo>>,
hooks: Arc<RwLock<HashMap<String, SessionHook>>>, #[cfg(not(any(target_os = "android", target_os = "ios")))]
hooks: Arc<RwLock<HashMap<String, crate::api::SessionHook>>>,
} }
#[cfg(not(feature = "flutter_texture_render"))] #[cfg(not(feature = "flutter_texture_render"))]
@ -159,7 +159,8 @@ pub struct FlutterHandler {
pub rgba: Arc<RwLock<Vec<u8>>>, pub rgba: Arc<RwLock<Vec<u8>>>,
pub rgba_valid: Arc<AtomicBool>, pub rgba_valid: Arc<AtomicBool>,
peer_info: Arc<RwLock<PeerInfo>>, peer_info: Arc<RwLock<PeerInfo>>,
hooks: Arc<RwLock<HashMap<String, SessionHook>>>, #[cfg(not(any(target_os = "android", target_os = "ios")))]
hooks: Arc<RwLock<HashMap<String, crate::api::SessionHook>>>,
} }
#[cfg(feature = "flutter_texture_render")] #[cfg(feature = "flutter_texture_render")]
@ -280,6 +281,7 @@ impl FlutterHandler {
serde_json::ser::to_string(&msg_vec).unwrap_or("".to_owned()) serde_json::ser::to_string(&msg_vec).unwrap_or("".to_owned())
} }
#[cfg(not(any(target_os = "android", target_os = "ios")))]
pub(crate) fn add_session_hook(&self, key: String, hook: crate::api::SessionHook) -> bool { pub(crate) fn add_session_hook(&self, key: String, hook: crate::api::SessionHook) -> bool {
let mut hooks = self.hooks.write().unwrap(); let mut hooks = self.hooks.write().unwrap();
if hooks.contains_key(&key) { if hooks.contains_key(&key) {
@ -290,6 +292,7 @@ impl FlutterHandler {
true true
} }
#[cfg(not(any(target_os = "android", target_os = "ios")))]
pub(crate) fn remove_session_hook(&self, key: &String) -> bool { pub(crate) fn remove_session_hook(&self, key: &String) -> bool {
let mut hooks = self.hooks.write().unwrap(); let mut hooks = self.hooks.write().unwrap();
if !hooks.contains_key(key) { if !hooks.contains_key(key) {

View File

@ -49,8 +49,10 @@ mod license;
mod port_forward; mod port_forward;
#[cfg(not(any(target_os = "android", target_os = "ios")))] #[cfg(not(any(target_os = "android", target_os = "ios")))]
#[cfg(any(feature = "flutter"))]
pub mod api; pub mod api;
#[cfg(not(any(target_os = "android", target_os = "ios")))] #[cfg(not(any(target_os = "android", target_os = "ios")))]
#[cfg(any(feature = "flutter"))]
pub mod plugins; pub mod plugins;
mod tray; mod tray;