add kActionAccessibilitySettings to manage Input Permission
This commit is contained in:
parent
48100c9e91
commit
73bc963311
@ -926,6 +926,11 @@ class AndroidPermissionManager {
|
||||
return gFFI.invokeMethod("check_permission", type);
|
||||
}
|
||||
|
||||
// startActivity goto Android Setting's page to request permission manually by user
|
||||
static void startAction(String action) {
|
||||
gFFI.invokeMethod(AndroidChannel.kStartAction, action);
|
||||
}
|
||||
|
||||
static Future<bool> request(String type) {
|
||||
if (isDesktop) {
|
||||
return Future.value(true);
|
||||
|
@ -142,6 +142,8 @@ const kActionApplicationDetailsSettings =
|
||||
"android.settings.APPLICATION_DETAILS_SETTINGS";
|
||||
const kActionRequestIgnoreBatteryOptimizations =
|
||||
"android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS";
|
||||
const kActionAccessibilitySettings = "android.settings.ACCESSIBILITY_SETTINGS";
|
||||
|
||||
const kRecordAudio = "android.permission.RECORD_AUDIO";
|
||||
const kManageExternalStorage = "android.permission.MANAGE_EXTERNAL_STORAGE";
|
||||
const kSystemAlertWindow = "android.permission.SYSTEM_ALERT_WINDOW";
|
||||
|
@ -305,7 +305,7 @@ class _SettingsState extends State<SettingsPage> with WidgetsBindingObserver {
|
||||
]),
|
||||
onToggle: (v) async {
|
||||
if (v) {
|
||||
gFFI.invokeMethod(AndroidChannel.kStartAction,
|
||||
AndroidPermissionManager.startAction(
|
||||
kActionRequestIgnoreBatteryOptimizations);
|
||||
} else {
|
||||
final res = await gFFI.dialogManager
|
||||
@ -323,7 +323,7 @@ class _SettingsState extends State<SettingsPage> with WidgetsBindingObserver {
|
||||
],
|
||||
));
|
||||
if (res == true) {
|
||||
gFFI.invokeMethod(AndroidChannel.kStartAction,
|
||||
AndroidPermissionManager.startAction(
|
||||
kActionApplicationDetailsSettings);
|
||||
}
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ class ServerModel with ChangeNotifier {
|
||||
if (!_audioOk && !await AndroidPermissionManager.check(kRecordAudio)) {
|
||||
final res = await AndroidPermissionManager.request(kRecordAudio);
|
||||
if (!res) {
|
||||
// TODO handle fail
|
||||
showToast(translate('Failed'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -250,7 +250,7 @@ class ServerModel with ChangeNotifier {
|
||||
final res =
|
||||
await AndroidPermissionManager.request(kManageExternalStorage);
|
||||
if (!res) {
|
||||
// TODO handle fail
|
||||
showToast(translate('Failed'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -348,10 +348,6 @@ class ServerModel with ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> initInput() async {
|
||||
await parent.target?.invokeMethod("init_input");
|
||||
}
|
||||
|
||||
Future<bool> setPermanentPassword(String newPW) async {
|
||||
await bind.mainSetPermanentPassword(password: newPW);
|
||||
await Future.delayed(Duration(milliseconds: 500));
|
||||
@ -689,7 +685,7 @@ String getLoginDialogTag(int id) {
|
||||
showInputWarnAlert(FFI ffi) {
|
||||
ffi.dialogManager.show((setState, close) {
|
||||
submit() {
|
||||
ffi.serverModel.initInput();
|
||||
AndroidPermissionManager.startAction(kActionAccessibilitySettings);
|
||||
close();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user