mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-06-27 02:34:56 +03:00
Add Android device deployment flow (#15146)
* Add Android device deployment flow Notify the Android Flutter UI when the server requires deployment, add a deploy dialog with API token/custom ID inputs, and reuse shared deploy logic for CLI and FFI Signed-off-by: 21pages <sunboeasy@gmail.com> * Hide Android deploy API token input Signed-off-by: 21pages <sunboeasy@gmail.com> * add more translations Signed-off-by: 21pages <sunboeasy@gmail.com> * optimize transations Signed-off-by: 21pages <sunboeasy@gmail.com> * Hide deploy action for outgoing-only clients Signed-off-by: 21pages <sunboeasy@gmail.com> * Fix deployment register throttle state reset Signed-off-by: 21pages <sunboeasy@gmail.com> * Move Android deploy dialog out of settings page Signed-off-by: 21pages <sunboeasy@gmail.com> * Use async mutex for deploy register throttle Signed-off-by: 21pages <sunboeasy@gmail.com> --------- Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
@@ -1153,6 +1153,22 @@ pub fn main_get_api_server() -> String {
|
||||
get_api_server()
|
||||
}
|
||||
|
||||
pub fn main_deploy_device(token: String, id: String) -> String {
|
||||
#[cfg(target_os = "android")]
|
||||
{
|
||||
let new_id = match id.trim() {
|
||||
"" => None,
|
||||
id => Some(id.to_owned()),
|
||||
};
|
||||
ui_interface::deploy_device(token, new_id).message()
|
||||
}
|
||||
#[cfg(not(target_os = "android"))]
|
||||
{
|
||||
let _ = (token, id);
|
||||
"Deployment is not supported on this platform.".to_owned()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn main_resolve_avatar_url(avatar: String) -> SyncReturn<String> {
|
||||
SyncReturn(resolve_avatar_url(avatar))
|
||||
}
|
||||
@@ -2116,6 +2132,7 @@ pub fn main_start_service() {
|
||||
#[cfg(target_os = "android")]
|
||||
{
|
||||
config::Config::set_option("stop-service".into(), "".into());
|
||||
crate::rendezvous_mediator::reset_needs_deploy_notification();
|
||||
crate::rendezvous_mediator::RendezvousMediator::restart();
|
||||
}
|
||||
}
|
||||
@@ -3055,6 +3072,7 @@ pub mod server_side {
|
||||
pub unsafe extern "system" fn Java_ffi_FFI_startService(_env: JNIEnv, _class: JClass) {
|
||||
log::debug!("startService from jvm");
|
||||
config::Config::set_option("stop-service".into(), "".into());
|
||||
crate::rendezvous_mediator::reset_needs_deploy_notification();
|
||||
crate::rendezvous_mediator::RendezvousMediator::restart();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user