2
0

Reformat to AppCode style.

This commit is contained in:
Maarten Billemont 2017-04-01 00:30:25 -04:00
parent de4300c3d3
commit 559934607b
56 changed files with 180 additions and 196 deletions

View File

@ -82,7 +82,7 @@ NSString *NSStringFromTimeToCrack(TimeToCrack timeToCrack);
- (void)resolvePasswordForSite:(MPSiteEntity *)site usingKey:(MPKey *)siteKey
result:(void ( ^ )(NSString *result))resultBlock;
- (void)resolveAnswerForSite:(MPSiteEntity *)site usingKey:(MPKey *)siteKey
result:(void ( ^ )(NSString *result))resultBlock;
result:(void ( ^ )(NSString *result))resultBlock;
- (void)resolveAnswerForQuestion:(MPSiteQuestionEntity *)question usingKey:(MPKey *)siteKey
result:(void ( ^ )(NSString *result))resultBlock;

View File

@ -426,7 +426,7 @@ NSOperationQueue *_mpwQueue = nil;
[PearlKeyChain deleteItemForQuery:siteQuery];
else
[PearlKeyChain addOrUpdateItemForQuery:siteQuery withAttributes:@{
(__bridge id)kSecValueData : encryptedContent,
(__bridge id)kSecValueData: encryptedContent,
#if TARGET_OS_IPHONE
(__bridge id)kSecAttrAccessible : (__bridge id)kSecAttrAccessibleWhenUnlockedThisDeviceOnly,
#endif
@ -730,8 +730,8 @@ NSOperationQueue *_mpwQueue = nil;
return [PearlKeyChain createQueryForClass:kSecClassGenericPassword
attributes:@{
(__bridge id)kSecAttrService : @"DevicePrivate",
(__bridge id)kSecAttrAccount : name
(__bridge id)kSecAttrService: @"DevicePrivate",
(__bridge id)kSecAttrAccount: name
}
matches:nil];
}

View File

@ -33,7 +33,7 @@
if (!explicit) {
if (site.type & MPSiteTypeClassGenerated &&
site.user.name.length != [site.user.name dataUsingEncoding:NSUTF8StringEncoding].length) {
site.user.name.length != [site.user.name dataUsingEncoding:NSUTF8StringEncoding].length) {
// This migration requires explicit permission for types of the generated class.
site.requiresExplicitMigration = YES;
return NO;

View File

@ -49,8 +49,8 @@ static NSDictionary *createKeyQuery(MPUserEntity *user, BOOL newItem, MPKeyOrigi
return [PearlKeyChain createQueryForClass:kSecClassGenericPassword
attributes:@{
(__bridge id)kSecAttrService : @"Saved Master Password",
(__bridge id)kSecAttrAccount : user.name?: @"",
(__bridge id)kSecAttrService: @"Saved Master Password",
(__bridge id)kSecAttrAccount: user.name?: @"",
#if TARGET_OS_IPHONE
(__bridge id)kSecAttrAccessible : (__bridge id)(kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly?: kSecAttrAccessibleWhenUnlockedThisDeviceOnly),
#endif
@ -81,7 +81,7 @@ static NSDictionary *createKeyQuery(MPUserEntity *user, BOOL newItem, MPKeyOrigi
inf( @"Saving key in keychain for user: %@", user.userID );
[PearlKeyChain addOrUpdateItemForQuery:createKeyQuery( user, YES, nil )
withAttributes:@{ (__bridge id)kSecValueData : keyData }];
withAttributes:@{ (__bridge id)kSecValueData: keyData }];
}
}
}
@ -102,7 +102,7 @@ static NSDictionary *createKeyQuery(MPUserEntity *user, BOOL newItem, MPKeyOrigi
self.key = nil;
self.activeUser = nil;
[[NSNotificationCenter defaultCenter] postNotificationName:MPSignedOutNotification object:self userInfo:@{ @"animated" : @(animated) }];
[[NSNotificationCenter defaultCenter] postNotificationName:MPSignedOutNotification object:self userInfo:@{ @"animated": @(animated) }];
}
- (BOOL)signInAsUser:(MPUserEntity *)user saveInContext:(NSManagedObjectContext *)moc usingMasterPassword:(NSString *)password {

View File

@ -11,7 +11,9 @@
#if TARGET_OS_IPHONE
@interface MPAppDelegate_Shared : PearlAppDelegate
#else
@interface MPAppDelegate_Shared : NSObject <PearlConfigDelegate>
@interface MPAppDelegate_Shared : NSObject<PearlConfigDelegate>
#endif
@property(strong, nonatomic, readonly) MPKey *key;

View File

@ -11,7 +11,7 @@
#import "MPAppDelegate_Key.h"
#import "NSManagedObjectModel+KCOrderedAccessorFix.h"
@interface MPAppDelegate_Shared ()
@interface MPAppDelegate_Shared()
@property(strong, nonatomic) MPKey *key;
@property(strong, nonatomic) NSManagedObjectID *activeUserOID;
@ -66,13 +66,12 @@
NSError *error;
if (activeUser.objectID.isTemporaryID && ![activeUser.managedObjectContext obtainPermanentIDsForObjects:@[ activeUser ] error:&error])
err(@"Failed to obtain a permanent object ID after setting active user: %@", [error fullDescription]);
err( @"Failed to obtain a permanent object ID after setting active user: %@", [error fullDescription] );
self.activeUserOID = activeUser.objectID;
}
- (void)handleCoordinatorError:(NSError *)error {
}
@end

View File

@ -21,10 +21,10 @@ typedef NS_ENUM( NSUInteger, MPImportResult ) {
@interface MPAppDelegate_Shared(Store)
+ (NSManagedObjectContext *)managedObjectContextForMainThreadIfReady;
+ (BOOL)managedObjectContextForMainThreadPerformBlock:(void (^)(NSManagedObjectContext *mainContext))mocBlock;
+ (BOOL)managedObjectContextForMainThreadPerformBlockAndWait:(void (^)(NSManagedObjectContext *mainContext))mocBlock;
+ (BOOL)managedObjectContextPerformBlock:(void (^)(NSManagedObjectContext *context))mocBlock;
+ (BOOL)managedObjectContextPerformBlockAndWait:(void (^)(NSManagedObjectContext *context))mocBlock;
+ (BOOL)managedObjectContextForMainThreadPerformBlock:(void ( ^ )(NSManagedObjectContext *mainContext))mocBlock;
+ (BOOL)managedObjectContextForMainThreadPerformBlockAndWait:(void ( ^ )(NSManagedObjectContext *mainContext))mocBlock;
+ (BOOL)managedObjectContextPerformBlock:(void ( ^ )(NSManagedObjectContext *context))mocBlock;
+ (BOOL)managedObjectContextPerformBlockAndWait:(void ( ^ )(NSManagedObjectContext *context))mocBlock;
- (MPFixableResult)findAndFixInconsistenciesSaveInContext:(NSManagedObjectContext *)context;
- (void)deleteAndResetStore;
@ -33,8 +33,8 @@ typedef NS_ENUM( NSUInteger, MPImportResult ) {
- (void)addSiteNamed:(NSString *)siteName completion:(void ( ^ )(MPSiteEntity *site, NSManagedObjectContext *context))completion;
- (MPSiteEntity *)changeSite:(MPSiteEntity *)site saveInContext:(NSManagedObjectContext *)context toType:(MPSiteType)type;
- (MPImportResult)importSites:(NSString *)importedSitesString
askImportPassword:(NSString *(^)(NSString *userName))importPassword
askUserPassword:(NSString *(^)(NSString *userName, NSUInteger importCount, NSUInteger deleteCount))userPassword;
askImportPassword:(NSString *( ^ )(NSString *userName))importPassword
askUserPassword:(NSString *( ^ )(NSString *userName, NSUInteger importCount, NSUInteger deleteCount))userPassword;
- (NSString *)exportSitesRevealPasswords:(BOOL)revealPasswords;
@end

View File

@ -211,8 +211,8 @@ PearlAssociatedObjectProperty( NSNumber*, StoreCorrupted, storeCorrupted );
}
if (![self.storeCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:[self localStoreURL]
options:@{
NSMigratePersistentStoresAutomaticallyOption : @YES,
NSInferMappingModelAutomaticallyOption : @YES,
NSMigratePersistentStoresAutomaticallyOption: @YES,
NSInferMappingModelAutomaticallyOption : @YES,
STORE_OPTIONS
} error:&error]) {
err( @"Failed to open store: %@", [error fullDescription] );
@ -292,7 +292,7 @@ PearlAssociatedObjectProperty( NSNumber*, StoreCorrupted, storeCorrupted );
else {
[context saveToStore];
[[NSNotificationCenter defaultCenter] postNotificationName:MPFoundInconsistenciesNotification object:nil userInfo:@{
MPInconsistenciesFixResultUserKey : @(result)
MPInconsistenciesFixResultUserKey: @(result)
}];
}
@ -383,12 +383,12 @@ PearlAssociatedObjectProperty( NSNumber*, StoreCorrupted, storeCorrupted );
NSError *error = nil;
if (![NSPersistentStore migrateStore:oldLocalStoreURL withOptions:@{
NSMigratePersistentStoresAutomaticallyOption : @YES,
NSInferMappingModelAutomaticallyOption : @YES,
NSMigratePersistentStoresAutomaticallyOption: @YES,
NSInferMappingModelAutomaticallyOption : @YES,
STORE_OPTIONS
} toStore:newLocalStoreURL withOptions:@{
NSMigratePersistentStoresAutomaticallyOption : @YES,
NSInferMappingModelAutomaticallyOption : @YES,
NSMigratePersistentStoresAutomaticallyOption: @YES,
NSInferMappingModelAutomaticallyOption : @YES,
STORE_OPTIONS
} model:nil error:&error]) {
err( @"Couldn't migrate the old store to the new location: %@", [error fullDescription] );
@ -755,7 +755,7 @@ PearlAssociatedObjectProperty( NSNumber*, StoreCorrupted, storeCorrupted );
inf( @"Import completed successfully." );
[[NSNotificationCenter defaultCenter] postNotificationName:MPSitesImportedNotification object:nil userInfo:@{
MPSitesImportedNotificationUserKey : user
MPSitesImportedNotificationUserKey: user
}];
return MPImportResultSuccess;

View File

@ -18,13 +18,13 @@
return nil;
[self.defaults registerDefaults:@{
NSStringFromSelector( @selector( askForReviews ) ) : @YES,
NSStringFromSelector( @selector( askForReviews ) ) : @YES,
NSStringFromSelector( @selector( sendInfo ) ) : @NO,
NSStringFromSelector( @selector( rememberLogin ) ) : @NO,
NSStringFromSelector( @selector( hidePasswords ) ) : @NO,
NSStringFromSelector( @selector( checkInconsistency ) ) : @NO,
NSStringFromSelector( @selector( siteAttacker ) ) : @(MPAttacker1),
NSStringFromSelector( @selector( sendInfo ) ) : @NO,
NSStringFromSelector( @selector( rememberLogin ) ) : @NO,
NSStringFromSelector( @selector( hidePasswords ) ) : @NO,
NSStringFromSelector( @selector( checkInconsistency ) ): @NO,
NSStringFromSelector( @selector( siteAttacker ) ) : @(MPAttacker1),
}];
self.delegate = [MPAppDelegate_Shared get];

View File

@ -10,9 +10,8 @@
#import <CoreData/CoreData.h>
#import "MPSiteEntity.h"
@interface MPGeneratedSiteEntity : MPSiteEntity
@property (nonatomic, retain) NSNumber * counter_;
@property(nonatomic, retain) NSNumber *counter_;
@end

View File

@ -8,7 +8,6 @@
#import "MPGeneratedSiteEntity.h"
@implementation MPGeneratedSiteEntity
@dynamic counter_;

View File

@ -20,7 +20,7 @@
@protocol MPAlgorithm;
typedef NS_ENUM(NSUInteger, MPKeyOrigin) {
typedef NS_ENUM( NSUInteger, MPKeyOrigin ) {
MPKeyOriginMasterPassword,
MPKeyOriginKeyChain,
MPKeyOriginKeyChainBiometric,

View File

@ -14,19 +14,19 @@
@interface MPSiteEntity : NSManagedObject
//@property (nonatomic, retain) id content; // Hide here, reveal in MPStoredSiteEntity
@property (nonatomic, retain) NSDate * lastUsed;
@property (nonatomic, retain) NSNumber * loginGenerated_;
@property (nonatomic, retain) NSString * loginName;
@property (nonatomic, retain) NSString * name;
@property (nonatomic, retain) NSNumber * requiresExplicitMigration_;
@property (nonatomic, retain) NSNumber * type_;
@property (nonatomic, retain) NSNumber * uses_;
@property (nonatomic, retain) NSNumber * version_;
@property (nonatomic, retain) NSOrderedSet *questions;
@property (nonatomic, retain) MPUserEntity *user;
@property(nonatomic, retain) NSDate *lastUsed;
@property(nonatomic, retain) NSNumber *loginGenerated_;
@property(nonatomic, retain) NSString *loginName;
@property(nonatomic, retain) NSString *name;
@property(nonatomic, retain) NSNumber *requiresExplicitMigration_;
@property(nonatomic, retain) NSNumber *type_;
@property(nonatomic, retain) NSNumber *uses_;
@property(nonatomic, retain) NSNumber *version_;
@property(nonatomic, retain) NSOrderedSet *questions;
@property(nonatomic, retain) MPUserEntity *user;
@end
@interface MPSiteEntity (CoreDataGeneratedAccessors)
@interface MPSiteEntity(CoreDataGeneratedAccessors)
- (void)insertObject:(MPSiteQuestionEntity *)value inQuestionsAtIndex:(NSUInteger)idx;
- (void)removeObjectFromQuestionsAtIndex:(NSUInteger)idx;

View File

@ -10,7 +10,6 @@
#import "MPSiteQuestionEntity.h"
#import "MPUserEntity.h"
@implementation MPSiteEntity
//@dynamic content;

View File

@ -13,7 +13,7 @@
@interface MPSiteQuestionEntity : NSManagedObject
@property (nonatomic, retain) NSString * keyword;
@property (nonatomic, retain) MPSiteEntity *site;
@property(nonatomic, retain) NSString *keyword;
@property(nonatomic, retain) MPSiteEntity *site;
@end

View File

@ -9,7 +9,6 @@
#import "MPSiteQuestionEntity.h"
#import "MPSiteEntity.h"
@implementation MPSiteQuestionEntity
@dynamic keyword;

View File

@ -10,9 +10,8 @@
#import <CoreData/CoreData.h>
#import "MPSiteEntity.h"
@interface MPStoredSiteEntity : MPSiteEntity
@property (nonatomic, retain) NSData *contentObject;
@property(nonatomic, retain) NSData *contentObject;
@end

View File

@ -8,7 +8,6 @@
#import "MPStoredSiteEntity.h"
@implementation MPStoredSiteEntity
@dynamic contentObject;

View File

@ -13,18 +13,18 @@
@interface MPUserEntity : NSManagedObject
@property (nonatomic, retain) NSNumber * avatar_;
@property (nonatomic, retain) NSNumber * defaultType_;
@property (nonatomic, retain) NSData * keyID;
@property (nonatomic, retain) NSDate * lastUsed;
@property (nonatomic, retain) NSString * name;
@property (nonatomic, retain) NSNumber * saveKey_;
@property (nonatomic, retain) NSNumber * touchID_;
@property (nonatomic, retain) NSNumber * version_;
@property (nonatomic, retain) NSSet *sites;
@property(nonatomic, retain) NSNumber *avatar_;
@property(nonatomic, retain) NSNumber *defaultType_;
@property(nonatomic, retain) NSData *keyID;
@property(nonatomic, retain) NSDate *lastUsed;
@property(nonatomic, retain) NSString *name;
@property(nonatomic, retain) NSNumber *saveKey_;
@property(nonatomic, retain) NSNumber *touchID_;
@property(nonatomic, retain) NSNumber *version_;
@property(nonatomic, retain) NSSet *sites;
@end
@interface MPUserEntity (CoreDataGeneratedAccessors)
@interface MPUserEntity(CoreDataGeneratedAccessors)
- (void)addSitesObject:(MPSiteEntity *)value;
- (void)removeSitesObject:(MPSiteEntity *)value;

View File

@ -9,7 +9,6 @@
#import "MPUserEntity.h"
#import "MPSiteEntity.h"
@implementation MPUserEntity
@dynamic avatar_;

View File

@ -30,8 +30,8 @@
[[NSNotificationCenter defaultCenter] addObserverForName:NSWindowWillCloseNotification object:self.window
queue:nil usingBlock:^(NSNotification *note) {
[MPMacAppDelegate get].initialWindowController = nil;
}];
[MPMacAppDelegate get].initialWindowController = nil;
}];
}
#pragma mark - Actions

View File

@ -123,12 +123,10 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven
^(MPMacAppDelegate *self, NSNotification *note) {
PearlMainQueue( ^{
NSString *key = note.object;
if (!key || [key isEqualToString:NSStringFromSelector( @
selector( hidePasswords ) )])
self.hidePasswordsItem.state = [[MPConfig get].hidePasswords boolValue]? NSOnState: NSOffState;
if (!key || [key isEqualToString:NSStringFromSelector( @
selector( rememberLogin ) )])
self.rememberPasswordItem.state = [[MPConfig get].rememberLogin boolValue]? NSOnState: NSOffState;
if (!key || [key isEqualToString:NSStringFromSelector( @selector( hidePasswords ) )])
self.hidePasswordsItem.state = [[MPConfig get].hidePasswords boolValue]? NSOnState: NSOffState;
if (!key || [key isEqualToString:NSStringFromSelector( @selector( rememberLogin ) )])
self.rememberPasswordItem.state = [[MPConfig get].rememberLogin boolValue]? NSOnState: NSOffState;
} );
} );
[self updateUsers];
@ -136,7 +134,8 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven
// Global hotkey.
EventHotKeyRef hotKeyRef;
EventTypeSpec hotKeyEvents[1] = { { .eventClass = kEventClassKeyboard, .eventKind = kEventHotKeyPressed } };
OSStatus status = InstallApplicationEventHandler( NewEventHandlerUPP( MPHotKeyHander ), GetEventTypeCount( hotKeyEvents ), hotKeyEvents, (__bridge void *)self, NULL );
OSStatus status = InstallApplicationEventHandler( NewEventHandlerUPP( MPHotKeyHander ), GetEventTypeCount( hotKeyEvents ), hotKeyEvents,
(__bridge void *)self, NULL );
if (status != noErr)
err( @"Error installing application event handler: %i", (int)status );
status = RegisterEventHotKey( 35 /* p */, controlKey + cmdKey, MPShowHotKey, GetApplicationEventTarget(), 0, &hotKeyRef );
@ -318,17 +317,17 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven
break;
case MPImportResultInternalError:
[[NSAlert alertWithError:[NSError errorWithDomain:MPErrorDomain code:0 userInfo:@{
NSLocalizedDescriptionKey : @"Import failed because of an internal error."
NSLocalizedDescriptionKey: @"Import failed because of an internal error."
}]] runModal];
break;
case MPImportResultMalformedInput:
[[NSAlert alertWithError:[NSError errorWithDomain:MPErrorDomain code:0 userInfo:@{
NSLocalizedDescriptionKey : @"The import doesn't look like a Master Password export."
NSLocalizedDescriptionKey: @"The import doesn't look like a Master Password export."
}]] runModal];
break;
case MPImportResultInvalidPassword:
[[NSAlert alertWithError:[NSError errorWithDomain:MPErrorDomain code:0 userInfo:@{
NSLocalizedDescriptionKey : @"Incorrect master password for the import sites."
NSLocalizedDescriptionKey: @"Incorrect master password for the import sites."
}]] runModal];
break;
}
@ -441,7 +440,7 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven
prof_new( @"showPasswordWindow" );
[NSApp activateIgnoringOtherApps:YES];
prof_rewind(@"activateIgnoringOtherApps");
prof_rewind( @"activateIgnoringOtherApps" );
// If no user, can't activate.
if (![self activeUserForMainThread]) {

View File

@ -5,7 +5,7 @@
#import "MPMacApplication.h"
@interface NSResponder (Editing)
@interface NSResponder(Editing)
- (void)undo:(id)sender;
- (void)redo:(id)sender;

View File

@ -17,8 +17,8 @@
return self;
[self.defaults registerDefaults:@{
NSStringFromSelector( @selector( appleID ) ) : @"510296984",
NSStringFromSelector( @selector( fullScreen ) ) : @YES,
NSStringFromSelector( @selector( appleID ) ) : @"510296984",
NSStringFromSelector( @selector( fullScreen ) ): @YES,
}];
return self;

View File

@ -18,6 +18,5 @@
#import <Foundation/Foundation.h>
@interface MPNoStateButtonCell : NSButtonCell
@end

View File

@ -18,9 +18,7 @@
#import "MPNoStateButton.h"
@implementation MPNoStateButtonCell {
}
- (void)setState:(NSInteger)state {

View File

@ -18,7 +18,6 @@
#import <Cocoa/Cocoa.h>
@interface MPPasswordWindow : NSWindow
@end

View File

@ -37,7 +37,7 @@
}
else if (self.level != NSNormalWindowLevel) {
[self setLevel:NSNormalWindowLevel];
[self setFrame:NSMakeRect( 0, 0, 640, 600) display:NO];
[self setFrame:NSMakeRect( 0, 0, 640, 600 ) display:NO];
[self center];
}

View File

@ -173,7 +173,7 @@
[self.progressView stopAnimation:self];
if (!success)
[[NSAlert alertWithError:[NSError errorWithDomain:MPErrorDomain code:0 userInfo:@{
NSLocalizedDescriptionKey : strf( @"Incorrect master password for user %@", userName )
NSLocalizedDescriptionKey: strf( @"Incorrect master password for user %@", userName )
}]] beginSheetModalForWindow:self.window completionHandler:nil];
} );
}];

