2015-12-07 03:31:43 +01:00
|
|
|
//
|
2017-01-23 23:23:12 +01:00
|
|
|
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
2015-12-07 03:31:43 +01:00
|
|
|
//
|
|
|
|
|
|
|
|
#import "TSStorageKeys.h"
|
|
|
|
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
#import <YapDatabase/YapDatabase.h>
|
|
|
|
|
|
|
|
@class ECKeyPair;
|
|
|
|
@class PreKeyRecord;
|
|
|
|
@class SignedPreKeyRecord;
|
2016-11-08 02:42:44 +01:00
|
|
|
@class TSPrivacyPreferences;
|
2015-12-07 03:31:43 +01:00
|
|
|
|
|
|
|
extern NSString *const TSUIDatabaseConnectionDidUpdateNotification;
|
|
|
|
|
|
|
|
@interface TSStorageManager : NSObject
|
|
|
|
|
|
|
|
+ (instancetype)sharedManager;
|
2017-01-23 23:23:12 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns NO if:
|
|
|
|
*
|
|
|
|
* - Keychain is locked because device has just been restarted.
|
|
|
|
* - Password could not be retrieved because of a keychain error.
|
|
|
|
*/
|
|
|
|
+ (BOOL)isDatabasePasswordAccessible;
|
|
|
|
|
2015-12-07 03:31:43 +01:00
|
|
|
- (void)setupDatabase;
|
|
|
|
- (void)deleteThreadsAndMessages;
|
2017-01-10 22:55:54 +01:00
|
|
|
- (void)resetSignalStorage;
|
2015-12-07 03:31:43 +01:00
|
|
|
|
|
|
|
- (YapDatabase *)database;
|
|
|
|
- (YapDatabaseConnection *)newDatabaseConnection;
|
|
|
|
|
|
|
|
|
|
|
|
- (void)setObject:(id)object forKey:(NSString *)key inCollection:(NSString *)collection;
|
|
|
|
- (void)removeObjectForKey:(NSString *)string inCollection:(NSString *)collection;
|
|
|
|
|
|
|
|
|
|
|
|
- (BOOL)boolForKey:(NSString *)key inCollection:(NSString *)collection;
|
|
|
|
- (int)intForKey:(NSString *)key inCollection:(NSString *)collection;
|
|
|
|
- (void)setInt:(int)integer forKey:(NSString *)key inCollection:(NSString *)collection;
|
|
|
|
- (id)objectForKey:(NSString *)key inCollection:(NSString *)collection;
|
|
|
|
- (NSDictionary *)dictionaryForKey:(NSString *)key inCollection:(NSString *)collection;
|
|
|
|
- (NSString *)stringForKey:(NSString *)key inCollection:(NSString *)collection;
|
|
|
|
- (NSData *)dataForKey:(NSString *)key inCollection:(NSString *)collection;
|
|
|
|
- (ECKeyPair *)keyPairForKey:(NSString *)key inCollection:(NSString *)collection;
|
|
|
|
- (PreKeyRecord *)preKeyRecordForKey:(NSString *)key inCollection:(NSString *)collection;
|
|
|
|
- (SignedPreKeyRecord *)signedPreKeyRecordForKey:(NSString *)key inCollection:(NSString *)collection;
|
|
|
|
- (void)purgeCollection:(NSString *)collection;
|
|
|
|
|
|
|
|
@property (nonatomic, readonly) YapDatabaseConnection *dbConnection;
|
2016-11-08 02:42:44 +01:00
|
|
|
@property (nonatomic, readonly) TSPrivacyPreferences *privacyPreferences;
|
2015-12-07 03:31:43 +01:00
|
|
|
|
|
|
|
@end
|