diff --git a/External/Pearl b/External/Pearl index 203a7798..62421fb9 160000 --- a/External/Pearl +++ b/External/Pearl @@ -1 +1 @@ -Subproject commit 203a779802b8aa6c330b5f8a88c6611925bd0968 +Subproject commit 62421fb92c7421eea8cbf8f784d141425516396a diff --git a/MasterPassword.xcodeproj/project.pbxproj b/MasterPassword.xcodeproj/project.pbxproj index 9f48446f..95b84624 100644 --- a/MasterPassword.xcodeproj/project.pbxproj +++ b/MasterPassword.xcodeproj/project.pbxproj @@ -204,7 +204,8 @@ DA84819514CB521E00A2FA22 /* tip_location_teal.png in Resources */ = {isa = PBXBuildFile; fileRef = DA84817714CB521E00A2FA22 /* tip_location_teal.png */; }; DA84819614CB521E00A2FA22 /* tip_location_wood.png in Resources */ = {isa = PBXBuildFile; fileRef = DA84817814CB521E00A2FA22 /* tip_location_wood.png */; }; DA8E8E4614DD7C1D0044257E /* logo-bare.png in Resources */ = {isa = PBXBuildFile; fileRef = DA8E8E4514DD7C1D0044257E /* logo-bare.png */; }; - DA8E8E5114DE78C20044257E /* OPMenuViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DA8E8E5014DE78C20044257E /* OPMenuViewController.m */; }; + DA8E8E5514DEB8FC0044257E /* InfoPlist.h in Headers */ = {isa = PBXBuildFile; fileRef = DA8E8E5314DEB8FC0044257E /* InfoPlist.h */; }; + DA8E8E5614DEB8FC0044257E /* InfoPlist.m in Sources */ = {isa = PBXBuildFile; fileRef = DA8E8E5414DEB8FC0044257E /* InfoPlist.m */; }; DAA3B68E14CCCEE700F35AF6 /* icon_addressbook-person@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DAA3B53814CCCEE700F35AF6 /* icon_addressbook-person@2x.png */; }; DAA3B68F14CCCEE700F35AF6 /* icon_addressbook.png in Resources */ = {isa = PBXBuildFile; fileRef = DAA3B53914CCCEE700F35AF6 /* icon_addressbook.png */; }; DAA3B69014CCCEE700F35AF6 /* icon_addressbook@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DAA3B53A14CCCEE700F35AF6 /* icon_addressbook@2x.png */; }; @@ -908,8 +909,8 @@ DA84817814CB521E00A2FA22 /* tip_location_wood.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = tip_location_wood.png; sourceTree = ""; }; DA8E8E4514DD7C1D0044257E /* logo-bare.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "logo-bare.png"; path = "Resources/logo-bare.png"; sourceTree = ""; }; DA8E8E4714DDA62D0044257E /* MasterPassword.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = MasterPassword.entitlements; sourceTree = ""; }; - DA8E8E4F14DE78C20044257E /* OPMenuViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OPMenuViewController.h; sourceTree = ""; }; - DA8E8E5014DE78C20044257E /* OPMenuViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OPMenuViewController.m; sourceTree = ""; }; + DA8E8E5314DEB8FC0044257E /* InfoPlist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InfoPlist.h; sourceTree = ""; }; + DA8E8E5414DEB8FC0044257E /* InfoPlist.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InfoPlist.m; sourceTree = ""; }; DAA3B53814CCCEE700F35AF6 /* icon_addressbook-person@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon_addressbook-person@2x.png"; sourceTree = ""; }; DAA3B53914CCCEE700F35AF6 /* icon_addressbook.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon_addressbook.png; sourceTree = ""; }; DAA3B53A14CCCEE700F35AF6 /* icon_addressbook@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon_addressbook@2x.png"; sourceTree = ""; }; @@ -1828,8 +1829,6 @@ DAE2C646148247E500BA6B10 /* OPTypeViewController.m */, DA55B29C14B38272001131B7 /* OPContentViewController.h */, DA55B29D14B38272001131B7 /* OPContentViewController.m */, - DA8E8E4F14DE78C20044257E /* OPMenuViewController.h */, - DA8E8E5014DE78C20044257E /* OPMenuViewController.m */, DA34DA1414B1BEA100F721C1 /* OPTypes.h */, DA34DA1514B1BEA100F721C1 /* OPTypes.m */, DA007F5014B24DCC00251337 /* OPConfig.h */, @@ -2055,6 +2054,8 @@ DAC77CD91482AAD600BCF976 /* StringUtils.m */, DAC77CDA1482AAD600BCF976 /* WebUtils.h */, DAC77CDB1482AAD600BCF976 /* WebUtils.m */, + DA8E8E5314DEB8FC0044257E /* InfoPlist.h */, + DA8E8E5414DEB8FC0044257E /* InfoPlist.m */, ); name = Pearl; path = External/Pearl/Pearl; @@ -2327,6 +2328,7 @@ DAC781301482AAD800BCF976 /* ValidatingTextField.h in Headers */, DAC781321482AAD800BCF976 /* WebViewController.h in Headers */, DA84808414CB3DBA00A2FA22 /* MessageView.h in Headers */, + DA8E8E5514DEB8FC0044257E /* InfoPlist.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3045,7 +3047,6 @@ DA0A848C14C4DFCB0090EA8E /* OPElementGeneratedEntity.m in Sources */, DAA3B81414CDC77100F35AF6 /* jquery-1.6.1.min.js in Sources */, DA65570614D731F000841C99 /* OPGuideViewController.m in Sources */, - DA8E8E5114DE78C20044257E /* OPMenuViewController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3101,6 +3102,7 @@ DAC781311482AAD800BCF976 /* ValidatingTextField.m in Sources */, DAC781331482AAD800BCF976 /* WebViewController.m in Sources */, DA84808514CB3DBA00A2FA22 /* MessageView.m in Sources */, + DA8E8E5614DEB8FC0044257E /* InfoPlist.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/MasterPassword/MainStoryboard_iPhone.storyboard b/MasterPassword/MainStoryboard_iPhone.storyboard index f372393d..bcdd0f1c 100644 --- a/MasterPassword/MainStoryboard_iPhone.storyboard +++ b/MasterPassword/MainStoryboard_iPhone.storyboard @@ -308,107 +308,6 @@ The passwords aren't saved anywhere. This is a major advantage: if you loose yo - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -672,22 +571,10 @@ L4m3P4sSw0rD - - + + + + @@ -815,7 +702,6 @@ L4m3P4sSw0rD - @@ -826,54 +712,6 @@ L4m3P4sSw0rD - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/MasterPassword/OPMainViewController.h b/MasterPassword/OPMainViewController.h index b09c05a1..90f3237d 100644 --- a/MasterPassword/OPMainViewController.h +++ b/MasterPassword/OPMainViewController.h @@ -34,8 +34,12 @@ - (IBAction)copyContent; - (IBAction)incrementPasswordCounter; - (IBAction)editPassword; -- (IBAction)toggleHelp; -- (void)toggleHelp:(BOOL)hidden; - (IBAction)closeAlert; +- (IBAction)action:(UIBarButtonItem *)sender; + +- (BOOL)isHelpVisible; +- (void)toggleHelpAnimated:(BOOL)animated; +- (void)setHelpHidden:(BOOL)hidden animated:(BOOL)animated; +- (void)setHelpChapter:(NSString *)chapter; @end diff --git a/MasterPassword/OPMainViewController.m b/MasterPassword/OPMainViewController.m index 039959cc..c48e979c 100644 --- a/MasterPassword/OPMainViewController.m +++ b/MasterPassword/OPMainViewController.m @@ -71,8 +71,8 @@ self.searchTipContainer.alpha = 1; }]; - [self toggleHelp:[[OPConfig get].helpHidden boolValue]]; - [self updateAnimated:NO]; + [self setHelpHidden:[[OPConfig get].helpHidden boolValue] animated:animated]; + [self updateAnimated:animated]; } - (void)viewDidAppear:(BOOL)animated { @@ -161,14 +161,7 @@ - (void)updateWasAnimated:(BOOL)animated { - NSUInteger chapter = self.activeElement? 2: 1; - [self.helpView loadRequest: - [NSURLRequest requestWithURL: - [NSURL URLWithString:[NSString stringWithFormat:@"#%d", chapter] relativeToURL: - [[NSBundle mainBundle] URLForResource:@"help" withExtension:@"html"]]]]; - [self.helpView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"setClass('%@');", - ClassNameFromOPElementType(self.activeElement.type)]]; - + [self setHelpChapter:self.activeElement? @"2": @"1"]; self.siteName.text = self.activeElement.name; self.passwordCounter.alpha = self.activeElement.type & OPElementTypeClassCalculated? 0.5f: 0; @@ -193,6 +186,42 @@ }); } +- (BOOL)isHelpVisible { + + return self.helpContainer.frame.origin.y < 400; +} + +- (void)toggleHelpAnimated:(BOOL)animated { + + [self setHelpHidden:[self isHelpVisible] animated:animated]; +} + +- (void)setHelpHidden:(BOOL)hidden animated:(BOOL)animated { + + [UIView animateWithDuration:animated? 0.3f: 0 animations:^{ + + if (hidden) { + self.contentContainer.frame = CGRectSetHeight(self.contentContainer.frame, 373); + self.helpContainer.frame = CGRectSetY(self.helpContainer.frame, 415); + [OPConfig get].helpHidden = [NSNumber numberWithBool:YES]; + } else { + self.contentContainer.frame = CGRectSetHeight(self.contentContainer.frame, 175); + self.helpContainer.frame = CGRectSetY(self.helpContainer.frame, 216); + [OPConfig get].helpHidden = [NSNumber numberWithBool:NO]; + } + }]; +} + +- (void)setHelpChapter:(NSString *)chapter { + + [self.helpView loadRequest: + [NSURLRequest requestWithURL: + [NSURL URLWithString:[NSString stringWithFormat:@"#%@", chapter] relativeToURL: + [[NSBundle mainBundle] URLForResource:@"help" withExtension:@"html"]]]]; + [self.helpView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"setClass('%@');", + ClassNameFromOPElementType(self.activeElement.type)]]; +} + - (void)showContentTip:(NSString *)message withIcon:(UIImageView *)icon { self.contentTipBody.text = message; @@ -280,29 +309,6 @@ } } -- (IBAction)toggleHelp { - - [UIView animateWithDuration:0.3f animations:^{ - if (self.helpContainer.frame.origin.y < 400) - [self toggleHelp:YES]; - else - [self toggleHelp:NO]; - }]; -} - -- (void)toggleHelp:(BOOL)hidden { - - if (hidden) { - self.contentContainer.frame = CGRectSetHeight(self.contentContainer.frame, 373); - self.helpContainer.frame = CGRectSetY(self.helpContainer.frame, 415); - [OPConfig get].helpHidden = [NSNumber numberWithBool:YES]; - } else { - self.contentContainer.frame = CGRectSetHeight(self.contentContainer.frame, 175); - self.helpContainer.frame = CGRectSetY(self.helpContainer.frame, 216); - [OPConfig get].helpHidden = [NSNumber numberWithBool:NO]; - } -} - - (IBAction)closeAlert { [UIView animateWithDuration:0.3f animations:^{ @@ -312,6 +318,34 @@ }]; } +- (IBAction)action:(id)sender { + + [SheetViewController showSheetWithTitle:nil message:nil viewStyle:UIActionSheetStyleAutomatic + tappedButtonBlock:^(UIActionSheet *sheet, NSInteger buttonIndex) { + if (buttonIndex == [sheet cancelButtonIndex]) + return; + + switch (buttonIndex - [sheet firstOtherButtonIndex]) { + case 0: + [self toggleHelpAnimated:YES]; + break; + case 1: + [self setHelpChapter:@"faq"]; + [self setHelpHidden:NO animated:YES]; + break; + case 2: + [[OPAppDelegate get] showGuide]; + break; + case 3: + [[UIApplication sharedApplication] openURL: + [NSURL URLWithString:[NSString stringWithFormat:@"prefs:root=Apps&path=%@", + [InfoPlist get].CFBundleDisplayName]]]; + break; + } + } cancelTitle:[PearlStrings get].commonButtonCancel destructiveTitle:nil + otherTitles:[self isHelpVisible]? @"Hide Help": @"Show Help", @"FAQ", @"Quick Start", @"Settings", nil]; +} + - (void)didSelectType:(OPElementType)type { [self updateElement:^{ diff --git a/MasterPassword/OPMenuViewController.h b/MasterPassword/OPMenuViewController.h deleted file mode 100644 index a0077703..00000000 --- a/MasterPassword/OPMenuViewController.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// OPMenuViewController.h -// MasterPassword -// -// Created by Maarten Billemont on 05/02/12. -// Copyright (c) 2012 Lyndir. All rights reserved. -// - -#import - -@interface OPMenuViewController : UITableViewController - -@end diff --git a/MasterPassword/OPMenuViewController.m b/MasterPassword/OPMenuViewController.m deleted file mode 100644 index ad10cbd4..00000000 --- a/MasterPassword/OPMenuViewController.m +++ /dev/null @@ -1,22 +0,0 @@ -// -// OPMenuViewController.m -// MasterPassword -// -// Created by Maarten Billemont on 05/02/12. -// Copyright (c) 2012 Lyndir. All rights reserved. -// - -#import "OPMenuViewController.h" - - -@implementation OPMenuViewController - -#pragma mark - Table view delegate - -- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - - if (indexPath.row == 4) - [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=Apps&path=MasterPassword"]]; -} - -@end