mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Respond to CR.
This commit is contained in:
parent
7a898f5e99
commit
5530b8d701
|
@ -97,6 +97,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
NSMutableArray<NSString *> *interactionIds = [NSMutableArray new];
|
||||
YapDatabaseViewTransaction *interactionsByThread = [transaction ext:TSMessageDatabaseViewExtensionName];
|
||||
OWSAssert(interactionsByThread);
|
||||
__block BOOL didDetectCorruption = NO;
|
||||
[interactionsByThread enumerateKeysInGroup:self.uniqueId
|
||||
usingBlock:^(NSString *collection, NSString *key, NSUInteger index, BOOL *stop) {
|
||||
if (![key isKindOfClass:[NSString class]] || key.length < 1) {
|
||||
|
@ -104,11 +105,17 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
self.logTag,
|
||||
key,
|
||||
[key class]);
|
||||
didDetectCorruption = YES;
|
||||
return;
|
||||
}
|
||||
[interactionIds addObject:key];
|
||||
}];
|
||||
|
||||
if (didDetectCorruption) {
|
||||
DDLogWarn(@"%@ incrementing version of: %@", self.logTag, TSMessageDatabaseViewExtensionName);
|
||||
[OWSPrimaryStorage incrementVersionOfDatabaseExtension:TSMessageDatabaseViewExtensionName];
|
||||
}
|
||||
|
||||
for (NSString *interactionId in interactionIds) {
|
||||
// We need to fetch each interaction, since [TSInteraction removeWithTransaction:] does important work.
|
||||
TSInteraction *_Nullable interaction =
|
||||
|
|
Loading…
Reference in a new issue