View File

@ -25,25 +25,25 @@
@interface MPSiteModel : NSObject
@property (nonatomic) NSString *name;
@property (nonatomic) NSAttributedString *displayedName;
@property (nonatomic) MPSiteType type;
@property (nonatomic) NSString *typeName;
@property (nonatomic) NSString *content;
@property (nonatomic) NSString *displayedContent;
@property (nonatomic) NSString *question;
@property (nonatomic) NSString *answer;
@property (nonatomic) NSString *loginName;
@property (nonatomic) BOOL loginGenerated;
@property (nonatomic) NSNumber *uses;
@property (nonatomic) NSUInteger counter;
@property (nonatomic) NSDate *lastUsed;
@property (nonatomic) id<MPAlgorithm> algorithm;
@property (nonatomic) MPAlgorithmVersion algorithmVersion;
@property (nonatomic, readonly) BOOL outdated;
@property (nonatomic, readonly) BOOL generated;
@property (nonatomic, readonly) BOOL stored;
@property (nonatomic, readonly) BOOL transient;
@property(nonatomic) NSString *name;
@property(nonatomic) NSAttributedString *displayedName;
@property(nonatomic) MPSiteType type;
@property(nonatomic) NSString *typeName;
@property(nonatomic) NSString *content;
@property(nonatomic) NSString *displayedContent;
@property(nonatomic) NSString *question;
@property(nonatomic) NSString *answer;
@property(nonatomic) NSString *loginName;
@property(nonatomic) BOOL loginGenerated;
@property(nonatomic) NSNumber *uses;
@property(nonatomic) NSUInteger counter;
@property(nonatomic) NSDate *lastUsed;
@property(nonatomic) id<MPAlgorithm> algorithm;
@property(nonatomic) MPAlgorithmVersion algorithmVersion;
@property(nonatomic, readonly) BOOL outdated;
@property(nonatomic, readonly) BOOL generated;
@property(nonatomic, readonly) BOOL stored;
@property(nonatomic, readonly) BOOL transient;
- (instancetype)initWithEntity:(MPSiteEntity *)entity fuzzyGroups:(NSArray *)fuzzyGroups;
- (instancetype)initWithName:(NSString *)siteName forUser:(MPUserEntity *)user;

