From 9f8617372f4665d4fbd392812cd743c9baaa1fc8 Mon Sep 17 00:00:00 2001 From: Michael Starke Date: Fri, 7 Dec 2018 13:43:15 +0100 Subject: [PATCH] Removed currently unused AutotypeExecution context. --- MacPass.xcodeproj/project.pbxproj | 6 ------ MacPass/MPAutotypeContext.h | 2 +- MacPass/MPAutotypeDaemon.h | 1 - MacPass/MPAutotypeDaemon.m | 6 +----- MacPass/MPAutotypeExecutionContext.h | 22 ---------------------- MacPass/MPAutotypeExecutionContext.m | 27 --------------------------- MacPass/MPDocument+Autotype.m | 2 +- MacPass/MPKeyTyper.m | 1 - 8 files changed, 3 insertions(+), 64 deletions(-) delete mode 100644 MacPass/MPAutotypeExecutionContext.h delete mode 100644 MacPass/MPAutotypeExecutionContext.m diff --git a/MacPass.xcodeproj/project.pbxproj b/MacPass.xcodeproj/project.pbxproj index 499c1d06..f1af43c0 100644 --- a/MacPass.xcodeproj/project.pbxproj +++ b/MacPass.xcodeproj/project.pbxproj @@ -135,7 +135,6 @@ 4C5A11FE1708DE8700223D8A /* MPPasswordCreatorViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C5A11FC1708DE8700223D8A /* MPPasswordCreatorViewController.m */; }; 4C5EF816218CA03F0003C00E /* MPAutotypeParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C5EF815218CA03F0003C00E /* MPAutotypeParser.m */; }; 4C5FE9AE17843CE20001D5A8 /* MPSelectedAttachmentTableCellView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C5FE9AD17843CE20001D5A8 /* MPSelectedAttachmentTableCellView.m */; }; - 4C61251C21B94BDD00A93924 /* MPAutotypeExecutionContext.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C61251B21B94BDD00A93924 /* MPAutotypeExecutionContext.m */; }; 4C61EA0316D2FD0800AC519E /* MPOutlineViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C61EA0216D2FD0800AC519E /* MPOutlineViewController.m */; }; 4C61EA0516D2FFE200AC519E /* OutlineView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C61EA0416D2FFE200AC519E /* OutlineView.xib */; }; 4C63B8FB17A3154D0091BD72 /* MPContextButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C63B8FA17A3154D0091BD72 /* MPContextButton.m */; }; @@ -550,8 +549,6 @@ 4C5F72851FC4351E00929153 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InspectorView.strings; sourceTree = ""; }; 4C5FE9AC17843CE20001D5A8 /* MPSelectedAttachmentTableCellView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPSelectedAttachmentTableCellView.h; sourceTree = ""; }; 4C5FE9AD17843CE20001D5A8 /* MPSelectedAttachmentTableCellView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPSelectedAttachmentTableCellView.m; sourceTree = ""; }; - 4C61251A21B94BDD00A93924 /* MPAutotypeExecutionContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MPAutotypeExecutionContext.h; sourceTree = ""; }; - 4C61251B21B94BDD00A93924 /* MPAutotypeExecutionContext.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MPAutotypeExecutionContext.m; sourceTree = ""; }; 4C61EA0116D2FD0800AC519E /* MPOutlineViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPOutlineViewController.h; sourceTree = ""; }; 4C61EA0216D2FD0800AC519E /* MPOutlineViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPOutlineViewController.m; sourceTree = ""; }; 4C61EA0416D2FFE200AC519E /* OutlineView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = OutlineView.xib; sourceTree = ""; }; @@ -1512,8 +1509,6 @@ 4C90757B18A42E7A00E598DA /* Commands */, 4CEE46DB181C301D006BF1E5 /* MPAutotypeDaemon.h */, 4CEE46DC181C301D006BF1E5 /* MPAutotypeDaemon.m */, - 4C61251A21B94BDD00A93924 /* MPAutotypeExecutionContext.h */, - 4C61251B21B94BDD00A93924 /* MPAutotypeExecutionContext.m */, 4CD2B9041849424B0051B395 /* MPAutotypeContext.h */, 4CD2B9051849424B0051B395 /* MPAutotypeContext.m */, 4CA3530918A53CB800839B0F /* MPKeyMapper.h */, @@ -2028,7 +2023,6 @@ 4CE082C31F6FCD2A0034FF56 /* MPCollectionView.m in Sources */, 4C4A100F176286FD00BBF2CA /* MPTableView.m in Sources */, 4CA334CA18AD60D1008A3322 /* MPWindowAssociationsTableViewDelegate.m in Sources */, - 4C61251C21B94BDD00A93924 /* MPAutotypeExecutionContext.m in Sources */, 4C01C2421764D8980016D5D0 /* MPContextMenuHelper.m in Sources */, 4CE296191842A166005F01CE /* MPAutotypePaste.m in Sources */, 4C569D9E17652B0600595B62 /* MPConstants.m in Sources */, diff --git a/MacPass/MPAutotypeContext.h b/MacPass/MPAutotypeContext.h index d5d19bc2..3cf95711 100644 --- a/MacPass/MPAutotypeContext.h +++ b/MacPass/MPAutotypeContext.h @@ -57,7 +57,7 @@ * Designated initializer * * @param entry Entry to use - * @param sequence Keystroke Sequence to use + * @param sequence Keystroke Sequence to use, this is usefull to override any sequences stored in the entry * * @return AutotypeSequnce with the entry and keystroke in places */ diff --git a/MacPass/MPAutotypeDaemon.h b/MacPass/MPAutotypeDaemon.h index 32fce461..e381b3d5 100644 --- a/MacPass/MPAutotypeDaemon.h +++ b/MacPass/MPAutotypeDaemon.h @@ -31,7 +31,6 @@ */ @interface MPAutotypeDaemon : NSObject -@property (strong, readonly) MPAutotypeExecutionContext *executionContext; @property (strong) IBOutlet NSWindow *matchSelectionWindow; @property (weak) IBOutlet NSPopUpButton *matchSelectionButton; @property (readonly, strong) DDHotKey *registredHotKey; diff --git a/MacPass/MPAutotypeDaemon.m b/MacPass/MPAutotypeDaemon.m index 448527a2..12c485dc 100644 --- a/MacPass/MPAutotypeDaemon.m +++ b/MacPass/MPAutotypeDaemon.m @@ -25,7 +25,6 @@ #import "MPDocumentWindowController.h" #import "MPAutotypeCommand.h" #import "MPAutotypeContext.h" -#import "MPAutotypeExecutionContext.h" #import "MPAutotypePaste.h" #import "MPPasteBoardController.h" #import "MPSettingsHelper.h" @@ -53,7 +52,6 @@ NSString *const kMPProcessIdentifierKey = @"kMPProcessIdentifierKey"; @property (copy) NSString *targetWindowTitle; // The title of the window that we are targeting @property (strong) NSRunningApplication *previousApplication; // The application that was active before we got invoked @property (assign) NSTimeInterval userActionRequested; -@property (strong, readwrite) MPAutotypeExecutionContext *executionContext; @end @@ -317,17 +315,15 @@ static MPAutotypeDaemon *_sharedInstance; if([self _orderApplicationToFront:self.targetPID]) { /* Sleep a bit after the app was activated */ - /* TODO - we can use a saver way and use a notification to check if the app actally was activated */ + /* TODO - we might be able to a notification to check if the app actally was activated instead of guessing a waiting time */ usleep(1 * NSEC_PER_MSEC); } - self.executionContext = [[MPAutotypeExecutionContext alloc] initWithTargetPid:self.targetPID]; for(MPAutotypeCommand *command in [MPAutotypeCommand commandsForContext:context]) { /* dispatch commands to main thread since most of them translate key events which is disallowed on background thread */ dispatch_async(dispatch_get_main_queue(), ^{ [command execute]; }); } - self.executionContext = nil; } #pragma mark - diff --git a/MacPass/MPAutotypeExecutionContext.h b/MacPass/MPAutotypeExecutionContext.h deleted file mode 100644 index c63f4372..00000000 --- a/MacPass/MPAutotypeExecutionContext.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// MPAutotypeExectutionContext.h -// MacPass -// -// Created by Michael Starke on 06.12.18. -// Copyright © 2018 HicknHack Software GmbH. All rights reserved. -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface MPAutotypeExecutionContext : NSObject - -@property (readonly) pid_t targetPid; - -- (instancetype)initWithTargetPid:(pid_t)pid NS_DESIGNATED_INITIALIZER; -- (instancetype)init NS_UNAVAILABLE; - -@end - -NS_ASSUME_NONNULL_END diff --git a/MacPass/MPAutotypeExecutionContext.m b/MacPass/MPAutotypeExecutionContext.m deleted file mode 100644 index 2909ec65..00000000 --- a/MacPass/MPAutotypeExecutionContext.m +++ /dev/null @@ -1,27 +0,0 @@ -// -// MPAutotypeExectutionContext.m -// MacPass -// -// Created by Michael Starke on 06.12.18. -// Copyright © 2018 HicknHack Software GmbH. All rights reserved. -// - -#import "MPAutotypeExecutionContext.h" - -@interface MPAutotypeExecutionContext () - -@property (readwrite) pid_t targetPid; - -@end - -@implementation MPAutotypeExecutionContext - -- (instancetype)initWithTargetPid:(pid_t)pid { - self = [super init]; - if(self) { - self.targetPid = pid; - } - return self; -} - -@end diff --git a/MacPass/MPDocument+Autotype.m b/MacPass/MPDocument+Autotype.m index 728d93ef..4a5d4bf2 100644 --- a/MacPass/MPDocument+Autotype.m +++ b/MacPass/MPDocument+Autotype.m @@ -111,7 +111,7 @@ /* Fall back to preferred Entry if no match was found */ if(usePreferredEntry && contexts.count == 0 ) { - context = [[MPAutotypeContext alloc] initWithEntry:entry andSequence:entry.autotype.defaultKeystrokeSequence]; + context = [[MPAutotypeContext alloc] initWithDefaultSequenceForEntry:entry]; if(context.valid) { [contexts addObject:context]; } diff --git a/MacPass/MPKeyTyper.m b/MacPass/MPKeyTyper.m index be5febb4..55088af7 100644 --- a/MacPass/MPKeyTyper.m +++ b/MacPass/MPKeyTyper.m @@ -9,7 +9,6 @@ #import "MPKeyTyper.h" #import "MPKeyMapper.h" #import "MPAutotypeDaemon.h" -#import "MPAutotypeExecutionContext.h" @implementation MPKeyTyper