Mac OS X build fixes of shared code from iOS.
[FIXED]     Build problems with code shared from the iOS project in the
            Mac project.
			
			
This commit is contained in:
		@@ -9,6 +9,8 @@
 | 
			
		||||
/* Begin PBXBuildFile section */
 | 
			
		||||
		DA600BEB150420AC008E9AB6 /* MPPasswordWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = DA600BE9150420AC008E9AB6 /* MPPasswordWindowController.m */; };
 | 
			
		||||
		DA600BEC150420AC008E9AB6 /* MPPasswordWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = DA600BEA150420AC008E9AB6 /* MPPasswordWindowController.xib */; };
 | 
			
		||||
		DA600C2D150565FC008E9AB6 /* MPConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = DA600C2A150565FC008E9AB6 /* MPConfig.m */; };
 | 
			
		||||
		DA600C2E150565FC008E9AB6 /* MPAppDelegate_Key.m in Sources */ = {isa = PBXBuildFile; fileRef = DA600C2B150565FC008E9AB6 /* MPAppDelegate_Key.m */; };
 | 
			
		||||
		DAB8D98D150374AD00CED3BC /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DAB8D98C150374AD00CED3BC /* Cocoa.framework */; };
 | 
			
		||||
		DAB8D9C8150375C800CED3BC /* MasterPassword.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = DAB8D9B2150375C800CED3BC /* MasterPassword.xcdatamodeld */; };
 | 
			
		||||
		DAB8D9C9150375C800CED3BC /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = DAB8D9B5150375C800CED3BC /* Credits.rtf */; };
 | 
			
		||||
@@ -773,6 +775,10 @@
 | 
			
		||||
		DA600BE8150420AC008E9AB6 /* MPPasswordWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPPasswordWindowController.h; sourceTree = "<group>"; };
 | 
			
		||||
		DA600BE9150420AC008E9AB6 /* MPPasswordWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPPasswordWindowController.m; sourceTree = "<group>"; };
 | 
			
		||||
		DA600BEA150420AC008E9AB6 /* MPPasswordWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MPPasswordWindowController.xib; sourceTree = "<group>"; };
 | 
			
		||||
		DA600C29150565FC008E9AB6 /* MPConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MPConfig.h; path = MasterPassword/MPConfig.h; sourceTree = SOURCE_ROOT; };
 | 
			
		||||
		DA600C2A150565FC008E9AB6 /* MPConfig.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MPConfig.m; path = MasterPassword/MPConfig.m; sourceTree = SOURCE_ROOT; };
 | 
			
		||||
		DA600C2B150565FC008E9AB6 /* MPAppDelegate_Key.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MPAppDelegate_Key.m; path = MasterPassword/MPAppDelegate_Key.m; sourceTree = SOURCE_ROOT; };
 | 
			
		||||
		DA600C2C150565FC008E9AB6 /* MPAppDelegate_Key.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MPAppDelegate_Key.h; path = MasterPassword/MPAppDelegate_Key.h; sourceTree = SOURCE_ROOT; };
 | 
			
		||||
		DAB8D988150374AD00CED3BC /* MasterPassword.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MasterPassword.app; sourceTree = BUILT_PRODUCTS_DIR; };
 | 
			
		||||
		DAB8D98C150374AD00CED3BC /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
 | 
			
		||||
		DAB8D98F150374AD00CED3BC /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
 | 
			
		||||
@@ -2013,6 +2019,10 @@
 | 
			
		||||
			children = (
 | 
			
		||||
				DAB8D9B2150375C800CED3BC /* MasterPassword.xcdatamodeld */,
 | 
			
		||||
				DAB8D9B4150375C800CED3BC /* Mac */,
 | 
			
		||||
				DA600C2B150565FC008E9AB6 /* MPAppDelegate_Key.m */,
 | 
			
		||||
				DA600C2C150565FC008E9AB6 /* MPAppDelegate_Key.h */,
 | 
			
		||||
				DA600C29150565FC008E9AB6 /* MPConfig.h */,
 | 
			
		||||
				DA600C2A150565FC008E9AB6 /* MPConfig.m */,
 | 
			
		||||
				DAB8D9C0150375C800CED3BC /* MPElementStoredEntity.m */,
 | 
			
		||||
				DAB8D9C1150375C800CED3BC /* MPTypes.m */,
 | 
			
		||||
				DAB8D9C2150375C800CED3BC /* MPElementEntity.h */,
 | 
			
		||||
@@ -4163,6 +4173,8 @@
 | 
			
		||||
				DAB8D9D1150375C800CED3BC /* MPElementEntity.m in Sources */,
 | 
			
		||||
				DAB8D9D2150375C800CED3BC /* MPElementGeneratedEntity.m in Sources */,
 | 
			
		||||
				DA600BEB150420AC008E9AB6 /* MPPasswordWindowController.m in Sources */,
 | 
			
		||||
				DA600C2D150565FC008E9AB6 /* MPConfig.m in Sources */,
 | 
			
		||||
				DA600C2E150565FC008E9AB6 /* MPAppDelegate_Key.m in Sources */,
 | 
			
		||||
			);
 | 
			
		||||
			runOnlyForDeploymentPostprocessing = 0;
 | 
			
		||||
		};
 | 
			
		||||
 
 | 
			
		||||
