mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Bubble collapse.
This commit is contained in:
parent
11819d9b8a
commit
4a4e9d1ce2
3 changed files with 22 additions and 2 deletions
|
@ -43,6 +43,11 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
NSMutableArray<OWSTableItem *> *items = [NSMutableArray new];
|
||||
|
||||
[items addObject:[OWSTableItem itemWithTitle:@"Delete all messages in thread"
|
||||
actionBlock:^{
|
||||
[DebugUIMessages deleteAllMessagesInThread:thread];
|
||||
}]];
|
||||
|
||||
for (DebugUIMessagesAction *action in @[
|
||||
[DebugUIMessages sendMessageVariationsAction:thread],
|
||||
// Send Media
|
||||
|
@ -2589,6 +2594,14 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
};
|
||||
}
|
||||
|
||||
+ (void)deleteAllMessagesInThread:(TSThread *)thread
|
||||
{
|
||||
[OWSPrimaryStorage.sharedManager.newDatabaseConnection
|
||||
readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
||||
[thread removeAllThreadInteractionsWithTransaction:transaction];
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TSYapDatabaseObject.h"
|
||||
|
@ -133,6 +133,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
*/
|
||||
- (void)unarchiveThreadWithTransaction:(YapDatabaseReadWriteTransaction *)transaction;
|
||||
|
||||
- (void)removeAllThreadInteractionsWithTransaction:(YapDatabaseReadWriteTransaction *)transaction;
|
||||
|
||||
#pragma mark Drafts
|
||||
|
||||
/**
|
||||
|
|
|
@ -49,8 +49,13 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
- (void)removeWithTransaction:(YapDatabaseReadWriteTransaction *)transaction
|
||||
{
|
||||
[super removeWithTransaction:transaction];
|
||||
[self removeAllThreadInteractionsWithTransaction:transaction];
|
||||
|
||||
[super removeWithTransaction:transaction];
|
||||
}
|
||||
|
||||
- (void)removeAllThreadInteractionsWithTransaction:(YapDatabaseReadWriteTransaction *)transaction
|
||||
{
|
||||
// We can't safely delete interactions while enumerating them, so
|
||||
// we collect and delete separately.
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue