diff --git a/External/Pearl b/External/Pearl index e9b731dc..1a1ab801 160000 --- a/External/Pearl +++ b/External/Pearl @@ -1 +1 @@ -Subproject commit e9b731dca83d62a1b5bf49d24d1a981349b5cdc8 +Subproject commit 1a1ab801f1dbfe7266f1db6ad4359e85ed3c0eb4 diff --git a/MasterPassword/ObjC/MPTypes.h b/MasterPassword/ObjC/MPTypes.h index 903d062f..2b887694 100644 --- a/MasterPassword/ObjC/MPTypes.h +++ b/MasterPassword/ObjC/MPTypes.h @@ -68,6 +68,7 @@ typedef enum { #define MPCheckpointApps @"MPCheckpointApps" #define MPCheckpointApp @"MPCheckpointApp" #define MPCheckpointEmergencyGenerator @"MPCheckpointEmergencyGenerator" +#define MPCheckpointLogs @"MPCheckpointLogs" #define MPSignedInNotification @"MPSignedInNotification" #define MPSignedOutNotification @"MPSignedOutNotification" diff --git a/MasterPassword/ObjC/iOS/MPLogsViewController.h b/MasterPassword/ObjC/iOS/MPLogsViewController.h new file mode 100644 index 00000000..6ae69efb --- /dev/null +++ b/MasterPassword/ObjC/iOS/MPLogsViewController.h @@ -0,0 +1,29 @@ +/** + * 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 + */ + +// +// MPLogsViewController.h +// MPLogsViewController +// +// Created by lhunath on 2013-04-29. +// Copyright, lhunath (Maarten Billemont) 2013. All rights reserved. +// + +#import +#import + +@interface MPLogsViewController : UIViewController +@property (weak, nonatomic) IBOutlet UITextView *logView; +@property (weak, nonatomic) IBOutlet UISegmentedControl *levelControl; +- (IBAction)toggleLevelControl:(UISegmentedControl *)sender; +- (IBAction)close:(UIBarButtonItem *)sender; +- (IBAction)refresh:(UIBarButtonItem *)sender; +- (IBAction)mail:(UIBarButtonItem *)sender; +@end diff --git a/MasterPassword/ObjC/iOS/MPLogsViewController.m b/MasterPassword/ObjC/iOS/MPLogsViewController.m new file mode 100644 index 00000000..37e2513b --- /dev/null +++ b/MasterPassword/ObjC/iOS/MPLogsViewController.m @@ -0,0 +1,77 @@ +/** + * 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 + */ + +// +// MPLogsViewController.h +// MPLogsViewController +// +// Created by lhunath on 2013-04-29. +// Copyright, lhunath (Maarten Billemont) 2013. All rights reserved. +// + +#import "MPLogsViewController.h" +#import "MPiOSAppDelegate.h" + +@implementation MPLogsViewController + +- (void)viewDidLoad { + + [super viewDidLoad]; + + [[NSNotificationCenter defaultCenter] addObserverForName:NSUserDefaultsDidChangeNotification object:nil queue:nil usingBlock: + ^(NSNotification *note) { + self.levelControl.selectedSegmentIndex = [[MPiOSConfig get].traceMode boolValue]? 1: 0; + }]; +} + +- (void)viewWillAppear:(BOOL)animated { + + [super viewWillAppear:animated]; + + [self refresh:nil]; + + self.levelControl.selectedSegmentIndex = [[MPiOSConfig get].traceMode boolValue]? 1: 0; +} + +- (IBAction)toggleLevelControl:(UISegmentedControl *)sender { + + BOOL traceEnabled = (BOOL)self.levelControl.selectedSegmentIndex; + if (traceEnabled) { + [PearlAlert showAlertWithTitle:@"Enable Trace Mode?" message: + @"Trace mode will log the internal operation of the application.\n" + @"Unless you're looking for the cause of a problem, you should leave this off to save memory." + viewStyle:UIAlertViewStyleDefault initAlert:nil + tappedButtonBlock:^(UIAlertView *alert, NSInteger buttonIndex) { + if (buttonIndex == [alert cancelButtonIndex]) + return; + + [MPiOSConfig get].traceMode = @YES; + } cancelTitle:[PearlStrings get].commonButtonCancel otherTitles:@"Enable Trace", nil]; + } + else + [MPiOSConfig get].traceMode = @NO; +} + +- (IBAction)close:(UIBarButtonItem *)sender { + + [self.navigationController popViewControllerAnimated:YES]; +} + +- (IBAction)refresh:(UIBarButtonItem *)sender { + + self.logView.text = [[PearlLogger get] formatMessagesWithLevel:PearlLogLevelTrace]; +} + +- (IBAction)mail:(UIBarButtonItem *)sender { + + [[MPiOSAppDelegate get] openFeedbackWithLogs:YES forVC:self]; +} + +@end diff --git a/MasterPassword/ObjC/iOS/MPPreferencesViewController.m b/MasterPassword/ObjC/iOS/MPPreferencesViewController.m index ccd2b116..4e58cbb3 100644 --- a/MasterPassword/ObjC/iOS/MPPreferencesViewController.m +++ b/MasterPassword/ObjC/iOS/MPPreferencesViewController.m @@ -89,6 +89,21 @@ [super viewWillDisappear:animated]; } +- (BOOL)canBecomeFirstResponder { + + return YES; +} + +- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event { + + if (motion == UIEventSubtypeMotionShake) { + MPCheckpoint( MPCheckpointLogs, @{ + @"trace": [MPiOSConfig get].traceMode + } ); + [self performSegueWithIdentifier:@"MP_Logs" sender:self]; + } +} + - (BOOL)shouldAutorotate { return NO; diff --git a/MasterPassword/ObjC/iOS/MPUnlockViewController.m b/MasterPassword/ObjC/iOS/MPUnlockViewController.m index 1b8911c5..1831c705 100644 --- a/MasterPassword/ObjC/iOS/MPUnlockViewController.m +++ b/MasterPassword/ObjC/iOS/MPUnlockViewController.m @@ -116,7 +116,8 @@ - (void)viewDidLoad { - [self.newsView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.masterpasswordapp.com/news.html"]]]; + [self.newsView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString: + PearlString(@"http://www.masterpasswordapp.com/news.html?version=%@", [[PearlInfoPlist get] CFBundleVersion])]]]; self.avatarToUserOID = [NSMutableDictionary dictionaryWithCapacity:3]; diff --git a/MasterPassword/ObjC/iOS/MPiOSAppDelegate.h b/MasterPassword/ObjC/iOS/MPiOSAppDelegate.h index 785eeb38..3aef4d23 100644 --- a/MasterPassword/ObjC/iOS/MPiOSAppDelegate.h +++ b/MasterPassword/ObjC/iOS/MPiOSAppDelegate.h @@ -17,8 +17,9 @@ - (void)showGuide; - (void)showSetup; - (void)showFeedbackWithLogs:(BOOL)logs forVC:(UIViewController *)viewController; +- (void)openFeedbackWithLogs:(BOOL)logs forVC:(UIViewController *)viewController; -- (void)export; + - (void)export; - (void)changeMasterPasswordFor:(MPUserEntity *)user inContext:(NSManagedObjectContext *)moc didResetBlock:(void (^)(void))didReset; @end diff --git a/MasterPassword/ObjC/iOS/MPiOSAppDelegate.m b/MasterPassword/ObjC/iOS/MPiOSAppDelegate.m index 649b3196..f4b79ada 100644 --- a/MasterPassword/ObjC/iOS/MPiOSAppDelegate.m +++ b/MasterPassword/ObjC/iOS/MPiOSAppDelegate.m @@ -17,7 +17,7 @@ + (void)initialize { [MPiOSConfig get]; - + [PearlLogger get].historyLevel = [[MPiOSConfig get].traceMode boolValue]? PearlLogLevelTrace: PearlLogLevelInfo; #ifdef DEBUG [PearlLogger get].printLevel = PearlLogLevelDebug; //[NSClassFromString(@"WebView") performSelector:NSSelectorFromString(@"_enableRemoteInspector")]; @@ -434,11 +434,6 @@ MPCheckpoint( MPCheckpointShowSetup, nil ); } -- (void)showFeedback { - - [self showFeedbackWithLogs:NO forVC:nil]; -} - - (void)showReview { MPCheckpoint( MPCheckpointReview, nil ); @@ -476,6 +471,8 @@ NSString *userName = [[MPiOSAppDelegate get] activeUserForThread].name; PearlLogLevel logLevel = [[MPiOSConfig get].sendInfo boolValue]? PearlLogLevelDebug: PearlLogLevelInfo; + if ([[MPiOSConfig get].traceMode boolValue]) + logLevel = PearlLogLevelTrace; [[[PearlEMail alloc] initForEMailTo:@"Master Password Development " subject:PearlString( @"Feedback for Master Password [%@]", @@ -603,6 +600,11 @@ - (void)didUpdateConfigForKey:(SEL)configKey fromValue:(id)value { + if (configKey == @selector(traceMode)) { + [PearlLogger get].historyLevel = [[MPiOSConfig get].traceMode boolValue]? PearlLogLevelTrace: PearlLogLevelInfo; + inf(@"Trace is now: %@", [[MPiOSConfig get].traceMode boolValue]? @"ON": @"OFF"); + } + [[NSNotificationCenter defaultCenter] postNotificationName:MPCheckConfigNotification object:NSStringFromSelector( configKey ) userInfo:nil]; } diff --git a/MasterPassword/ObjC/iOS/MPiOSConfig.h b/MasterPassword/ObjC/iOS/MPiOSConfig.h index 03597263..37522d43 100644 --- a/MasterPassword/ObjC/iOS/MPiOSConfig.h +++ b/MasterPassword/ObjC/iOS/MPiOSConfig.h @@ -16,5 +16,6 @@ @property(nonatomic, retain) NSNumber *actionsTipShown; @property(nonatomic, retain) NSNumber *typeTipShown; @property(nonatomic, retain) NSNumber *loginNameTipShown; +@property(nonatomic, retain) NSNumber *traceMode; @end diff --git a/MasterPassword/ObjC/iOS/MPiOSConfig.m b/MasterPassword/ObjC/iOS/MPiOSConfig.m index 847bfc40..8bf099fd 100644 --- a/MasterPassword/ObjC/iOS/MPiOSConfig.m +++ b/MasterPassword/ObjC/iOS/MPiOSConfig.m @@ -8,7 +8,7 @@ @implementation MPiOSConfig -@dynamic sendInfo, helpHidden, siteInfoHidden, showSetup, actionsTipShown, typeTipShown, loginNameTipShown; +@dynamic helpHidden, siteInfoHidden, showSetup, actionsTipShown, typeTipShown, loginNameTipShown, traceMode; - (id)init { @@ -20,9 +20,10 @@ NSStringFromSelector( @selector(siteInfoHidden) ) : @YES, NSStringFromSelector( @selector(showSetup) ) : @YES, NSStringFromSelector( @selector(iTunesID) ) : @"510296984", - NSStringFromSelector( @selector(actionsTipShown) ) : PearlBoolNot(self.firstRun), - NSStringFromSelector( @selector(typeTipShown) ) : PearlBoolNot(self.firstRun), - NSStringFromSelector( @selector(loginNameTipShown) ) : PearlBool(NO) + NSStringFromSelector( @selector(actionsTipShown) ) : @(!self.firstRun), + NSStringFromSelector( @selector(typeTipShown) ) : @(!self.firstRun), + NSStringFromSelector( @selector(loginNameTipShown) ) : @NO, + NSStringFromSelector( @selector(traceMode) ) : @NO }]; return self; diff --git a/MasterPassword/ObjC/iOS/MainStoryboard_iPhone.storyboard b/MasterPassword/ObjC/iOS/MainStoryboard_iPhone.storyboard index cdfd911a..2d1d3879 100644 --- a/MasterPassword/ObjC/iOS/MainStoryboard_iPhone.storyboard +++ b/MasterPassword/ObjC/iOS/MainStoryboard_iPhone.storyboard @@ -476,6 +476,99 @@ Your passwords will be AES-encrypted with your master password. + + + + + + + + + + + + + + + + + 119-20:51:52 MPiOSAppDelegate.m:36 | INFO : Initializing TestFlight +119-20:51:52 MPiOSAppDelegate.m:70 | INFO : Initializing Google+ +119-20:51:52 MPiOSAppDelegate.m:80 | INFO : Initializing Crashlytics +119-20:51:52 MPiOSAppDelegate.m:109 | INFO : Initializing Localytics +119-20:51:53 PearlAppDelegate.m:71 | INFO : Master Password (MasterPassword) 1.4 (1.4.0) (GIT: 1.4-0-g8a4eecd-dirty) +119-20:51:53 MPiOSAppDelegate.m:257 | INFO : Started up with device identifier: A8C51CDA-6F60-4F0C-BFC9-68A08F2F2DD7 +119-20:51:59 MPAppDelegate_Store.m:278 | DEBUG : [StoreManager] (Re)loading store... +119-20:51:59 MPAppDelegate_Store.m:278 | DEBUG : [StoreManager] Will load cloud store: 0B3CA2DF-5796-44DF-B5E0-121EC3846464 (definite). +119-20:51:59 PearlConfig.m:193 | INFO : Lock screen will appear +119-20:51:59 MPiOSAppDelegate.m:412 | INFO : Re-activated +119-20:51:59 PearlConfig.m:180 | DEBUG : MPiOSConfig.launchCount = [70 ->] 71 +119-20:52:02 MPAppDelegate_Store.m:278 | DEBUG : [StoreManager] Clearing stores... +119-20:52:03 MPAppDelegate_Store.m:278 | DEBUG : [StoreManager] Loading store without seeding. +119-20:52:09 MPAppDelegate_Store.m:278 | DEBUG : [StoreManager] Cloud enabled and successfully loaded cloud store. +119-20:52:09 MPAppDelegate_Store.m:299 | INFO : Using iCloud? 1 +119-20:52:12 MPAppDelegate_Key.m:28 | INFO : Found key in keychain for: b55911588b178466be1d6392597e899b8de46f9a +119-20:52:12 MPAppDelegate_Key.m:132 | INFO : Logged in: b55911588b178466be1d6392597e899b8de46f9a +119-20:52:13 MPUnlockViewController.m:229 | INFO : Lock screen will disappear +119-20:52:13 MPMainViewController.m:142 | INFO : Main will appear +119-20:52:16 MPMainViewController.m:734 | INFO : Action: Preferences +119-20:52:17 MPMainViewController.m:187 | INFO : Main will disappear. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2172,6 +2265,7 @@ If you set a custom password, it will be encrypted before it is saved to the clo + @@ -2869,7 +2963,6 @@ However, it means that anyone who finds your device unlocked can do the same. - @@ -2885,7 +2978,17 @@ However, it means that anyone who finds your device unlocked can do the same. - + + + + + + + + + + + diff --git a/MasterPassword/ObjC/iOS/MasterPassword-iOS.xcodeproj/project.pbxproj b/MasterPassword/ObjC/iOS/MasterPassword-iOS.xcodeproj/project.pbxproj index 401743a9..cb5cb7ad 100644 --- a/MasterPassword/ObjC/iOS/MasterPassword-iOS.xcodeproj/project.pbxproj +++ b/MasterPassword/ObjC/iOS/MasterPassword-iOS.xcodeproj/project.pbxproj @@ -16,10 +16,12 @@ 93D396BA1C74C4A06FD86437 /* PearlOverlay.h in Headers */ = {isa = PBXBuildFile; fileRef = 93D3942A356B639724157982 /* PearlOverlay.h */; }; 93D3992FA1546E01F498F665 /* PearlNavigationController.h in Headers */ = {isa = PBXBuildFile; fileRef = 93D398567FD02DB2647B8CF3 /* PearlNavigationController.h */; }; 93D399433EA75E50656040CB /* Twitter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 93D394077F8FAB8167647187 /* Twitter.framework */; }; + 93D399BBC0A7EC746CB1B19B /* MPLogsViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 93D391943675426839501BB8 /* MPLogsViewController.h */; }; 93D39C34FE35830EF5BE1D2A /* NSArray+Indexing.h in Headers */ = {isa = PBXBuildFile; fileRef = 93D396D04E57792A54D437AC /* NSArray+Indexing.h */; }; 93D39E281E3658B30550CB55 /* NSDictionary+Indexing.m in Sources */ = {isa = PBXBuildFile; fileRef = 93D39AA1EE2E1E7B81372240 /* NSDictionary+Indexing.m */; }; 93D39F8A9254177891F38705 /* MPSetupViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 93D39A28369954D147E239BA /* MPSetupViewController.m */; }; DA04E33E14B1E70400ECA4F3 /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA04E33D14B1E70400ECA4F3 /* MobileCoreServices.framework */; }; + DA095E75172F4CD8001C948B /* MPLogsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 93D3979190DACEBD1F6AE9F4 /* MPLogsViewController.m */; }; DA30E9CE15722ECA00A68B4C /* NSBundle+PearlMutableInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = DA30E9CB15722ECA00A68B4C /* NSBundle+PearlMutableInfo.h */; }; DA30E9CF15722ECA00A68B4C /* NSBundle+PearlMutableInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = DA30E9CC15722ECA00A68B4C /* NSBundle+PearlMutableInfo.m */; }; DA30E9D015722ECA00A68B4C /* Pearl.m in Sources */ = {isa = PBXBuildFile; fileRef = DA30E9CD15722ECA00A68B4C /* Pearl.m */; }; @@ -968,6 +970,7 @@ /* Begin PBXFileReference section */ 93D39067C0AFDC581794E2B8 /* NSArray+Indexing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSArray+Indexing.m"; sourceTree = ""; }; 93D390FADEB325D8D54A957D /* PearlOverlay.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PearlOverlay.m; sourceTree = ""; }; + 93D391943675426839501BB8 /* MPLogsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPLogsViewController.h; sourceTree = ""; }; 93D393B97158D7BE9332EA53 /* NSDictionary+Indexing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+Indexing.h"; sourceTree = ""; }; 93D393BB973253D4BAAC84AA /* PearlEMail.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PearlEMail.m; sourceTree = ""; }; 93D394077F8FAB8167647187 /* Twitter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Twitter.framework; path = System/Library/Frameworks/Twitter.framework; sourceTree = SDKROOT; }; @@ -975,6 +978,7 @@ 93D3956915634581E737B38C /* PearlNavigationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PearlNavigationController.m; sourceTree = ""; }; 93D396D04E57792A54D437AC /* NSArray+Indexing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSArray+Indexing.h"; sourceTree = ""; }; 93D39730673227EFF6DEFF19 /* MPSetupViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPSetupViewController.h; sourceTree = ""; }; + 93D3979190DACEBD1F6AE9F4 /* MPLogsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPLogsViewController.m; sourceTree = ""; }; 93D398567FD02DB2647B8CF3 /* PearlNavigationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PearlNavigationController.h; sourceTree = ""; }; 93D39A28369954D147E239BA /* MPSetupViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPSetupViewController.m; sourceTree = ""; }; 93D39AA1EE2E1E7B81372240 /* NSDictionary+Indexing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDictionary+Indexing.m"; sourceTree = ""; }; @@ -3007,6 +3011,8 @@ DABD3BFC1711E2DC00CF925C /* main.m */, 93D39A28369954D147E239BA /* MPSetupViewController.m */, 93D39730673227EFF6DEFF19 /* MPSetupViewController.h */, + 93D3979190DACEBD1F6AE9F4 /* MPLogsViewController.m */, + 93D391943675426839501BB8 /* MPLogsViewController.h */, ); path = iOS; sourceTree = ""; @@ -3523,6 +3529,7 @@ files = ( DACA22BC1705DE7D002C6C22 /* NSError+UbiquityStoreManager.h in Headers */, DACA22BE1705DE7D002C6C22 /* UbiquityStoreManager.h in Headers */, + 93D399BBC0A7EC746CB1B19B /* MPLogsViewController.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -4771,6 +4778,7 @@ DABD3C211711E2DC00CF925C /* MPiOSConfig.m in Sources */, DABD3C271711E2DC00CF925C /* main.m in Sources */, 93D39F8A9254177891F38705 /* MPSetupViewController.m in Sources */, + DA095E75172F4CD8001C948B /* MPLogsViewController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -5631,6 +5639,7 @@ DAFC5661172C573B00CB5CC5 /* AppStore-iOS */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = "AdHoc-iOS"; }; /* End XCConfigurationList section */