@@ -3824,6 +3824,7 @@
 | 
			
		||||
				GCC_DYNAMIC_NO_PIC = NO;
 | 
			
		||||
				GCC_OPTIMIZATION_LEVEL = 0;
 | 
			
		||||
				GCC_PREPROCESSOR_DEFINITIONS = (
 | 
			
		||||
					"TESTFLIGHT=1",
 | 
			
		||||
					"DEBUG=1",
 | 
			
		||||
					"$(inherited)",
 | 
			
		||||
				);
 | 
			
		||||
@@ -3847,6 +3848,10 @@
 | 
			
		||||
				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
 | 
			
		||||
				COPY_PHASE_STRIP = NO;
 | 
			
		||||
				GCC_C_LANGUAGE_STANDARD = gnu99;
 | 
			
		||||
				GCC_PREPROCESSOR_DEFINITIONS = (
 | 
			
		||||
					"TESTFLIGHT=1",
 | 
			
		||||
					"$(inherited)",
 | 
			
		||||
				);
 | 
			
		||||
				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
 | 
			
		||||
				GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
 | 
			
		||||
				GCC_WARN_ABOUT_RETURN_TYPE = YES;
 | 
			
		||||
@@ -3917,7 +3922,7 @@
 | 
			
		||||
			};
 | 
			
		||||
			name = Release;
 | 
			
		||||
		};
 | 
			
		||||
		DA95D60914DF3F3B008D1B94 /* Production */ = {
 | 
			
		||||
		DA95D60914DF3F3B008D1B94 /* AppStore */ = {
 | 
			
		||||
			isa = XCBuildConfiguration;
 | 
			
		||||
			buildSettings = {
 | 
			
		||||
				ALWAYS_SEARCH_USER_PATHS = NO;
 | 
			
		||||
@@ -3925,7 +3930,10 @@
 | 
			
		||||
				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
 | 
			
		||||
				COPY_PHASE_STRIP = NO;
 | 
			
		||||
				GCC_C_LANGUAGE_STANDARD = gnu99;
 | 
			
		||||
				GCC_PREPROCESSOR_DEFINITIONS = "PRODUCTION=1";
 | 
			
		||||
				GCC_PREPROCESSOR_DEFINITIONS = (
 | 
			
		||||
					"APPSTORE=1",
 | 
			
		||||
					"$(inherited)",
 | 
			
		||||
				);
 | 
			
		||||
				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
 | 
			
		||||
				GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
 | 
			
		||||
				GCC_WARN_ABOUT_RETURN_TYPE = YES;
 | 
			
		||||
@@ -3938,9 +3946,9 @@
 | 
			
		||||
				TARGETED_DEVICE_FAMILY = "1,2";
 | 
			
		||||
				VALIDATE_PRODUCT = YES;
 | 
			
		||||
			};
 | 
			
		||||
			name = Production;
 | 
			
		||||
			name = AppStore;
 | 
			
		||||
		};
 | 
			
		||||
		DA95D60A14DF3F3B008D1B94 /* Production */ = {
 | 
			
		||||
		DA95D60A14DF3F3B008D1B94 /* AppStore */ = {
 | 
			
		||||
			isa = XCBuildConfiguration;
 | 
			
		||||
			buildSettings = {
 | 
			
		||||
				CLANG_ENABLE_OBJC_ARC = YES;
 | 
			
		||||
@@ -3956,9 +3964,9 @@
 | 
			
		||||
				PRODUCT_NAME = "$(TARGET_NAME)";
 | 
			
		||||
				WRAPPER_EXTENSION = app;
 | 
			
		||||
			};
 | 
			
		||||
			name = Production;
 | 
			
		||||
			name = AppStore;
 | 
			
		||||
		};
 | 
			
		||||
		DA95D60B14DF3F3B008D1B94 /* Production */ = {
 | 
			
		||||
		DA95D60B14DF3F3B008D1B94 /* AppStore */ = {
 | 
			
		||||
			isa = XCBuildConfiguration;
 | 
			
		||||
			buildSettings = {
 | 
			
		||||
				CLANG_ENABLE_OBJC_ARC = NO;
 | 
			
		||||
@@ -3970,9 +3978,9 @@
 | 
			
		||||
				PRODUCT_NAME = "$(TARGET_NAME)";
 | 
			
		||||
				SKIP_INSTALL = YES;
 | 
			
		||||
			};
 | 
			
		||||
			name = Production;
 | 
			
		||||
			name = AppStore;
 | 
			
		||||
		};
 | 
			
		||||
		DA95D60C14DF3F3B008D1B94 /* Production */ = {
 | 
			
		||||
		DA95D60C14DF3F3B008D1B94 /* AppStore */ = {
 | 
			
		||||
			isa = XCBuildConfiguration;
 | 
			
		||||
			buildSettings = {
 | 
			
		||||
				CLANG_ENABLE_OBJC_ARC = NO;
 | 
			
		||||
@@ -3982,9 +3990,9 @@
 | 
			
		||||
				PRODUCT_NAME = "$(TARGET_NAME)";
 | 
			
		||||
				SKIP_INSTALL = YES;
 | 
			
		||||
			};
 | 
			
		||||
			name = Production;
 | 
			
		||||
			name = AppStore;
 | 
			
		||||
		};
 | 
			
		||||
		DA95D60D14DF3F3B008D1B94 /* Production */ = {
 | 
			
		||||
		DA95D60D14DF3F3B008D1B94 /* AppStore */ = {
 | 
			
		||||
			isa = XCBuildConfiguration;
 | 
			
		||||
			buildSettings = {
 | 
			
		||||
				CLANG_ENABLE_OBJC_ARC = NO;
 | 
			
		||||
@@ -3994,9 +4002,9 @@
 | 
			
		||||
				PRODUCT_NAME = "$(TARGET_NAME)";
 | 
			
		||||
				SKIP_INSTALL = YES;
 | 
			
		||||
			};
 | 
			
		||||
			name = Production;
 | 
			
		||||
			name = AppStore;
 | 
			
		||||
		};
 | 
			
		||||
		DA95D60E14DF3F3B008D1B94 /* Production */ = {
 | 
			
		||||
		DA95D60E14DF3F3B008D1B94 /* AppStore */ = {
 | 
			
		||||
			isa = XCBuildConfiguration;
 | 
			
		||||
			buildSettings = {
 | 
			
		||||
				DSTROOT = /tmp/InAppSettingsKit.dst;
 | 
			
		||||
@@ -4004,7 +4012,7 @@
 | 
			
		||||
				PRODUCT_NAME = InAppSettingsKit;
 | 
			
		||||
				SKIP_INSTALL = YES;
 | 
			
		||||
			};
 | 
			
		||||
			name = Production;
 | 
			
		||||
			name = AppStore;
 | 
			
		||||
		};
 | 
			
		||||
		DAC632661486805C0075AEA5 /* Debug */ = {
 | 
			
		||||
			isa = XCBuildConfiguration;
 | 
			
		||||
@@ -4090,7 +4098,7 @@
 | 
			
		||||
			buildConfigurations = (
 | 
			
		||||
				DA5BFA6B147E415C00F98B1E /* Debug */,
 | 
			
		||||
				DA5BFA6C147E415C00F98B1E /* Release */,
 | 
			
		||||
				DA95D60914DF3F3B008D1B94 /* Production */,
 | 
			
		||||
				DA95D60914DF3F3B008D1B94 /* AppStore */,
 | 
			
		||||
			);
 | 
			
		||||
			defaultConfigurationIsVisible = 0;
 | 
			
		||||
			defaultConfigurationName = Release;
 | 
			
		||||
@@ -4100,7 +4108,7 @@
 | 
			
		||||
			buildConfigurations = (
 | 
			
		||||
				DA5BFA6E147E415C00F98B1E /* Debug */,
 | 
			
		||||
				DA5BFA6F147E415C00F98B1E /* Release */,
 | 
			
		||||
				DA95D60A14DF3F3B008D1B94 /* Production */,
 | 
			
		||||
				DA95D60A14DF3F3B008D1B94 /* AppStore */,
 | 
			
		||||
			);
 | 
			
		||||
			defaultConfigurationIsVisible = 0;
 | 
			
		||||
			defaultConfigurationName = Release;
 | 
			
		||||
@@ -4110,7 +4118,7 @@
 | 
			
		||||
			buildConfigurations = (
 | 
			
		||||
				DA95D5A514DF063C008D1B94 /* Debug */,
 | 
			
		||||
				DA95D5A614DF063C008D1B94 /* Release */,
 | 
			
		||||
				DA95D60E14DF3F3B008D1B94 /* Production */,
 | 
			
		||||
				DA95D60E14DF3F3B008D1B94 /* AppStore */,
 | 
			
		||||
			);
 | 
			
		||||
			defaultConfigurationIsVisible = 0;
 | 
			
		||||
			defaultConfigurationName = Release;
 | 
			
		||||
@@ -4120,7 +4128,7 @@
 | 
			
		||||
			buildConfigurations = (
 | 
			
		||||
				DAC632661486805C0075AEA5 /* Debug */,
 | 
			
		||||
				DAC632671486805C0075AEA5 /* Release */,
 | 
			
		||||
				DA95D60C14DF3F3B008D1B94 /* Production */,
 | 
			
		||||
				DA95D60C14DF3F3B008D1B94 /* AppStore */,
 | 
			
		||||
			);
 | 
			
		||||
			defaultConfigurationIsVisible = 0;
 | 
			
		||||
			defaultConfigurationName = Release;
 | 
			
		||||
@@ -4130,7 +4138,7 @@
 | 
			
		||||
			buildConfigurations = (
 | 
			
		||||
				DAC63275148680650075AEA5 /* Debug */,
 | 
			
		||||
				DAC63276148680650075AEA5 /* Release */,
 | 
			
		||||
				DA95D60D14DF3F3B008D1B94 /* Production */,
 | 
			
		||||
				DA95D60D14DF3F3B008D1B94 /* AppStore */,
 | 
			
		||||
			);
 | 
			
		||||
			defaultConfigurationIsVisible = 0;
 | 
			
		||||
			defaultConfigurationName = Release;
 | 
			
		||||
@@ -4140,7 +4148,7 @@
 | 
			
		||||
			buildConfigurations = (
 | 
			
		||||
				DAC77CB5148291A600BCF976 /* Debug */,
 | 
			
		||||
				DAC77CB6148291A600BCF976 /* Release */,
 | 
			
		||||
				DA95D60B14DF3F3B008D1B94 /* Production */,
 | 
			
		||||
				DA95D60B14DF3F3B008D1B94 /* AppStore */,
 | 
			
		||||
			);
 | 
			
		||||
			defaultConfigurationIsVisible = 0;
 | 
			
		||||
			defaultConfigurationName = Release;
 | 
			
		||||
 
 | 
			
		||||
@@ -63,14 +63,14 @@
 | 
			
		||||
      shouldUseLaunchSchemeArgsEnv = "YES"
 | 
			
		||||
      savedToolIdentifier = ""
 | 
			
		||||
      useCustomWorkingDirectory = "NO"
 | 
			
		||||
      buildConfiguration = "Release"
 | 
			
		||||
      buildConfiguration = "Production"
 | 
			
		||||
      debugDocumentVersioning = "YES">
 | 
			
		||||
   </ProfileAction>
 | 
			
		||||
   <AnalyzeAction
 | 
			
		||||
      buildConfiguration = "Debug">
 | 
			
		||||
   </AnalyzeAction>
 | 
			
		||||
   <ArchiveAction
 | 
			
		||||
      buildConfiguration = "Release"
 | 
			
		||||
      buildConfiguration = "Production"
 | 
			
		||||
      revealArchiveInOrganizer = "YES">
 | 
			
		||||
   </ArchiveAction>
 | 
			
		||||
</Scheme>
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,6 @@
 | 
			
		||||
//  Copyright (c) 2011 Lyndir. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import <UIKit/UIKit.h>
 | 
			
		||||
#import "MPAppDelegate.h"
 | 
			
		||||
 | 
			
		||||
@interface MPAppDelegate ()
 | 
			
		||||
 
 | 
			
		||||
@@ -6,11 +6,9 @@
 | 
			
		||||
//  Copyright (c) 2011 Lyndir. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import "MPConfig.h"
 | 
			
		||||
#import "MPAppDelegate_Key.h"
 | 
			
		||||
 | 
			
		||||
#import "MPMainViewController.h"
 | 
			
		||||
#import "IASKSettingsReader.h"
 | 
			
		||||
 | 
			
		||||
@implementation MPAppDelegate (Key)
 | 
			
		||||
 | 
			
		||||
static NSDictionary *keyQuery() {
 | 
			
		||||
@@ -44,7 +42,7 @@ static NSDictionary *keyHashQuery() {
 | 
			
		||||
    [PearlKeyChain deleteItemForQuery:keyHashQuery()];
 | 
			
		||||
    
 | 
			
		||||
    [[NSNotificationCenter defaultCenter] postNotificationName:MPNotificationKeyForgotten object:self];
 | 
			
		||||
#ifndef PRODUCTION
 | 
			
		||||
#ifdef TESTFLIGHT
 | 
			
		||||
    [TestFlight passCheckpoint:MPTestFlightCheckpointMPForgotten];
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
@@ -56,7 +54,7 @@ static NSDictionary *keyHashQuery() {
 | 
			
		||||
 | 
			
		||||
- (void)loadStoredKey {
 | 
			
		||||
    
 | 
			
		||||
    if ([[MPiOSConfig get].storeKey boolValue]) {
 | 
			
		||||
    if ([[MPConfig get].storeKey boolValue]) {
 | 
			
		||||
        // Key is stored in keychain.  Load it.
 | 
			
		||||
        dbg(@"Loading key from key chain.");
 | 
			
		||||
        [self updateKey:[PearlKeyChain dataOfItemForQuery:keyQuery()]];
 | 
			
		||||
@@ -65,7 +63,7 @@ static NSDictionary *keyHashQuery() {
 | 
			
		||||
        // Key should not be stored in keychain.  Delete it.
 | 
			
		||||
        dbg(@"Deleting key from key chain.");
 | 
			
		||||
        [PearlKeyChain deleteItemForQuery:keyQuery()];
 | 
			
		||||
#ifndef PRODUCTION
 | 
			
		||||
#ifdef TESTFLIGHT
 | 
			
		||||
        [TestFlight passCheckpoint:MPTestFlightCheckpointMPUnstored];
 | 
			
		||||
#endif
 | 
			
		||||
    }
 | 
			
		||||
@@ -73,7 +71,13 @@ static NSDictionary *keyHashQuery() {
 | 
			
		||||
 | 
			
		||||
+ (MPAppDelegate *)get {
 | 
			
		||||
 | 
			
		||||
    return (MPAppDelegate *)[super get];
 | 
			
		||||
#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED
 | 
			
		||||
    return (MPAppDelegate *)[UIApplication sharedApplication].delegate;
 | 
			
		||||
#elif defined (__MAC_OS_X_VERSION_MIN_REQUIRED)
 | 
			
		||||
    return (MPAppDelegate *)[NSApplication sharedApplication].delegate;
 | 
			
		||||
#else
 | 
			
		||||
#error Unsupported OS.
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
- (BOOL)tryMasterPassword:(NSString *)tryPassword {
 | 
			
		||||
@@ -92,13 +96,13 @@ static NSDictionary *keyHashQuery() {
 | 
			
		||||
        if (![keyHash isEqual:tryKeyHash]) {
 | 
			
		||||
            dbg(@"Key phrase hash mismatch. Expected: %@, answer: %@.", keyHash, tryKeyHash);
 | 
			
		||||
            
 | 
			
		||||
#ifndef PRODUCTION
 | 
			
		||||
#ifdef TESTFLIGHT
 | 
			
		||||
            [TestFlight passCheckpoint:MPTestFlightCheckpointMPMismatch];
 | 
			
		||||
#endif
 | 
			
		||||
            return NO;
 | 
			
		||||
        }
 | 
			
		||||
    
 | 
			
		||||
#ifndef PRODUCTION
 | 
			
		||||
#ifdef TESTFLIGHT
 | 
			
		||||
    [TestFlight passCheckpoint:MPTestFlightCheckpointMPAsked];
 | 
			
		||||
#endif
 | 
			
		||||
    
 | 
			
		||||
@@ -123,18 +127,22 @@ static NSDictionary *keyHashQuery() {
 | 
			
		||||
        [PearlKeyChain addOrUpdateItemForQuery:keyHashQuery()
 | 
			
		||||
                                withAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
 | 
			
		||||
                                                self.keyHash,                                      (__bridge id)kSecValueData,
 | 
			
		||||
#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED
 | 
			
		||||
                                                kSecAttrAccessibleWhenUnlocked,                          (__bridge id)kSecAttrAccessible,
 | 
			
		||||
#endif
 | 
			
		||||
                                                nil]];
 | 
			
		||||
        if ([[MPiOSConfig get].storeKey boolValue]) {
 | 
			
		||||
        if ([[MPConfig get].storeKey boolValue]) {
 | 
			
		||||
            dbg(@"Storing key in key chain.");
 | 
			
		||||
            [PearlKeyChain addOrUpdateItemForQuery:keyQuery()
 | 
			
		||||
                                    withAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
 | 
			
		||||
                                                    key,  (__bridge id)kSecValueData,
 | 
			
		||||
#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED
 | 
			
		||||
                                                    kSecAttrAccessibleWhenUnlocked,                      (__bridge id)kSecAttrAccessible,
 | 
			
		||||
#endif
 | 
			
		||||
                                                    nil]];
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
#ifndef PRODUCTION
 | 
			
		||||
#ifdef TESTFLIGHT
 | 
			
		||||
        [TestFlight passCheckpoint:[NSString stringWithFormat:MPTestFlightCheckpointSetKeyphraseLength, key.length]];
 | 
			
		||||
#endif
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -32,7 +32,7 @@ typedef enum {
 | 
			
		||||
    MPElementTypeStoredDevicePrivate    = MPElementTypeClassStored      | 0x02,
 | 
			
		||||
} MPElementType;
 | 
			
		||||
 | 
			
		||||
#ifndef PRODUCTION
 | 
			
		||||
#ifdef TESTFLIGHT
 | 
			
		||||
#define MPTestFlightCheckpointAction                    @"MPTestFlightCheckpointAction"
 | 
			
		||||
#define MPTestFlightCheckpointHelpChapter               @"MPTestFlightCheckpointHelpChapter_%@"
 | 
			
		||||
#define MPTestFlightCheckpointCopyToPasteboard          @"MPTestFlightCheckpointCopyToPasteboard"
 | 
			
		||||
 
 | 
			
		||||
@@ -17,15 +17,9 @@
 | 
			
		||||
@property (readonly, strong, nonatomic) NSManagedObjectModel            *managedObjectModel;
 | 
			
		||||
@property (readonly, strong, nonatomic) NSManagedObjectContext          *managedObjectContext;
 | 
			
		||||
 | 
			
		||||
@property (readonly, strong, nonatomic) MPPasswordWindowController      *passwordWindow;
 | 
			
		||||
@property (readonly, strong, nonatomic) NSData                          *keyPhrase;
 | 
			
		||||
@property (readonly, strong, nonatomic) NSString                        *keyPhraseHashHex;
 | 
			
		||||
 | 
			
		||||
+ (MPAppDelegate *)get;
 | 
			
		||||
+ (NSManagedObjectModel *)managedObjectModel;
 | 
			
		||||
+ (NSManagedObjectContext *)managedObjectContext;
 | 
			
		||||
 | 
			
		||||
- (IBAction)saveAction:(id)sender;
 | 
			
		||||
- (NSData *)keyPhraseWithLength:(NSUInteger)keyLength;
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@
 | 
			
		||||
//  Copyright (c) 2012 Lyndir. All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import "MPAppDelegate.h"
 | 
			
		||||
#import "MPAppDelegate_Key.h"
 | 
			
		||||
 | 
			
		||||
@interface MPAppDelegate ()
 | 
			
		||||
 | 
			
		||||
@@ -20,12 +20,10 @@
 | 
			
		||||
@synthesize managedObjectModel = __managedObjectModel;
 | 
			
		||||
@synthesize managedObjectContext = __managedObjectContext;
 | 
			
		||||
@synthesize passwordWindow;
 | 
			
		||||
@synthesize keyPhrase;
 | 
			
		||||
 | 
			
		||||
+ (MPAppDelegate *)get {
 | 
			
		||||
    
 | 
			
		||||
    return (MPAppDelegate *)[NSApplication sharedApplication].delegate;
 | 
			
		||||
}
 | 
			
		||||
@synthesize key;
 | 
			
		||||
@synthesize keyHash;
 | 
			
		||||
@synthesize keyHashHex;
 | 
			
		||||
 | 
			
		||||
+ (NSManagedObjectContext *)managedObjectContext {
 | 
			
		||||
    
 | 
			
		||||
@@ -54,11 +52,6 @@
 | 
			
		||||
    return [appSupportURL URLByAppendingPathComponent:@"com.lyndir.lhunath.MasterPassword"];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
- (NSData *)keyPhraseWithLength:(NSUInteger)keyLength {
 | 
			
		||||
    
 | 
			
		||||
    return [self.keyPhrase subdataWithRange:NSMakeRange(0, MIN(keyLength, self.keyPhrase.length))];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#pragma mark - Core Data stack
 | 
			
		||||
 | 
			
		||||
- (NSManagedObjectModel *)managedObjectModel {
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#import "MPPasswordWindowController.h"
 | 
			
		||||
#import "MPAppDelegate.h"
 | 
			
		||||
#import "MPAppDelegate_Key.h"
 | 
			
		||||
 | 
			
		||||
@interface MPPasswordWindowController ()
 | 
			
		||||
 | 
			
		||||
@@ -46,7 +46,7 @@
 | 
			
		||||
                                    fetchRequestFromTemplateWithName:@"MPElements"
 | 
			
		||||
                                    substitutionVariables:[NSDictionary dictionaryWithObjectsAndKeys:
 | 
			
		||||
                                                           query,                                   @"query",
 | 
			
		||||
                                                           [MPAppDelegate get].keyPhraseHashHex,    @"mpHashHex",
 | 
			
		||||
                                                           [MPAppDelegate get].keyHashHex,    @"mpHashHex",
 | 
			
		||||
                                                           nil]];
 | 
			
		||||
 | 
			
		||||
    return [NSArray arrayWithObjects:@"cow", @"milk", @"hippopotamus", nil];
 | 
			
		||||
 
 | 
			
		||||
@@ -40,7 +40,7 @@
 | 
			
		||||
 | 
			
		||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
 | 
			
		||||
    
 | 
			
		||||
#ifndef PRODUCTION
 | 
			
		||||
#ifdef TESTFLIGHT
 | 
			
		||||
    @try {
 | 
			
		||||
        [TestFlight takeOff:@"bd44885deee7adce0645ce8e5498d80a_NDQ5NDQyMDExLTEyLTAyIDExOjM1OjQ4LjQ2NjM4NA"];
 | 
			
		||||
        [TestFlight setOptions:[NSDictionary dictionaryWithObjectsAndKeys:
 | 
			
		||||
@@ -124,7 +124,7 @@
 | 
			
		||||
                                                          [self loadKey:YES];
 | 
			
		||||
                                                  }];
 | 
			
		||||
    
 | 
			
		||||
#ifndef PRODUCTION
 | 
			
		||||
#ifdef TESTFLIGHT
 | 
			
		||||
    [PearlAlert showAlertWithTitle:@"Welcome, tester!" message:
 | 
			
		||||
     @"Thank you for taking the time to test Master Password.\n\n"
 | 
			
		||||
     @"Please provide any feedback, however minor it may seem, via the Feedback action item accessible from the top right.\n\n"
 | 
			
		||||
@@ -149,7 +149,7 @@
 | 
			
		||||
    else
 | 
			
		||||
        [self loadKey:NO];
 | 
			
		||||
    
 | 
			
		||||
#ifndef PRODUCTION
 | 
			
		||||
#ifdef TESTFLIGHT
 | 
			
		||||
    [TestFlight passCheckpoint:MPTestFlightCheckpointActivated];
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
@@ -158,7 +158,7 @@
 | 
			
		||||
    
 | 
			
		||||
    [self.navigationController performSegueWithIdentifier:@"MP_Guide" sender:self];
 | 
			
		||||
    
 | 
			
		||||
#ifndef PRODUCTION
 | 
			
		||||
#ifdef TESTFLIGHT
 | 
			
		||||
    [TestFlight passCheckpoint:MPTestFlightCheckpointShowGuide];
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
@@ -193,7 +193,7 @@
 | 
			
		||||
    if (![[MPiOSConfig get].rememberKey boolValue])
 | 
			
		||||
        [self updateKey:nil];
 | 
			
		||||
    
 | 
			
		||||
#ifndef PRODUCTION
 | 
			
		||||
#ifdef TESTFLIGHT
 | 
			
		||||
    [TestFlight passCheckpoint:MPTestFlightCheckpointDeactivated];
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
@@ -202,7 +202,7 @@
 | 
			
		||||
    
 | 
			
		||||
    [self saveContext];
 | 
			
		||||
    
 | 
			
		||||
#ifndef PRODUCTION
 | 
			
		||||
#ifdef TESTFLIGHT
 | 
			
		||||
    [TestFlight passCheckpoint:MPTestFlightCheckpointTerminated];
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
@@ -298,7 +298,7 @@
 | 
			
		||||
        [[NSFileManager defaultManager] removeItemAtURL:storeURL error:nil];        
 | 
			
		||||
#endif
 | 
			
		||||
        
 | 
			
		||||
#ifndef PRODUCTION
 | 
			
		||||
#ifdef TESTFLIGHT
 | 
			
		||||
        [TestFlight passCheckpoint:MPTestFlightCheckpointStoreIncompatible];
 | 
			
		||||
#endif
 | 
			
		||||
        
 | 
			
		||||
 
 | 
			
		||||
@@ -216,7 +216,7 @@
 | 
			
		||||
 | 
			
		||||
- (void)setHelpChapter:(NSString *)chapter {
 | 
			
		||||
    
 | 
			
		||||
#ifndef PRODUCTION
 | 
			
		||||
#ifdef TESTFLIGHT
 | 
			
		||||
    [TestFlight passCheckpoint:[NSString stringWithFormat:MPTestFlightCheckpointHelpChapter, chapter]];
 | 
			
		||||
#endif
 | 
			
		||||
    
 | 
			
		||||
@@ -280,7 +280,7 @@
 | 
			
		||||
    
 | 
			
		||||
    [self showContentTip:@"Copied!" withIcon:nil];
 | 
			
		||||
    
 | 
			
		||||
#ifndef PRODUCTION
 | 
			
		||||
#ifdef TESTFLIGHT
 | 
			
		||||
    [TestFlight passCheckpoint:MPTestFlightCheckpointCopyToPasteboard];
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
@@ -295,7 +295,7 @@
 | 
			
		||||
        ++((MPElementGeneratedEntity *) self.activeElement).counter;
 | 
			
		||||
    }];
 | 
			
		||||
    
 | 
			
		||||
#ifndef PRODUCTION
 | 
			
		||||
#ifdef TESTFLIGHT
 | 
			
		||||
    [TestFlight passCheckpoint:MPTestFlightCheckpointIncrementPasswordCounter];
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
@@ -323,7 +323,7 @@
 | 
			
		||||
        [self.contentField becomeFirstResponder];
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
#ifndef PRODUCTION
 | 
			
		||||
#ifdef TESTFLIGHT
 | 
			
		||||
    [TestFlight passCheckpoint:MPTestFlightCheckpointEditPassword];
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
@@ -336,7 +336,7 @@
 | 
			
		||||
        self.alertBody.text = nil;
 | 
			
		||||
    }];
 | 
			
		||||
    
 | 
			
		||||
#ifndef PRODUCTION
 | 
			
		||||
#ifdef TESTFLIGHT
 | 
			
		||||
    [TestFlight passCheckpoint:MPTestFlightCheckpointCloseAlert];
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
@@ -365,7 +365,7 @@
 | 
			
		||||
                             [self.navigationController pushViewController:settingsVC animated:YES];
 | 
			
		||||
                             break;
 | 
			
		||||
                         }
 | 
			
		||||
#ifndef PRODUCTION
 | 
			
		||||
#ifdef TESTFLIGHT
 | 
			
		||||
                         case 4:
 | 
			
		||||
                             [TestFlight openFeedbackView];
 | 
			
		||||
                             break;
 | 
			
		||||
@@ -380,13 +380,13 @@
 | 
			
		||||
                         }
 | 
			
		||||
                     }
 | 
			
		||||
                     
 | 
			
		||||
#ifndef PRODUCTION
 | 
			
		||||
#ifdef TESTFLIGHT
 | 
			
		||||
                     [TestFlight passCheckpoint:MPTestFlightCheckpointAction];
 | 
			
		||||
#endif
 | 
			
		||||
                 } cancelTitle:[PearlStrings get].commonButtonCancel destructiveTitle:nil
 | 
			
		||||
                       otherTitles:
 | 
			
		||||
     [self isHelpVisible]? @"Hide Help": @"Show Help", @"FAQ", @"Tutorial", @"Settings",
 | 
			
		||||
#ifndef PRODUCTION
 | 
			
		||||
#ifdef TESTFLIGHT
 | 
			
		||||
     @"Feedback",
 | 
			
		||||
#endif
 | 
			
		||||
     @"Sign Out",
 | 
			
		||||
@@ -418,7 +418,7 @@
 | 
			
		||||
        
 | 
			
		||||
        self.activeElement.type = type;
 | 
			
		||||
        
 | 
			
		||||
#ifndef PRODUCTION
 | 
			
		||||
#ifdef TESTFLIGHT
 | 
			
		||||
        [TestFlight passCheckpoint:[NSString stringWithFormat:MPTestFlightCheckpointSelectType, NSStringFromMPElementType(type)]];
 | 
			
		||||
#endif
 | 
			
		||||
        
 | 
			
		||||
@@ -436,7 +436,7 @@
 | 
			
		||||
        [self.searchDisplayController setActive:NO animated:YES];
 | 
			
		||||
        self.searchDisplayController.searchBar.text = self.activeElement.name;
 | 
			
		||||
        
 | 
			
		||||
#ifndef PRODUCTION
 | 
			
		||||
#ifdef TESTFLIGHT
 | 
			
		||||
        [TestFlight passCheckpoint:MPTestFlightCheckpointSelectElement];
 | 
			
		||||
#endif
 | 
			
		||||
    }
 | 
			
		||||
@@ -474,7 +474,7 @@
 | 
			
		||||
 navigationType:(UIWebViewNavigationType)navigationType {
 | 
			
		||||
    
 | 
			
		||||
    if (navigationType == UIWebViewNavigationTypeLinkClicked) {
 | 
			
		||||
#ifndef PRODUCTION
 | 
			
		||||
#ifdef TESTFLIGHT
 | 
			
		||||
        [TestFlight passCheckpoint:MPTestFlightCheckpointExternalLink];
 | 
			
		||||
#endif
 | 
			
		||||
        
 | 
			
		||||
 
 | 
			
		||||
@@ -54,7 +54,7 @@
 | 
			
		||||
 | 
			
		||||
- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar {
 | 
			
		||||
    
 | 
			
		||||
#ifndef PRODUCTION
 | 
			
		||||
#ifdef TESTFLIGHT
 | 
			
		||||
    [TestFlight passCheckpoint:MPTestFlightCheckpointCancelSearch];
 | 
			
		||||
#endif
 | 
			
		||||
    
 | 
			
		||||
@@ -302,7 +302,7 @@
 | 
			
		||||
                MPElementEntity *element = [self.fetchedResultsController objectAtIndexPath:indexPath];
 | 
			
		||||
                [self.fetchedResultsController.managedObjectContext deleteObject:element];
 | 
			
		||||
                
 | 
			
		||||
#ifndef PRODUCTION
 | 
			
		||||
#ifdef TESTFLIGHT
 | 
			
		||||
                [TestFlight passCheckpoint:MPTestFlightCheckpointDeleteElement];
 | 
			
		||||
#endif
 | 
			
		||||
            }];
 | 
			
		||||
 
 | 
			
		||||
@@ -214,7 +214,7 @@ typedef enum {
 | 
			
		||||
                     
 | 
			
		||||
                     [[MPAppDelegate get] loadKey:YES];
 | 
			
		||||
                     
 | 
			
		||||
#ifndef PRODUCTION
 | 
			
		||||
#ifdef TESTFLIGHT
 | 
			
		||||
                     [TestFlight passCheckpoint:MPTestFlightCheckpointMPChanged];
 | 
			
		||||
#endif
 | 
			
		||||
                 }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user