2017-04-05 20:56:22 +00:00
|
|
|
//==============================================================================
|
|
|
|
// This file is part of Master Password.
|
|
|
|
// Copyright (c) 2011-2017, Maarten Billemont.
|
2012-05-07 20:18:01 +00:00
|
|
|
//
|
2017-04-05 20:56:22 +00:00
|
|
|
// Master Password is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
2012-05-07 20:18:01 +00:00
|
|
|
//
|
2017-04-05 20:56:22 +00:00
|
|
|
// Master Password is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
2012-05-07 20:18:01 +00:00
|
|
|
//
|
2017-04-05 20:56:22 +00:00
|
|
|
// You can find a copy of the GNU General Public License in the
|
|
|
|
// LICENSE file. Alternatively, see <http://www.gnu.org/licenses/>.
|
|
|
|
//==============================================================================
|
2012-05-07 20:18:01 +00:00
|
|
|
|
|
|
|
#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;
|
2017-04-01 04:30:25 +00:00
|
|
|
+ (BOOL)managedObjectContextForMainThreadPerformBlock:(void ( ^ )(NSManagedObjectContext *mainContext))mocBlock;
|
|
|
|
+ (BOOL)managedObjectContextForMainThreadPerformBlockAndWait:(void ( ^ )(NSManagedObjectContext *mainContext))mocBlock;
|
|
|
|
+ (BOOL)managedObjectContextPerformBlock:(void ( ^ )(NSManagedObjectContext *context))mocBlock;
|
|
|
|
+ (BOOL)managedObjectContextPerformBlockAndWait:(void ( ^ )(NSManagedObjectContext *context))mocBlock;
|
2017-04-29 19:01:24 +00:00
|
|
|
+ (id)managedObjectContextChanged:(void ( ^ )(NSDictionary<NSManagedObjectID *, NSString *> *affectedObjects))changedBlock;
|
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
|
2017-04-01 04:30:25 +00:00
|
|
|
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
|