diff --git a/Cargo.toml b/Cargo.toml index fd84b73aa..2861b3f63 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -151,7 +151,7 @@ hound = "3.5" name = "RustDesk" identifier = "com.carriez.rustdesk" icon = ["res/32x32.png", "res/128x128.png", "res/128x128@2x.png"] -deb_depends = ["libgtk-3-0", "libxcb-randr0", "libxdo3", "libxfixes3", "libxcb-shape0", "libxcb-xfixes0", "libasound2", "libsystemd0", "curl", "libappindicator3-1", "libvdpau1", "libva2"] +deb_depends = ["libgtk-3-0", "libxcb-randr0", "libxdo3", "libxfixes3", "libxcb-shape0", "libxcb-xfixes0", "libasound2", "libsystemd0", "curl", "libvdpau1", "libva2"] osx_minimum_system_version = "10.14" resources = ["res/mac-tray-light.png","res/mac-tray-dark.png"] diff --git a/README.md b/README.md index 2fd744429..ad19edaa1 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ Please download sciter dynamic library yourself. ```sh sudo apt install -y zip g++ gcc git curl wget nasm yasm libgtk-3-dev clang libxcb-randr0-dev libxdo-dev \ libxfixes-dev libxcb-shape0-dev libxcb-xfixes0-dev libasound2-dev libpulse-dev cmake make \ - libclang-dev ninja-build libappindicator3-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev + libclang-dev ninja-build libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev ``` ### openSUSE Tumbleweed diff --git a/build.py b/build.py index 42438909f..fc62f8ecb 100755 --- a/build.py +++ b/build.py @@ -217,7 +217,7 @@ Version: %s Architecture: amd64 Maintainer: open-trade Homepage: https://rustdesk.com -Depends: libgtk-3-0, libxcb-randr0, libxdo3, libxfixes3, libxcb-shape0, libxcb-xfixes0, libasound2, libsystemd0, curl, libappindicator3-1, libva-drm2, libva-x11-2, libvdpau1, libgstreamer-plugins-base1.0-0 +Depends: libgtk-3-0, libxcb-randr0, libxdo3, libxfixes3, libxcb-shape0, libxcb-xfixes0, libasound2, libsystemd0, curl, libva-drm2, libva-x11-2, libvdpau1, libgstreamer-plugins-base1.0-0 Description: A remote control software. """ % version diff --git a/flutter/lib/models/native_model.dart b/flutter/lib/models/native_model.dart index 68b85968a..0a833583e 100644 --- a/flutter/lib/models/native_model.dart +++ b/flutter/lib/models/native_model.dart @@ -29,6 +29,7 @@ typedef HandleEvent = Future Function(Map evt); /// Hides the platform differences. class PlatformFFI { String _dir = ''; + // _homeDir is only needed for Android and IOS. String _homeDir = ''; F2? _translate; final _eventHandlers = >{}; @@ -119,8 +120,10 @@ class PlatformFFI { if (isAndroid) { // only support for android _homeDir = (await ExternalPath.getExternalStorageDirectories())[0]; + } else if (isIOS) { + _homeDir = _ffiBind.mainGetDataDirIos(); } else { - _homeDir = (await getDownloadsDirectory())?.path ?? ''; + // no need to set home dir } } catch (e) { debugPrint('initialize failed: $e'); @@ -159,8 +162,13 @@ class PlatformFFI { name = macOsInfo.computerName; id = macOsInfo.systemGUID ?? ''; } - debugPrint( - '_appType:$_appType,info1-id:$id,info2-name:$name,dir:$_dir,homeDir:$_homeDir'); + if (isAndroid || isIOS) { + debugPrint( + '_appType:$_appType,info1-id:$id,info2-name:$name,dir:$_dir,homeDir:$_homeDir'); + } else { + debugPrint( + '_appType:$_appType,info1-id:$id,info2-name:$name,dir:$_dir'); + } await _ffiBind.mainDeviceId(id: id); await _ffiBind.mainDeviceName(name: name); await _ffiBind.mainSetHomeDir(home: _homeDir); diff --git a/flutter/lib/utils/tray_manager.dart b/flutter/lib/utils/tray_manager.dart deleted file mode 100644 index 91550e1d8..000000000 --- a/flutter/lib/utils/tray_manager.dart +++ /dev/null @@ -1,32 +0,0 @@ -import 'dart:io'; - -import 'package:tray_manager/tray_manager.dart'; - -import '../common.dart'; - -const kTrayItemShowKey = "show"; -const kTrayItemQuitKey = "quit"; - -Future initTray({List? extra_item}) async { - List items = [ - MenuItem(key: kTrayItemShowKey, label: translate("Show RustDesk")), - MenuItem.separator(), - MenuItem(key: kTrayItemQuitKey, label: translate("Quit")), - ]; - if (extra_item != null) { - items.insertAll(0, extra_item); - } - if (Platform.isMacOS || Platform.isWindows) { - await trayManager.setToolTip("rustdesk"); - } - if (Platform.isMacOS || Platform.isLinux) { - await trayManager.setTitle("rustdesk"); - } - await trayManager - .setIcon(Platform.isWindows ? "assets/logo.ico" : "assets/logo.png"); - await trayManager.setContextMenu(Menu(items: items)); -} - -Future destoryTray() async { - return trayManager.destroy(); -} diff --git a/libs/hbb_common/src/config.rs b/libs/hbb_common/src/config.rs index f476816ef..328a1ea59 100644 --- a/libs/hbb_common/src/config.rs +++ b/libs/hbb_common/src/config.rs @@ -57,6 +57,10 @@ lazy_static::lazy_static! { lazy_static::lazy_static! { pub static ref APP_DIR: Arc> = Default::default(); +} + +#[cfg(any(target_os = "android", target_os = "ios"))] +lazy_static::lazy_static! { pub static ref APP_HOME_DIR: Arc> = Default::default(); } diff --git a/src/flutter_ffi.rs b/src/flutter_ffi.rs index 0f3fb5ef6..094a2faa7 100644 --- a/src/flutter_ffi.rs +++ b/src/flutter_ffi.rs @@ -967,8 +967,22 @@ pub fn session_change_prefer_codec(id: String) { } } -pub fn main_set_home_dir(home: String) { - *config::APP_HOME_DIR.write().unwrap() = home; +pub fn main_set_home_dir(_home: String) { + #[cfg(any(target_os = "android", target_os = "ios"))] + { + *config::APP_HOME_DIR.write().unwrap() = _home; + } +} + +// This is a temporary method to get data dir for ios +pub fn main_get_data_dir_ios() -> SyncReturn { + let data_dir = config::Config::path("data"); + if !data_dir.exists() { + if let Err(e) = std::fs::create_dir_all(&data_dir) { + log::warn!("Failed to create data dir {}", e); + } + } + SyncReturn(data_dir.to_string_lossy().to_string()) } pub fn main_stop_service() {