Refactored Autotype to use environment for better encapsulation of parameters

This commit is contained in:
Michael Starke
2020-01-22 15:11:28 +01:00
parent 2216a14729
commit 77d96976ec
6 changed files with 57 additions and 56 deletions

View File

@@ -15,11 +15,15 @@ NS_ASSUME_NONNULL_BEGIN
@interface MPAutotypeEnvironment : NSObject
@property (readonly, weak) KPKEntry *entry;
@property (readonly) pid_t pid;
@property (readonly, copy) NSString *windowTitle;
@property (readonly) BOOL hidden;
@property (readonly) BOOL isSelfTargeting;
/**
The selected entry, if Autotype is run only for a single entry.
If autotype should search for entries, set this to nil.
*/
@property (readonly, weak, nullable) KPKEntry *preferredEntry;
@property (readonly) pid_t pid; // the PID of the target application to which the key strokes should be sent
@property (readonly, copy) NSString *windowTitle; /// The window title of the target application.
@property (readonly) BOOL hidden; /// If set to YES, MacPass was hidden when autotype was initiated
@property (readonly) BOOL isSelfTargeting; /// If MacPass should autotype to itself, YES, otherwise NO
+ (instancetype)environmentWithTargetApplication:(NSRunningApplication *)targetApplication entry:(KPKEntry * _Nullable)entry;
- (instancetype)initWithTargetApplication:(NSRunningApplication *)targetApplication entry:(KPKEntry * _Nullable)entry NS_DESIGNATED_INITIALIZER;