diff --git a/MasterPassword.xcworkspace/xcshareddata/MasterPassword.xccheckout b/MasterPassword.xcworkspace/xcshareddata/MasterPassword.xccheckout index f11d1ee6..cbb4fb9f 100644 --- a/MasterPassword.xcworkspace/xcshareddata/MasterPassword.xccheckout +++ b/MasterPassword.xcworkspace/xcshareddata/MasterPassword.xccheckout @@ -44,7 +44,7 @@ 2FE140B36B7D26140DC8D5E5C639DC5900EFCF35 ../External/Pearl/External/uicolor-utilities 304AD0F97EA7B4893D91DFB8C3413D4E627B9472 - ../External/KCOrderedAccessorFix/ + ../External/KCOrderedAccessorFix 3E67FB08419C920516AAC3B00DAAF23073B8CF77 ../External/RHStatusItemView 4DDCFFD91B41F00326AD14553BD66CFD366ABD91 diff --git a/MasterPassword/ObjC/MPAppDelegate_InApp.m b/MasterPassword/ObjC/MPAppDelegate_InApp.m index 8aa4f54c..4188761d 100644 --- a/MasterPassword/ObjC/MPAppDelegate_InApp.m +++ b/MasterPassword/ObjC/MPAppDelegate_InApp.m @@ -132,6 +132,8 @@ PearlAssociatedObjectProperty( NSMutableArray*, ProductObservers, productObserve float currentFuel = [[MPiOSConfig get].developmentFuel floatValue]; float purchasedFuel = transaction.payment.quantity / MP_FUEL_HOURLY_RATE; [MPiOSConfig get].developmentFuel = @(currentFuel + purchasedFuel); + if (![MPiOSConfig get].developmentFuelChecked || !currentFuel) + [MPiOSConfig get].developmentFuelChecked = [NSDate date]; } [[NSUserDefaults standardUserDefaults] setObject:transaction.transactionIdentifier forKey:transaction.payment.productIdentifier]; diff --git a/MasterPassword/ObjC/iOS/MPAvatarCell.m b/MasterPassword/ObjC/iOS/MPAvatarCell.m index 111b7bb8..5a32aa56 100644 --- a/MasterPassword/ObjC/iOS/MPAvatarCell.m +++ b/MasterPassword/ObjC/iOS/MPAvatarCell.m @@ -214,18 +214,20 @@ const long MPAvatarAdd = 10000; switch (self.mode) { case MPAvatarModeLowered: { - [self.avatarSizeConstraint updateConstant:self.avatarImageView.image.size.height]; + [self.avatarSizeConstraint updateConstant: + self.avatarImageView.image.size.height * (self.visibility * 0.3f + 0.7f)]; [self.avatarRaisedConstraint updatePriority:UILayoutPriorityDefaultLow]; [self.avatarToTopConstraint updatePriority:UILayoutPriorityDefaultLow]; [self.nameToCenterConstraint updatePriority:UILayoutPriorityDefaultLow]; self.nameContainer.alpha = self.visibility; self.nameContainer.backgroundColor = [UIColor clearColor]; - self.avatarImageView.alpha = self.visibility / 0.7f + 0.3f; + self.avatarImageView.alpha = self.visibility * 0.7f + 0.3f; self.avatarImageView.layer.shadowRadius = 15 * self.visibility * self.visibility; break; } case MPAvatarModeRaisedButInactive: { - [self.avatarSizeConstraint updateConstant:self.avatarImageView.image.size.height]; + [self.avatarSizeConstraint updateConstant: + self.avatarImageView.image.size.height * (self.visibility * 0.7f + 0.3f)]; [self.avatarRaisedConstraint updatePriority:UILayoutPriorityDefaultHigh]; [self.avatarToTopConstraint updatePriority:UILayoutPriorityDefaultLow]; [self.nameToCenterConstraint updatePriority:UILayoutPriorityDefaultLow]; @@ -236,7 +238,8 @@ const long MPAvatarAdd = 10000; break; } case MPAvatarModeRaisedAndActive: { - [self.avatarSizeConstraint updateConstant:self.avatarImageView.image.size.height]; + [self.avatarSizeConstraint updateConstant: + self.avatarImageView.image.size.height * (self.visibility * 0.7f + 0.3f)]; [self.avatarRaisedConstraint updatePriority:UILayoutPriorityDefaultHigh]; [self.avatarToTopConstraint updatePriority:UILayoutPriorityDefaultLow]; [self.nameToCenterConstraint updatePriority:UILayoutPriorityDefaultHigh]; @@ -247,7 +250,8 @@ const long MPAvatarAdd = 10000; break; } case MPAvatarModeRaisedAndHidden: { - [self.avatarSizeConstraint updateConstant:self.avatarImageView.image.size.height]; + [self.avatarSizeConstraint updateConstant: + self.avatarImageView.image.size.height * (self.visibility * 0.7f + 0.3f)]; [self.avatarRaisedConstraint updatePriority:UILayoutPriorityDefaultHigh]; [self.avatarToTopConstraint updatePriority:UILayoutPriorityDefaultLow]; [self.nameToCenterConstraint updatePriority:UILayoutPriorityDefaultHigh]; diff --git a/MasterPassword/ObjC/iOS/MPPopdownSegue.m b/MasterPassword/ObjC/iOS/MPPopdownSegue.m index 73acef12..0532cdec 100644 --- a/MasterPassword/ObjC/iOS/MPPopdownSegue.m +++ b/MasterPassword/ObjC/iOS/MPPopdownSegue.m @@ -1,12 +1,12 @@ /** - * Copyright Maarten Billemont (http://www.lhunath.com, lhunath@lyndir.com) - * - * See the enclosed file LICENSE for license information (LGPLv3). If you did - * not receive this file, see http://www.gnu.org/licenses/lgpl-3.0.txt - * - * @author Maarten Billemont - * @license http://www.gnu.org/licenses/lgpl-3.0.txt - */ +* Copyright Maarten Billemont (http://www.lhunath.com, lhunath@lyndir.com) +* +* See the enclosed file LICENSE for license information (LGPLv3). If you did +* not receive this file, see http://www.gnu.org/licenses/lgpl-3.0.txt +* +* @author Maarten Billemont +* @license http://www.gnu.org/licenses/lgpl-3.0.txt +*/ // // MPPopdownSegue.h @@ -22,6 +22,8 @@ @implementation MPPopdownSegue { } +static char UnwindingObserverKey; + - (void)perform { MPPasswordsViewController *passwordsVC; @@ -35,17 +37,30 @@ [passwordsVC addChildViewController:popdownVC]; [passwordsVC.popdownContainer addSubview:popdownView]; [passwordsVC.popdownContainer addConstraintsWithVisualFormats:@[ @"H:|[popdownView]|", @"V:|[popdownView]|" ] options:0 - metrics:nil views:NSDictionaryOfVariableBindings(popdownView)]; + metrics:nil views:NSDictionaryOfVariableBindings( popdownView )]; [UIView animateWithDuration:0.3f animations:^{ [[passwordsVC.popdownToTopConstraint updatePriority:1] layoutIfNeeded]; - } completion:^(BOOL finished) { + } completion:^(BOOL finished) { [popdownVC didMoveToParentViewController:passwordsVC]; + + id observer = [[NSNotificationCenter defaultCenter] addObserverForName:MPSignedOutNotification object:nil + queue:[NSOperationQueue mainQueue] usingBlock: + ^(NSNotification *note) { + [[[MPPopdownSegue alloc] initWithIdentifier:@"unwind-popdown" source:popdownVC + destination:passwordsVC] perform]; + }]; + objc_setAssociatedObject( popdownVC, &UnwindingObserverKey, observer, OBJC_ASSOCIATION_RETAIN ); }]; } - else if ([self.destinationViewController isKindOfClass:[MPPasswordsViewController class]]) { + else { popdownVC = self.sourceViewController; - passwordsVC = self.destinationViewController; + for (passwordsVC = self.sourceViewController; passwordsVC && ![(id)passwordsVC isKindOfClass:[MPPasswordsViewController class]]; + passwordsVC = (id)passwordsVC.parentViewController); + NSAssert( passwordsVC, @"Couldn't find passwords VC to pop back to." ); + + [[NSNotificationCenter defaultCenter] removeObserver:objc_getAssociatedObject( popdownVC, &UnwindingObserverKey )]; + objc_setAssociatedObject( popdownVC, &UnwindingObserverKey, nil, OBJC_ASSOCIATION_RETAIN ); [popdownVC willMoveToParentViewController:nil]; [UIView animateWithDuration:0.3f delay:0 options:UIViewAnimationOptionOverrideInheritedDuration animations:^{ diff --git a/MasterPassword/ObjC/iOS/MPStoreViewController.m b/MasterPassword/ObjC/iOS/MPStoreViewController.m index d9858213..21525db6 100644 --- a/MasterPassword/ObjC/iOS/MPStoreViewController.m +++ b/MasterPassword/ObjC/iOS/MPStoreViewController.m @@ -220,10 +220,12 @@ PearlEnum( MPDevelopmentFuelConsumption, CGFloat weeklyFuelConsumption = [self weeklyFuelConsumption]; /* consume x fuel / week */ CGFloat fuel = [[MPiOSConfig get].developmentFuel floatValue]; /* x fuel left */ - NSTimeInterval fuelSecondsElapsed = [[MPiOSConfig get].developmentFuelChecked timeIntervalSinceNow]; - if (fuelSecondsElapsed > 3600) { + NSDate *now = [NSDate date]; + NSTimeInterval fuelSecondsElapsed = [[MPiOSConfig get].developmentFuelChecked timeIntervalSinceDate:now]; + if (fuelSecondsElapsed > 3600 || ![MPiOSConfig get].developmentFuelChecked) { NSTimeInterval weeksElapsed = fuelSecondsElapsed / (3600 * 24 * 7 /* 1 week */); /* x weeks elapsed */ fuel -= weeklyFuelConsumption * weeksElapsed; + [MPiOSConfig get].developmentFuelChecked = now; [MPiOSConfig get].developmentFuel = @(fuel); } diff --git a/MasterPassword/ObjC/iOS/Storyboard.storyboard b/MasterPassword/ObjC/iOS/Storyboard.storyboard index cdd2dffd..8edb8b31 100644 --- a/MasterPassword/ObjC/iOS/Storyboard.storyboard +++ b/MasterPassword/ObjC/iOS/Storyboard.storyboard @@ -1633,212 +1633,237 @@ - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - + - - + + + + - + +