2
0

Minor code improvement.

[FIXED]     Some minor code fixes thanks to inspections.
[FIXED]     Some iOS6 deprecation issues.
[IMPROVED]  Cleanup with regards to store migration.
This commit is contained in:
Maarten Billemont 2013-01-27 16:27:49 -05:00
parent 1b3f5f5d25
commit 725da285da
18 changed files with 18 additions and 69 deletions

View File

@ -5,7 +5,9 @@
<inspection_tool class="FunctionImplicitDeclarationInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LossyEncoding" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="MethodIsLaterInTheScope" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="OCNotLocalizedStringInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="OCUnusedMethodInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnusedLocalVariable" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnusedParameter" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
</profile>
</component>

2
External/Pearl vendored

@ -1 +1 @@
Subproject commit 7cbc205dd8353c4b82ee6e8229df500cdaee0b94
Subproject commit b0271de7eb8fc9b6bb3e83fa8872b440171191d9

View File

@ -5208,7 +5208,7 @@
GCC_WARN_UNUSED_LABEL = YES;
GCC_WARN_UNUSED_VALUE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "${TARGET_NAME}";
@ -5271,7 +5271,7 @@
GCC_WARN_UNUSED_LABEL = YES;
GCC_WARN_UNUSED_VALUE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "${TARGET_NAME}";
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
@ -5427,7 +5427,7 @@
GCC_WARN_UNUSED_LABEL = YES;
GCC_WARN_UNUSED_VALUE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "${TARGET_NAME}";
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "";

View File

@ -16,7 +16,6 @@
//
#import "MPAlgorithm.h"
#import "MPEntities.h"
id<MPAlgorithm> MPAlgorithmForVersion(NSUInteger version) {

View File

@ -42,13 +42,12 @@ static char managedObjectContextKey;
- (void)migrateStoreForManager:(UbiquityStoreManager *)storeManager {
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"iCloudEnabledKey"];
NSNumber *cloudEnabled = [[NSUserDefaults standardUserDefaults] objectForKey:@"iCloudEnabledKey"];
if (!cloudEnabled)
// No old data to migrate.
return;
if ([cloudEnabled boolValue]) {
NSURL *newCloudContentURL = [storeManager URLForCloudContent];
NSURL *newCloudStoreURL = [storeManager URLForCloudStore];
if ([[NSFileManager defaultManager] fileExistsAtPath:newCloudStoreURL.path isDirectory:NO])
// New store already exists, migration has already been done.
@ -56,6 +55,7 @@ static char managedObjectContextKey;
NSString *uuid = [[NSUserDefaults standardUserDefaults] stringForKey:@"LocalUUIDKey"];
NSURL *cloudContainerURL = [[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:@"HL3Q45LX9N.com.lyndir.lhunath.MasterPassword.shared"];
NSURL *newCloudContentURL = [storeManager URLForCloudContent];
//NSURL *oldCloudContentURL = [[cloudContainerURL URLByAppendingPathComponent:@"Data" isDirectory:YES]
// URLByAppendingPathComponent:uuid isDirectory:YES];
NSURL *oldCloudStoreDirectoryURL = [cloudContainerURL URLByAppendingPathComponent:@"Database.nosync" isDirectory:YES];
@ -136,6 +136,7 @@ static char managedObjectContextKey;
}
}
}
[[NSUserDefaults standardUserDefaults] removeObjectForKey:@"LocalUUIDKey"];
[[NSUserDefaults standardUserDefaults] removeObjectForKey:@"iCloudEnabledKey"];
}

View File

@ -6,7 +6,6 @@
// Copyright (c) 2012 Lyndir. All rights reserved.
//
#import "MPConfig.h"
#import "MPAppDelegate.h"
@implementation MPConfig

View File

@ -7,7 +7,6 @@
//
#import "MPElementEntity.h"
#import "MPUserEntity.h"
@implementation MPElementEntity

View File

@ -15,7 +15,6 @@
// Copyright 2012 lhunath (Maarten Billemont). All rights reserved.
//
#import "MPKey.h"
#import "MPAlgorithm.h"

View File

@ -7,7 +7,6 @@
//
#import "MPUserEntity.h"
#import "MPElementEntity.h"
@implementation MPUserEntity

View File

@ -16,7 +16,6 @@
#import "MPAppDelegate_Store.h"
#import "IASKSettingsReader.h"
#import "LocalyticsSession.h"
@interface MPAppDelegate ()

View File

