2012-05-07 20:18:01 +00:00
|
|
|
//
|
|
|
|
// MPAppDelegate_Key.h
|
|
|
|
// MasterPassword
|
|
|
|
//
|
|
|
|
// Created by Maarten Billemont on 24/11/11.
|
|
|
|
// Copyright (c) 2011 Lyndir. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import "MPAppDelegate_Shared.h"
|
|
|
|
|
2014-04-26 18:03:44 +00:00
|
|
|
#import "MPFixable.h"
|
2012-05-07 20:18:01 +00:00
|
|
|
|
2014-06-29 03:45:06 +00:00
|
|
|
typedef NS_ENUM( NSUInteger, MPImportResult ) {
|
2012-05-09 08:11:34 +00:00
|
|
|
MPImportResultSuccess,
|
|
|
|
MPImportResultCancelled,
|
|
|
|
MPImportResultInvalidPassword,
|
|
|
|
MPImportResultMalformedInput,
|
|
|
|
MPImportResultInternalError,
|
2014-06-29 03:45:06 +00:00
|
|
|
};
|
2012-05-09 08:11:34 +00:00
|
|
|
|
2014-09-15 05:00:23 +00:00
|
|
|
@interface MPAppDelegate_Shared(Store)
|
2012-05-07 20:18:01 +00:00
|
|
|
|
2013-06-16 16:39:52 +00:00
|
|
|
+ (NSManagedObjectContext *)managedObjectContextForMainThreadIfReady;
|
2014-03-20 11:15:37 +00:00
|
|
|
+ (BOOL)managedObjectContextForMainThreadPerformBlock:(void (^)(NSManagedObjectContext *mainContext))mocBlock;
|
|
|
|
+ (BOOL)managedObjectContextForMainThreadPerformBlockAndWait:(void (^)(NSManagedObjectContext *mainContext))mocBlock;
|
2013-05-16 02:42:21 +00:00
|
|
|
+ (BOOL)managedObjectContextPerformBlock:(void (^)(NSManagedObjectContext *context))mocBlock;
|
|
|
|
+ (BOOL)managedObjectContextPerformBlockAndWait:(void (^)(NSManagedObjectContext *context))mocBlock;
|
2012-05-07 20:18:01 +00:00
|
|
|
|
2014-04-26 18:03:44 +00:00
|
|
|
- (MPFixableResult)findAndFixInconsistenciesSaveInContext:(NSManagedObjectContext *)context;
|
2014-09-22 03:11:05 +00:00
|
|
|
- (void)deleteAndResetStore;
|
2013-05-07 04:45:06 +00:00
|
|
|
|
2014-09-21 15:47:53 +00:00
|
|
|
/** @param completion The block to execute after adding the site, executed from the main thread with the new site in the main MOC. */
|
|
|
|
- (void)addSiteNamed:(NSString *)siteName completion:(void ( ^ )(MPSiteEntity *site, NSManagedObjectContext *context))completion;
|
2014-09-21 14:39:09 +00:00
|
|
|
- (MPSiteEntity *)changeSite:(MPSiteEntity *)site saveInContext:(NSManagedObjectContext *)context toType:(MPSiteType)type;
|
2012-08-19 07:34:49 +00:00
|
|
|
- (MPImportResult)importSites:(NSString *)importedSitesString
|
|
|
|
askImportPassword:(NSString *(^)(NSString *userName))importPassword
|
|
|
|
askUserPassword:(NSString *(^)(NSString *userName, NSUInteger importCount, NSUInteger deleteCount))userPassword;
|
2014-04-25 01:43:47 +00:00
|
|
|
- (NSString *)exportSitesRevealPasswords:(BOOL)revealPasswords;
|
2012-05-08 13:57:11 +00:00
|
|
|
|
2012-05-07 20:18:01 +00:00
|
|
|
@end
|