Revert "Adjusted checks for auto-type permissions"

This reverts commit 7095d55670.

# Conflicts:
#	MacPass/MPAutotypeEnvironment.h
#	MacPass/MPAutotypeEnvironment.m
This commit is contained in:
Michael Starke
2020-11-03 11:15:50 +01:00
parent 499b7fdd6b
commit e82e2fe4a2
6 changed files with 20 additions and 40 deletions

View File

@@ -55,6 +55,7 @@
@property (strong) NSRunningApplication *previousApplication; // The application that was active before we got invoked
@property (assign) NSTimeInterval userActionRequested;
@property (strong) id applicationActivationObserver;
@property (nonatomic, readonly) BOOL hasNecessaryAutotypePermissions;
@end
@implementation MPAutotypeDaemon
@@ -130,6 +131,10 @@ static MPAutotypeDaemon *_sharedInstance;
}
}
- (BOOL)hasNecessaryAutotypePermissions {
return MPAutotypeDoctor.defaultDoctor.hasNecessaryAutotypePermissions;
}
#pragma mark -
#pragma mark Autotype Invocation
- (void)performAutotypeForEntry:(KPKEntry *)entry {
@@ -144,7 +149,7 @@ static MPAutotypeDaemon *_sharedInstance;
}
- (void)_didPressHotKey {
MPAutotypeEnvironment *env = [MPAutotypeEnvironment environmentWithTargetApplication:nil entry:nil overrideSequence:nil];
MPAutotypeEnvironment *env = [MPAutotypeEnvironment environmentWithTargetApplication:NSWorkspace.sharedWorkspace.frontmostApplication entry:nil overrideSequence:nil];
[self _runAutotypeWithEnvironment:env];
}
@@ -188,14 +193,8 @@ static MPAutotypeDaemon *_sharedInstance;
if(env.isSelfTargeting) {
return; // we do not want to target ourselves
}
BOOL hasNeededPermissions = NO;
if(env.globalAutotype) {
hasNeededPermissions = [MPAutotypeDoctor.defaultDoctor hasNecessaryPermissionForTask:MPAutotypeTaskGlobalAutotype];
}
else {
hasNeededPermissions = [MPAutotypeDoctor.defaultDoctor hasNecessaryPermissionForTask:MPAutotypeTaskAutotype];
}
if(!hasNeededPermissions) {
if(!self.hasNecessaryAutotypePermissions) {
NSUserNotification *notification = [[NSUserNotification alloc] init];
notification.title = NSLocalizedString(@"AUTOTYPE_NOTIFICATION_PERMISSIONS_MISSING_TITLE", "Title for autotype feedback on missing permissions");
notification.informativeText = NSLocalizedString(@"AUTOTYPE_NOTIFICATION_MACPASS_IS_MISSING_PERMISSIONS", "Notification: Autotype failed, MacPass has not enough permissions to perform autotype");