View File

@ -93,8 +93,8 @@
NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new];
paragraphStyle.alignment = NSCenterTextAlignment;
self.displayedName = stra( siteName, @{
NSBackgroundColorAttributeName : [NSColor alternateSelectedControlColor],
NSParagraphStyleAttributeName : paragraphStyle,
NSBackgroundColorAttributeName: [NSColor alternateSelectedControlColor],
NSParagraphStyleAttributeName : paragraphStyle,
} );
self.name = siteName;
self.algorithm = MPAlgorithmDefault;

View File

@ -12,7 +12,7 @@
@interface MPAnswersViewController : UIViewController
@property (nonatomic) IBOutlet UITableView *tableView;
@property(nonatomic) IBOutlet UITableView *tableView;
- (void)setSite:(MPSiteEntity *)site;
- (MPSiteEntity *)siteInContext:(NSManagedObjectContext *)context;
@ -21,8 +21,8 @@
@interface MPGlobalAnswersCell : UITableViewCell
@property (nonatomic) IBOutlet UILabel *titleLabel;
@property (nonatomic) IBOutlet UITextField *answerField;
@property(nonatomic) IBOutlet UILabel *titleLabel;
@property(nonatomic) IBOutlet UITextField *answerField;
- (void)setSite:(MPSiteEntity *)site;
@ -32,7 +32,7 @@
@end
@interface MPMultipleAnswersCell : UITableViewCell <UITextFieldDelegate>
@interface MPMultipleAnswersCell : UITableViewCell<UITextFieldDelegate>
@end

