Clean up ahead of PR.
This commit is contained in:
parent
137fe6fb8b
commit
5dcf4b3bbc
@ -134,13 +134,24 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
[UIAlertAction actionWithTitle:NSLocalizedString(@"SETTINGS_DELETE_HISTORYLOG_CONFIRMATION_BUTTON", @"")
|
||||
style:UIAlertActionStyleDestructive
|
||||
handler:^(UIAlertAction *_Nonnull action) {
|
||||
[[TSStorageManager sharedManager] deleteThreadsAndMessages];
|
||||
[self deleteThreadsAndMessages];
|
||||
}];
|
||||
[alertController addAction:deleteAction];
|
||||
|
||||
[self presentViewController:alertController animated:true completion:nil];
|
||||
}
|
||||
|
||||
- (void)deleteThreadsAndMessages
|
||||
{
|
||||
[TSStorageManager.dbReadWriteConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
||||
[transaction removeAllObjectsInCollection:[TSThread collection]];
|
||||
[transaction removeAllObjectsInCollection:[SignalRecipient collection]];
|
||||
[transaction removeAllObjectsInCollection:[TSInteraction collection]];
|
||||
[transaction removeAllObjectsInCollection:[TSAttachment collection]];
|
||||
}];
|
||||
[TSAttachmentStream deleteAttachments];
|
||||
}
|
||||
|
||||
- (void)didToggleScreenSecuritySwitch:(UISwitch *)sender
|
||||
{
|
||||
BOOL enabled = sender.isOn;
|
||||
|
||||
@ -23,7 +23,7 @@ NSString *const OWSPreferencesKeyCallKitPrivacyEnabled = @"CallKitPrivacyEnabled
|
||||
NSString *const OWSPreferencesKeyCallsHideIPAddress = @"CallsHideIPAddress";
|
||||
NSString *const OWSPreferencesKeyHasDeclinedNoContactsView = @"hasDeclinedNoContactsView";
|
||||
NSString *const OWSPreferencesKeyIOSUpgradeNagVersion = @"iOSUpgradeNagVersion";
|
||||
NSString *const OWSPreferencesKey_IsReadyForAppExtensions = @"isReadyForAppExtensions";
|
||||
NSString *const OWSPreferencesKey_IsReadyForAppExtensions = @"isReadyForAppExtensions2";
|
||||
NSString *const OWSPreferencesKey_IsRegistered = @"OWSPreferencesKey_IsRegistered";
|
||||
|
||||
@implementation OWSPreferences
|
||||
|
||||
@ -305,7 +305,6 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
+ (void)deleteAttachments
|
||||
{
|
||||
NSError *error;
|
||||
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
|
||||
NSURL *fileURL = [NSURL fileURLWithPath:self.attachmentsFolder];
|
||||
@ -318,15 +317,11 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
}
|
||||
|
||||
for (NSURL *url in contents) {
|
||||
NSError *deletionError;
|
||||
[fileManager removeItemAtURL:url error:&deletionError];
|
||||
if (deletionError) {
|
||||
OWSFail(@"failed to remove item at path: %@ with error: %@", url, deletionError);
|
||||
// continue to try to delete remaining items.
|
||||
[fileManager removeItemAtURL:url error:&error];
|
||||
if (error) {
|
||||
OWSFail(@"failed to remove item at path: %@ with error: %@", url, error);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
- (CGSize)calculateImageSize
|
||||
|
||||
@ -28,8 +28,6 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
*/
|
||||
- (void)setupDatabaseWithSafeBlockingMigrations:(void (^_Nonnull)(void))safeBlockingMigrationsBlock;
|
||||
|
||||
- (void)deleteThreadsAndMessages;
|
||||
|
||||
// TODO: Deprecate.
|
||||
+ (YapDatabaseConnection *)dbReadConnection;
|
||||
+ (YapDatabaseConnection *)dbReadWriteConnection;
|
||||
|
||||
@ -201,16 +201,6 @@ NSString *const TSStorageManagerExceptionName_CouldNotCreateDatabaseDirectory
|
||||
return TSStorageManager.sharedManager.dbReadWriteConnection;
|
||||
}
|
||||
|
||||
- (void)deleteThreadsAndMessages {
|
||||
[self.dbReadWriteConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
||||
[transaction removeAllObjectsInCollection:[TSThread collection]];
|
||||
[transaction removeAllObjectsInCollection:[SignalRecipient collection]];
|
||||
[transaction removeAllObjectsInCollection:[TSInteraction collection]];
|
||||
[transaction removeAllObjectsInCollection:[TSAttachment collection]];
|
||||
}];
|
||||
[TSAttachmentStream deleteAttachments];
|
||||
}
|
||||
|
||||
- (void)deleteDatabaseFile
|
||||
{
|
||||
NSError *error;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user