2
0

Fix unlock screen when MOC unavailable.

[REMOVED]   Disable TestFlight for release, it doesn't work anyway.
[FIXED]     Properly handle unlock screen when there is no MOC yet.
[FIXED]     Some log statements format strings & arguments.
This commit is contained in:
Maarten Billemont 2012-08-04 23:15:50 +02:00
parent 553a14dced
commit c928b1ca2c
8 changed files with 105 additions and 85 deletions

2
External/Pearl vendored

@ -1 +1 @@
Subproject commit f81514bfd87773c6b1ea202520d75841c159ce9f Subproject commit cc97c1be4c0f2ee0080af417940244ac8f3e5f47

View File

@ -192,7 +192,7 @@
return nil; return nil;
if (!(element.type & MPElementTypeClassGenerated)) { if (!(element.type & MPElementTypeClassGenerated)) {
err(@"Incorrect type (is not MPElementTypeClassGenerated): %d, for: %@", [self nameOfType:element.type], element.name); err(@"Incorrect type (is not MPElementTypeClassGenerated): %@, for: %@", [self nameOfType:element.type], element.name);
return nil; return nil;
} }
if (!element.name.length) { if (!element.name.length) {

View File

@ -54,7 +54,7 @@
return nil; return nil;
if (!(element.type & MPElementTypeClassGenerated)) { if (!(element.type & MPElementTypeClassGenerated)) {
err(@"Incorrect type (is not MPElementTypeClassGenerated): %d, for: %@", [self nameOfType:element.type], element.name); err(@"Incorrect type (is not MPElementTypeClassGenerated): %@, for: %@", [self nameOfType:element.type], element.name);
return nil; return nil;
} }
if (!element.name.length) { if (!element.name.length) {

View File

@ -34,7 +34,7 @@
[MPiOSConfig get]; [MPiOSConfig get];
#ifdef DEBUG #ifdef DEBUG
[PearlLogger get].autoprintLevel = PearlLogLevelDebug; [PearlLogger get].printLevel = PearlLogLevelDebug;
//[NSClassFromString(@"WebView") performSelector:NSSelectorFromString(@"_enableRemoteInspector")]; //[NSClassFromString(@"WebView") performSelector:NSSelectorFromString(@"_enableRemoteInspector")];
#endif #endif
} }
@ -49,16 +49,14 @@
[[[NSBundle mainBundle] mutableInfoDictionary] setObject:@"Master Password" forKey:@"CFBundleDisplayName"]; [[[NSBundle mainBundle] mutableInfoDictionary] setObject:@"Master Password" forKey:@"CFBundleDisplayName"];
[[[NSBundle mainBundle] mutableLocalizedInfoDictionary] setObject:@"Master Password" forKey:@"CFBundleDisplayName"]; [[[NSBundle mainBundle] mutableLocalizedInfoDictionary] setObject:@"Master Password" forKey:@"CFBundleDisplayName"];
#ifdef ADHOC
@try { @try {
NSString *testFlightToken = [self testFlightToken]; NSString *testFlightToken = [self testFlightToken];
if ([testFlightToken length]) { if ([testFlightToken length]) {
inf(@"Initializing TestFlight"); inf(@"Initializing TestFlight");
[TestFlight addCustomEnvironmentInformation:@"Anonymous" forKey:@"username"]; [TestFlight addCustomEnvironmentInformation:@"Anonymous" forKey:@"username"];
#ifdef ADHOC
[TestFlight setDeviceIdentifier:[(id)[UIDevice currentDevice] uniqueIdentifier]]; [TestFlight setDeviceIdentifier:[(id)[UIDevice currentDevice] uniqueIdentifier]];
#else // [TestFlight setDeviceIdentifier:[PearlKeyChain deviceIdentifier]];
[TestFlight setDeviceIdentifier:[PearlKeyChain deviceIdentifier]];
#endif
[TestFlight setOptions:[NSDictionary dictionaryWithObjectsAndKeys: [TestFlight setOptions:[NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:NO], @"logToConsole", [NSNumber numberWithBool:NO], @"logToConsole",
[NSNumber numberWithBool:NO], @"logToSTDERR", [NSNumber numberWithBool:NO], @"logToSTDERR",
@ -81,6 +79,7 @@
@catch (id exception) { @catch (id exception) {
err(@"TestFlight: %@", exception); err(@"TestFlight: %@", exception);
} }
#endif
@try { @try {
NSString *crashlyticsAPIKey = [self crashlyticsAPIKey]; NSString *crashlyticsAPIKey = [self crashlyticsAPIKey];
if ([crashlyticsAPIKey length]) { if ([crashlyticsAPIKey length]) {
@ -115,12 +114,12 @@
[[LocalyticsSession sharedLocalyticsSession] startSession:localyticsKey]; [[LocalyticsSession sharedLocalyticsSession] startSession:localyticsKey];
[[PearlLogger get] registerListener:^BOOL(PearlLogMessage *message) { [[PearlLogger get] registerListener:^BOOL(PearlLogMessage *message) {
if (message.level >= PearlLogLevelWarn) if (message.level >= PearlLogLevelWarn)
[[LocalyticsSession sharedLocalyticsSession] tagEvent:@"Problem" attributes: [[LocalyticsSession sharedLocalyticsSession] tagEvent:@"Problem"
[NSDictionary dictionaryWithObjectsAndKeys: attributes:[NSDictionary
[message levelDescription], dictionaryWithObjectsAndKeys:
@"level", [NSString stringWithCString:PearlLogLevelStr(message.level)
message.message, encoding:NSASCIIStringEncoding], @"level",
@"message", message.message, @"message",
nil]]; nil]];
return YES; return YES;
@ -352,8 +351,8 @@
if ([[MPConfig get].iCloud boolValue] != [self.storeManager iCloudEnabled]) if ([[MPConfig get].iCloud boolValue] != [self.storeManager iCloudEnabled])
[self.storeManager useiCloudStore:[[MPConfig get].iCloud boolValue] alertUser:YES]; [self.storeManager useiCloudStore:[[MPConfig get].iCloud boolValue] alertUser:YES];
if ([[MPiOSConfig get].sendInfo boolValue]) { if ([[MPiOSConfig get].sendInfo boolValue]) {
if ([PearlLogger get].autoprintLevel > PearlLogLevelInfo) if ([PearlLogger get].printLevel > PearlLogLevelInfo)
[PearlLogger get].autoprintLevel = PearlLogLevelInfo; [PearlLogger get].printLevel = PearlLogLevelInfo;
[[Crashlytics sharedInstance] setBoolValue:[[MPConfig get].rememberLogin boolValue] forKey:@"rememberLogin"]; [[Crashlytics sharedInstance] setBoolValue:[[MPConfig get].rememberLogin boolValue] forKey:@"rememberLogin"];
[[Crashlytics sharedInstance] setBoolValue:[[MPConfig get].iCloud boolValue] forKey:@"iCloud"]; [[Crashlytics sharedInstance] setBoolValue:[[MPConfig get].iCloud boolValue] forKey:@"iCloud"];
@ -396,11 +395,14 @@
? @"YES": @"NO", @"showQuickStart", ? @"YES": @"NO", @"showQuickStart",
[[PearlConfig get].firstRun boolValue] [[PearlConfig get].firstRun boolValue]
? @"YES": @"NO", @"firstRun", ? @"YES": @"NO", @"firstRun",
[[PearlConfig get].launchCount description], @"launchCount", [[PearlConfig get].launchCount description],
@"launchCount",
[[PearlConfig get].askForReviews boolValue] [[PearlConfig get].askForReviews boolValue]
? @"YES": @"NO", @"askForReviews", ? @"YES": @"NO", @"askForReviews",
[[PearlConfig get].reviewAfterLaunches description], @"reviewAfterLaunches", [[PearlConfig get].reviewAfterLaunches description],
[PearlConfig get].reviewedVersion, @"reviewedVersion", @"reviewAfterLaunches",
[PearlConfig get].reviewedVersion,
@"reviewedVersion",
nil]]; nil]];
} }
} }
@ -445,8 +447,7 @@
@"Your device is not yet set up for sending mail.\n" @"Your device is not yet set up for sending mail.\n"
@"Close Master Password, go into Settings and add a Mail account." @"Close Master Password, go into Settings and add a Mail account."
viewStyle:UIAlertViewStyleDefault viewStyle:UIAlertViewStyleDefault
initAlert:nil tappedButtonBlock:nil initAlert:nil tappedButtonBlock:nil cancelTitle:[PearlStrings get].commonButtonOkay
cancelTitle:[PearlStrings get].commonButtonOkay
otherTitles:nil]; otherTitles:nil];
return; return;
} }
@ -487,7 +488,7 @@
[self.window.rootViewController presentModalViewController:composer animated:YES]; [self.window.rootViewController presentModalViewController:composer animated:YES];
} }
- (void)changeMasterPasswordFor:(MPUserEntity *)user didResetBlock:(void(^)(void))didReset { - (void)changeMasterPasswordFor:(MPUserEntity *)user didResetBlock:(void (^)(void))didReset {
[PearlAlert showAlertWithTitle:@"Changing Master Password" [PearlAlert showAlertWithTitle:@"Changing Master Password"
message: message:
@ -508,8 +509,7 @@
didReset(); didReset();
[TestFlight passCheckpoint:MPCheckpointChangeMP]; [TestFlight passCheckpoint:MPCheckpointChangeMP];
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointChangeMP [[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointChangeMP attributes:nil];
attributes:nil];
} }
cancelTitle:[PearlStrings get].commonButtonAbort cancelTitle:[PearlStrings get].commonButtonAbort
otherTitles:[PearlStrings get].commonButtonContinue, nil]; otherTitles:[PearlStrings get].commonButtonContinue, nil];

View File

@ -19,11 +19,12 @@
@property (weak, nonatomic) IBOutlet UILabel *oldNameLabel; @property (weak, nonatomic) IBOutlet UILabel *oldNameLabel;
@property (weak, nonatomic) IBOutlet UIButton *avatarTemplate; @property (weak, nonatomic) IBOutlet UIButton *avatarTemplate;
@property (weak, nonatomic) IBOutlet UIView *createPasswordTipView; @property (weak, nonatomic) IBOutlet UIView *createPasswordTipView;
@property (weak, nonatomic) IBOutlet UILabel *deleteTip; @property (weak, nonatomic) IBOutlet UILabel *tip;
@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 (weak, nonatomic) IBOutlet UIView *wordWall; @property (weak, nonatomic) IBOutlet UIView *wordWall;
@property (strong, nonatomic) IBOutlet UILongPressGestureRecognizer *targetedUserActionGesture; @property (strong, nonatomic) IBOutlet UILongPressGestureRecognizer *targetedUserActionGesture;
@property (weak, nonatomic) IBOutlet UIActivityIndicatorView *loadingUsersIndicator;
@property (nonatomic, strong) UIColor *avatarShadowColor; @property (nonatomic, strong) UIColor *avatarShadowColor;

View File

@ -34,11 +34,12 @@
@synthesize nameLabel, oldNameLabel; @synthesize nameLabel, oldNameLabel;
@synthesize avatarTemplate; @synthesize avatarTemplate;
@synthesize createPasswordTipView; @synthesize createPasswordTipView;
@synthesize deleteTip; @synthesize tip;
@synthesize passwordTipView; @synthesize passwordTipView;
@synthesize passwordTipLabel; @synthesize passwordTipLabel;
@synthesize wordWall; @synthesize wordWall;
@synthesize targetedUserActionGesture; @synthesize targetedUserActionGesture;
@synthesize loadingUsersIndicator;
@synthesize avatarShadowColor = _avatarShadowColor; @synthesize avatarShadowColor = _avatarShadowColor;
@synthesize wordWallAnimating = _wordWallAnimating; @synthesize wordWallAnimating = _wordWallAnimating;
@synthesize wordList = _wordList; @synthesize wordList = _wordList;
@ -154,6 +155,8 @@
[self updateUsers]; [self updateUsers];
}]; }];
[self updateLayoutAnimated:NO allowScroll:YES completion:nil];
[super viewDidLoad]; [super viewDidLoad];
} }
@ -165,13 +168,14 @@
[self setAvatarsView:nil]; [self setAvatarsView:nil];
[self setNameLabel:nil]; [self setNameLabel:nil];
[self setAvatarTemplate:nil]; [self setAvatarTemplate:nil];
[self setDeleteTip:nil]; [self setTip:nil];
[self setPasswordTipView:nil]; [self setPasswordTipView:nil];
[self setPasswordTipLabel:nil]; [self setPasswordTipLabel:nil];
[self setTargetedUserActionGesture:nil]; [self setTargetedUserActionGesture:nil];
[self setWordWall:nil]; [self setWordWall:nil];
[self setCreatePasswordTipView:nil]; [self setCreatePasswordTipView:nil];
[self setPasswordFieldLabel:nil]; [self setPasswordFieldLabel:nil];
[self setLoadingUsersIndicator:nil];
[super viewDidUnload]; [super viewDidUnload];
} }
@ -202,9 +206,19 @@
- (void)updateUsers { - (void)updateUsers {
NSManagedObjectContext *moc = [MPAppDelegate managedObjectContextIfReady];
if (!moc) {
self.tip.text = @"Loading...";
[self.loadingUsersIndicator startAnimating];
return;
}
self.tip.text = @"Tap and hold to delete or reset.";
[self.loadingUsersIndicator stopAnimating];
NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:NSStringFromClass([MPUserEntity class])]; NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:NSStringFromClass([MPUserEntity class])];
fetchRequest.sortDescriptors = [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"lastUsed" ascending:NO]]; fetchRequest.sortDescriptors = [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"lastUsed" ascending:NO]];
NSArray *users = [[MPAppDelegate managedObjectContextIfReady] executeFetchRequest:fetchRequest error:nil]; NSArray *users = [moc executeFetchRequest:fetchRequest error:nil];
// Clean up avatars. // Clean up avatars.
for (UIView *subview in [self.avatarsView subviews]) for (UIView *subview in [self.avatarsView subviews])
@ -390,7 +404,6 @@
self.nameLabel.backgroundColor = [UIColor blackColor]; self.nameLabel.backgroundColor = [UIColor blackColor];
self.oldNameLabel.center = self.nameLabel.center; self.oldNameLabel.center = self.nameLabel.center;
self.avatarShadowColor = [UIColor whiteColor]; self.avatarShadowColor = [UIColor whiteColor];
self.deleteTip.alpha = 0;
} else } else
if (!self.selectedUser && self.passwordView.alpha == 1) { if (!self.selectedUser && self.passwordView.alpha == 1) {
// User was just deselected. // User was just deselected.
@ -402,7 +415,6 @@
self.nameLabel.backgroundColor = [UIColor clearColor]; self.nameLabel.backgroundColor = [UIColor clearColor];
self.oldNameLabel.center = self.nameLabel.center; self.oldNameLabel.center = self.nameLabel.center;
self.avatarShadowColor = [UIColor lightGrayColor]; self.avatarShadowColor = [UIColor lightGrayColor];
self.deleteTip.alpha = 0.5;
} }
// Lay out the word wall. // Lay out the word wall.
@ -463,7 +475,7 @@
} }
// Lay out user name label. // Lay out user name label.
self.nameLabel.text = targetedUser? targetedUser.name: @"New User"; self.nameLabel.text = targetedAvatar? targetedUser? targetedUser.name: @"New User": nil;
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)