View File

@ -23,7 +23,7 @@
/* Avatar with a "+" symbol. */
extern const long MPAvatarAdd;
typedef NS_ENUM(NSUInteger, MPAvatarMode) {
typedef NS_ENUM( NSUInteger, MPAvatarMode ) {
MPAvatarModeLowered,
MPAvatarModeRaisedButInactive,
MPAvatarModeRaisedAndActive,
@ -32,12 +32,13 @@ typedef NS_ENUM(NSUInteger, MPAvatarMode) {
};
@interface MPAvatarCell : UICollectionViewCell
@property (copy, nonatomic) NSString *name;
@property (assign, nonatomic) NSUInteger avatar;
@property (assign, nonatomic) MPAvatarMode mode;
@property (assign, nonatomic) CGFloat visibility;
@property (assign, nonatomic) BOOL spinnerActive;
@property (assign, nonatomic, readonly) BOOL newUser;
@property(copy, nonatomic) NSString *name;
@property(assign, nonatomic) NSUInteger avatar;
@property(assign, nonatomic) MPAvatarMode mode;
@property(assign, nonatomic) CGFloat visibility;
@property(assign, nonatomic) BOOL spinnerActive;
@property(assign, nonatomic, readonly) BOOL newUser;
+ (NSString *)reuseIdentifier;

View File

@ -20,7 +20,7 @@
#import "MPPasswordsViewController.h"
#import "MPEmergencyViewController.h"
typedef NS_ENUM(NSUInteger, MPCombinedMode) {
typedef NS_ENUM( NSUInteger, MPCombinedMode ) {
MPCombinedModeUserSelection,
MPCombinedModePasswordSelection,
};

View File

@ -131,7 +131,7 @@
[self.usersVC setActive:YES animated:animated];
if (_passwordsVC) {
MPPasswordsSegue *segue = [[MPPasswordsSegue alloc] initWithIdentifier:@"passwords" source:_passwordsVC destination:self];
[self prepareForSegue:segue sender:@{ @"animated" : @(animated) }];
[self prepareForSegue:segue sender:@{ @"animated": @(animated) }];
[segue perform];
}
break;
@ -139,7 +139,7 @@
case MPCombinedModePasswordSelection: {
self.usersVC.view.userInteractionEnabled = NO;
[self.usersVC setActive:NO animated:animated];
[self performSegueWithIdentifier:@"passwords" sender:@{ @"animated" : @(animated) }];
[self performSegueWithIdentifier:@"passwords" sender:@{ @"animated": @(animated) }];
break;
}
}

View File

@ -17,7 +17,7 @@
//
@interface MPEmergencyViewController : UIViewController <UITextFieldDelegate>
@interface MPEmergencyViewController : UIViewController<UITextFieldDelegate>
@property(weak, nonatomic) IBOutlet UIScrollView *scrollView;
@property(weak, nonatomic) IBOutlet UIView *dialogView;

View File

@ -20,8 +20,9 @@
#import <UIKit/UIKit.h>
@interface MPLogsViewController : UIViewController
@property (weak, nonatomic) IBOutlet UITextView *logView;
@property (weak, nonatomic) IBOutlet UISegmentedControl *levelControl;
@property(weak, nonatomic) IBOutlet UITextView *logView;
@property(weak, nonatomic) IBOutlet UISegmentedControl *levelControl;
- (IBAction)toggleLevelControl:(UISegmentedControl *)sender;
- (IBAction)refresh:(UIBarButtonItem *)sender;

View File

@ -20,6 +20,6 @@
@interface MPMessageViewController : UIViewController
@property (nonatomic) MPMessage *message;
@property(nonatomic) MPMessage *message;
@end

View File

@ -18,6 +18,5 @@
#import <Foundation/Foundation.h>
@interface MPNavigationController : UINavigationController
@end

View File

@ -18,7 +18,6 @@
#import <Foundation/Foundation.h>
@interface MPOverlayViewController : UIViewController
@end

View File

@ -80,7 +80,7 @@
for (NSValue *dismissButtonValue in [_dismissSegueByButton allKeys])
if (((UIStoryboardSegue *)_dismissSegueByButton[dismissButtonValue]).sourceViewController == viewController) {
dismissButton = [dismissButtonValue nonretainedObjectValue];
NSAssert([self.view.subviews containsObject:dismissButton], @"Missing dismiss button in dictionary.");
NSAssert( [self.view.subviews containsObject:dismissButton], @"Missing dismiss button in dictionary." );
}
if (!dismissButton)
return;

View File

@ -25,9 +25,9 @@ typedef NS_ENUM ( NSUInteger, MPPasswordCellMode ) {
MPPasswordCellModeSettings,
};
@interface MPPasswordCell : MPCell <UIScrollViewDelegate, UITextFieldDelegate>
@interface MPPasswordCell : MPCell<UIScrollViewDelegate, UITextFieldDelegate>
@property (nonatomic) NSArray *fuzzyGroups;
@property(nonatomic) NSArray *fuzzyGroups;
- (void)setSite:(MPSiteEntity *)site animated:(BOOL)animated;
- (void)setTransientSite:(NSString *)siteName animated:(BOOL)animated;

View File

@ -532,7 +532,7 @@
self.passwordField.attributedPlaceholder = stra(
mainSite.type & MPSiteTypeClassStored? strl( @"No password" ):
mainSite.type & MPSiteTypeClassGenerated? strl( @"..." ): @"", @{
NSForegroundColorAttributeName : [UIColor whiteColor]
NSForegroundColorAttributeName: [UIColor whiteColor]
} );
[MPiOSAppDelegate managedObjectContextPerformBlock:^(NSManagedObjectContext *context) {
MPSiteEntity *site = [self siteInContext:context];
@ -570,8 +570,8 @@
[self.modeScrollView addSubview:self.indicatorView];
[self.contentView addConstraintsWithVisualFormat:@"V:[indicator][target]" options:NSLayoutFormatAlignAllCenterX
metrics:nil views:@{
@"indicator" : self.indicatorView,
@"target" : settingsMode? self.editButton: self.modeButton
@"indicator": self.indicatorView,
@"target" : settingsMode? self.editButton: self.modeButton
}];
}
else if (requiresExplicitMigration) {
@ -580,8 +580,8 @@
[self.modeScrollView addSubview:self.indicatorView];
[self.contentView addConstraintsWithVisualFormat:@"V:[indicator][target]" options:NSLayoutFormatAlignAllCenterX
metrics:nil views:@{
@"indicator" : self.indicatorView,
@"target" : settingsMode? self.upgradeButton: self.modeButton
@"indicator": self.indicatorView,
@"target" : settingsMode? self.upgradeButton: self.modeButton
}];
}
else
@ -617,7 +617,7 @@
}
[attributedSiteName appendAttributedString:stra(
strf( @" - %@", self.transientSite? @"Tap to create": [site.algorithm shortNameOfType:site.type] ), @{ } )];
strf( @" - %@", self.transientSite? @"Tap to create": [site.algorithm shortNameOfType:site.type] ), @{} )];
self.siteNameLabel.attributedText = attributedSiteName;
}

