Adjusted checks for auto-type permissions

We do not need to check for screen recording permissions, if auto-type is executed. Only global auto-type requires screen recording permissions and should check for them.
This commit is contained in:
Michael Starke
2020-09-21 17:44:15 +02:00
parent e4946bd91b
commit 7095d55670
6 changed files with 37 additions and 19 deletions

View File

@@ -51,14 +51,17 @@
return instance;
}
- (BOOL)hasNecessaryAutotypePermissions {
if(![self hasAccessibiltyPermissions:NULL]) {
return NO;
- (BOOL)hasNecessaryPermissionForTask:(MPAutotypeTask)task {
BOOL permissionsOK = YES;
switch(task) {
case MPAutotypeTaskGlobalAutotype:
permissionsOK &= [self hasScreenRecordingPermissions:NULL];
// fallthrough!
case MPAutotypeTaskAutotype:
permissionsOK &= [self hasAccessibiltyPermissions:NULL];
break;
}
if(![self hasScreenRecordingPermissions:NULL]) {
return NO;
}
return YES;
return permissionsOK;
}
- (BOOL)hasScreenRecordingPermissions:(NSError *__autoreleasing*)error {