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

@@ -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,
@@ -31,13 +31,14 @@ typedef NS_ENUM(NSUInteger, MPAvatarMode) {
MPAvatarModeRaisedAndMinimized,
};
@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;
@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;
+ (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,11 +418,11 @@ 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];
NSInteger fromSections = self.passwordCollectionView.numberOfSections;
NSInteger toSections = [self numberOfSectionsInCollectionView:self.passwordCollectionView];
for (NSInteger section = 0; section < MAX( toSections, fromSections ); ++section) {
@@ -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.