View File

@ -20,6 +20,6 @@
@interface MPPasswordsSegue : UIStoryboardSegue
@property (nonatomic, assign) BOOL animated;
@property(nonatomic, assign) BOOL animated;
@end

View File

@ -33,7 +33,7 @@
@property(assign, nonatomic) BOOL active;
- (void)setActive:(BOOL)active animated:(BOOL)animated completion:(void (^)(BOOL finished))completion;
- (void)setActive:(BOOL)active animated:(BOOL)animated completion:(void ( ^ )(BOOL finished))completion;
- (void)updatePasswords;
- (IBAction)dismissPopdown:(id)sender;

View File

@ -91,7 +91,7 @@ typedef NS_OPTIONS( NSUInteger, MPPasswordsTips ) {
[MPiOSAppDelegate managedObjectContextPerformBlock:^(NSManagedObjectContext *context) {
MPUserEntity *activeUser = [[MPiOSAppDelegate get] activeUserInContext:context];
if (![MPAlgorithmDefault tryMigrateUser:activeUser inContext:context])
PearlMainQueue(^{
PearlMainQueue( ^{
[self performSegueWithIdentifier:@"message" sender:
[MPMessage messageWithTitle:@"You have sites that can be upgraded." text:
@"Upgrading a site allows it to take advantage of the latest improvements in the Master Password algorithm.\n\n"
@ -99,7 +99,7 @@ typedef NS_OPTIONS( NSUInteger, MPPasswordsTips ) {
"You can then update your site's account with the new and stronger password.\n\n"
"The upgrade button can be found in the site's settings and looks like this:"
info:YES]];
});
} );
[context saveToStore];
}];
}
@ -418,7 +418,7 @@ typedef NS_OPTIONS( NSUInteger, MPPasswordsTips ) {
if (![self.fetchedResultsController performFetch:&error])
err( @"Couldn't fetch sites: %@", [error fullDescription] );
PearlMainQueue(^{
PearlMainQueue( ^{
@try {
[self.passwordCollectionView performBatchUpdates:^{
[self fetchedItemsDidUpdate];
@ -449,7 +449,7 @@ typedef NS_OPTIONS( NSUInteger, MPPasswordsTips ) {
wrn( @"While updating password cells: %@", [exception fullDescription] );
[self.passwordCollectionView reloadData];
}
});
} );
}];
}

View File

@ -90,7 +90,7 @@
[MPiOSAppDelegate managedObjectContextPerformBlock:^(NSManagedObjectContext *context) {
if ([[MPiOSAppDelegate get] findAndFixInconsistenciesSaveInContext:context] == MPFixableResultNoProblems)
[PearlAlert showAlertWithTitle:@"No Inconsistencies" message:
@"No inconsistencies were detected in your sites."
@"No inconsistencies were detected in your sites."
viewStyle:UIAlertViewStyleDefault initAlert:nil
tappedButtonBlock:nil cancelTitle:[PearlStrings get].commonButtonOkay otherTitles:nil];
}];
@ -111,9 +111,9 @@
[[MPiOSAppDelegate get] forgetSavedKeyFor:activeUser];
[context saveToStore];
PearlMainQueue(^{
PearlMainQueue( ^{
[self reload];
});
} );
}];
if (sender == self.touchIDSwitch)
@ -241,7 +241,7 @@
return MPSiteTypeStoredDevicePrivate;
default:
Throw( @"unsupported selected type index: generated=%ld, stored=%ld", (long)selectedGeneratedIndex,
(long)selectedStoredIndex );
(long)selectedStoredIndex );
}
}
}

