mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
android floating window (#8268)
Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
@@ -136,6 +136,8 @@ const String kOptionAllowRemoveWallpaper = "allow-remove-wallpaper";
|
||||
|
||||
const String kOptionToggleViewOnly = "view-only";
|
||||
|
||||
const String kOptionDisableFloatingWindow = "disable-floating-window";
|
||||
|
||||
const String kUrlActionClose = "close";
|
||||
|
||||
const String kTabLabelHomePage = "Home";
|
||||
|
||||
@@ -854,6 +854,15 @@ void androidChannelInit() {
|
||||
msgBox(gFFI.sessionId, type, title, text, link, gFFI.dialogManager);
|
||||
break;
|
||||
}
|
||||
case "stop_service":
|
||||
{
|
||||
print(
|
||||
"stop_service by kotlin, isStart:${gFFI.serverModel.isStart}");
|
||||
if (gFFI.serverModel.isStart) {
|
||||
gFFI.serverModel.stopService();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
debugPrintStack(label: "MethodCallHandler err:$e");
|
||||
|
||||
@@ -340,6 +340,20 @@ class ServerModel with ChangeNotifier {
|
||||
return res;
|
||||
}
|
||||
|
||||
Future<bool> checkFloatingWindowPermission() async {
|
||||
debugPrint("androidVersion $androidVersion");
|
||||
if (androidVersion < 23) {
|
||||
return false;
|
||||
}
|
||||
if (await AndroidPermissionManager.check(kSystemAlertWindow)) {
|
||||
debugPrint("alert window permission already granted");
|
||||
return true;
|
||||
}
|
||||
var res = await AndroidPermissionManager.request(kSystemAlertWindow);
|
||||
debugPrint("alert window permission request result: $res");
|
||||
return res;
|
||||
}
|
||||
|
||||
/// Toggle the screen sharing service.
|
||||
toggleService() async {
|
||||
if (_isStart) {
|
||||
@@ -367,6 +381,9 @@ class ServerModel with ChangeNotifier {
|
||||
}
|
||||
} else {
|
||||
await checkRequestNotificationPermission();
|
||||
if (bind.mainGetLocalOption(key: kOptionDisableFloatingWindow) != 'Y') {
|
||||
await checkFloatingWindowPermission();
|
||||
}
|
||||
if (!await AndroidPermissionManager.check(kManageExternalStorage)) {
|
||||
await AndroidPermissionManager.request(kManageExternalStorage);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user