2
0

UI Redesign.

This commit is contained in:
Maarten Billemont 2012-01-16 09:51:08 +01:00
parent 7ea4758590
commit f4eb33e728
488 changed files with 2191 additions and 415 deletions

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 361 KiB

View File

@ -22,82 +22,56 @@
[Logger get].autoprintLevel = LogLevelDebug; [Logger get].autoprintLevel = LogLevelDebug;
} }
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - (void)applicationWillResignActive:(UIApplication *)application {
dispatch_async(dispatch_get_main_queue(), ^{ if (![[OPConfig get].rememberKeyPhrase boolValue])
NSString *keyPhraseHash = [OPConfig get].keyPhraseHash; self.keyPhrase = nil;
}
AlertViewController *keyPhraseAlert = [[AlertViewController alloc] initQuestionWithTitle:@"One Password" - (void)applicationDidBecomeActive:(UIApplication *)application {
message:keyPhraseHash? @"Unlock with your master password:": @"Choose your master password:"
tappedButtonBlock:
^(NSInteger buttonIndex, NSString *answer) {
if (buttonIndex == 0)
exit(0);
if (![answer length]) { if (!self.keyPhrase)
[AlertViewController showAlertWithTitle:[PearlStrings get].commonTitleError dispatch_async(dispatch_get_main_queue(), ^{
message:@"No master password entered." NSString *keyPhraseHash = [OPConfig get].keyPhraseHash;
tappedButtonBlock:
^(NSInteger buttonIndex) {
exit(0);
} cancelTitle:@"Quit" otherTitles:nil];
}
NSString *answerHash = [[answer hashWith:PearlDigestSHA1] encodeHex]; AlertViewController *keyPhraseAlert = [[AlertViewController alloc] initQuestionWithTitle:@"One Password"
if (keyPhraseHash) { message:keyPhraseHash? @"Unlock with your master password:": @"Choose your master password:"
if (![keyPhraseHash isEqualToString:answerHash]) { tappedButtonBlock:
^(NSInteger buttonIndex, NSString *answer) {
if (buttonIndex == 0)
exit(0);
if (![answer length]) {
[AlertViewController showAlertWithTitle:[PearlStrings get].commonTitleError [AlertViewController showAlertWithTitle:[PearlStrings get].commonTitleError
message:@"Incorrect master password." message:@"No master password entered."
tappedButtonBlock: tappedButtonBlock:
^(NSInteger buttonIndex) { ^(NSInteger buttonIndex) {
exit(0); exit(0);
} cancelTitle:@"Quit" otherTitles:nil]; } cancelTitle:@"Quit" otherTitles:nil];
return;
} }
} else
[OPConfig get].keyPhraseHash = answerHash;
self.keyPhrase = answer; NSString *answerHash = [[answer hashWith:PearlDigestSHA1] encodeHex];
} cancelTitle:@"Quit" otherTitles:@"Unlock", nil]; if (keyPhraseHash) {
keyPhraseAlert.alertField.autocapitalizationType = UITextAutocapitalizationTypeNone; if (![keyPhraseHash isEqualToString:answerHash]) {
keyPhraseAlert.alertField.autocorrectionType = UITextAutocorrectionTypeNo; [AlertViewController showAlertWithTitle:[PearlStrings get].commonTitleError
keyPhraseAlert.alertField.secureTextEntry = YES; message:@"Incorrect master password."
[keyPhraseAlert showAlert]; tappedButtonBlock:
}); ^(NSInteger buttonIndex) {
exit(0);
} cancelTitle:@"Quit" otherTitles:nil];
// Override point for customization after application launch. return;
return [super application:application didFinishLaunchingWithOptions:launchOptions]; }
} } else
[OPConfig get].keyPhraseHash = answerHash;
- (void)applicationWillResignActive:(UIApplication *)application self.keyPhrase = answer;
{ } cancelTitle:@"Quit" otherTitles:@"Unlock", nil];
/* keyPhraseAlert.alertField.autocapitalizationType = UITextAutocapitalizationTypeNone;
Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. keyPhraseAlert.alertField.autocorrectionType = UITextAutocorrectionTypeNo;
Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. keyPhraseAlert.alertField.secureTextEntry = YES;
*/ [keyPhraseAlert showAlert];
} });
- (void)applicationDidEnterBackground:(UIApplication *)application
{
/*
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
*/
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
/*
Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
*/
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
/*
Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
*/
} }
- (void)applicationWillTerminate:(UIApplication *)application - (void)applicationWillTerminate:(UIApplication *)application