View File

@ -18,8 +18,6 @@
#import <Foundation/Foundation.h>
@interface MPRootSegue : UIStoryboardSegue
@end

View File

@ -18,9 +18,7 @@
#import "MPRootSegue.h"
@implementation MPRootSegue {
}
- (void)perform {

View File

@ -22,7 +22,7 @@
- (void)viewWillAppear:(BOOL)animated {
inf(@"Type selection will appear");
inf( @"Type selection will appear" );
self.recommendedTipContainer.alpha = 0;
[super viewWillAppear:animated];
@ -55,7 +55,7 @@
- (void)viewWillDisappear:(BOOL)animated {
inf(@"Type selection will disappear");
inf( @"Type selection will disappear" );
[super viewWillDisappear:animated];
}
@ -94,11 +94,11 @@
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSAssert(self.navigationController.topViewController == self, @"Not the currently active navigation item.");
NSAssert( self.navigationController.topViewController == self, @"Not the currently active navigation item." );
MPSiteType type = [self typeAtIndexPath:indexPath];
if (type == (MPSiteType)NSNotFound)
// Selected a non-type row.
// Selected a non-type row.
return;
[self.delegate didSelectType:type];
@ -129,7 +129,7 @@
return (MPSiteType)NSNotFound;
default: {
Throw(@"Unsupported row: %ld, when selecting generated site type.", (long)indexPath.row);
Throw( @"Unsupported row: %ld, when selecting generated site type.", (long)indexPath.row );
}
}
}
@ -147,13 +147,13 @@
return (MPSiteType)NSNotFound;
default: {
Throw(@"Unsupported row: %ld, when selecting stored site type.", (long)indexPath.row);
Throw( @"Unsupported row: %ld, when selecting stored site type.", (long)indexPath.row );
}
}
}
default:
Throw(@"Unsupported section: %ld, when selecting site type.", (long)indexPath.section);
Throw( @"Unsupported section: %ld, when selecting site type.", (long)indexPath.section );
}
}

