2
0

Merge branch 'master' of github.com:Lyndir/MasterPassword

This commit is contained in:
Maarten Billemont 2013-04-04 10:54:07 -04:00
commit e0e548c611
864 changed files with 8599 additions and 12088 deletions

8
.gitignore vendored
View File

@ -13,13 +13,7 @@
/*.iws /*.iws
# Xcode IDE # Xcode IDE
/*.xcodeproj/* xcuserdata/
!/*.xcodeproj/*.pbxproj
!/*.xcodeproj/xcshareddata
!/*.xcodeproj/xcshareddata/*
!/*.xcodeproj/project.xcworkspace
!/*.xcodeproj/project.xcworkspace/*
/*.xcodeproj/project.xcworkspace/xcuserdata
# Media # Media
Press/Background.png Press/Background.png

9
.gitmodules vendored
View File

@ -4,9 +4,12 @@
[submodule "External/InAppSettingsKit"] [submodule "External/InAppSettingsKit"]
path = External/InAppSettingsKit path = External/InAppSettingsKit
url = git://github.com/futuretap/InAppSettingsKit.git url = git://github.com/futuretap/InAppSettingsKit.git
[submodule "External/iCloudStoreManager"]
path = External/iCloudStoreManager
url = git://github.com/lhunath/iCloudStoreManager.git
[submodule "External/FontReplacer"] [submodule "External/FontReplacer"]
path = External/FontReplacer path = External/FontReplacer
url = git://github.com/0xced/FontReplacer.git url = git://github.com/0xced/FontReplacer.git
[submodule "Press"]
path = Press
url = ../Press
[submodule "External/UbiquityStoreManager"]
path = External/UbiquityStoreManager
url = git@github.com:lhunath/UbiquityStoreManager.git

View File

@ -1 +0,0 @@
../../../run

View File

@ -1,15 +0,0 @@
#!/usr/bin/ruby
#
# WARNING: DO NOT MODIFY THIS FILE.
#
# Crashlytics
# Crashlytics Version: 1.0.0.1
#
# Copyright Crashlytics, Inc. 2012. All rights reserved.
#
require 'pathname'
path = Pathname.new(__FILE__).parent
`#{path}/../../../run`

Binary file not shown.

View File

@ -2,8 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>BuildMachineOSBuild</key>
<string>12C60</string>
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
<string>English</string> <string>English</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
@ -17,29 +15,15 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>FMWK</string> <string>FMWK</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>2.0.3</string> <string>2.0.7</string>
<key>CFBundleSupportedPlatforms</key> <key>CFBundleSupportedPlatforms</key>
<array> <array>
<string>iPhoneOS</string> <string>iPhoneOS</string>
</array> </array>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>0200.03.00</string> <string>0200.07.00</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>10A403</string>
<key>DTPlatformName</key> <key>DTPlatformName</key>
<string>iphoneos</string> <string>iphoneos</string>
<key>DTPlatformVersion</key>
<string>6.0</string>
<key>DTSDKBuild</key>
<string>10A403</string>
<key>DTSDKName</key>
<string>iphoneos6.0</string>
<key>DTXcode</key>
<string>0451</string>
<key>DTXcodeBuild</key>
<string>4G1004</string>
<key>MinimumOSVersion</key> <key>MinimumOSVersion</key>
<string>4.0</string> <string>4.0</string>
</dict> </dict>

BIN
External/Crashlytics.framework/run vendored Executable file

Binary file not shown.

2
External/Pearl vendored

@ -1 +1 @@
Subproject commit 611f618ed295f37753992d7c7a664ec9e042a79f Subproject commit 5b51c3360c5e173390678899f99ab89c903465de

1
External/UbiquityStoreManager vendored Submodule

@ -0,0 +1 @@
Subproject commit 22dabd3ad6f3f04bc747aebffd46a57c7f28aabd

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:MasterPassword/ObjC/iOS/MasterPassword-iOS.xcodeproj">
</FileRef>
<FileRef
location = "group:MasterPassword/ObjC/Mac/MasterPassword-Mac.xcodeproj">
</FileRef>
</Workspace>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.lyndir.lhunath.masterpassword" android:versionCode="1" android:versionName="GIT-SNAPSHOT">
<uses-sdk android:minSdkVersion="8"
android:targetSdkVersion="16" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".HelloAndroidActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

View File

@ -0,0 +1,3 @@
# File used by Eclipse to determine the target system
# Project target.
target=android-16

View File

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- PROJECT METADATA -->
<parent>
<groupId>com.lyndir.lhunath.masterpassword</groupId>
<artifactId>masterpassword</artifactId>
<version>GIT-SNAPSHOT</version>
</parent>
<name>Master Password Android</name>
<description>An Android application to the Master Password algorithm</description>
<groupId>com.lyndir.lhunath.masterpassword</groupId>
<artifactId>masterpassword-android</artifactId>
<packaging>apk</packaging>
<!-- BUILD CONFIGURATION -->
<build>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<!--configuration>
<proguard>
<skip>false</skip>
<config>proguard.cfg</config>
</proguard>
</configuration-->
</plugin>
</plugins>
</build>
<!-- DEPENDENCY MANAGEMENT -->
<dependencies>
<!-- PROJECT REFERENCES -->
<dependency>
<groupId>com.lyndir.lhunath.masterpassword</groupId>
<artifactId>masterpassword-algorithm</artifactId>
<version>GIT-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>4.1.1.4</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,5 @@
-ignorewarnings
-dontoptimize
-dontobfuscate
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
</LinearLayout>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello masterpassword-android!</string>
<string name="app_name">masterpassword-android</string>
</resources>

View File

@ -0,0 +1,25 @@
package com.lyndir.lhunath.masterpassword;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
public class HelloAndroidActivity extends Activity {
private static String TAG = "masterpassword-android";
/**
* Called when the activity is first created.
* @param savedInstanceState If the activity is being re-initialized after
* previously being shut down then this Bundle contains the data it most
* recently supplied in onSaveInstanceState(Bundle). <b>Note: Otherwise it is null.</b>
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.i(TAG, "onCreate");
setContentView(R.layout.main);
}
}

View File

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>com.lyndir.lhunath</groupId> <groupId>com.lyndir.lhunath</groupId>
<artifactId>lyndir</artifactId> <artifactId>lyndir</artifactId>
<version>1.17</version> <version>GIT-SNAPSHOT</version>
</parent> </parent>
<name>Master Password</name> <name>Master Password</name>
@ -21,6 +21,7 @@
<modules> <modules>
<module>masterpassword-algorithm</module> <module>masterpassword-algorithm</module>
<module>masterpassword-cli</module> <module>masterpassword-cli</module>
<module>masterpassword-android</module>
</modules> </modules>
<!-- REMOTE ARTIFACT REPOSITORIES --> <!-- REMOTE ARTIFACT REPOSITORIES -->

View File

@ -144,7 +144,7 @@ static NSDictionary *keyQuery(MPUserEntity *user) {
} }
[user saveContext]; [user saveContext];
#ifdef PEARL_UIKIT #ifdef PEARL_UIKIT
[activityAlert dismissAlert]; [activityAlert cancelAlert];
#endif #endif
} }
} }

View File

@ -24,6 +24,7 @@ typedef enum {
+ (BOOL)managedObjectContextPerformBlock:(void (^)(NSManagedObjectContext *moc))mocBlock; + (BOOL)managedObjectContextPerformBlock:(void (^)(NSManagedObjectContext *moc))mocBlock;
+ (BOOL)managedObjectContextPerformBlockAndWait:(void (^)(NSManagedObjectContext *))mocBlock; + (BOOL)managedObjectContextPerformBlockAndWait:(void (^)(NSManagedObjectContext *))mocBlock;
- (UbiquityStoreManager *)storeManager;
- (MPImportResult)importSites:(NSString *)importedSitesString - (MPImportResult)importSites:(NSString *)importedSitesString
askImportPassword:(NSString *(^)(NSString *userName))importPassword askImportPassword:(NSString *(^)(NSString *userName))importPassword
askUserPassword:(NSString *(^)(NSString *userName, NSUInteger importCount, NSUInteger deleteCount))userPassword; askUserPassword:(NSString *(^)(NSString *userName, NSUInteger importCount, NSUInteger deleteCount))userPassword;

View File

@ -9,6 +9,14 @@
#import <objc/runtime.h> #import <objc/runtime.h>
#import "MPAppDelegate_Store.h" #import "MPAppDelegate_Store.h"
@interface MPAppDelegate_Shared ()
@property(nonatomic, strong) PearlAlert *handleCloudContentAlert;
@property(nonatomic, strong) PearlAlert *fixCloudContentAlert;
@property(nonatomic, strong) PearlOverlay *storeLoading;
@end
@implementation MPAppDelegate_Shared (Store) @implementation MPAppDelegate_Shared (Store)
static char privateManagedObjectContextKey, mainManagedObjectContextKey; static char privateManagedObjectContextKey, mainManagedObjectContextKey;
@ -58,35 +66,15 @@ static char privateManagedObjectContextKey, mainManagedObjectContextKey;
} }
- (NSManagedObjectContext *)mainManagedObjectContextIfReady { - (NSManagedObjectContext *)mainManagedObjectContextIfReady {
if (![self privateManagedObjectContextIfReady]) [self storeManager];
return nil; return objc_getAssociatedObject( self, &mainManagedObjectContextKey );
return objc_getAssociatedObject(self, &mainManagedObjectContextKey);
} }
- (NSManagedObjectContext *)privateManagedObjectContextIfReady { - (NSManagedObjectContext *)privateManagedObjectContextIfReady {
NSManagedObjectContext *privateManagedObjectContext = objc_getAssociatedObject(self, &privateManagedObjectContextKey); [self storeManager];
if (!privateManagedObjectContext) { return objc_getAssociatedObject( self, &privateManagedObjectContextKey );
privateManagedObjectContext = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSPrivateQueueConcurrencyType];
[privateManagedObjectContext performBlockAndWait:^{
privateManagedObjectContext.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy;
privateManagedObjectContext.persistentStoreCoordinator = self.storeManager.persistentStoreCoordinator;
}];
NSManagedObjectContext *mainManagedObjectContext = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSMainQueueConcurrencyType];
mainManagedObjectContext.parentContext = privateManagedObjectContext;
objc_setAssociatedObject(self, &privateManagedObjectContextKey, privateManagedObjectContext, OBJC_ASSOCIATION_RETAIN);
objc_setAssociatedObject(self, &mainManagedObjectContextKey, mainManagedObjectContext, OBJC_ASSOCIATION_RETAIN);
}
if (![privateManagedObjectContext.persistentStoreCoordinator.persistentStores count])
// Store not available yet.
return nil;
return privateManagedObjectContext;
} }
- (void)migrateStoreForManager:(UbiquityStoreManager *)storeManager { - (void)migrateStoreForManager:(UbiquityStoreManager *)storeManager {
@ -223,26 +211,16 @@ static char privateManagedObjectContextKey, mainManagedObjectContextKey;
containerIdentifier:@"HL3Q45LX9N.com.lyndir.lhunath.MasterPassword.shared" containerIdentifier:@"HL3Q45LX9N.com.lyndir.lhunath.MasterPassword.shared"
#if TARGET_OS_IPHONE #if TARGET_OS_IPHONE
additionalStoreOptions:@{ additionalStoreOptions:@{
NSPersistentStoreFileProtectionKey : NSFileProtectionComplete NSPersistentStoreFileProtectionKey : NSFileProtectionComplete
}]; }
#else #else
additionalStoreOptions:nil]; additionalStoreOptions:nil
#endif #endif
storeManager.delegate = self; delegate:self];
// Migrate old store to new store location. // Migrate old store to new store location.
[self migrateStoreForManager:storeManager]; [self migrateStoreForManager:storeManager];
[[NSNotificationCenter defaultCenter] addObserverForName:UbiquityManagedStoreDidChangeNotification
object:storeManager queue:nil
usingBlock:^(NSNotification *note) {
objc_setAssociatedObject(self, &privateManagedObjectContextKey, nil, OBJC_ASSOCIATION_RETAIN);
}];
[[NSNotificationCenter defaultCenter] addObserverForName:MPCheckConfigNotification object:nil queue:nil usingBlock:
^(NSNotification *note) {
if ([[MPConfig get].iCloud boolValue] != [self.storeManager cloudEnabled])
self.storeManager.cloudEnabled = [[MPConfig get].iCloud boolValue];
}];
#if TARGET_OS_IPHONE #if TARGET_OS_IPHONE
[[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationWillTerminateNotification [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationWillTerminateNotification
object:[UIApplication sharedApplication] queue:nil object:[UIApplication sharedApplication] queue:nil
@ -294,88 +272,97 @@ static char privateManagedObjectContextKey, mainManagedObjectContextKey;
dbg(@"[StoreManager] %@", message); dbg(@"[StoreManager] %@", message);
} }
- (void)ubiquityStoreManager:(UbiquityStoreManager *)manager didSwitchToCloud:(BOOL)cloudEnabled { - (void)ubiquityStoreManager:(UbiquityStoreManager *)manager willLoadStoreIsCloud:(BOOL)isCloudStore {
// manager.cloudEnabled is more reliable (eg. iOS' MPAppDelegate tampers with didSwitch a bit) if (![self.storeLoading isVisible])
cloudEnabled = manager.cloudEnabled; self.storeLoading = [PearlOverlay showOverlayWithTitle:@"Loading..."];
inf(@"Using iCloud? %@", cloudEnabled? @"YES": @"NO");
objc_setAssociatedObject( self, &privateManagedObjectContextKey, nil, OBJC_ASSOCIATION_RETAIN );
objc_setAssociatedObject( self, &mainManagedObjectContextKey, nil, OBJC_ASSOCIATION_RETAIN );
}
- (void)ubiquityStoreManager:(UbiquityStoreManager *)manager didLoadStoreForCoordinator:(NSPersistentStoreCoordinator *)coordinator
isCloud:(BOOL)isCloudStore {
inf(@"Using iCloud? %@", @(isCloudStore));
#ifdef TESTFLIGHT_SDK_VERSION #ifdef TESTFLIGHT_SDK_VERSION
[TestFlight passCheckpoint:cloudEnabled? MPCheckpointCloudEnabled: MPCheckpointCloudDisabled]; [TestFlight passCheckpoint:isCloudStore? MPCheckpointCloudEnabled: MPCheckpointCloudDisabled];
#endif #endif
#ifdef LOCALYTICS #ifdef LOCALYTICS
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointCloud attributes:@{ [[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointCloud attributes:@{
@"enabled": cloudEnabled? @"YES": @"NO" @"enabled": isCloudStore? @"YES": @"NO"
}]; }];
#endif #endif
[MPConfig get].iCloud = @(cloudEnabled); // Create our contexts.
NSManagedObjectContext *privateManagedObjectContext = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSPrivateQueueConcurrencyType];
[privateManagedObjectContext performBlockAndWait:^{
privateManagedObjectContext.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy;
privateManagedObjectContext.persistentStoreCoordinator = coordinator;
}];
NSManagedObjectContext *mainManagedObjectContext = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSMainQueueConcurrencyType];
mainManagedObjectContext.parentContext = privateManagedObjectContext;
objc_setAssociatedObject( self, &privateManagedObjectContextKey, privateManagedObjectContext, OBJC_ASSOCIATION_RETAIN );
objc_setAssociatedObject( self, &mainManagedObjectContextKey, mainManagedObjectContext, OBJC_ASSOCIATION_RETAIN );
[self.handleCloudContentAlert cancelAlert];
[self.fixCloudContentAlert cancelAlert];
[self.storeLoading cancelOverlay];
} }
- (void)ubiquityStoreManager:(UbiquityStoreManager *)manager didEncounterError:(NSError *)error cause:(UbiquityStoreManagerErrorCause)cause - (void)ubiquityStoreManager:(UbiquityStoreManager *)manager didEncounterError:(NSError *)error cause:(UbiquityStoreErrorCause)cause
context:(id)context { context:(id)context {
err(@"StoreManager: cause=%d, context=%@, error=%@", cause, context, error); err(@"[StoreManager] ERROR: cause=%d, context=%@, error=%@", cause, context, error);
#ifdef TESTFLIGHT_SDK_VERSION #ifdef TESTFLIGHT_SDK_VERSION
[TestFlight passCheckpoint:PearlString(MPCheckpointMPErrorUbiquity @"_%d", cause)]; [TestFlight passCheckpoint:PearlString( MPCheckpointMPErrorUbiquity @"_%d", cause )];
#endif #endif
#ifdef LOCALYTICS #ifdef LOCALYTICS
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointMPErrorUbiquity attributes:@{ [[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointMPErrorUbiquity attributes:@{
@"cause": @(cause), @"cause" : @(cause),
@"error.domain": error.domain, @"error.domain" : error.domain,
@"error.code": @(error.code) @"error.code" : @(error.code)
}]; }];
#endif #endif
}
switch (cause) { - (BOOL)ubiquityStoreManager:(UbiquityStoreManager *)manager handleCloudContentCorruptionWithHealthyStore:(BOOL)storeHealthy {
case UbiquityStoreManagerErrorCauseDeleteStore:
case UbiquityStoreManagerErrorCauseCreateStorePath:
case UbiquityStoreManagerErrorCauseClearStore:
break;
case UbiquityStoreManagerErrorCauseOpenLocalStore: {
wrn(@"Local store could not be opened: %@", error);
if (error.code == NSMigrationMissingSourceModelError) { if (manager.cloudEnabled && !storeHealthy && !([self.handleCloudContentAlert.alertView isVisible] || [self.fixCloudContentAlert.alertView isVisible]))
wrn(@"Resetting the local store."); dispatch_async( dispatch_get_main_queue(), ^{
[self showCloudContentAlert];
} );
#ifdef TESTFLIGHT_SDK_VERSION return NO;
[TestFlight passCheckpoint:MPCheckpointLocalStoreReset]; }
#endif
#ifdef LOCALYTICS
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointLocalStoreReset attributes:nil];
#endif
[manager deleteLocalStore];
Throw(@"Local store was reset, application must be restarted to use it."); - (void)showCloudContentAlert {
} else
// Try again.
[manager persistentStoreCoordinator];
}
case UbiquityStoreManagerErrorCauseOpenCloudStore: {
wrn(@"iCloud store could not be opened: %@", error);
if (error.code == NSMigrationMissingSourceModelError) { __weak MPAppDelegate_Shared *wSelf = self;
wrn(@"Resetting the iCloud store."); [self.handleCloudContentAlert cancelAlert];
self.handleCloudContentAlert = [PearlAlert showActivityWithTitle:@"iCloud Sync Problem" message:
@"Waiting for your other device to autocorrect the problem..."
initAlert:^(UIAlertView *alert) {
[alert addButtonWithTitle:@"Fix Now"];
}];
#ifdef TESTFLIGHT_SDK_VERSION self.handleCloudContentAlert.tappedButtonBlock = ^(UIAlertView *alert, NSInteger buttonIndex) {
[TestFlight passCheckpoint:MPCheckpointCloudStoreReset]; wSelf.fixCloudContentAlert = [PearlAlert showAlertWithTitle:@"Fix iCloud Now" message:
#endif @"This problem can usually be autocorrected by opening the app on another device where you recently made changes.\n"
#ifdef LOCALYTICS @"You can correct the problem from this device anyway, but recent changes made on another device might get lost."
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointCloudStoreReset attributes:nil]; viewStyle:UIAlertViewStyleDefault initAlert:nil tappedButtonBlock:
#endif ^(UIAlertView *alert_, NSInteger buttonIndex_) {
[manager deleteCloudStore]; if (buttonIndex_ == alert_.cancelButtonIndex)
break; [wSelf showCloudContentAlert];
} else if (buttonIndex_ == [alert_ firstOtherButtonIndex])
// Try again. [wSelf.storeManager rebuildCloudContentFromCloudStoreOrLocalStore:YES];
[manager persistentStoreCoordinator]; }
} cancelTitle:[PearlStrings get].commonButtonBack otherTitles:@"Fix Anyway", nil];
case UbiquityStoreManagerErrorCauseMigrateLocalToCloudStore: { };
wrn(@"Couldn't migrate local store to the cloud: %@", error);
wrn(@"Resetting the iCloud store.");
[manager deleteCloudStore];
};
}
} }
#pragma mark - Import / Export #pragma mark - Import / Export

View File

@ -13,7 +13,6 @@
@property (nonatomic, retain) NSNumber *sendInfo; @property (nonatomic, retain) NSNumber *sendInfo;
@property (nonatomic, retain) NSNumber *rememberLogin; @property (nonatomic, retain) NSNumber *rememberLogin;
@property (nonatomic, retain) NSNumber *iCloud;
@property (nonatomic, retain) NSNumber *iCloudDecided; @property (nonatomic, retain) NSNumber *iCloudDecided;
@end @end

View File

@ -9,7 +9,7 @@
#import "MPAppDelegate.h" #import "MPAppDelegate.h"
@implementation MPConfig @implementation MPConfig
@dynamic sendInfo, rememberLogin, iCloud, iCloudDecided; @dynamic sendInfo, rememberLogin, iCloudDecided;
- (id)init { - (id)init {
@ -20,7 +20,6 @@
NSStringFromSelector(@selector(sendInfo)): @NO, NSStringFromSelector(@selector(sendInfo)): @NO,
NSStringFromSelector(@selector(rememberLogin)): @NO, NSStringFromSelector(@selector(rememberLogin)): @NO,
NSStringFromSelector(@selector(iCloud)): @NO,
NSStringFromSelector(@selector(iCloudDecided)): @NO}]; NSStringFromSelector(@selector(iCloudDecided)): @NO}];
self.delegate = [MPAppDelegate get]; self.delegate = [MPAppDelegate get];

View File

@ -39,7 +39,7 @@
return; return;
} }
[MPAppDelegate managedObjectContextPerform:^(NSManagedObjectContext *moc) { [MPAppDelegate managedObjectContextPerformBlock:^(NSManagedObjectContext *moc) {
MPUserEntity *activeUser = [MPAppDelegate get].activeUser; MPUserEntity *activeUser = [MPAppDelegate get].activeUser;
if (![MPAlgorithmDefault migrateUser:activeUser]) if (![MPAlgorithmDefault migrateUser:activeUser])
[NSAlert alertWithMessageText:@"Migration Needed" defaultButton:@"OK" alternateButton:nil otherButton:nil [NSAlert alertWithMessageText:@"Migration Needed" defaultButton:@"OK" alternateButton:nil otherButton:nil

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Scheme <Scheme
LastUpgradeVersion = "0460"
version = "1.3"> version = "1.3">
<BuildAction <BuildAction
parallelizeBuildables = "YES" parallelizeBuildables = "YES"
@ -13,7 +14,7 @@
buildForAnalyzing = "YES"> buildForAnalyzing = "YES">
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "DAB8D987150374AD00CED3BC" BlueprintIdentifier = "DA5BFA43147E415C00F98B1E"
BuildableName = "MasterPassword.app" BuildableName = "MasterPassword.app"
BlueprintName = "MasterPassword" BlueprintName = "MasterPassword"
ReferencedContainer = "container:MasterPassword-Mac.xcodeproj"> ReferencedContainer = "container:MasterPassword-Mac.xcodeproj">
@ -31,7 +32,7 @@
<MacroExpansion> <MacroExpansion>
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "DAB8D987150374AD00CED3BC" BlueprintIdentifier = "DA5BFA43147E415C00F98B1E"
BuildableName = "MasterPassword.app" BuildableName = "MasterPassword.app"
BlueprintName = "MasterPassword" BlueprintName = "MasterPassword"
ReferencedContainer = "container:MasterPassword-Mac.xcodeproj"> ReferencedContainer = "container:MasterPassword-Mac.xcodeproj">
@ -43,14 +44,14 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0" launchStyle = "0"
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug" buildConfiguration = "AppStore"
ignoresPersistentStateOnLaunch = "NO" ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES" debugDocumentVersioning = "YES"
allowLocationSimulation = "YES"> allowLocationSimulation = "YES">
<BuildableProductRunnable> <BuildableProductRunnable>
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "DAB8D987150374AD00CED3BC" BlueprintIdentifier = "DA5BFA43147E415C00F98B1E"
BuildableName = "MasterPassword.app" BuildableName = "MasterPassword.app"
BlueprintName = "MasterPassword" BlueprintName = "MasterPassword"
ReferencedContainer = "container:MasterPassword-Mac.xcodeproj"> ReferencedContainer = "container:MasterPassword-Mac.xcodeproj">
@ -63,12 +64,12 @@
shouldUseLaunchSchemeArgsEnv = "YES" shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = "" savedToolIdentifier = ""
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
buildConfiguration = "Release" buildConfiguration = "AppStore"
debugDocumentVersioning = "YES"> debugDocumentVersioning = "YES">
<BuildableProductRunnable> <BuildableProductRunnable>
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "DAB8D987150374AD00CED3BC" BlueprintIdentifier = "DA5BFA43147E415C00F98B1E"
BuildableName = "MasterPassword.app" BuildableName = "MasterPassword.app"
BlueprintName = "MasterPassword" BlueprintName = "MasterPassword"
ReferencedContainer = "container:MasterPassword-Mac.xcodeproj"> ReferencedContainer = "container:MasterPassword-Mac.xcodeproj">
@ -79,7 +80,7 @@
buildConfiguration = "Debug"> buildConfiguration = "Debug">
</AnalyzeAction> </AnalyzeAction>
<ArchiveAction <ArchiveAction
buildConfiguration = "Release" buildConfiguration = "AppStore"
revealArchiveInOrganizer = "YES"> revealArchiveInOrganizer = "YES">
</ArchiveAction> </ArchiveAction>
</Scheme> </Scheme>

View File

@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0460"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DA5BFA43147E415C00F98B1E"
BuildableName = "MasterPassword.app"
BlueprintName = "MasterPassword"
ReferencedContainer = "container:MasterPassword-Mac.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DA3EF17815A47744003ABF4E"
BuildableName = "Tests.octest"
BlueprintName = "Tests"
ReferencedContainer = "container:MasterPassword-Mac.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DA5BFA43147E415C00F98B1E"
BuildableName = "MasterPassword.app"
BlueprintName = "MasterPassword"
ReferencedContainer = "container:MasterPassword-Mac.xcodeproj">
</BuildableReference>
</MacroExpansion>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DA5BFA43147E415C00F98B1E"
BuildableName = "MasterPassword.app"
BlueprintName = "MasterPassword"
ReferencedContainer = "container:MasterPassword-Mac.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
<AdditionalOption
key = "NSZombieEnabled"
value = "YES"
isEnabled = "YES">
</AdditionalOption>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DA5BFA43147E415C00F98B1E"
BuildableName = "MasterPassword.app"
BlueprintName = "MasterPassword"
ReferencedContainer = "container:MasterPassword-Mac.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "AdHoc"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -203,7 +203,7 @@
[PearlLogger get].printLevel = PearlLogLevelInfo; [PearlLogger get].printLevel = PearlLogLevelInfo;
[[Crashlytics sharedInstance] setBoolValue:[[MPConfig get].rememberLogin boolValue] forKey:@"rememberLogin"]; [[Crashlytics sharedInstance] setBoolValue:[[MPConfig get].rememberLogin boolValue] forKey:@"rememberLogin"];
[[Crashlytics sharedInstance] setBoolValue:[[MPConfig get].iCloud boolValue] forKey:@"iCloud"]; [[Crashlytics sharedInstance] setBoolValue:[self storeManager].cloudEnabled forKey:@"iCloud"];
[[Crashlytics sharedInstance] setBoolValue:[[MPConfig get].iCloudDecided boolValue] forKey:@"iCloudDecided"]; [[Crashlytics sharedInstance] setBoolValue:[[MPConfig get].iCloudDecided boolValue] forKey:@"iCloudDecided"];
[[Crashlytics sharedInstance] setBoolValue:[[MPiOSConfig get].sendInfo boolValue] forKey:@"sendInfo"]; [[Crashlytics sharedInstance] setBoolValue:[[MPiOSConfig get].sendInfo boolValue] forKey:@"sendInfo"];
[[Crashlytics sharedInstance] setBoolValue:[[MPiOSConfig get].helpHidden boolValue] forKey:@"helpHidden"]; [[Crashlytics sharedInstance] setBoolValue:[[MPiOSConfig get].helpHidden boolValue] forKey:@"helpHidden"];
@ -216,7 +216,7 @@
#ifdef TESTFLIGHT_SDK_VERSION #ifdef TESTFLIGHT_SDK_VERSION
[TestFlight addCustomEnvironmentInformation:[[MPConfig get].rememberLogin boolValue]? @"YES": @"NO" forKey:@"rememberLogin"]; [TestFlight addCustomEnvironmentInformation:[[MPConfig get].rememberLogin boolValue]? @"YES": @"NO" forKey:@"rememberLogin"];
[TestFlight addCustomEnvironmentInformation:[[MPConfig get].iCloud boolValue]? @"YES": @"NO" forKey:@"iCloud"]; [TestFlight addCustomEnvironmentInformation:[self storeManager].cloudEnabled? @"YES": @"NO" forKey:@"iCloud"];
[TestFlight addCustomEnvironmentInformation:[[MPConfig get].iCloudDecided boolValue]? @"YES": @"NO" forKey:@"iCloudDecided"]; [TestFlight addCustomEnvironmentInformation:[[MPConfig get].iCloudDecided boolValue]? @"YES": @"NO" forKey:@"iCloudDecided"];
[TestFlight addCustomEnvironmentInformation:[[MPiOSConfig get].sendInfo boolValue]? @"YES": @"NO" forKey:@"sendInfo"]; [TestFlight addCustomEnvironmentInformation:[[MPiOSConfig get].sendInfo boolValue]? @"YES": @"NO" forKey:@"sendInfo"];
[TestFlight addCustomEnvironmentInformation:[[MPiOSConfig get].helpHidden boolValue]? @"YES": @"NO" forKey:@"helpHidden"]; [TestFlight addCustomEnvironmentInformation:[[MPiOSConfig get].helpHidden boolValue]? @"YES": @"NO" forKey:@"helpHidden"];
@ -233,7 +233,7 @@
#endif #endif
[[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointConfig attributes:@{ [[LocalyticsSession sharedLocalyticsSession] tagEvent:MPCheckpointConfig attributes:@{
@"rememberLogin" : [[MPConfig get].rememberLogin boolValue]? @"YES": @"NO", @"rememberLogin" : [[MPConfig get].rememberLogin boolValue]? @"YES": @"NO",
@"iCloud" : [[MPConfig get].iCloud boolValue]? @"YES": @"NO", @"iCloud" : [self storeManager].cloudEnabled? @"YES": @"NO",
@"iCloudDecided" : [[MPConfig get].iCloudDecided boolValue]? @"YES": @"NO", @"iCloudDecided" : [[MPConfig get].iCloudDecided boolValue]? @"YES": @"NO",
@"sendInfo" : [[MPiOSConfig get].sendInfo boolValue]? @"YES": @"NO", @"sendInfo" : [[MPiOSConfig get].sendInfo boolValue]? @"YES": @"NO",
@"helpHidden" : [[MPiOSConfig get].helpHidden boolValue]? @"YES": @"NO", @"helpHidden" : [[MPiOSConfig get].helpHidden boolValue]? @"YES": @"NO",
@ -281,7 +281,7 @@
// Google+ // Google+
if ([self.googlePlus handleURL:url sourceApplication:sourceApplication annotation:annotation]) if ([self.googlePlus handleURL:url sourceApplication:sourceApplication annotation:annotation])
return YES; return YES;
// Arbitrary URL to mpsites data. // Arbitrary URL to mpsites data.
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSError *error; NSError *error;
@ -365,7 +365,7 @@
break; break;
} }
[activityAlert dismissAlert]; [activityAlert cancelAlert];
}); });
return YES; return YES;
@ -615,66 +615,62 @@
} }
#pragma mark - UbiquityStoreManagerDelegate #pragma mark - UbiquityStoreManagerDelegate
- (void)ubiquityStoreManager:(UbiquityStoreManager *)manager willLoadStoreIsCloud:(BOOL)isCloudStore {
- (void)ubiquityStoreManager:(UbiquityStoreManager *)manager didSwitchToCloud:(BOOL)cloudEnabled { [super ubiquityStoreManager:manager willLoadStoreIsCloud:isCloudStore];
[super ubiquityStoreManager:manager didSwitchToCloud:cloudEnabled]; if (!isCloudStore && ![[MPConfig get].iCloudDecided boolValue])
[self alertCloudDisabledForManager:manager];
}
if (![[MPConfig get].iCloudDecided boolValue]) { - (void)alertCloudDisabledForManager:(UbiquityStoreManager *)manager {
if (!cloudEnabled) {
[PearlAlert showAlertWithTitle:@"iCloud" [PearlAlert showAlertWithTitle:@"iCloud" message:
message: @"iCloud is now disabled.\n\n"
@"iCloud is now disabled.\n\n" @"It is highly recommended you enable iCloud."
@"It is highly recommended you enable iCloud." viewStyle:UIAlertViewStyleDefault initAlert:nil
viewStyle:UIAlertViewStyleDefault initAlert:nil tappedButtonBlock:^(UIAlertView *alert, NSInteger buttonIndex) {
tappedButtonBlock:^(UIAlertView *alert, NSInteger buttonIndex) { if (buttonIndex == [alert firstOtherButtonIndex] + 0) {
if (buttonIndex == [alert firstOtherButtonIndex] + 0) { [PearlAlert showAlertWithTitle:@"About iCloud" message:
[PearlAlert showAlertWithTitle:@"About iCloud" @"iCloud is Apple's solution for saving your data in \"the cloud\" "
message: @"and making sure your other iPhones, iPads and Macs are in sync.\n\n"
@"iCloud is Apple's solution for saving your data in \"the cloud\" " @"For Master Password, that means your sites are available on all your "
@"and making sure your other iPhones, iPads and Macs are in sync.\n\n" @"Apple devices, and you always have a backup of them in case "
@"For Master Password, that means your sites are available on all your " @"you lose one or need to restore.\n\n"
@"Apple devices, and you always have a backup of them in case " @"Thanks to the way Master Password works, it doesn't need to send your "
@"you loose one or need to restore.\n\n" @"site's passwords to Apple for the backup to work: Only their names are "
@"Because of the way Master Password works, it doesn't need to send your " @"saved. If you set a custom password it will be sent to iCloud after "
@"site's passwords to Apple. Only their names are saved to make it easier " @"being encrypted with your master password.\n\n"
@"for you to find the site you need. For some sites you may have set " @"Apple can never see any of your passwords."
@"a user-specified password: these are sent to iCloud after being encrypted " viewStyle:UIAlertViewStyleDefault
@"with your master password.\n\n" initAlert:nil tappedButtonBlock:^(UIAlertView *alert_, NSInteger buttonIndex_) {
@"Apple can never see any of your passwords." [self alertCloudDisabledForManager:manager];
viewStyle:UIAlertViewStyleDefault
initAlert:nil tappedButtonBlock:^(UIAlertView *alert_, NSInteger buttonIndex_) {
[self ubiquityStoreManager:manager didSwitchToCloud:cloudEnabled];
}
cancelTitle:[PearlStrings get].commonButtonThanks otherTitles:nil];
return;
} }
cancelTitle:[PearlStrings get].commonButtonThanks otherTitles:nil];
return;
}
[MPConfig get].iCloudDecided = @YES; [MPConfig get].iCloudDecided = @YES;
if (buttonIndex == [alert cancelButtonIndex]) if (buttonIndex == [alert firstOtherButtonIndex] + 1)
return; manager.cloudEnabled = YES;
if (buttonIndex == [alert firstOtherButtonIndex] + 1) } cancelTitle:@"Leave Off" otherTitles:@"Explain?", @"Enable iCloud", nil];
manager.cloudEnabled = YES;
} cancelTitle:@"Leave iCloud Off" otherTitles:@"Explain?", @"Enable iCloud", nil];
}
}
} }
#pragma mark - Google+ #pragma mark - Google+
- (NSDictionary *)googlePlusInfo { - (NSDictionary *)googlePlusInfo {
static NSDictionary *googlePlusInfo = nil; static NSDictionary *googlePlusInfo = nil;
if (googlePlusInfo == nil) if (googlePlusInfo == nil)
googlePlusInfo = [[NSDictionary alloc] initWithContentsOfURL: googlePlusInfo = [[NSDictionary alloc] initWithContentsOfURL:
[[NSBundle mainBundle] URLForResource:@"Google+" withExtension:@"plist"]]; [[NSBundle mainBundle] URLForResource:@"Google+" withExtension:@"plist"]];
return googlePlusInfo; return googlePlusInfo;
} }
- (NSString *)googlePlusClientID { - (NSString *)googlePlusClientID {
return NSNullToNil([[self googlePlusInfo] valueForKeyPath:@"ClientID"]); return NSNullToNil([[self googlePlusInfo] valueForKeyPath:@"ClientID"]);
} }

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