4 #import "keychain/ot/OctagonPendingFlag.h"
6 NSString* OctagonPendingConditionsToString(OctagonPendingConditions cond)
8 if((cond & OctagonPendingConditionsDeviceUnlocked) != 0x0) {
14 return [NSString stringWithFormat:@"Unknown conditions: 0x%x", (int)cond];
17 @implementation OctagonPendingFlag
19 - (instancetype)initWithFlag:(OctagonFlag*)flag delayInSeconds:(NSTimeInterval)delay
21 if ((self = [super init])) {
23 _fireTime = [NSDate dateWithTimeIntervalSinceNow:delay];
24 _afterOperation = nil;
30 - (instancetype)initWithFlag:(OctagonFlag*)flag
31 conditions:(OctagonPendingConditions)conditions
33 if ((self = [super init])) {
36 _afterOperation = nil;
37 _conditions = conditions;
42 - (instancetype)initWithFlag:(OctagonFlag*)flag after:(NSOperation*)op
44 if ((self = [super init])) {
53 - (NSString*)description {
55 return [NSString stringWithFormat:@"<OctagonPendingFlag: %@: %@>", self.flag, self.fireTime];
56 } else if(self.afterOperation) {
57 return [NSString stringWithFormat:@"<OctagonPendingFlag: %@: %@>", self.flag, self.afterOperation];
59 return [NSString stringWithFormat:@"<OctagonPendingFlag: %@: %@>", self.flag, OctagonPendingConditionsToString(self.conditions)];