View File

@ -16,7 +16,7 @@
// Copyright, lhunath (Maarten Billemont) 2014. All rights reserved.
//
@interface MPUsersViewController : UIViewController <UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, UITextFieldDelegate>
@interface MPUsersViewController : UIViewController<UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, UITextFieldDelegate>
@property(weak, nonatomic) IBOutlet UIView *userSelectionContainer;
@property(weak, nonatomic) IBOutlet UIButton *marqueeButton;

View File

@ -18,8 +18,7 @@
#import <Foundation/Foundation.h>
@interface MPWebViewController : UIViewController <UIWebViewDelegate>
@interface MPWebViewController : UIViewController<UIWebViewDelegate>
@property(nonatomic) IBOutlet UIWebView *webView;
@property(nonatomic) IBOutlet UINavigationItem *webNavigationItem;

View File

@ -16,6 +16,6 @@
- (void)openFeedbackWithLogs:(BOOL)logs forVC:(UIViewController *)viewController;
- (void)showExportForVC:(UIViewController *)viewController;
- (void)changeMasterPasswordFor:(MPUserEntity *)user saveInContext:(NSManagedObjectContext *)moc didResetBlock:(void (^)(void))didReset;
- (void)changeMasterPasswordFor:(MPUserEntity *)user saveInContext:(NSManagedObjectContext *)moc didResetBlock:(void ( ^ )(void))didReset;
@end

View File

