documented Autotype context API to make internal behaviour clear

This commit is contained in:
Michael Starke
2019-03-01 16:01:01 +01:00
parent 6129300c1b
commit 1399a8d142
2 changed files with 8 additions and 3 deletions

View File

@@ -41,11 +41,16 @@
@property (nonatomic, readonly, copy) NSString *command;
@property (nonatomic, readonly, copy) NSString *normalizedCommand;
/**
* Command with placeholders and references resolved
* Command with placeholders and references resolved.
* This will evaluate any placeholder regardless of side-effects.
* If you need to evaluat the command without interaction, you should call kpk_finalValueForEntry:options: directly on the normalizedCommand.
*/
@property (nonatomic, readonly, copy) NSString *evaluatedCommand;
/**
@return command with placeholders and references resolved but masked password placeholder
@return command with placeholders and references resolved but masked password placeholder.
This will call kpk_finalValueForEntry:options on the normalizedCommand with options set to KPKCommandEvaluationOptionSkipUserInteraction and KPKCommandEvaluationOptionReadOnly.
This way it is ensured that the value can be used in UI without any intereference or data changes!
*/
@property (nonatomic, readonly, copy) NSString *maskedEvaluatedCommand;
/**

View File

@@ -86,7 +86,7 @@
NSString *passwordPlaceholder = [NSString stringWithFormat:@"{%@}",kKPKPasswordKey];
NSString *normalized = self.normalizedCommand;
NSString *masked = [normalized stringByReplacingOccurrencesOfString:passwordPlaceholder withString:@"•••" options:NSCaseInsensitiveSearch range:NSMakeRange(0, normalized.length)];
return [[masked kpk_finalValueForEntry:self.entry] copy];
return [[masked kpk_finalValueForEntry:self.entry options:KPKCommandEvaluationOptionSkipUserInteraction|KPKCommandEvaluationOptionReadOnly] copy];
}
- (NSString *)description {