|
|
@ -17,7 +17,7 @@
|
|
|
|
#import <SignalServiceKit/TSMessage.h>
|
|
|
|
#import <SignalServiceKit/TSMessage.h>
|
|
|
|
#import <SignalServiceKit/TSQuotedMessage.h>
|
|
|
|
#import <SignalServiceKit/TSQuotedMessage.h>
|
|
|
|
#import <SignalServiceKit/TSThread.h>
|
|
|
|
#import <SignalServiceKit/TSThread.h>
|
|
|
|
#import <SignalServiceKit/YapDatabaseConnection+OWS.h>
|
|
|
|
#import <SignalServiceKit/YapDatabaseTransaction+OWS.h>
|
|
|
|
#import <YapDatabase/YapDatabase.h>
|
|
|
|
#import <YapDatabase/YapDatabase.h>
|
|
|
|
|
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
@ -427,10 +427,10 @@ typedef void (^OrphanDataBlock)(OWSOrphanData *);
|
|
|
|
__block NSString *_Nullable lastCleaningVersion;
|
|
|
|
__block NSString *_Nullable lastCleaningVersion;
|
|
|
|
__block NSDate *_Nullable lastCleaningDate;
|
|
|
|
__block NSDate *_Nullable lastCleaningDate;
|
|
|
|
[databaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
|
|
|
|
[databaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
|
|
|
|
lastCleaningVersion = [databaseConnection stringForKey:OWSOrphanDataCleaner_LastCleaningVersionKey
|
|
|
|
lastCleaningVersion = [transaction stringForKey:OWSOrphanDataCleaner_LastCleaningVersionKey
|
|
|
|
inCollection:OWSOrphanDataCleaner_Collection];
|
|
|
|
inCollection:OWSOrphanDataCleaner_Collection];
|
|
|
|
lastCleaningDate = [databaseConnection dateForKey:OWSOrphanDataCleaner_LastCleaningDateKey
|
|
|
|
lastCleaningDate = [transaction dateForKey:OWSOrphanDataCleaner_LastCleaningDateKey
|
|
|
|
inCollection:OWSOrphanDataCleaner_Collection];
|
|
|
|
inCollection:OWSOrphanDataCleaner_Collection];
|
|
|
|
}];
|
|
|
|
}];
|
|
|
|
|
|
|
|
|
|
|
|
// Only clean up once per app version.
|
|
|
|
// Only clean up once per app version.
|
|
|
@ -515,12 +515,14 @@ typedef void (^OrphanDataBlock)(OWSOrphanData *);
|
|
|
|
success:^{
|
|
|
|
success:^{
|
|
|
|
DDLogInfo(@"%@ Completed orphan data cleanup.", self.logTag);
|
|
|
|
DDLogInfo(@"%@ Completed orphan data cleanup.", self.logTag);
|
|
|
|
|
|
|
|
|
|
|
|
[databaseConnection setObject:AppVersion.sharedInstance.currentAppVersion
|
|
|
|
[databaseConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
|
|
|
forKey:OWSOrphanDataCleaner_LastCleaningVersionKey
|
|
|
|
[transaction setObject:AppVersion.sharedInstance.currentAppVersion
|
|
|
|
inCollection:OWSOrphanDataCleaner_Collection];
|
|
|
|
forKey:OWSOrphanDataCleaner_LastCleaningVersionKey
|
|
|
|
[databaseConnection setDate:[NSDate new]
|
|
|
|
inCollection:OWSOrphanDataCleaner_Collection];
|
|
|
|
forKey:OWSOrphanDataCleaner_LastCleaningDateKey
|
|
|
|
[transaction setDate:[NSDate new]
|
|
|
|
inCollection:OWSOrphanDataCleaner_Collection];
|
|
|
|
forKey:OWSOrphanDataCleaner_LastCleaningDateKey
|
|
|
|
|
|
|
|
inCollection:OWSOrphanDataCleaner_Collection];
|
|
|
|
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
failure:^{
|
|
|
|
failure:^{
|
|
|
|
DDLogInfo(@"%@ Aborting orphan data cleanup.", self.logTag);
|
|
|
|
DDLogInfo(@"%@ Aborting orphan data cleanup.", self.logTag);
|
|
|
|