@ -16,7 +16,6 @@
//
#import "MPAppViewController.h"
#import "LocalyticsSession.h"
@implementation MPAppViewController {

View File

@ -16,7 +16,6 @@
//
#import "MPAppsViewController.h"
#import "LocalyticsSession.h"
@interface MPAppsViewController ()

View File

@ -7,12 +7,9 @@
//
#import "MPGuideViewController.h"
#import "LocalyticsSession.h"
@implementation MPGuideViewController
@synthesize scrollView;
@synthesize pageControl;
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

View File

@ -10,7 +10,6 @@
#import "MPAppDelegate.h"
#import "MPAppDelegate_Key.h"
#import "MPAppDelegate_Store.h"
#import "LocalyticsSession.h"
@implementation MPMainViewController

View File

@ -11,20 +11,12 @@
#import "MPAppDelegate.h"
#import "MPAppDelegate_Key.h"
#import "MPAppDelegate_Store.h"
#import "LocalyticsSession.h"
@interface MPPreferencesViewController ()
@end
@implementation MPPreferencesViewController
@synthesize avatarsView;
@synthesize avatarTemplate;
@synthesize savePasswordSwitch;
@synthesize exportCell;
@synthesize changeMPCell;
@synthesize defaultTypeLabel;
- (void)viewDidLoad {

View File

@ -8,7 +8,6 @@
#import "MPSearchDelegate.h"
#import "MPAppDelegate.h"
#import "LocalyticsSession.h"
#import "MPAppDelegate_Store.h"
@interface MPSearchDelegate (Private)
@ -21,12 +20,6 @@
NSFetchedResultsController *_fetchedResultsController;
}
@synthesize tipView;
@synthesize query;
@synthesize dateFormatter;
@synthesize delegate;
@synthesize searchDisplayController;
@synthesize searchTipContainer;
- (id)init {
@ -38,7 +31,7 @@
self.query = @"";
self.tipView = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320, 170)];
self.tipView.textAlignment = UITextAlignmentCenter;
self.tipView.textAlignment = NSTextAlignmentCenter;
self.tipView.backgroundColor = [UIColor clearColor];
self.tipView.textColor = [UIColor lightTextColor];
self.tipView.shadowColor = [UIColor blackColor];

View File

@ -7,7 +7,6 @@
//
#import "MPTypeViewController.h"
#import "LocalyticsSession.h"
@interface MPTypeViewController ()
@ -17,8 +16,6 @@
@end
@implementation MPTypeViewController
@synthesize delegate;
@synthesize recommendedTipContainer;
#pragma mark - View lifecycle
@ -72,8 +69,8 @@
UITableViewCell *cell = [super tableView:tableView cellForRowAtIndexPath:indexPath];
if ([delegate respondsToSelector:@selector(selectedType)])
cell.selected = ([delegate selectedType] == [self typeAtIndexPath:indexPath]);
if ([self.delegate respondsToSelector:@selector(selectedType)])
cell.selected = ([self.delegate selectedType] == [self typeAtIndexPath:indexPath]);
return cell;
}
@ -87,7 +84,7 @@
// Selected a non-type row.
return;
[delegate didSelectType:type];
[self.delegate didSelectType:type];
[self.navigationController popViewControllerAnimated:YES];
}
@ -98,7 +95,7 @@
// Generated
switch (indexPath.row) {
case 0:
return NSNotFound;
return (MPElementType)NSNotFound;
case 1:
return MPElementTypeGeneratedMaximum;
case 2:
@ -112,7 +109,7 @@
case 6:
return MPElementTypeGeneratedPIN;
case 7:
return NSNotFound;
return (MPElementType)NSNotFound;
default: {
Throw(@"Unsupported row: %d, when selecting generated element type.", indexPath.row);
@ -124,13 +121,13 @@
// Stored
switch (indexPath.row) {
case 0:
return NSNotFound;
return (MPElementType)NSNotFound;
case 1:
return MPElementTypeStoredPersonal;
case 2:
return MPElementTypeStoredDevicePrivate;
case 3:
return NSNotFound;
return (MPElementType)NSNotFound;
default: {
Throw(@"Unsupported row: %d, when selecting stored element type.", indexPath.row);

View File

@ -19,7 +19,6 @@
#import "MPAppDelegate.h"
#import "MPAppDelegate_Key.h"
#import "MPAppDelegate_Store.h"
#import "LocalyticsSession.h"
@interface MPUnlockViewController ()
@ -29,32 +28,9 @@
@property (nonatomic, strong) NSArray *wordList;
@property (nonatomic, strong) NSOperationQueue *fbOperationQueue;
@end
@implementation MPUnlockViewController
@synthesize selectedUser;
@synthesize avatarToUser;
@synthesize spinner;
@synthesize passwordFieldLabel;
@synthesize passwordField;
@synthesize passwordView;
@synthesize avatarsView;
@synthesize nameLabel, oldNameLabel;
@synthesize avatarTemplate;
@synthesize createPasswordTipView;
@synthesize tip;
@synthesize passwordTipView;
@synthesize passwordTipLabel;
@synthesize wordWall;
@synthesize targetedUserActionGesture;
@synthesize loadingUsersIndicator;
@synthesize uiContainer;
@synthesize avatarShadowColor = _avatarShadowColor;
@synthesize wordWallAnimating = _wordWallAnimating;
@synthesize wordList = _wordList;
@synthesize fbOperationQueue = _fbOperationQueue;
- (void)initializeAvatarAlert:(UIAlertView *)alert forUser:(MPUserEntity *)user {
@ -351,7 +327,7 @@
}
if (![alert textFieldAtIndex:0].text.length) {
[PearlAlert showAlertWithTitle:@"Name Is Required" message:nil viewStyle:UIAlertViewStyleDefault initAlert:nil
tappedButtonBlock:^(UIAlertView *alert, NSInteger buttonIndex) {
tappedButtonBlock:^(UIAlertView *alert_, NSInteger buttonIndex_) {
[self showNewUserNameAlertFor:newUser completion:completion];
} cancelTitle:@"Try Again" otherTitles:nil];
return;