View File

@ -1414,6 +1414,10 @@ You could use the word wall for inspiration in finding a memorable master passw
</subviews> </subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view> </view>
<activityIndicatorView opaque="NO" contentMode="scaleToFill" hidesWhenStopped="YES" animating="YES" style="whiteLarge" id="XuP-pi-ygN">
<rect key="frame" x="142" y="415" width="37" height="37"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
</activityIndicatorView>
</subviews> </subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view> </view>
@ -1422,7 +1426,8 @@ You could use the word wall for inspiration in finding a memorable master passw
<outlet property="avatarTemplate" destination="Ten-ig-gog" id="0ZZ-z5-d5m"/> <outlet property="avatarTemplate" destination="Ten-ig-gog" id="0ZZ-z5-d5m"/>
<outlet property="avatarsView" destination="Blg-F1-9NA" id="2NL-jU-IMI"/> <outlet property="avatarsView" destination="Blg-F1-9NA" id="2NL-jU-IMI"/>
<outlet property="createPasswordTipView" destination="xWL-xQ-KjX" id="Pa1-Bk-pW2"/> <outlet property="createPasswordTipView" destination="xWL-xQ-KjX" id="Pa1-Bk-pW2"/>
<outlet property="deleteTip" destination="DBJ-Qi-ZcF" id="VXD-Zc-UYi"/> <outlet property="tip" destination="DBJ-Qi-ZcF" id="VXD-Zc-UYi"/>
<outlet property="loadingUsersIndicator" destination="XuP-pi-ygN" id="idh-aH-sDL"/>
<outlet property="nameLabel" destination="0NM-NI-7UR" id="GBg-Ry-sqj"/> <outlet property="nameLabel" destination="0NM-NI-7UR" id="GBg-Ry-sqj"/>
<outlet property="oldNameLabel" destination="8s0-nT-Aoq" id="plu-1H-MVc"/> <outlet property="oldNameLabel" destination="8s0-nT-Aoq" id="plu-1H-MVc"/>
<outlet property="passwordField" destination="rTR-7Q-X8o" id="Vsn-uO-4lO"/> <outlet property="passwordField" destination="rTR-7Q-X8o" id="Vsn-uO-4lO"/>
@ -1853,6 +1858,7 @@ You could use the word wall for inspiration in finding a memorable master passw
<relationship kind="action" name="incrementPasswordCounter"/> <relationship kind="action" name="incrementPasswordCounter"/>
<relationship kind="action" name="infoOutdatedAlert"/> <relationship kind="action" name="infoOutdatedAlert"/>
<relationship kind="action" name="resetPasswordCounter:" candidateClass="UILongPressGestureRecognizer"/> <relationship kind="action" name="resetPasswordCounter:" candidateClass="UILongPressGestureRecognizer"/>
<relationship kind="action" name="searchOutdatedElements"/>
<relationship kind="action" name="toggleUser"/> <relationship kind="action" name="toggleUser"/>
<relationship kind="action" name="upgradePassword"/> <relationship kind="action" name="upgradePassword"/>
<relationship kind="outlet" name="actionsTipContainer" candidateClass="UIView"/> <relationship kind="outlet" name="actionsTipContainer" candidateClass="UIView"/>
@ -1922,7 +1928,8 @@ You could use the word wall for inspiration in finding a memorable master passw
<relationship kind="outlet" name="avatarTemplate" candidateClass="UIButton"/> <relationship kind="outlet" name="avatarTemplate" candidateClass="UIButton"/>
<relationship kind="outlet" name="avatarsView" candidateClass="UIScrollView"/> <relationship kind="outlet" name="avatarsView" candidateClass="UIScrollView"/>
<relationship kind="outlet" name="createPasswordTipView" candidateClass="UIView"/> <relationship kind="outlet" name="createPasswordTipView" candidateClass="UIView"/>
<relationship kind="outlet" name="deleteTip" candidateClass="UILabel"/> <relationship kind="outlet" name="tip" candidateClass="UILabel"/>
<relationship kind="outlet" name="loadingUsersIndicator" candidateClass="UIActivityIndicatorView"/>
<relationship kind="outlet" name="nameLabel" candidateClass="UILabel"/> <relationship kind="outlet" name="nameLabel" candidateClass="UILabel"/>
<relationship kind="outlet" name="oldNameLabel" candidateClass="UILabel"/> <relationship kind="outlet" name="oldNameLabel" candidateClass="UILabel"/>
<relationship kind="outlet" name="passwordField" candidateClass="UITextField"/> <relationship kind="outlet" name="passwordField" candidateClass="UITextField"/>

View File

@ -13,7 +13,7 @@
- (void)setUp - (void)setUp
{ {
dbg(@"======================= TEST SET-UP ======================"); dbg(@"======================= TEST SET-UP ======================");
[PearlLogger get].autoprintLevel = PearlLogLevelTrace; [PearlLogger get].printLevel = PearlLogLevelTrace;
[super setUp]; [super setUp];