@ -42,7 +42,7 @@
#ifdef CRASHLYTICS
NSString *crashlyticsAPIKey = [self crashlyticsAPIKey];
if ([crashlyticsAPIKey length]) {
inf(@"Initializing Crashlytics");
inf( @"Initializing Crashlytics" );
#if defined (DEBUG) || defined (ADHOC)
[Crashlytics sharedInstance].debugMode = YES;
#endif
@ -82,12 +82,12 @@
#ifdef ADHOC
[PearlAlert showAlertWithTitle:@"Welcome, tester!" message:
@"Thank you for taking the time to test Master Password.\n\n"
@"Please provide any feedback, however minor it may seem, via the Feedback action item accessible from the top right.\n\n"
@"Contact me directly at:\n"
@"lhunath@lyndir.com\n"
@"Or report detailed issues at:\n"
@"https://youtrack.lyndir.com\n"
@"Thank you for taking the time to test Master Password.\n\n"
@"Please provide any feedback, however minor it may seem, via the Feedback action item accessible from the top right.\n\n"
@"Contact me directly at:\n"
@"lhunath@lyndir.com\n"
@"Or report detailed issues at:\n"
@"https://youtrack.lyndir.com\n"
viewStyle:UIAlertViewStyleDefault initAlert:nil tappedButtonBlock:nil
cancelTitle:nil otherTitles:[PearlStrings get].commonButtonOkay, nil];
#endif

View File

@ -17,16 +17,16 @@
return self;
[self.defaults registerDefaults:@{
NSStringFromSelector( @selector( helpHidden ) ) : @NO,
NSStringFromSelector( @selector( siteInfoHidden ) ) : @YES,
NSStringFromSelector( @selector( showSetup ) ) : @YES,
NSStringFromSelector( @selector( appleID ) ) : @"510296984",
NSStringFromSelector( @selector( actionsTipShown ) ) : @(!self.firstRun),
NSStringFromSelector( @selector( typeTipShown ) ) : @(!self.firstRun),
NSStringFromSelector( @selector( loginNameTipShown ) ) : @NO,
NSStringFromSelector( @selector( traceMode ) ) : @NO,
NSStringFromSelector( @selector( dictationSearch ) ) : @NO,
NSStringFromSelector( @selector( allowDowngrade ) ) : @NO,
NSStringFromSelector( @selector( helpHidden ) ) : @NO,
NSStringFromSelector( @selector( siteInfoHidden ) ) : @YES,
NSStringFromSelector( @selector( showSetup ) ) : @YES,
NSStringFromSelector( @selector( appleID ) ) : @"510296984",
NSStringFromSelector( @selector( actionsTipShown ) ) : @(!self.firstRun),
NSStringFromSelector( @selector( typeTipShown ) ) : @(!self.firstRun),
NSStringFromSelector( @selector( loginNameTipShown ) ): @NO,
NSStringFromSelector( @selector( traceMode ) ) : @NO,
NSStringFromSelector( @selector( dictationSearch ) ) : @NO,
NSStringFromSelector( @selector( allowDowngrade ) ) : @NO,
}];
return self;

View File

@ -25,20 +25,20 @@
- (NSAttributedString *)attributedMarkdownStringWithFontSize:(CGFloat)fontSize {
NSMutableAttributedString *attributedString = markdown_to_attr_string( self, 0, @{
@(EMPH) : @{ NSFontAttributeName : [UIFont fontWithName:@"Exo2.0-Bold" size:fontSize] },
@(STRONG) : @{ NSFontAttributeName : [UIFont fontWithName:@"Exo2.0-ExtraBold" size:fontSize] },
@(EMPH | STRONG) : @{ NSFontAttributeName : [UIFont fontWithName:@"Exo2.0-ExtraBold" size:fontSize] },
@(PLAIN) : @{ NSFontAttributeName : [UIFont fontWithName:@"Exo2.0-Regular" size:fontSize] },
@(H1) : @{ NSFontAttributeName : [UIFont fontWithName:@"Exo2.0-Thin" size:fontSize * 2.f] },
@(H2) : @{ NSFontAttributeName : [UIFont fontWithName:@"Exo2.0-Thin" size:fontSize * 1.5f] },
@(H3) : @{ NSFontAttributeName : [UIFont fontWithName:@"Exo2.0-Thin" size:fontSize * 1.17f] },
@(H4) : @{ NSFontAttributeName : [UIFont fontWithName:@"Exo2.0-Thin" size:fontSize * 1.f] },
@(H5) : @{ NSFontAttributeName : [UIFont fontWithName:@"Exo2.0-Thin" size:fontSize * .83f] },
@(H6) : @{ NSFontAttributeName : [UIFont fontWithName:@"Exo2.0-Thin" size:fontSize * .75f] },
@(BLOCKQUOTE) : @{ NSFontAttributeName : [UIFont fontWithName:@"Exo2.0-Thin" size:fontSize * 1.17f] },
@(CODE) : @{ NSFontAttributeName : [UIFont fontWithName:@"SourceCodePro-Regular" size:fontSize] },
@(VERBATIM) : @{ NSFontAttributeName : [UIFont fontWithName:@"SourceCodePro-Regular" size:fontSize] },
@(NOTE) : @{ NSFontAttributeName : [UIFont fontWithName:@"Exo2.0-Thin" size:fontSize * 1.17f] },
@(EMPH) : @{ NSFontAttributeName: [UIFont fontWithName:@"Exo2.0-Bold" size:fontSize] },
@(STRONG) : @{ NSFontAttributeName: [UIFont fontWithName:@"Exo2.0-ExtraBold" size:fontSize] },
@(EMPH | STRONG): @{ NSFontAttributeName: [UIFont fontWithName:@"Exo2.0-ExtraBold" size:fontSize] },
@(PLAIN) : @{ NSFontAttributeName: [UIFont fontWithName:@"Exo2.0-Regular" size:fontSize] },
@(H1) : @{ NSFontAttributeName: [UIFont fontWithName:@"Exo2.0-Thin" size:fontSize * 2.f] },
@(H2) : @{ NSFontAttributeName: [UIFont fontWithName:@"Exo2.0-Thin" size:fontSize * 1.5f] },
@(H3) : @{ NSFontAttributeName: [UIFont fontWithName:@"Exo2.0-Thin" size:fontSize * 1.17f] },
@(H4) : @{ NSFontAttributeName: [UIFont fontWithName:@"Exo2.0-Thin" size:fontSize * 1.f] },
@(H5) : @{ NSFontAttributeName: [UIFont fontWithName:@"Exo2.0-Thin" size:fontSize * .83f] },
@(H6) : @{ NSFontAttributeName: [UIFont fontWithName:@"Exo2.0-Thin" size:fontSize * .75f] },
@(BLOCKQUOTE) : @{ NSFontAttributeName: [UIFont fontWithName:@"Exo2.0-Thin" size:fontSize * 1.17f] },
@(CODE) : @{ NSFontAttributeName: [UIFont fontWithName:@"SourceCodePro-Regular" size:fontSize] },
@(VERBATIM) : @{ NSFontAttributeName: [UIFont fontWithName:@"SourceCodePro-Regular" size:fontSize] },
@(NOTE) : @{ NSFontAttributeName: [UIFont fontWithName:@"Exo2.0-Thin" size:fontSize * 1.17f] },
} );
// Trim trailing newlines.