mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-12-12 11:06:57 +00:00
android floating window (#8268)
Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
@@ -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