2
0

Import fix, password type change fix, fancier generator appearance.

[FIXED]     Import of ubiquity changes was using wrong delegate method and MOC.
[FIXED]     Password type change broken when password type causes a class change.
[IMPROVED]  Fancier animation of emergency generator appearance.
This commit is contained in:
Maarten Billemont 2013-05-11 19:43:41 -04:00
parent 076cfb1257
commit cefe8d144d
7 changed files with 34 additions and 12 deletions

2
External/Pearl vendored

@ -1 +1 @@
Subproject commit c2b07f9c648fd6386aca0c982b44769bb36ac4b3 Subproject commit a2a43a63e26a110ebd130c918b8a47b41b20ae99

@ -1 +1 @@
Subproject commit 389c8b78501331af77c363857f381a497cbf0060 Subproject commit 8c7d9d629ef4f8ad26f1cd3f8012687f311a7c71

View File

@ -316,9 +316,9 @@ PearlAssociatedObjectProperty(NSManagedObjectContext*, MainManagedObjectContext,
#pragma mark - UbiquityStoreManagerDelegate #pragma mark - UbiquityStoreManagerDelegate
- (NSManagedObjectContext *)managedObjectContextForUbiquityStoreManager:(UbiquityStoreManager *)usm { - (NSManagedObjectContext *)managedObjectContextForUbiquityChangesInManager:(UbiquityStoreManager *)manager {
return [self privateManagedObjectContextIfReady]; return [self mainManagedObjectContextIfReady];
} }
- (void)ubiquityStoreManager:(UbiquityStoreManager *)manager log:(NSString *)message { - (void)ubiquityStoreManager:(UbiquityStoreManager *)manager log:(NSString *)message {
@ -328,7 +328,7 @@ PearlAssociatedObjectProperty(NSManagedObjectContext*, MainManagedObjectContext,
- (void)ubiquityStoreManager:(UbiquityStoreManager *)manager willLoadStoreIsCloud:(BOOL)isCloudStore { - (void)ubiquityStoreManager:(UbiquityStoreManager *)manager willLoadStoreIsCloud:(BOOL)isCloudStore {
NSManagedObjectContext *moc = self.mainManagedObjectContextIfReady; NSManagedObjectContext *moc = [self mainManagedObjectContextIfReady];
[moc performBlockAndWait:^{ [moc performBlockAndWait:^{
[moc saveToStore]; [moc saveToStore];

View File

@ -598,6 +598,8 @@
NSString *oldPassword = [activeElement.content description]; NSString *oldPassword = [activeElement.content description];
if (!task( activeElement, context )) if (!task( activeElement, context ))
return; return;
activeElement = [self activeElementInContext:context];
NSString *newPassword = [activeElement.content description]; NSString *newPassword = [activeElement.content description];
// Save. // Save.
@ -787,11 +789,15 @@
@"If you continue, the password for this site will change. " @"If you continue, the password for this site will change. "
@"You will need to update your account's old password to the new one." @"You will need to update your account's old password to the new one."
do:^BOOL(MPElementEntity *activeElement, NSManagedObjectContext *context) { do:^BOOL(MPElementEntity *activeElement, NSManagedObjectContext *context) {
if ([activeElement.algorithm classOfType:type] != activeElement.typeClass) { if ([activeElement.algorithm classOfType:type] == activeElement.typeClass)
activeElement.type = type;
else {
// Type requires a different class of element. Recreate the element. // Type requires a different class of element. Recreate the element.
MPElementEntity *newElement MPElementEntity *newElement
= [NSEntityDescription insertNewObjectForEntityForName:[activeElement.algorithm classNameOfType:type] = [NSEntityDescription insertNewObjectForEntityForName:[activeElement.algorithm classNameOfType:type]
inManagedObjectContext:context]; inManagedObjectContext:context];
newElement.type = type;
newElement.name = activeElement.name; newElement.name = activeElement.name;
newElement.user = activeElement.user; newElement.user = activeElement.user;
newElement.uses = activeElement.uses; newElement.uses = activeElement.uses;
@ -800,6 +806,7 @@
newElement.loginName = activeElement.loginName; newElement.loginName = activeElement.loginName;
[context deleteObject:activeElement]; [context deleteObject:activeElement];
[context saveToStore];
NSError *error; NSError *error;
if (![context obtainPermanentIDsForObjects:@[ newElement ] error:&error]) if (![context obtainPermanentIDsForObjects:@[ newElement ] error:&error])
@ -808,7 +815,6 @@
_activeElementOID = newElement.objectID; _activeElementOID = newElement.objectID;
activeElement = newElement; activeElement = newElement;
} }
activeElement.type = type;
[[NSNotificationCenter defaultCenter] [[NSNotificationCenter defaultCenter]
postNotificationName:MPElementUpdatedNotification object:activeElement.objectID]; postNotificationName:MPElementUpdatedNotification object:activeElement.objectID];

View File

@ -77,7 +77,9 @@
[(UITextField *)[cell viewWithTag:2] setText:@"..."]; [(UITextField *)[cell viewWithTag:2] setText:@"..."];
NSString *name = selectedElement.name; NSString *name = selectedElement.name;
NSUInteger counter = ((MPElementGeneratedEntity *)selectedElement).counter; NSUInteger counter = 0;
if ([selectedElement isKindOfClass:[MPElementGeneratedEntity class]])
counter = ((MPElementGeneratedEntity *)selectedElement).counter;
dispatch_async( dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0 ), ^{ dispatch_async( dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0 ), ^{
NSString *typeContent = [MPAlgorithmDefault generateContentNamed:name ofType:cellType NSString *typeContent = [MPAlgorithmDefault generateContentNamed:name ofType:cellType

View File

@ -8,6 +8,7 @@
#import <QuartzCore/QuartzCore.h> #import <QuartzCore/QuartzCore.h>
#import <Social/Social.h> #import <Social/Social.h>
#import <CoreGraphics/CoreGraphics.h>
#import "MPUnlockViewController.h" #import "MPUnlockViewController.h"
#import "MPiOSAppDelegate.h" #import "MPiOSAppDelegate.h"
@ -209,6 +210,8 @@
- (void)viewDidAppear:(BOOL)animated { - (void)viewDidAppear:(BOOL)animated {
[self becomeFirstResponder];
if (!animated && !self.navigationController.presentedViewController) if (!animated && !self.navigationController.presentedViewController)
[[self findTargetedAvatar] setSelected:YES]; [[self findTargetedAvatar] setSelected:YES];
else else
@ -254,10 +257,21 @@
self.emergencyGeneratorContainer.alpha = 0; self.emergencyGeneratorContainer.alpha = 0;
self.emergencyGeneratorContainer.hidden = NO; self.emergencyGeneratorContainer.hidden = NO;
[UIView animateWithDuration:0.5 animations:^{ self.emergencyGeneratorContainer.frame = CGRectSetX( self.emergencyGeneratorContainer.frame,
self.emergencyGeneratorContainer.frame.origin.x - 100 );
[UIView animateWithDuration:0.3 animations:^{
self.emergencyGeneratorContainer.frame = CGRectSetX( self.emergencyGeneratorContainer.frame,
self.emergencyGeneratorContainer.frame.origin.x + 150 );
self.emergencyGeneratorContainer.alpha = 1; self.emergencyGeneratorContainer.alpha = 1;
} completion:^(BOOL finished) { } completion:^(BOOL finished) {
if (!finished)
return;
[self.emergencyName becomeFirstResponder]; [self.emergencyName becomeFirstResponder];
[UIView animateWithDuration:0.2 animations:^{
self.emergencyGeneratorContainer.frame = CGRectSetX( self.emergencyGeneratorContainer.frame,
self.emergencyGeneratorContainer.frame.origin.x - 50 );
}];
}]; }];
} }
} }
@ -925,7 +939,7 @@
[[self.emergencyGeneratorContainer findFirstResponderInHierarchy] resignFirstResponder]; [[self.emergencyGeneratorContainer findFirstResponderInHierarchy] resignFirstResponder];
if (animated) { if (animated) {
[UIView animateWithDuration:0.5 animations:^{ [UIView animateWithDuration:0.2 animations:^{
self.emergencyGeneratorContainer.alpha = 0; self.emergencyGeneratorContainer.alpha = 0;
} completion:^(BOOL finished) { } completion:^(BOOL finished) {
[self emergencyCloseAnimated:NO]; [self emergencyCloseAnimated:NO];

View File

@ -1549,11 +1549,11 @@ You could use the word wall for inspiration in finding a memorable master passw
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view> </view>
<view hidden="YES" alpha="0.30000000000000016" contentMode="scaleToFill" id="KNa-Xb-RuE" userLabel="View - Emergency Generator"> <view hidden="YES" alpha="0.30000000000000016" contentMode="scaleToFill" id="KNa-Xb-RuE" userLabel="View - Emergency Generator">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/> <rect key="frame" x="-100" y="0.0" width="520" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<view contentMode="scaleToFill" id="vdf-Kn-Sle"> <view contentMode="scaleToFill" id="vdf-Kn-Sle">
<rect key="frame" x="0.0" y="20" width="320" height="434"/> <rect key="frame" x="100" y="20" width="320" height="434"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" image="ui_panel_display.png" id="jLf-TI-anP"> <imageView userInteractionEnabled="NO" contentMode="scaleToFill" image="ui_panel_display.png" id="jLf-TI-anP">