View File

@ -10,6 +10,7 @@
@property (nonatomic, retain) NSNumber *dataStoreError; @property (nonatomic, retain) NSNumber *dataStoreError;
@property (nonatomic, retain) NSString *keyPhraseHash; @property (nonatomic, retain) NSString *keyPhraseHash;
@property (nonatomic, retain) NSNumber *rememberKeyPhrase;
+ (OPConfig *)get; + (OPConfig *)get;

View File

@ -10,7 +10,7 @@
@implementation OPConfig @implementation OPConfig
@dynamic dataStoreError, keyPhraseHash; @dynamic dataStoreError, keyPhraseHash, rememberKeyPhrase;
-(id) init { -(id) init {
@ -20,6 +20,7 @@
[self.defaults registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys: [self.defaults registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:NO], NSStringFromSelector(@selector(dataStoreError)), [NSNumber numberWithBool:NO], NSStringFromSelector(@selector(dataStoreError)),
[NSNumber numberWithBool:NO], NSStringFromSelector(@selector(rememberKeyPhrase)),
nil]]; nil]];

View File

@ -10,16 +10,19 @@
#import "OPElementEntity.h" #import "OPElementEntity.h"
#import "OPSearchDelegate.h" #import "OPSearchDelegate.h"
@interface OPMainViewController : UITableViewController <OPTypeDelegate, UITextFieldDelegate, UISearchBarDelegate, OPSearchResultsDelegate> @interface OPMainViewController : UIViewController <OPTypeDelegate, UITextFieldDelegate, UISearchBarDelegate, OPSearchResultsDelegate>
@property (strong, nonatomic) OPElementEntity *activeElement; @property (strong, nonatomic) OPElementEntity *activeElement;
@property (strong, nonatomic) IBOutlet OPSearchDelegate *searchResultsController; @property (strong, nonatomic) IBOutlet OPSearchDelegate *searchResultsController;
@property (weak, nonatomic) IBOutlet UITextField *contentField; @property (weak, nonatomic) IBOutlet UITextField *contentField;
@property (weak, nonatomic) IBOutlet UITextView *contentTextView; @property (weak, nonatomic) IBOutlet UIButton *typeButton;
@property (weak, nonatomic) IBOutlet UILabel *typeLabel; @property (weak, nonatomic) IBOutlet UIWebView *helpView;
@property (weak, nonatomic) IBOutlet UISegmentedControl *contentType; @property (weak, nonatomic) IBOutlet UILabel *siteName;
@property (weak, nonatomic) IBOutlet UILabel *passwordCounter;
@property (weak, nonatomic) IBOutlet UIButton *passwordIncrementer;
- (IBAction)didChangeContentType:(UISegmentedControl *)sender; - (IBAction)didChangeContentType:(UISegmentedControl *)sender;
- (IBAction)didTriggerContent:(id)sender; - (IBAction)didTriggerContent;
- (IBAction)didIncrementPasswordCounter;
@end @end

View File

