AppCode code formatting.
This commit is contained in:
parent
d59f77720c
commit
a8bf74a925
2
External/Pearl
vendored
2
External/Pearl
vendored
@ -1 +1 @@
|
|||||||
Subproject commit e55ef6876ee26f61a7cd2c075fc1e7a942016de0
|
Subproject commit 009482a08a2a05e9856c2158c1040d01aeedb5ff
|
@ -44,10 +44,10 @@ static NSDictionary *keyQuery(MPUserEntity *user) {
|
|||||||
inf(@"Updating key in keychain.");
|
inf(@"Updating key in keychain.");
|
||||||
[PearlKeyChain addOrUpdateItemForQuery:keyQuery(user)
|
[PearlKeyChain addOrUpdateItemForQuery:keyQuery(user)
|
||||||
withAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
|
withAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
|
||||||
self.key, (__bridge id) kSecValueData,
|
self.key, (__bridge id)kSecValueData,
|
||||||
#if TARGET_OS_IPHONE
|
#if TARGET_OS_IPHONE
|
||||||
kSecAttrAccessibleWhenUnlockedThisDeviceOnly, (__bridge id) kSecAttrAccessible,
|
kSecAttrAccessibleWhenUnlockedThisDeviceOnly, (__bridge id)kSecAttrAccessible,
|
||||||
#endif
|
#endif
|
||||||
nil]];
|
nil]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -96,7 +96,8 @@ static NSDictionary *keyQuery(MPUserEntity *user) {
|
|||||||
// Key should not be stored in keychain. Delete it.
|
// Key should not be stored in keychain. Delete it.
|
||||||
[self forgetSavedKeyFor:user];
|
[self forgetSavedKeyFor:user];
|
||||||
|
|
||||||
else if (!tryKey) {
|
else
|
||||||
|
if (!tryKey) {
|
||||||
// Key should be saved in keychain. Load it.
|
// Key should be saved in keychain. Load it.
|
||||||
if ((tryKey = [self loadSavedKeyFor:user]))
|
if ((tryKey = [self loadSavedKeyFor:user]))
|
||||||
if (![user.keyID isEqual:keyIDForKey(tryKey)]) {
|
if (![user.keyID isEqual:keyIDForKey(tryKey)]) {
|
||||||
@ -117,9 +118,9 @@ static NSDictionary *keyQuery(MPUserEntity *user) {
|
|||||||
if (![user.keyID isEqual:keyIDForKey(tryKey)]) {
|
if (![user.keyID isEqual:keyIDForKey(tryKey)]) {
|
||||||
tryKey = nil;
|
tryKey = nil;
|
||||||
|
|
||||||
#ifdef TESTFLIGHT_SDK_VERSION
|
#ifdef TESTFLIGHT_SDK_VERSION
|
||||||
[TestFlight passCheckpoint:MPTestFlightCheckpointMPMismatch];
|
[TestFlight passCheckpoint:MPTestFlightCheckpointMPMismatch];
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#import "MPEntities.h"
|
#import "MPEntities.h"
|
||||||
|
|
||||||
#if TARGET_OS_IPHONE
|
#if TARGET_OS_IPHONE
|
||||||
|
|
||||||
@interface MPAppDelegate_Shared : PearlAppDelegate
|
@interface MPAppDelegate_Shared : PearlAppDelegate
|
||||||
#else
|
#else
|
||||||
@interface MPAppDelegate_Shared : NSObject <PearlConfigDelegate>
|
@interface MPAppDelegate_Shared : NSObject <PearlConfigDelegate>
|
||||||
|
@ -18,7 +18,7 @@ typedef enum {
|
|||||||
MPImportResultInternalError,
|
MPImportResultInternalError,
|
||||||
} MPImportResult;
|
} MPImportResult;
|
||||||
|
|
||||||
@interface MPAppDelegate_Shared (Store) <UbiquityStoreManagerDelegate>
|
@interface MPAppDelegate_Shared (Store)<UbiquityStoreManagerDelegate>
|
||||||
|
|
||||||
+ (NSManagedObjectContext *)managedObjectContext;
|
+ (NSManagedObjectContext *)managedObjectContext;
|
||||||
+ (NSManagedObjectModel *)managedObjectModel;
|
+ (NSManagedObjectModel *)managedObjectModel;
|
||||||
|
@ -40,7 +40,7 @@ static NSDateFormatter *rfc3339DateFormatter = nil;
|
|||||||
if (managedObjectContext)
|
if (managedObjectContext)
|
||||||
return managedObjectContext;
|
return managedObjectContext;
|
||||||
|
|
||||||
return [PearlLazy lazyObjectLoadedFrom:^id{
|
return [PearlLazy lazyObjectLoadedFrom:^id {
|
||||||
NSPersistentStoreCoordinator *coordinator = [self persistentStoreCoordinator];
|
NSPersistentStoreCoordinator *coordinator = [self persistentStoreCoordinator];
|
||||||
assert(coordinator);
|
assert(coordinator);
|
||||||
|
|
||||||
@ -59,9 +59,9 @@ static NSDateFormatter *rfc3339DateFormatter = nil;
|
|||||||
// Start loading the store.
|
// Start loading the store.
|
||||||
[self storeManager];
|
[self storeManager];
|
||||||
|
|
||||||
return [PearlLazy lazyObjectLoadedFrom:^id{
|
return [PearlLazy lazyObjectLoadedFrom:^id {
|
||||||
// Wait until the storeManager is ready.
|
// Wait until the storeManager is ready.
|
||||||
for(__block BOOL isReady = [self storeManager].isReady; !isReady;) {
|
for (__block BOOL isReady = [self storeManager].isReady; !isReady;) {
|
||||||
[NSThread sleepForTimeInterval:0.1];
|
[NSThread sleepForTimeInterval:0.1];
|
||||||
dispatch_sync(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
dispatch_sync(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||||
isReady = [self storeManager].isReady;
|
isReady = [self storeManager].isReady;
|
||||||
@ -83,7 +83,8 @@ static NSDateFormatter *rfc3339DateFormatter = nil;
|
|||||||
localStoreURL:[[self applicationFilesDirectory] URLByAppendingPathComponent:@"MasterPassword.sqlite"]
|
localStoreURL:[[self applicationFilesDirectory] URLByAppendingPathComponent:@"MasterPassword.sqlite"]
|
||||||
containerIdentifier:@"HL3Q45LX9N.com.lyndir.lhunath.MasterPassword.shared"
|
containerIdentifier:@"HL3Q45LX9N.com.lyndir.lhunath.MasterPassword.shared"
|
||||||
#if TARGET_OS_IPHONE
|
#if TARGET_OS_IPHONE
|
||||||
additionalStoreOptions:[NSDictionary dictionaryWithObject:NSFileProtectionComplete forKey:NSPersistentStoreFileProtectionKey]
|
additionalStoreOptions:[NSDictionary dictionaryWithObject:NSFileProtectionComplete
|
||||||
|
forKey:NSPersistentStoreFileProtectionKey]
|
||||||
#else
|
#else
|
||||||
additionalStoreOptions:nil
|
additionalStoreOptions:nil
|
||||||
#endif
|
#endif
|
||||||
@ -157,7 +158,8 @@ static NSDateFormatter *rfc3339DateFormatter = nil;
|
|||||||
[MPConfig get].iCloud = [NSNumber numberWithBool:iCloudEnabled];
|
[MPConfig get].iCloud = [NSNumber numberWithBool:iCloudEnabled];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)ubiquityStoreManager:(UbiquityStoreManager *)manager didEncounterError:(NSError *)error cause:(UbiquityStoreManagerErrorCause)cause context:(id)context {
|
- (void)ubiquityStoreManager:(UbiquityStoreManager *)manager didEncounterError:(NSError *)error cause:(UbiquityStoreManagerErrorCause)cause
|
||||||
|
context:(id)context {
|
||||||
|
|
||||||
#ifdef TESTFLIGHT_SDK_VERSION
|
#ifdef TESTFLIGHT_SDK_VERSION
|
||||||
[TestFlight passCheckpoint:PearlString(@"MPTestFlightCheckpointMPErrorUbiquity_%d", cause)];
|
[TestFlight passCheckpoint:PearlString(@"MPTestFlightCheckpointMPErrorUbiquity_%d", cause)];
|
||||||
@ -238,7 +240,7 @@ static NSDateFormatter *rfc3339DateFormatter = nil;
|
|||||||
NSMutableSet *elementsToDelete = [NSMutableSet set];
|
NSMutableSet *elementsToDelete = [NSMutableSet set];
|
||||||
NSMutableArray *importedSiteElements = [NSMutableArray arrayWithCapacity:[importedSiteLines count]];
|
NSMutableArray *importedSiteElements = [NSMutableArray arrayWithCapacity:[importedSiteLines count]];
|
||||||
NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:NSStringFromClass([MPElementEntity class])];
|
NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:NSStringFromClass([MPElementEntity class])];
|
||||||
for(NSString *importedSiteLine in importedSiteLines) {
|
for (NSString *importedSiteLine in importedSiteLines) {
|
||||||
if ([importedSiteLine hasPrefix:@"#"]) {
|
if ([importedSiteLine hasPrefix:@"#"]) {
|
||||||
// Comment or header
|
// Comment or header
|
||||||
if (!headerStarted) {
|
if (!headerStarted) {
|
||||||
@ -258,7 +260,8 @@ static NSDateFormatter *rfc3339DateFormatter = nil;
|
|||||||
err(@"Invalid header format in line: %@", importedSiteLine);
|
err(@"Invalid header format in line: %@", importedSiteLine);
|
||||||
return MPImportResultMalformedInput;
|
return MPImportResultMalformedInput;
|
||||||
}
|
}
|
||||||
NSTextCheckingResult *headerElements = [[headerPattern matchesInString:importedSiteLine options:0 range:NSMakeRange(0, [importedSiteLine length])] lastObject];
|
NSTextCheckingResult *headerElements = [[headerPattern matchesInString:importedSiteLine options:0
|
||||||
|
range:NSMakeRange(0, [importedSiteLine length])] lastObject];
|
||||||
NSString *key = [importedSiteLine substringWithRange:[headerElements rangeAtIndex:1]];
|
NSString *key = [importedSiteLine substringWithRange:[headerElements rangeAtIndex:1]];
|
||||||
NSString *value = [importedSiteLine substringWithRange:[headerElements rangeAtIndex:2]];
|
NSString *value = [importedSiteLine substringWithRange:[headerElements rangeAtIndex:2]];
|
||||||
if ([key isEqualToString:@"User Name"]) {
|
if ([key isEqualToString:@"User Name"]) {
|
||||||
@ -287,7 +290,8 @@ static NSDateFormatter *rfc3339DateFormatter = nil;
|
|||||||
err(@"Invalid site format in line: %@", importedSiteLine);
|
err(@"Invalid site format in line: %@", importedSiteLine);
|
||||||
return MPImportResultMalformedInput;
|
return MPImportResultMalformedInput;
|
||||||
}
|
}
|
||||||
NSTextCheckingResult *siteElements = [[sitePattern matchesInString:importedSiteLine options:0 range:NSMakeRange(0, [importedSiteLine length])] lastObject];
|
NSTextCheckingResult *siteElements = [[sitePattern matchesInString:importedSiteLine options:0
|
||||||
|
range:NSMakeRange(0, [importedSiteLine length])] lastObject];
|
||||||
NSString *lastUsed = [importedSiteLine substringWithRange:[siteElements rangeAtIndex:1]];
|
NSString *lastUsed = [importedSiteLine substringWithRange:[siteElements rangeAtIndex:1]];
|
||||||
NSString *uses = [importedSiteLine substringWithRange:[siteElements rangeAtIndex:2]];
|
NSString *uses = [importedSiteLine substringWithRange:[siteElements rangeAtIndex:2]];
|
||||||
NSString *type = [importedSiteLine substringWithRange:[siteElements rangeAtIndex:3]];
|
NSString *type = [importedSiteLine substringWithRange:[siteElements rangeAtIndex:3]];
|
||||||
@ -321,7 +325,8 @@ static NSDateFormatter *rfc3339DateFormatter = nil;
|
|||||||
|
|
||||||
// Import new sites.
|
// Import new sites.
|
||||||
if (!user) {
|
if (!user) {
|
||||||
user = [NSEntityDescription insertNewObjectForEntityForName:NSStringFromClass([MPUserEntity class]) inManagedObjectContext:self.managedObjectContext];
|
user = [NSEntityDescription insertNewObjectForEntityForName:NSStringFromClass([MPUserEntity class])
|
||||||
|
inManagedObjectContext:self.managedObjectContext];
|
||||||
user.name = userName;
|
user.name = userName;
|
||||||
user.keyID = [keyIDHex decodeHex];
|
user.keyID = [keyIDHex decodeHex];
|
||||||
}
|
}
|
||||||
@ -390,12 +395,14 @@ static NSDateFormatter *rfc3339DateFormatter = nil;
|
|||||||
if (!(type & MPElementFeatureDevicePrivate)) {
|
if (!(type & MPElementFeatureDevicePrivate)) {
|
||||||
if (showPasswords)
|
if (showPasswords)
|
||||||
content = element.content;
|
content = element.content;
|
||||||
else if (type & MPElementFeatureExportContent)
|
else
|
||||||
|
if (type & MPElementFeatureExportContent)
|
||||||
content = element.exportContent;
|
content = element.exportContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
[export appendFormat:@"%@ %8d %8d %20s\t%@\n",
|
[export appendFormat:@"%@ %8d %8d %20s\t%@\n",
|
||||||
[rfc3339DateFormatter stringFromDate:lastUsed], uses, type, [name cStringUsingEncoding:NSUTF8StringEncoding], content? content: @""];
|
[rfc3339DateFormatter stringFromDate:lastUsed], uses, type, [name cStringUsingEncoding:NSUTF8StringEncoding], content
|
||||||
|
? content: @""];
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TESTFLIGHT_SDK_VERSION
|
#ifdef TESTFLIGHT_SDK_VERSION
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
// Copyright (c) 2012 Lyndir. All rights reserved.
|
// Copyright (c) 2012 Lyndir. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
#import "MPConfig.h"
|
|
||||||
#import "MPAppDelegate.h"
|
#import "MPAppDelegate.h"
|
||||||
|
|
||||||
@implementation MPConfig
|
@implementation MPConfig
|
||||||
@ -14,7 +13,7 @@
|
|||||||
|
|
||||||
- (id)init {
|
- (id)init {
|
||||||
|
|
||||||
if(!(self = [super init]))
|
if (!(self = [super init]))
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
[self.defaults registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:
|
[self.defaults registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:
|
||||||
|
@ -14,10 +14,10 @@
|
|||||||
@interface MPElementEntity : NSManagedObject
|
@interface MPElementEntity : NSManagedObject
|
||||||
|
|
||||||
@property (nonatomic, retain) id content;
|
@property (nonatomic, retain) id content;
|
||||||
@property (nonatomic, retain) NSDate * lastUsed;
|
@property (nonatomic, retain) NSDate *lastUsed;
|
||||||
@property (nonatomic, retain) NSString * name;
|
@property (nonatomic, retain) NSString *name;
|
||||||
@property (nonatomic, retain) NSNumber * type_;
|
@property (nonatomic, retain) NSNumber *type_;
|
||||||
@property (nonatomic, retain) NSNumber * uses_;
|
@property (nonatomic, retain) NSNumber *uses_;
|
||||||
@property (nonatomic, retain) MPUserEntity *user;
|
@property (nonatomic, retain) MPUserEntity *user;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#import "MPElementEntity.h"
|
#import "MPElementEntity.h"
|
||||||
#import "MPUserEntity.h"
|
|
||||||
|
|
||||||
|
|
||||||
@implementation MPElementEntity
|
@implementation MPElementEntity
|
||||||
|
@ -13,6 +13,6 @@
|
|||||||
|
|
||||||
@interface MPElementGeneratedEntity : MPElementEntity
|
@interface MPElementGeneratedEntity : MPElementEntity
|
||||||
|
|
||||||
@property (nonatomic, retain) NSNumber * counter_;
|
@property (nonatomic, retain) NSNumber *counter_;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -129,9 +129,9 @@
|
|||||||
[PearlKeyChain addOrUpdateItemForQuery:[MPElementStoredEntity queryForDevicePrivateElementNamed:self.name]
|
[PearlKeyChain addOrUpdateItemForQuery:[MPElementStoredEntity queryForDevicePrivateElementNamed:self.name]
|
||||||
withAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
|
withAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
|
||||||
encryptedContent, (__bridge id)kSecValueData,
|
encryptedContent, (__bridge id)kSecValueData,
|
||||||
#if TARGET_OS_IPHONE
|
#if TARGET_OS_IPHONE
|
||||||
kSecAttrAccessibleWhenUnlockedThisDeviceOnly, (__bridge id)kSecAttrAccessible,
|
kSecAttrAccessibleWhenUnlockedThisDeviceOnly, (__bridge id)kSecAttrAccessible,
|
||||||
#endif
|
#endif
|
||||||
nil]];
|
nil]];
|
||||||
self.contentObject = nil;
|
self.contentObject = nil;
|
||||||
} else
|
} else
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#import "MPTypes.h"
|
#import "MPTypes.h"
|
||||||
#import "MPElementGeneratedEntity.h"
|
|
||||||
#import "MPElementStoredEntity.h"
|
#import "MPElementStoredEntity.h"
|
||||||
|
|
||||||
|
|
||||||
@ -23,21 +22,25 @@ NSData *keyForPassword(NSString *password, NSString *username) {
|
|||||||
NSData *key = [PearlSCrypt deriveKeyWithLength:MP_dkLen fromPassword:[password dataUsingEncoding:NSUTF8StringEncoding]
|
NSData *key = [PearlSCrypt deriveKeyWithLength:MP_dkLen fromPassword:[password dataUsingEncoding:NSUTF8StringEncoding]
|
||||||
usingSalt:[NSData dataByConcatenatingDatas:
|
usingSalt:[NSData dataByConcatenatingDatas:
|
||||||
[@"com.lyndir.masterpassword" dataUsingEncoding:NSUTF8StringEncoding],
|
[@"com.lyndir.masterpassword" dataUsingEncoding:NSUTF8StringEncoding],
|
||||||
[NSData dataWithBytes:&nusernameLength length:sizeof(nusernameLength)],
|
[NSData dataWithBytes:&nusernameLength
|
||||||
|
length:sizeof(nusernameLength)],
|
||||||
[username dataUsingEncoding:NSUTF8StringEncoding],
|
[username dataUsingEncoding:NSUTF8StringEncoding],
|
||||||
nil] N:MP_N r:MP_r p:MP_p];
|
nil] N:MP_N r:MP_r p:MP_p];
|
||||||
|
|
||||||
trc(@"User: %@, password: %@ derives to key ID: %@", username, password, [keyIDForKey(key) encodeHex]);
|
trc(@"User: %@, password: %@ derives to key ID: %@", username, password, [keyIDForKey(key) encodeHex]);
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSData *keyIDForPassword(NSString *password, NSString *username) {
|
NSData *keyIDForPassword(NSString *password, NSString *username) {
|
||||||
|
|
||||||
return keyIDForKey(keyForPassword(password, username));
|
return keyIDForKey(keyForPassword(password, username));
|
||||||
}
|
}
|
||||||
|
|
||||||
NSData *keyIDForKey(NSData *key) {
|
NSData *keyIDForKey(NSData *key) {
|
||||||
|
|
||||||
return [key hashWith:MP_hash];
|
return [key hashWith:MP_hash];
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString *NSStringFromMPElementType(MPElementType type) {
|
NSString *NSStringFromMPElementType(MPElementType type) {
|
||||||
|
|
||||||
if (!type)
|
if (!type)
|
||||||
@ -114,6 +117,7 @@ NSString *ClassNameFromMPElementType(MPElementType type) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static NSDictionary *MPTypes_ciphers = nil;
|
static NSDictionary *MPTypes_ciphers = nil;
|
||||||
|
|
||||||
NSString *MPCalculateContent(MPElementType type, NSString *name, NSData *key, uint32_t counter) {
|
NSString *MPCalculateContent(MPElementType type, NSString *name, NSData *key, uint32_t counter) {
|
||||||
|
|
||||||
if (!(type & MPElementTypeClassGenerated)) {
|
if (!(type & MPElementTypeClassGenerated)) {
|
||||||
@ -164,7 +168,8 @@ NSString *MPCalculateContent(MPElementType type, NSString *name, NSData *key, ui
|
|||||||
uint16_t keyByte = htons(seedBytes[c + 1]);
|
uint16_t keyByte = htons(seedBytes[c + 1]);
|
||||||
NSString *cipherClass = [cipher substringWithRange:NSMakeRange(c, 1)];
|
NSString *cipherClass = [cipher substringWithRange:NSMakeRange(c, 1)];
|
||||||
NSString *cipherClassCharacters = [[MPTypes_ciphers valueForKey:@"MPCharacterClasses"] valueForKey:cipherClass];
|
NSString *cipherClassCharacters = [[MPTypes_ciphers valueForKey:@"MPCharacterClasses"] valueForKey:cipherClass];
|
||||||
NSString *character = [cipherClassCharacters substringWithRange:NSMakeRange(keyByte % [cipherClassCharacters length], 1)];
|
NSString *character = [cipherClassCharacters substringWithRange:NSMakeRange(keyByte % [cipherClassCharacters length],
|
||||||
|
1)];
|
||||||
|
|
||||||
trc(@"class %@ has characters: %@, selected: %@", cipherClass, cipherClassCharacters, character);
|
trc(@"class %@ has characters: %@, selected: %@", cipherClass, cipherClassCharacters, character);
|
||||||
[content appendString:character];
|
[content appendString:character];
|
||||||
|
@ -13,11 +13,11 @@
|
|||||||
|
|
||||||
@interface MPUserEntity : NSManagedObject
|
@interface MPUserEntity : NSManagedObject
|
||||||
|
|
||||||
@property (nonatomic, retain) NSNumber * avatar_;
|
@property (nonatomic, retain) NSNumber *avatar_;
|
||||||
@property (nonatomic, retain) NSData * keyID;
|
@property (nonatomic, retain) NSData *keyID;
|
||||||
@property (nonatomic, retain) NSDate * lastUsed;
|
@property (nonatomic, retain) NSDate *lastUsed;
|
||||||
@property (nonatomic, retain) NSString * name;
|
@property (nonatomic, retain) NSString *name;
|
||||||
@property (nonatomic, retain) NSNumber * saveKey_;
|
@property (nonatomic, retain) NSNumber *saveKey_;
|
||||||
@property (nonatomic, retain) NSSet *elements;
|
@property (nonatomic, retain) NSSet *elements;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#import "MPUserEntity.h"
|
#import "MPUserEntity.h"
|
||||||
#import "MPElementEntity.h"
|
|
||||||
|
|
||||||
|
|
||||||
@implementation MPUserEntity
|
@implementation MPUserEntity
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#import "MPAppDelegate_Shared.h"
|
#import "MPAppDelegate_Shared.h"
|
||||||
#import "MPPasswordWindowController.h"
|
#import "MPPasswordWindowController.h"
|
||||||
|
|
||||||
@interface MPAppDelegate : MPAppDelegate_Shared <NSApplicationDelegate>
|
@interface MPAppDelegate : MPAppDelegate_Shared<NSApplicationDelegate>
|
||||||
|
|
||||||
@property (strong) NSStatusItem *statusItem;
|
@property (strong) NSStatusItem *statusItem;
|
||||||
@property (strong) MPPasswordWindowController *passwordWindow;
|
@property (strong) MPPasswordWindowController *passwordWindow;
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
@synthesize keyID;
|
@synthesize keyID;
|
||||||
|
|
||||||
#pragma GCC diagnostic ignored "-Wfour-char-constants"
|
#pragma GCC diagnostic ignored "-Wfour-char-constants"
|
||||||
static EventHotKeyID MPShowHotKey = { .signature = 'show', .id = 1 };
|
static EventHotKeyID MPShowHotKey = {.signature = 'show', .id = 1};
|
||||||
|
|
||||||
+ (void)initialize {
|
+ (void)initialize {
|
||||||
|
|
||||||
@ -44,12 +44,12 @@ static EventHotKeyID MPShowHotKey = { .signature = 'show', .id = 1 };
|
|||||||
return (MPAppDelegate *)[super get];
|
return (MPAppDelegate *)[super get];
|
||||||
}
|
}
|
||||||
|
|
||||||
static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEvent, void *userData){
|
static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEvent, void *userData) {
|
||||||
|
|
||||||
// Extract the hotkey ID.
|
// Extract the hotkey ID.
|
||||||
EventHotKeyID hotKeyID;
|
EventHotKeyID hotKeyID;
|
||||||
GetEventParameter(theEvent,kEventParamDirectObject,typeEventHotKeyID,
|
GetEventParameter(theEvent, kEventParamDirectObject, typeEventHotKeyID,
|
||||||
NULL,sizeof(hotKeyID),NULL,&hotKeyID);
|
NULL, sizeof(hotKeyID), NULL, &hotKeyID);
|
||||||
|
|
||||||
// Check which hotkey this was.
|
// Check which hotkey this was.
|
||||||
if (hotKeyID.signature == MPShowHotKey.signature && hotKeyID.id == MPShowHotKey.id) {
|
if (hotKeyID.signature == MPShowHotKey.signature && hotKeyID.id == MPShowHotKey.id) {
|
||||||
@ -133,13 +133,14 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven
|
|||||||
|
|
||||||
// Global hotkey.
|
// Global hotkey.
|
||||||
EventHotKeyRef hotKeyRef;
|
EventHotKeyRef hotKeyRef;
|
||||||
EventTypeSpec hotKeyEvents[1] = { { .eventClass = kEventClassKeyboard, .eventKind = kEventHotKeyPressed } };
|
EventTypeSpec hotKeyEvents[1] = {{.eventClass = kEventClassKeyboard, .eventKind = kEventHotKeyPressed}};
|
||||||
OSStatus status = InstallApplicationEventHandler(NewEventHandlerUPP(MPHotKeyHander), GetEventTypeCount(hotKeyEvents), hotKeyEvents,
|
OSStatus status = InstallApplicationEventHandler(NewEventHandlerUPP(MPHotKeyHander), GetEventTypeCount(hotKeyEvents),
|
||||||
|
hotKeyEvents,
|
||||||
(__bridge void *)self, NULL);
|
(__bridge void *)self, NULL);
|
||||||
if(status != noErr)
|
if (status != noErr)
|
||||||
err(@"Error installing application event handler: %d", status);
|
err(@"Error installing application event handler: %d", status);
|
||||||
status = RegisterEventHotKey(35 /* p */, controlKey + cmdKey, MPShowHotKey, GetApplicationEventTarget(), 0, &hotKeyRef);
|
status = RegisterEventHotKey(35 /* p */, controlKey + cmdKey, MPShowHotKey, GetApplicationEventTarget(), 0, &hotKeyRef);
|
||||||
if(status != noErr)
|
if (status != noErr)
|
||||||
err(@"Error registering hotkey: %d", status);
|
err(@"Error registering hotkey: %d", status);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,8 +165,7 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven
|
|||||||
self.key = nil;
|
self.key = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
|
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender {
|
||||||
{
|
|
||||||
// Save changes in the application's managed object context before the application terminates.
|
// Save changes in the application's managed object context before the application terminates.
|
||||||
|
|
||||||
if (![self managedObjectContext]) {
|
if (![self managedObjectContext]) {
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
@interface MPPasswordWindowController : NSWindowController <NSTextFieldDelegate> {
|
@interface MPPasswordWindowController : NSWindowController<NSTextFieldDelegate> {
|
||||||
|
|
||||||
NSString *_content;
|
NSString *_content;
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) alertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo {
|
- (void)alertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo {
|
||||||
|
|
||||||
switch (returnCode) {
|
switch (returnCode) {
|
||||||
case NSAlertAlternateReturn:
|
case NSAlertAlternateReturn:
|
||||||
@ -92,7 +92,8 @@
|
|||||||
@"Note that you will only see the sites and passwords for the master password you log in with.\n"
|
@"Note that you will only see the sites and passwords for the master password you log in with.\n"
|
||||||
@"If you log in with a different master password, your current sites will be unavailable.\n\n"
|
@"If you log in with a different master password, your current sites will be unavailable.\n\n"
|
||||||
@"You can always change back to your current master password later.\n"
|
@"You can always change back to your current master password later.\n"
|
||||||
@"Your current sites and passwords will then become available again."] runModal] == 1)
|
@"Your current sites and passwords will then become available again."] runModal]
|
||||||
|
== 1)
|
||||||
[[MPAppDelegate get] forgetKey];
|
[[MPAppDelegate get] forgetKey];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -107,7 +108,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *)control:(NSControl *)control textView:(NSTextView *)textView completions:(NSArray *)words forPartialWordRange:(NSRange)charRange indexOfSelectedItem:(NSInteger *)index {
|
- (NSArray *)control:(NSControl *)control textView:(NSTextView *)textView completions:(NSArray *)words
|
||||||
|
forPartialWordRange:(NSRange)charRange indexOfSelectedItem:(NSInteger *)index {
|
||||||
|
|
||||||
NSString *query = [[control stringValue] substringWithRange:charRange];
|
NSString *query = [[control stringValue] substringWithRange:charRange];
|
||||||
if (![query length] || ![MPAppDelegate get].keyID)
|
if (![query length] || ![MPAppDelegate get].keyID)
|
||||||
|
@ -3,7 +3,9 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#ifdef __OBJC__
|
#ifdef __OBJC__
|
||||||
#import <Cocoa/Cocoa.h>
|
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#import "Pearl-Prefix.pch"
|
#import "Pearl-Prefix.pch"
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[]) {
|
||||||
{
|
|
||||||
return NSApplicationMain(argc, (const char **)argv);
|
return NSApplicationMain(argc, (const char **)argv);
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#import <MessageUI/MessageUI.h>
|
#import <MessageUI/MessageUI.h>
|
||||||
#import "MPAppDelegate_Shared.h"
|
#import "MPAppDelegate_Shared.h"
|
||||||
|
|
||||||
@interface MPAppDelegate : MPAppDelegate_Shared <MFMailComposeViewControllerDelegate>
|
@interface MPAppDelegate : MPAppDelegate_Shared<MFMailComposeViewControllerDelegate>
|
||||||
|
|
||||||
+ (MPAppDelegate *)get;
|
+ (MPAppDelegate *)get;
|
||||||
|
|
||||||
|
@ -12,8 +12,6 @@
|
|||||||
|
|
||||||
#import "IASKSettingsReader.h"
|
#import "IASKSettingsReader.h"
|
||||||
#import "LocalyticsSession.h"
|
#import "LocalyticsSession.h"
|
||||||
#import "TestFlight.h"
|
|
||||||
#import <Crashlytics/Crashlytics.h>
|
|
||||||
#import "ATConnect.h"
|
#import "ATConnect.h"
|
||||||
|
|
||||||
@interface MPAppDelegate ()
|
@interface MPAppDelegate ()
|
||||||
@ -76,7 +74,8 @@
|
|||||||
@"making the result safe from falling in the wrong hands.\n\n"
|
@"making the result safe from falling in the wrong hands.\n\n"
|
||||||
@"If all your passwords are shown and somebody else finds the export, "
|
@"If all your passwords are shown and somebody else finds the export, "
|
||||||
@"they could gain access to all your sites!"
|
@"they could gain access to all your sites!"
|
||||||
viewStyle:UIAlertViewStyleDefault initAlert:nil tappedButtonBlock:^(UIAlertView *alert_, NSInteger buttonIndex_) {
|
viewStyle:UIAlertViewStyleDefault initAlert:nil
|
||||||
|
tappedButtonBlock:^(UIAlertView *alert_, NSInteger buttonIndex_) {
|
||||||
if (buttonIndex_ == [alert_ firstOtherButtonIndex] + 0)
|
if (buttonIndex_ == [alert_ firstOtherButtonIndex] + 0)
|
||||||
// Safe Export
|
// Safe Export
|
||||||
[self exportShowPasswords:NO];
|
[self exportShowPasswords:NO];
|
||||||
@ -252,26 +251,26 @@
|
|||||||
[[UIToolbar appearance] setBackgroundImage:toolBarImage forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];
|
[[UIToolbar appearance] setBackgroundImage:toolBarImage forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
UIImage *minImage = [[UIImage imageNamed:@"slider-minimum.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 5, 0, 0)];
|
UIImage *minImage = [[UIImage imageNamed:@"slider-minimum.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 5, 0, 0)];
|
||||||
UIImage *maxImage = [[UIImage imageNamed:@"slider-maximum.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 5, 0, 0)];
|
UIImage *maxImage = [[UIImage imageNamed:@"slider-maximum.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 5, 0, 0)];
|
||||||
UIImage *thumbImage = [UIImage imageNamed:@"slider-handle.png"];
|
UIImage *thumbImage = [UIImage imageNamed:@"slider-handle.png"];
|
||||||
|
|
||||||
[[UISlider appearance] setMaximumTrackImage:maxImage forState:UIControlStateNormal];
|
[[UISlider appearance] setMaximumTrackImage:maxImage forState:UIControlStateNormal];
|
||||||
[[UISlider appearance] setMinimumTrackImage:minImage forState:UIControlStateNormal];
|
[[UISlider appearance] setMinimumTrackImage:minImage forState:UIControlStateNormal];
|
||||||
[[UISlider appearance] setThumbImage:thumbImage forState:UIControlStateNormal];
|
[[UISlider appearance] setThumbImage:thumbImage forState:UIControlStateNormal];
|
||||||
|
|
||||||
UIImage *segmentSelected = [[UIImage imageNamed:@"segcontrol_sel.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 4, 0, 4)];
|
UIImage *segmentSelected = [[UIImage imageNamed:@"segcontrol_sel.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 4, 0, 4)];
|
||||||
UIImage *segmentUnselected = [[UIImage imageNamed:@"segcontrol_uns.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 15, 0, 15)];
|
UIImage *segmentUnselected = [[UIImage imageNamed:@"segcontrol_uns.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 15, 0, 15)];
|
||||||
UIImage *segmentSelectedUnselected = [UIImage imageNamed:@"segcontrol_sel-uns.png"];
|
UIImage *segmentSelectedUnselected = [UIImage imageNamed:@"segcontrol_sel-uns.png"];
|
||||||
UIImage *segUnselectedSelected = [UIImage imageNamed:@"segcontrol_uns-sel.png"];
|
UIImage *segUnselectedSelected = [UIImage imageNamed:@"segcontrol_uns-sel.png"];
|
||||||
UIImage *segmentUnselectedUnselected = [UIImage imageNamed:@"segcontrol_uns-uns.png"];
|
UIImage *segmentUnselectedUnselected = [UIImage imageNamed:@"segcontrol_uns-uns.png"];
|
||||||
|
|
||||||
[[UISegmentedControl appearance] setBackgroundImage:segmentUnselected forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
|
[[UISegmentedControl appearance] setBackgroundImage:segmentUnselected forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
|
||||||
[[UISegmentedControl appearance] setBackgroundImage:segmentSelected forState:UIControlStateSelected barMetrics:UIBarMetricsDefault];
|
[[UISegmentedControl appearance] setBackgroundImage:segmentSelected forState:UIControlStateSelected barMetrics:UIBarMetricsDefault];
|
||||||
|
|
||||||
[[UISegmentedControl appearance] setDividerImage:segmentUnselectedUnselected forLeftSegmentState:UIControlStateNormal rightSegmentState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
|
[[UISegmentedControl appearance] setDividerImage:segmentUnselectedUnselected forLeftSegmentState:UIControlStateNormal rightSegmentState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
|
||||||
[[UISegmentedControl appearance] setDividerImage:segmentSelectedUnselected forLeftSegmentState:UIControlStateSelected rightSegmentState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
|
[[UISegmentedControl appearance] setDividerImage:segmentSelectedUnselected forLeftSegmentState:UIControlStateSelected rightSegmentState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
|
||||||
[[UISegmentedControl appearance] setDividerImage:segUnselectedSelected forLeftSegmentState:UIControlStateNormal rightSegmentState:UIControlStateSelected barMetrics:UIBarMetricsDefault];*/
|
[[UISegmentedControl appearance] setDividerImage:segUnselectedSelected forLeftSegmentState:UIControlStateNormal rightSegmentState:UIControlStateSelected barMetrics:UIBarMetricsDefault];*/
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter] addObserverForName:MPNotificationSignedOut object:nil queue:nil
|
[[NSNotificationCenter defaultCenter] addObserverForName:MPNotificationSignedOut object:nil queue:nil
|
||||||
usingBlock:^(NSNotification *note) {
|
usingBlock:^(NSNotification *note) {
|
||||||
@ -294,8 +293,7 @@
|
|||||||
cancelTitle:nil otherTitles:[PearlStrings get].commonButtonOkay, nil];
|
cancelTitle:nil otherTitles:[PearlStrings get].commonButtonOkay, nil];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
[[UIApplication sharedApplication] setStatusBarHidden:NO
|
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationSlide];
|
||||||
withAnimation:UIStatusBarAnimationSlide];
|
|
||||||
|
|
||||||
return [super application:application didFinishLaunchingWithOptions:launchOptions];
|
return [super application:application didFinishLaunchingWithOptions:launchOptions];
|
||||||
}
|
}
|
||||||
@ -326,11 +324,14 @@
|
|||||||
dispatch_group_enter(confirmationGroup);
|
dispatch_group_enter(confirmationGroup);
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
[PearlAlert showAlertWithTitle:@"Import Sites?"
|
[PearlAlert showAlertWithTitle:@"Import Sites?"
|
||||||
message:PearlString(@"Import %d sites, overwriting %d existing sites?", importCount, deleteCount)
|
message:PearlString(
|
||||||
|
@"Import %d sites, overwriting %d existing sites?",
|
||||||
|
importCount, deleteCount)
|
||||||
viewStyle:UIAlertViewStyleDefault
|
viewStyle:UIAlertViewStyleDefault
|
||||||
initAlert:nil
|
initAlert:nil
|
||||||
tappedButtonBlock:^(UIAlertView *alert_, NSInteger buttonIndex_) {
|
tappedButtonBlock:^(UIAlertView *alert_, NSInteger buttonIndex_) {
|
||||||
if (buttonIndex_ != [alert_ cancelButtonIndex])
|
if (buttonIndex_
|
||||||
|
!= [alert_ cancelButtonIndex])
|
||||||
confirmation = YES;
|
confirmation = YES;
|
||||||
|
|
||||||
dispatch_group_leave(confirmationGroup);
|
dispatch_group_leave(confirmationGroup);
|
||||||
@ -338,7 +339,8 @@
|
|||||||
cancelTitle:[PearlStrings get].commonButtonCancel
|
cancelTitle:[PearlStrings get].commonButtonCancel
|
||||||
otherTitles:@"Import", nil];
|
otherTitles:@"Import", nil];
|
||||||
});
|
});
|
||||||
dispatch_group_wait(confirmationGroup, DISPATCH_TIME_FOREVER);
|
dispatch_group_wait(
|
||||||
|
confirmationGroup, DISPATCH_TIME_FOREVER);
|
||||||
|
|
||||||
return confirmation;
|
return confirmation;
|
||||||
}];
|
}];
|
||||||
@ -426,7 +428,8 @@
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MFMailComposeResultFailed:
|
case MFMailComposeResultFailed:
|
||||||
[PearlAlert showError:@"A problem occurred while sending the message." tappedButtonBlock:^(UIAlertView *alert, NSInteger buttonIndex) {
|
[PearlAlert showError:@"A problem occurred while sending the message."
|
||||||
|
tappedButtonBlock:^(UIAlertView *alert, NSInteger buttonIndex) {
|
||||||
if (buttonIndex == [alert firstOtherButtonIndex])
|
if (buttonIndex == [alert firstOtherButtonIndex])
|
||||||
return;
|
return;
|
||||||
} otherTitles:@"Retry", nil];
|
} otherTitles:@"Retry", nil];
|
||||||
@ -450,7 +453,8 @@
|
|||||||
message:
|
message:
|
||||||
@"iCloud is now disabled.\n\n"
|
@"iCloud is now disabled.\n\n"
|
||||||
@"It is highly recommended you enable iCloud."
|
@"It is highly recommended you enable iCloud."
|
||||||
viewStyle:UIAlertViewStyleDefault initAlert:nil tappedButtonBlock:^(UIAlertView *alert, NSInteger buttonIndex) {
|
viewStyle:UIAlertViewStyleDefault initAlert:nil
|
||||||
|
tappedButtonBlock:^(UIAlertView *alert, NSInteger buttonIndex) {
|
||||||
if (buttonIndex == [alert firstOtherButtonIndex] + 0) {
|
if (buttonIndex == [alert firstOtherButtonIndex] + 0) {
|
||||||
[PearlAlert showAlertWithTitle:@"About iCloud"
|
[PearlAlert showAlertWithTitle:@"About iCloud"
|
||||||
message:
|
message:
|
||||||
@ -466,8 +470,7 @@
|
|||||||
@"with your master password.\n\n"
|
@"with your master password.\n\n"
|
||||||
@"Apple can never see any of your passwords."
|
@"Apple can never see any of your passwords."
|
||||||
viewStyle:UIAlertViewStyleDefault
|
viewStyle:UIAlertViewStyleDefault
|
||||||
initAlert:nil
|
initAlert:nil tappedButtonBlock:^(UIAlertView *alert_, NSInteger buttonIndex_) {
|
||||||
tappedButtonBlock:^(UIAlertView *alert_, NSInteger buttonIndex_) {
|
|
||||||
[self ubiquityStoreManager:manager didSwitchToiCloud:iCloudEnabled];
|
[self ubiquityStoreManager:manager didSwitchToiCloud:iCloudEnabled];
|
||||||
}
|
}
|
||||||
cancelTitle:[PearlStrings get].commonButtonThanks otherTitles:nil];
|
cancelTitle:[PearlStrings get].commonButtonThanks otherTitles:nil];
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#import "MPGuideViewController.h"
|
#import "MPGuideViewController.h"
|
||||||
#import "MPAppDelegate.h"
|
|
||||||
|
|
||||||
|
|
||||||
@implementation MPGuideViewController
|
@implementation MPGuideViewController
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#import "MPElementEntity.h"
|
#import "MPElementEntity.h"
|
||||||
#import "MPSearchDelegate.h"
|
#import "MPSearchDelegate.h"
|
||||||
|
|
||||||
@interface MPMainViewController : UIViewController <MPTypeDelegate, UITextFieldDelegate, MPSearchResultsDelegate, UIWebViewDelegate>
|
@interface MPMainViewController : UIViewController<MPTypeDelegate, UITextFieldDelegate, MPSearchResultsDelegate, UIWebViewDelegate>
|
||||||
|
|
||||||
@property (strong, nonatomic) MPElementEntity *activeElement;
|
@property (strong, nonatomic) MPElementEntity *activeElement;
|
||||||
@property (strong, nonatomic) IBOutlet MPSearchDelegate *searchResultsController;
|
@property (strong, nonatomic) IBOutlet MPSearchDelegate *searchResultsController;
|
||||||
|
@ -12,8 +12,6 @@
|
|||||||
#import "MPAppDelegate_Store.h"
|
#import "MPAppDelegate_Store.h"
|
||||||
#import "ATConnect.h"
|
#import "ATConnect.h"
|
||||||
|
|
||||||
#import <MobileCoreServices/MobileCoreServices.h>
|
|
||||||
|
|
||||||
|
|
||||||
@interface MPMainViewController (Private)
|
@interface MPMainViewController (Private)
|
||||||
|
|
||||||
@ -169,7 +167,7 @@
|
|||||||
self.contentField.enabled = NO;
|
self.contentField.enabled = NO;
|
||||||
|
|
||||||
if ([self.activeElement isKindOfClass:[MPElementGeneratedEntity class]])
|
if ([self.activeElement isKindOfClass:[MPElementGeneratedEntity class]])
|
||||||
self.passwordCounter.text = PearlString(@"%u", ((MPElementGeneratedEntity *) self.activeElement).counter);
|
self.passwordCounter.text = PearlString(@"%u", ((MPElementGeneratedEntity *)self.activeElement).counter);
|
||||||
|
|
||||||
self.contentField.text = @"";
|
self.contentField.text = @"";
|
||||||
if (self.activeElement.name && ![self.activeElement isDeleted])
|
if (self.activeElement.name && ![self.activeElement isDeleted])
|
||||||
@ -246,7 +244,7 @@
|
|||||||
} completion:^(BOOL finished) {
|
} completion:^(BOOL finished) {
|
||||||
if (finished) {
|
if (finished) {
|
||||||
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, 5 * NSEC_PER_SEC);
|
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, 5 * NSEC_PER_SEC);
|
||||||
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
|
dispatch_after(popTime, dispatch_get_main_queue(), ^(void) {
|
||||||
[UIView animateWithDuration:0.2f animations:^{
|
[UIView animateWithDuration:0.2f animations:^{
|
||||||
self.contentTipContainer.alpha = 0;
|
self.contentTipContainer.alpha = 0;
|
||||||
} completion:self.contentTipCleanup];
|
} completion:self.contentTipCleanup];
|
||||||
@ -299,7 +297,7 @@
|
|||||||
@"You will then need to update your account's old password to this newly generated password.\n\n"
|
@"You will then need to update your account's old password to this newly generated password.\n\n"
|
||||||
@"You can reset the counter by holding down on this button."
|
@"You can reset the counter by holding down on this button."
|
||||||
do:^{
|
do:^{
|
||||||
++((MPElementGeneratedEntity *) self.activeElement).counter;
|
++((MPElementGeneratedEntity *)self.activeElement).counter;
|
||||||
}];
|
}];
|
||||||
|
|
||||||
[TestFlight passCheckpoint:MPTestFlightCheckpointIncrementPasswordCounter];
|
[TestFlight passCheckpoint:MPTestFlightCheckpointIncrementPasswordCounter];
|
||||||
@ -322,7 +320,7 @@
|
|||||||
@"If you continue, the site's password will change back to its original value. "
|
@"If you continue, the site's password will change back to its original value. "
|
||||||
@"You will then need to update your account's password back to this original value."
|
@"You will then need to update your account's password back to this original value."
|
||||||
do:^{
|
do:^{
|
||||||
((MPElementGeneratedEntity *) self.activeElement).counter = 1;
|
((MPElementGeneratedEntity *)self.activeElement).counter = 1;
|
||||||
}];
|
}];
|
||||||
|
|
||||||
[TestFlight passCheckpoint:MPTestFlightCheckpointResetPasswordCounter];
|
[TestFlight passCheckpoint:MPTestFlightCheckpointResetPasswordCounter];
|
||||||
@ -331,8 +329,7 @@
|
|||||||
- (void)changeElementWithWarning:(NSString *)warning do:(void (^)(void))task; {
|
- (void)changeElementWithWarning:(NSString *)warning do:(void (^)(void))task; {
|
||||||
|
|
||||||
[PearlAlert showAlertWithTitle:@"Password Change" message:warning viewStyle:UIAlertViewStyleDefault
|
[PearlAlert showAlertWithTitle:@"Password Change" message:warning viewStyle:UIAlertViewStyleDefault
|
||||||
initAlert:nil
|
initAlert:nil tappedButtonBlock:^(UIAlertView *alert, NSInteger buttonIndex) {
|
||||||
tappedButtonBlock:^(UIAlertView *alert, NSInteger buttonIndex) {
|
|
||||||
if (buttonIndex == [alert cancelButtonIndex])
|
if (buttonIndex == [alert cancelButtonIndex])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -450,7 +447,8 @@
|
|||||||
if (ClassFromMPElementType(type) != ClassFromMPElementType(self.activeElement.type))
|
if (ClassFromMPElementType(type) != ClassFromMPElementType(self.activeElement.type))
|
||||||
// Type requires a different class of element. Recreate the element.
|
// Type requires a different class of element. Recreate the element.
|
||||||
[[MPAppDelegate managedObjectContext] performBlockAndWait:^{
|
[[MPAppDelegate managedObjectContext] performBlockAndWait:^{
|
||||||
MPElementEntity *newElement = [NSEntityDescription insertNewObjectForEntityForName:ClassNameFromMPElementType(type)
|
MPElementEntity *newElement = [NSEntityDescription insertNewObjectForEntityForName:ClassNameFromMPElementType(
|
||||||
|
type)
|
||||||
inManagedObjectContext:[MPAppDelegate managedObjectContext]];
|
inManagedObjectContext:[MPAppDelegate managedObjectContext]];
|
||||||
newElement.name = self.activeElement.name;
|
newElement.name = self.activeElement.name;
|
||||||
newElement.user = self.activeElement.user;
|
newElement.user = self.activeElement.user;
|
||||||
@ -463,7 +461,8 @@
|
|||||||
|
|
||||||
self.activeElement.type = type;
|
self.activeElement.type = type;
|
||||||
|
|
||||||
[TestFlight passCheckpoint:[NSString stringWithFormat:MPTestFlightCheckpointSelectType, NSStringFromMPElementType(type)]];
|
[TestFlight passCheckpoint:[NSString stringWithFormat:MPTestFlightCheckpointSelectType, NSStringFromMPElementType(
|
||||||
|
type)]];
|
||||||
|
|
||||||
if (type & MPElementTypeClassStored && ![[self.activeElement.content description] length])
|
if (type & MPElementTypeClassStored && ![[self.activeElement.content description] length])
|
||||||
[self showContentTip:@"Tap to set a password." withIcon:self.contentTipEditIcon];
|
[self showContentTip:@"Tap to set a password." withIcon:self.contentTipEditIcon];
|
||||||
@ -524,12 +523,12 @@
|
|||||||
// Not of a type whose content can be edited.
|
// Not of a type whose content can be edited.
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ([((MPElementStoredEntity *) self.activeElement).content isEqual:self.contentField.text])
|
if ([((MPElementStoredEntity *)self.activeElement).content isEqual:self.contentField.text])
|
||||||
// Content hasn't changed.
|
// Content hasn't changed.
|
||||||
return;
|
return;
|
||||||
|
|
||||||
[self changeElementWithoutWarningDo:^{
|
[self changeElementWithoutWarningDo:^{
|
||||||
((MPElementStoredEntity *) self.activeElement).content = self.contentField.text;
|
((MPElementStoredEntity *)self.activeElement).content = self.contentField.text;
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
#import "IASKAppSettingsViewController.h"
|
#import "IASKAppSettingsViewController.h"
|
||||||
|
|
||||||
@interface MPPreferencesViewController : UITableViewController <IASKSettingsDelegate>
|
@interface MPPreferencesViewController : UITableViewController<IASKSettingsDelegate>
|
||||||
|
|
||||||
@property (weak, nonatomic) IBOutlet UIScrollView *avatarsView;
|
@property (weak, nonatomic) IBOutlet UIScrollView *avatarsView;
|
||||||
@property (weak, nonatomic) IBOutlet UIButton *avatarTemplate;
|
@property (weak, nonatomic) IBOutlet UIButton *avatarTemplate;
|
||||||
|
@ -64,7 +64,7 @@
|
|||||||
|
|
||||||
[self.avatarsView autoSizeContent];
|
[self.avatarsView autoSizeContent];
|
||||||
[self.avatarsView enumerateSubviews:^(UIView *subview, BOOL *stop, BOOL *recurse) {
|
[self.avatarsView enumerateSubviews:^(UIView *subview, BOOL *stop, BOOL *recurse) {
|
||||||
if (subview.tag && ((UIControl *) subview).selected) {
|
if (subview.tag && ((UIControl *)subview).selected) {
|
||||||
[self.avatarsView setContentOffset:CGPointMake(subview.center.x - self.avatarsView.bounds.size.width / 2, 0) animated:animated];
|
[self.avatarsView setContentOffset:CGPointMake(subview.center.x - self.avatarsView.bounds.size.width / 2, 0) animated:animated];
|
||||||
}
|
}
|
||||||
} recurse:NO];
|
} recurse:NO];
|
||||||
@ -80,6 +80,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)viewDidUnload {
|
- (void)viewDidUnload {
|
||||||
|
|
||||||
[self setAvatarsView:nil];
|
[self setAvatarsView:nil];
|
||||||
[self setAvatarTemplate:nil];
|
[self setAvatarTemplate:nil];
|
||||||
[self setAvatarsView:nil];
|
[self setAvatarsView:nil];
|
||||||
@ -97,7 +98,8 @@
|
|||||||
if (cell == self.exportCell)
|
if (cell == self.exportCell)
|
||||||
[[MPAppDelegate get] export];
|
[[MPAppDelegate get] export];
|
||||||
|
|
||||||
else if (cell == self.changeMPCell)
|
else
|
||||||
|
if (cell == self.changeMPCell)
|
||||||
[[MPAppDelegate get] changeMP];
|
[[MPAppDelegate get] changeMP];
|
||||||
|
|
||||||
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||||||
|
@ -9,13 +9,13 @@
|
|||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import "MPElementEntity.h"
|
#import "MPElementEntity.h"
|
||||||
|
|
||||||
@protocol MPSearchResultsDelegate <NSObject>
|
@protocol MPSearchResultsDelegate<NSObject>
|
||||||
|
|
||||||
- (void)didSelectElement:(MPElementEntity *)element;
|
- (void)didSelectElement:(MPElementEntity *)element;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface MPSearchDelegate : NSObject <UITableViewDelegate, UITableViewDataSource, UISearchBarDelegate, UISearchDisplayDelegate, NSFetchedResultsControllerDelegate>
|
@interface MPSearchDelegate : NSObject<UITableViewDelegate, UITableViewDataSource, UISearchBarDelegate, UISearchDisplayDelegate, NSFetchedResultsControllerDelegate>
|
||||||
|
|
||||||
@property (strong, nonatomic) NSDateFormatter *dateFormatter;
|
@property (strong, nonatomic) NSDateFormatter *dateFormatter;
|
||||||
@property (strong, nonatomic) NSFetchedResultsController *fetchedResultsController;
|
@property (strong, nonatomic) NSFetchedResultsController *fetchedResultsController;
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:NSStringFromClass([MPElementEntity class])];
|
NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:NSStringFromClass([MPElementEntity class])];
|
||||||
fetchRequest.sortDescriptors = [NSArray arrayWithObject:[[NSSortDescriptor alloc] initWithKey:@"uses_" ascending:NO]];
|
fetchRequest.sortDescriptors = [NSArray arrayWithObject:[[NSSortDescriptor alloc] initWithKey:@"uses_" ascending:NO]];
|
||||||
self.fetchedResultsController = [PearlLazy lazyObjectLoadedFrom:^id{
|
self.fetchedResultsController = [PearlLazy lazyObjectLoadedFrom:^id {
|
||||||
NSFetchedResultsController *controller = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest
|
NSFetchedResultsController *controller = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest
|
||||||
managedObjectContext:[MPAppDelegate managedObjectContext]
|
managedObjectContext:[MPAppDelegate managedObjectContext]
|
||||||
sectionNameKeyPath:nil cacheName:nil];
|
sectionNameKeyPath:nil cacheName:nil];
|
||||||
@ -51,7 +51,8 @@
|
|||||||
self.tipView.textColor = [UIColor lightTextColor];
|
self.tipView.textColor = [UIColor lightTextColor];
|
||||||
self.tipView.shadowColor = [UIColor blackColor];
|
self.tipView.shadowColor = [UIColor blackColor];
|
||||||
self.tipView.shadowOffset = CGSizeMake(0, -1);
|
self.tipView.shadowOffset = CGSizeMake(0, -1);
|
||||||
self.tipView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleBottomMargin;
|
self.tipView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight
|
||||||
|
| UIViewAutoresizingFlexibleBottomMargin;
|
||||||
self.tipView.numberOfLines = 0;
|
self.tipView.numberOfLines = 0;
|
||||||
self.tipView.font = [UIFont systemFontOfSize:14];
|
self.tipView.font = [UIFont systemFontOfSize:14];
|
||||||
self.tipView.text =
|
self.tipView.text =
|
||||||
@ -298,15 +299,15 @@
|
|||||||
[PearlAlert showAlertWithTitle:@"New Site"
|
[PearlAlert showAlertWithTitle:@"New Site"
|
||||||
message:PearlString(@"Do you want to create a new site named:\n%@", siteName)
|
message:PearlString(@"Do you want to create a new site named:\n%@", siteName)
|
||||||
viewStyle:UIAlertViewStyleDefault
|
viewStyle:UIAlertViewStyleDefault
|
||||||
initAlert:nil
|
initAlert:nil tappedButtonBlock:^(UIAlertView *alert, NSInteger buttonIndex) {
|
||||||
tappedButtonBlock:^(UIAlertView *alert, NSInteger buttonIndex) {
|
|
||||||
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||||||
|
|
||||||
if (buttonIndex == [alert cancelButtonIndex])
|
if (buttonIndex == [alert cancelButtonIndex])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
[self.fetchedResultsController.managedObjectContext performBlock:^{
|
[self.fetchedResultsController.managedObjectContext performBlock:^{
|
||||||
MPElementGeneratedEntity *element = [NSEntityDescription insertNewObjectForEntityForName:NSStringFromClass([MPElementGeneratedEntity class])
|
MPElementGeneratedEntity *element = [NSEntityDescription insertNewObjectForEntityForName:NSStringFromClass(
|
||||||
|
[MPElementGeneratedEntity class])
|
||||||
inManagedObjectContext:self.fetchedResultsController.managedObjectContext];
|
inManagedObjectContext:self.fetchedResultsController.managedObjectContext];
|
||||||
assert([element isKindOfClass:ClassFromMPElementType(element.type)]);
|
assert([element isKindOfClass:ClassFromMPElementType(element.type)]);
|
||||||
assert([MPAppDelegate get].activeUser.keyID);
|
assert([MPAppDelegate get].activeUser.keyID);
|
||||||
@ -340,7 +341,8 @@
|
|||||||
return [self.fetchedResultsController sectionForSectionIndexTitle:title atIndex:index];
|
return [self.fetchedResultsController sectionForSectionIndexTitle:title atIndex:index];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
|
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle
|
||||||
|
forRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||||
|
|
||||||
if (indexPath.section < (NSInteger)[[self.fetchedResultsController sections] count]) {
|
if (indexPath.section < (NSInteger)[[self.fetchedResultsController sections] count]) {
|
||||||
if (editingStyle == UITableViewCellEditingStyleDelete)
|
if (editingStyle == UITableViewCellEditingStyleDelete)
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
@protocol MPTypeDelegate <NSObject>
|
@protocol MPTypeDelegate<NSObject>
|
||||||
|
|
||||||
- (void)didSelectType:(MPElementType)type;
|
- (void)didSelectType:(MPElementType)type;
|
||||||
|
|
||||||
|
@ -130,6 +130,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)viewDidUnload {
|
- (void)viewDidUnload {
|
||||||
|
|
||||||
[self setRecommendedTipContainer:nil];
|
[self setRecommendedTipContainer:nil];
|
||||||
[super viewDidUnload];
|
[super viewDidUnload];
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
@interface MPUnlockViewController : UIViewController <UITextFieldDelegate, UIScrollViewDelegate>
|
@interface MPUnlockViewController : UIViewController<UITextFieldDelegate, UIScrollViewDelegate>
|
||||||
|
|
||||||
@property (weak, nonatomic) IBOutlet UIImageView *spinner;
|
@property (weak, nonatomic) IBOutlet UIImageView *spinner;
|
||||||
@property (weak, nonatomic) IBOutlet UITextField *passwordField;
|
@property (weak, nonatomic) IBOutlet UITextField *passwordField;
|
||||||
@ -21,7 +21,7 @@
|
|||||||
@property (weak, nonatomic) IBOutlet UIView *passwordTipView;
|
@property (weak, nonatomic) IBOutlet UIView *passwordTipView;
|
||||||
@property (weak, nonatomic) IBOutlet UILabel *passwordTipLabel;
|
@property (weak, nonatomic) IBOutlet UILabel *passwordTipLabel;
|
||||||
|
|
||||||
@property(nonatomic, strong) UIColor *avatarShadowColor;
|
@property (nonatomic, strong) UIColor *avatarShadowColor;
|
||||||
|
|
||||||
- (IBAction)deleteTargetedUser:(UILongPressGestureRecognizer *)sender;
|
- (IBAction)deleteTargetedUser:(UILongPressGestureRecognizer *)sender;
|
||||||
|
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
|
|
||||||
@interface MPUnlockViewController ()
|
@interface MPUnlockViewController ()
|
||||||
|
|
||||||
@property(strong, nonatomic) MPUserEntity *selectedUser;
|
@property (strong, nonatomic) MPUserEntity *selectedUser;
|
||||||
@property(strong, nonatomic) NSMutableDictionary *avatarToUser;
|
@property (strong, nonatomic) NSMutableDictionary *avatarToUser;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@ -85,14 +85,14 @@
|
|||||||
|
|
||||||
- (void)viewDidAppear:(BOOL)animated {
|
- (void)viewDidAppear:(BOOL)animated {
|
||||||
|
|
||||||
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:animated ? UIStatusBarAnimationSlide : UIStatusBarAnimationNone];
|
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:animated? UIStatusBarAnimationSlide: UIStatusBarAnimationNone];
|
||||||
|
|
||||||
[super viewDidAppear:animated];
|
[super viewDidAppear:animated];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)viewWillDisappear:(BOOL)animated {
|
- (void)viewWillDisappear:(BOOL)animated {
|
||||||
|
|
||||||
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:animated ? UIStatusBarAnimationSlide : UIStatusBarAnimationNone];
|
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:animated? UIStatusBarAnimationSlide: UIStatusBarAnimationNone];
|
||||||
|
|
||||||
[super viewWillDisappear:animated];
|
[super viewWillDisappear:animated];
|
||||||
}
|
}
|
||||||
@ -130,10 +130,11 @@
|
|||||||
avatar.backgroundColor = [UIColor clearColor];
|
avatar.backgroundColor = [UIColor clearColor];
|
||||||
} options:0];
|
} options:0];
|
||||||
[avatar onSelect:^(BOOL selected) {
|
[avatar onSelect:^(BOOL selected) {
|
||||||
self.selectedUser = selected ? user : nil;
|
self.selectedUser = selected? user: nil;
|
||||||
if (user)
|
if (user)
|
||||||
[self didToggleUserSelection];
|
[self didToggleUserSelection];
|
||||||
else if (selected)
|
else
|
||||||
|
if (selected)
|
||||||
[self didSelectNewUserAvatar:avatar];
|
[self didSelectNewUserAvatar:avatar];
|
||||||
} options:0];
|
} options:0];
|
||||||
avatar.togglesSelectionInSuperview = YES;
|
avatar.togglesSelectionInSuperview = YES;
|
||||||
@ -163,7 +164,8 @@
|
|||||||
|
|
||||||
if (!self.selectedUser)
|
if (!self.selectedUser)
|
||||||
[self.passwordField resignFirstResponder];
|
[self.passwordField resignFirstResponder];
|
||||||
else if ([[MPAppDelegate get] signInAsUser:self.selectedUser usingMasterPassword:nil]) {
|
else
|
||||||
|
if ([[MPAppDelegate get] signInAsUser:self.selectedUser usingMasterPassword:nil]) {
|
||||||
[self dismissModalViewControllerAnimated:YES];
|
[self dismissModalViewControllerAnimated:YES];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -229,7 +231,8 @@
|
|||||||
self.oldNameLabel.center = self.nameLabel.center;
|
self.oldNameLabel.center = self.nameLabel.center;
|
||||||
self.avatarShadowColor = [UIColor whiteColor];
|
self.avatarShadowColor = [UIColor whiteColor];
|
||||||
self.deleteTip.alpha = 0;
|
self.deleteTip.alpha = 0;
|
||||||
} else if (!self.selectedUser && self.passwordView.alpha == 1) {
|
} else
|
||||||
|
if (!self.selectedUser && self.passwordView.alpha == 1) {
|
||||||
self.passwordView.alpha = 0;
|
self.passwordView.alpha = 0;
|
||||||
self.avatarsView.center = CGPointMake(160, 240);
|
self.avatarsView.center = CGPointMake(160, 240);
|
||||||
self.avatarsView.scrollEnabled = YES;
|
self.avatarsView.scrollEnabled = YES;
|
||||||
@ -257,7 +260,7 @@
|
|||||||
BOOL isTargeted = avatar == targetedAvatar;
|
BOOL isTargeted = avatar == targetedAvatar;
|
||||||
|
|
||||||
avatar.userInteractionEnabled = isTargeted;
|
avatar.userInteractionEnabled = isTargeted;
|
||||||
avatar.alpha = isTargeted ? 1 : self.selectedUser ? 0.1 : 0.4;
|
avatar.alpha = isTargeted? 1: self.selectedUser? 0.1: 0.4;
|
||||||
|
|
||||||
[self updateAvatarShadowColor:avatar isTargeted:isTargeted];
|
[self updateAvatarShadowColor:avatar isTargeted:isTargeted];
|
||||||
} recurse:NO];
|
} recurse:NO];
|
||||||
@ -269,7 +272,7 @@
|
|||||||
[self.avatarsView setContentOffset:targetContentOffset animated:animated];
|
[self.avatarsView setContentOffset:targetContentOffset animated:animated];
|
||||||
}
|
}
|
||||||
|
|
||||||
self.nameLabel.text = targetedUser ? targetedUser.name : @"New User";
|
self.nameLabel.text = targetedUser? targetedUser.name: @"New User";
|
||||||
self.nameLabel.bounds = CGRectSetHeight(self.nameLabel.bounds,
|
self.nameLabel.bounds = CGRectSetHeight(self.nameLabel.bounds,
|
||||||
[self.nameLabel.text sizeWithFont:self.nameLabel.font
|
[self.nameLabel.text sizeWithFont:self.nameLabel.font
|
||||||
constrainedToSize:CGSizeMake(self.nameLabel.bounds.size.width - 10, 100)
|
constrainedToSize:CGSizeMake(self.nameLabel.bounds.size.width - 10, 100)
|
||||||
@ -298,10 +301,11 @@
|
|||||||
|
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
if (unlocked) {
|
if (unlocked) {
|
||||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (long) (NSEC_PER_SEC * 0.5f)), dispatch_get_main_queue(), ^{
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (long)(NSEC_PER_SEC * 0.5f)), dispatch_get_main_queue(), ^{
|
||||||
[self dismissModalViewControllerAnimated:YES];
|
[self dismissModalViewControllerAnimated:YES];
|
||||||
});
|
});
|
||||||
} else if (self.passwordField.text.length)
|
} else
|
||||||
|
if (self.passwordField.text.length)
|
||||||
[self setPasswordTip:@"Incorrect password."];
|
[self setPasswordTip:@"Incorrect password."];
|
||||||
|
|
||||||
[self setSpinnerActive:NO];
|
[self setSpinnerActive:NO];
|
||||||
@ -312,7 +316,8 @@
|
|||||||
- (UIButton *)findTargetedAvatar {
|
- (UIButton *)findTargetedAvatar {
|
||||||
|
|
||||||
CGFloat xOfMiddle = self.avatarsView.contentOffset.x + self.avatarsView.bounds.size.width / 2;
|
CGFloat xOfMiddle = self.avatarsView.contentOffset.x + self.avatarsView.bounds.size.width / 2;
|
||||||
return (UIButton *) [PearlUIUtils viewClosestTo:CGPointMake(xOfMiddle, self.avatarsView.contentOffset.y) ofArray:self.avatarsView.subviews];
|
return (UIButton *)[PearlUIUtils viewClosestTo:CGPointMake(xOfMiddle, self.avatarsView.contentOffset.y)
|
||||||
|
ofArray:self.avatarsView.subviews];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (UIButton *)avatarForUser:(MPUserEntity *)user {
|
- (UIButton *)avatarForUser:(MPUserEntity *)user {
|
||||||
@ -367,7 +372,8 @@
|
|||||||
if (targeted) {
|
if (targeted) {
|
||||||
if (![avatar.layer animationForKey:@"targetedShadow"]) {
|
if (![avatar.layer animationForKey:@"targetedShadow"]) {
|
||||||
CABasicAnimation *toShadowColorAnimation = [CABasicAnimation animationWithKeyPath:@"shadowColor"];
|
CABasicAnimation *toShadowColorAnimation = [CABasicAnimation animationWithKeyPath:@"shadowColor"];
|
||||||
toShadowColorAnimation.toValue = (__bridge id) (avatar.selected? self.avatarTemplate.backgroundColor: [UIColor whiteColor]).CGColor;
|
toShadowColorAnimation.toValue = (__bridge id)(avatar.selected? self.avatarTemplate.backgroundColor
|
||||||
|
: [UIColor whiteColor]).CGColor;
|
||||||
toShadowColorAnimation.beginTime = 0.0f;
|
toShadowColorAnimation.beginTime = 0.0f;
|
||||||
toShadowColorAnimation.duration = 0.5f;
|
toShadowColorAnimation.duration = 0.5f;
|
||||||
toShadowColorAnimation.fillMode = kCAFillModeForwards;
|
toShadowColorAnimation.fillMode = kCAFillModeForwards;
|
||||||
@ -394,7 +400,7 @@
|
|||||||
} else {
|
} else {
|
||||||
if ([avatar.layer animationForKey:@"targetedShadow"]) {
|
if ([avatar.layer animationForKey:@"targetedShadow"]) {
|
||||||
CABasicAnimation *toShadowColorAnimation = [CABasicAnimation animationWithKeyPath:@"shadowColor"];
|
CABasicAnimation *toShadowColorAnimation = [CABasicAnimation animationWithKeyPath:@"shadowColor"];
|
||||||
toShadowColorAnimation.toValue = (__bridge id) [UIColor blackColor].CGColor;
|
toShadowColorAnimation.toValue = (__bridge id)[UIColor blackColor].CGColor;
|
||||||
toShadowColorAnimation.duration = 0.5f;
|
toShadowColorAnimation.duration = 0.5f;
|
||||||
|
|
||||||
CABasicAnimation *toShadowOpacityAnimation = [CABasicAnimation animationWithKeyPath:@"shadowOpacity"];
|
CABasicAnimation *toShadowOpacityAnimation = [CABasicAnimation animationWithKeyPath:@"shadowOpacity"];
|
||||||
@ -443,7 +449,8 @@
|
|||||||
@"The password you entered doesn't match with the master password you tried to use. "
|
@"The password you entered doesn't match with the master password you tried to use. "
|
||||||
@"You've probably mistyped one of them.\n\n"
|
@"You've probably mistyped one of them.\n\n"
|
||||||
@"Give it another try."
|
@"Give it another try."
|
||||||
viewStyle:UIAlertViewStyleDefault initAlert:nil tappedButtonBlock:nil cancelTitle:[PearlStrings get].commonButtonOkay otherTitles:nil];
|
viewStyle:UIAlertViewStyleDefault initAlert:nil tappedButtonBlock:nil
|
||||||
|
cancelTitle:[PearlStrings get].commonButtonOkay otherTitles:nil];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -458,10 +465,12 @@
|
|||||||
|
|
||||||
#pragma mark - UIScrollViewDelegate
|
#pragma mark - UIScrollViewDelegate
|
||||||
|
|
||||||
- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset {
|
- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity
|
||||||
|
targetContentOffset:(inout CGPoint *)targetContentOffset {
|
||||||
|
|
||||||
CGFloat xOfMiddle = targetContentOffset->x + scrollView.bounds.size.width / 2;
|
CGFloat xOfMiddle = targetContentOffset->x + scrollView.bounds.size.width / 2;
|
||||||
UIButton *middleAvatar = (UIButton *) [PearlUIUtils viewClosestTo:CGPointMake(xOfMiddle, targetContentOffset->y) ofArray:scrollView.subviews];
|
UIButton *middleAvatar = (UIButton *)[PearlUIUtils viewClosestTo:CGPointMake(xOfMiddle, targetContentOffset->y)
|
||||||
|
ofArray:scrollView.subviews];
|
||||||
*targetContentOffset = CGPointMake(middleAvatar.center.x - scrollView.bounds.size.width / 2, targetContentOffset->y);
|
*targetContentOffset = CGPointMake(middleAvatar.center.x - scrollView.bounds.size.width / 2, targetContentOffset->y);
|
||||||
|
|
||||||
[self updateLayoutAnimated:NO allowScroll:NO completion:nil];
|
[self updateLayoutAnimated:NO allowScroll:NO completion:nil];
|
||||||
@ -494,7 +503,8 @@
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
[PearlAlert showAlertWithTitle:@"Delete User" message:
|
[PearlAlert showAlertWithTitle:@"Delete User" message:
|
||||||
PearlString(@"Do you want to delete all record of the following user?\n\n%@", targetedUser.name)
|
PearlString(@"Do you want to delete all record of the following user?\n\n%@",
|
||||||
|
targetedUser.name)
|
||||||
viewStyle:UIAlertViewStyleDefault
|
viewStyle:UIAlertViewStyleDefault
|
||||||
initAlert:nil tappedButtonBlock:^(UIAlertView *alert, NSInteger buttonIndex) {
|
initAlert:nil tappedButtonBlock:^(UIAlertView *alert, NSInteger buttonIndex) {
|
||||||
if (buttonIndex == [alert cancelButtonIndex])
|
if (buttonIndex == [alert cancelButtonIndex])
|
||||||
|
@ -6,14 +6,12 @@
|
|||||||
// Copyright (c) 2012 Lyndir. All rights reserved.
|
// Copyright (c) 2012 Lyndir. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
#import "MPiOSConfig.h"
|
|
||||||
|
|
||||||
@implementation MPiOSConfig
|
@implementation MPiOSConfig
|
||||||
@dynamic helpHidden, showQuickStart;
|
@dynamic helpHidden, showQuickStart;
|
||||||
|
|
||||||
- (id)init {
|
- (id)init {
|
||||||
|
|
||||||
if(!(self = [super init]))
|
if (!(self = [super init]))
|
||||||
return self;
|
return self;
|
||||||
|
|
||||||
[self.defaults registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:
|
[self.defaults registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:
|
||||||
|
@ -11,12 +11,14 @@
|
|||||||
#import "Pearl-Prefix.pch"
|
#import "Pearl-Prefix.pch"
|
||||||
|
|
||||||
#ifdef __OBJC__
|
#ifdef __OBJC__
|
||||||
#import <UIKit/UIKit.h>
|
|
||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import <CoreData/CoreData.h>
|
|
||||||
|
|
||||||
#import "TestFlight.h"
|
#import <UIKit/UIKit.h>
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
#import <CoreData/CoreData.h>
|
||||||
|
|
||||||
|
#import "TestFlight.h"
|
||||||
|
|
||||||
|
#import "MPTypes.h"
|
||||||
|
#import "MPiOSConfig.h"
|
||||||
|
|
||||||
#import "MPTypes.h"
|
|
||||||
#import "MPiOSConfig.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
#import "MPAppDelegate.h"
|
#import "MPAppDelegate.h"
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[]) {
|
||||||
{
|
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
return UIApplicationMain(argc, argv, nil, NSStringFromClass([MPAppDelegate class]));
|
return UIApplicationMain(argc, argv, nil, NSStringFromClass([MPAppDelegate class]));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user