mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Merge branch 'charlesmchen/storageReset'
This commit is contained in:
commit
b8c6d29170
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
#import "OWSStorage.h"
|
#import "OWSStorage.h"
|
||||||
|
@ -23,6 +23,7 @@ NSString *const OWSStorageExceptionName_DatabasePasswordInaccessibleWhileBackgro
|
||||||
NSString *const OWSStorageExceptionName_DatabasePasswordUnwritable
|
NSString *const OWSStorageExceptionName_DatabasePasswordUnwritable
|
||||||
= @"OWSStorageExceptionName_DatabasePasswordUnwritable";
|
= @"OWSStorageExceptionName_DatabasePasswordUnwritable";
|
||||||
NSString *const OWSStorageExceptionName_NoDatabase = @"OWSStorageExceptionName_NoDatabase";
|
NSString *const OWSStorageExceptionName_NoDatabase = @"OWSStorageExceptionName_NoDatabase";
|
||||||
|
NSString *const OWSResetStorageNotification = @"OWSResetStorageNotification";
|
||||||
|
|
||||||
static NSString *keychainService = @"TSKeyChainService";
|
static NSString *keychainService = @"TSKeyChainService";
|
||||||
static NSString *keychainDBPassAccount = @"TSDatabasePass";
|
static NSString *keychainDBPassAccount = @"TSDatabasePass";
|
||||||
|
@ -270,11 +271,21 @@ static NSString *keychainDBPassAccount = @"TSDatabasePass";
|
||||||
[NSException raise:OWSStorageExceptionName_NoDatabase format:@"Failed to initialize database."];
|
[NSException raise:OWSStorageExceptionName_NoDatabase format:@"Failed to initialize database."];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||||
|
selector:@selector(resetStorage)
|
||||||
|
name:OWSResetStorageNotification
|
||||||
|
object:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)dealloc
|
||||||
|
{
|
||||||
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||||
|
}
|
||||||
|
|
||||||
- (BOOL)areAsyncRegistrationsComplete
|
- (BOOL)areAsyncRegistrationsComplete
|
||||||
{
|
{
|
||||||
OWS_ABSTRACT_METHOD();
|
OWS_ABSTRACT_METHOD();
|
||||||
|
@ -450,9 +461,7 @@ static NSString *keychainDBPassAccount = @"TSDatabasePass";
|
||||||
|
|
||||||
+ (void)resetAllStorage
|
+ (void)resetAllStorage
|
||||||
{
|
{
|
||||||
for (OWSStorage *storage in self.allStorages) {
|
[[NSNotificationCenter defaultCenter] postNotificationName:OWSResetStorageNotification object:nil];
|
||||||
[storage resetStorage];
|
|
||||||
}
|
|
||||||
|
|
||||||
// This might be redundant but in the spirit of thoroughness...
|
// This might be redundant but in the spirit of thoroughness...
|
||||||
[self deleteDatabaseFiles];
|
[self deleteDatabaseFiles];
|
||||||
|
|
Loading…
Reference in a new issue