@ -23,10 +23,12 @@
@implementation OPMainViewController @implementation OPMainViewController
@synthesize activeElement = _activeElement; @synthesize activeElement = _activeElement;
@synthesize searchResultsController = _searchResultsController; @synthesize searchResultsController = _searchResultsController;
@synthesize typeLabel = _typeLabel; @synthesize typeButton = _typeButton;
@synthesize contentType = _contentType; @synthesize helpView = _helpView;
@synthesize siteName = _siteName;
@synthesize passwordCounter = _passwordCounter;
@synthesize passwordIncrementer = _passwordIncrementer;
@synthesize contentField = _contentField; @synthesize contentField = _contentField;
@synthesize contentTextView = _contentTextView;
#pragma mark - View lifecycle #pragma mark - View lifecycle
@ -48,14 +50,12 @@
[super viewWillAppear:animated]; [super viewWillAppear:animated];
[self updateAnimated:NO]; [self updateAnimated:NO];
[self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:animated];
} }
- (void)viewDidLoad { - (void)viewDidLoad {
// Because IB's edit button doesn't auto-toggle self.editable like editButtonItem does. // Because IB's edit button doesn't auto-toggle self.editable like editButtonItem does.
self.navigationItem.rightBarButtonItem = self.editButtonItem; self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"background"]];
self.tableView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"Background.png"]];
[super viewDidLoad]; [super viewDidLoad];
} }
@ -63,11 +63,12 @@
- (void)viewDidUnload { - (void)viewDidUnload {
[self setContentField:nil]; [self setContentField:nil];
[self setTypeLabel:nil]; [self setTypeButton:nil];
[self setContentType:nil];
[self setContentTextView:nil];
[self setSearchResultsController:nil]; [self setSearchResultsController:nil];
[self setHelpView:nil];
[self setSiteName:nil];
[self setPasswordCounter:nil];
[self setPasswordIncrementer:nil];
[super viewDidUnload]; [super viewDidUnload];
} }
@ -92,17 +93,23 @@
- (void)updateWasAnimated:(BOOL)animated { - (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.navigationItem setRightBarButtonItem:self.activeElement.type & OPElementTypeStored? self.editButtonItem: nil animated:animated];
self.searchDisplayController.searchBar.placeholder = self.activeElement.name; self.searchDisplayController.searchBar.placeholder = self.activeElement.name;
self.siteName.text = self.activeElement.name;
self.typeLabel.text = self.activeElement? NSStringFromOPElementType(self.activeElement.type): @""; self.passwordCounter.alpha = self.activeElement.type & OPElementTypeCalculated? 1: 0;
self.passwordIncrementer.alpha = self.activeElement.type & OPElementTypeCalculated? 1: 0;
self.contentTextView.alpha = self.contentType.selectedSegmentIndex == OPElementContentTypeNote? 1: 0; [self.typeButton setTitle:NSStringFromOPElementType(self.activeElement.type)
self.contentTextView.editable = self.editing && self.activeElement.type & OPElementTypeStored; forState:UIControlStateNormal];
self.contentType.alpha = self.editing && self.activeElement.type & OPElementTypeStored? 1: 0;
self.contentType.selectedSegmentIndex = self.activeElement.contentType;
self.contentField.alpha = self.contentType.selectedSegmentIndex == OPElementContentTypePassword? 1: 0;
self.contentField.enabled = self.editing && self.activeElement.type & OPElementTypeStored; self.contentField.enabled = self.editing && self.activeElement.type & OPElementTypeStored;
self.contentField.clearButtonMode = self.contentField.enabled? UITextFieldViewModeAlways: UITextFieldViewModeNever; self.contentField.clearButtonMode = self.contentField.enabled? UITextFieldViewModeAlways: UITextFieldViewModeNever;
self.contentField.text = @"..."; self.contentField.text = @"...";
@ -119,7 +126,6 @@
- (IBAction)didChangeContentType:(UISegmentedControl *)sender { - (IBAction)didChangeContentType:(UISegmentedControl *)sender {
self.activeElement.contentType = self.contentType.selectedSegmentIndex;
[self updateAnimated:YES]; [self updateAnimated:YES];
} }
@ -129,6 +135,9 @@
forPasteboardType:self.activeElement.contentUTI]; forPasteboardType:self.activeElement.contentUTI];
} }
- (IBAction)didIncrementPasswordCounter {
}
- (void)didSelectType:(OPElementType)type { - (void)didSelectType:(OPElementType)type {
self.activeElement.type = type; self.activeElement.type = type;
@ -150,9 +159,4 @@
[self updateAnimated:YES]; [self updateAnimated:YES];
} }
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
return NO;
}
@end @end

View File

@ -11,6 +11,9 @@
NSString *NSStringFromOPElementType(OPElementType type) { NSString *NSStringFromOPElementType(OPElementType type) {
if (!type)
return nil;
switch (type) { switch (type) {
case OPElementTypeCalculatedLong: case OPElementTypeCalculatedLong:
return @"Long"; return @"Long";

View File

@ -44,8 +44,6 @@
<string>1.0</string> <string>1.0</string>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
<true/> <true/>
<key>UIApplicationExitsOnSuspend</key>
<true/>
<key>UIMainStoryboardFile</key> <key>UIMainStoryboardFile</key>
<string>MainStoryboard_iPhone</string> <string>MainStoryboard_iPhone</string>
<key>UIMainStoryboardFile~ipad</key> <key>UIMainStoryboardFile~ipad</key>

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 972 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 953 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 941 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 936 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 781 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 905 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1013 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 667 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 971 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1013 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 776 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 732 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 928 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 926 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 775 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Some files were not shown because too many files have changed in this diff Show More