[Some users report][0] that data isn't being properly deleted. This adds some additional logging to `OWSOrphanDataCleaner` (and converts some of it to Swift while we're at it) which may help us fix the bug. There are some small behavior changes here, but they should be minor: - We now only open _one_ transaction when checking whether we should do a cleanup, instead of two. - Some log messages were changed - We now handle the case where the "last cleaned date" is unexpectedly missing [0]: https://github.com/signalapp/Signal-iOS/issues/4916#issuecomment-1248234244
30 lines
722 B
Objective-C
30 lines
722 B
Objective-C
//
|
|
// Copyright 2018 Signal Messenger, LLC
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
//
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
extern NSString *const OWSOrphanDataCleaner_LastCleaningVersionKey;
|
|
extern NSString *const OWSOrphanDataCleaner_LastCleaningDateKey;
|
|
|
|
@class SDSKeyValueStore;
|
|
|
|
// Notes:
|
|
//
|
|
// * On disk, we only bother cleaning up files, not directories.
|
|
@interface OWSOrphanDataCleaner : NSObject
|
|
|
|
+ (SDSKeyValueStore *)keyValueStore;
|
|
|
|
- (instancetype)init NS_DESIGNATED_INITIALIZER;
|
|
|
|
// This is exposed for the debug UI.
|
|
+ (void)auditAndCleanup:(BOOL)shouldCleanup;
|
|
// This is exposed for the tests.
|
|
+ (void)auditAndCleanup:(BOOL)shouldCleanup completion:(nullable dispatch_block_t)completion;
|
|
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|