mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Fixing crashes when deleting single messages.
This commit is contained in:
parent
1eef08628a
commit
86c524ddbc
|
@ -8,6 +8,7 @@
|
|||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "TSContactThread.h"
|
||||
#import "MessagesViewController.h"
|
||||
|
||||
@interface FingerprintViewController : UIViewController
|
||||
|
||||
|
|
|
@ -147,6 +147,13 @@
|
|||
}
|
||||
|
||||
- (void)shredDiscussionsWithContact {
|
||||
UINavigationController *nVC = (UINavigationController*)self.presentingViewController;
|
||||
for (UIViewController __strong *vc in nVC.viewControllers) {
|
||||
if ([vc isKindOfClass:[MessagesViewController class]]) {
|
||||
vc = nil;
|
||||
}
|
||||
}
|
||||
|
||||
[self.thread remove]; // this removes the thread and all it's discussion (YapDatabaseRelationships)
|
||||
__block SignalsNavigationController *vc = (SignalsNavigationController*)[self presentingViewController];
|
||||
[vc dismissViewControllerAnimated:YES completion:^{
|
||||
|
|
|
@ -856,6 +856,7 @@ typedef enum : NSUInteger {
|
|||
- (void)deleteMessageAtIndexPath:(NSIndexPath*)indexPath {
|
||||
[self.editingDatabaseConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
||||
TSInteraction *interaction = [self interactionAtIndexPath:indexPath];
|
||||
[[TSAdapterCacheManager sharedManager] clearCacheEntryForInteractionId:interaction.uniqueId];
|
||||
[interaction removeWithTransaction:transaction];
|
||||
}];
|
||||
}
|
||||
|
@ -1193,8 +1194,6 @@ typedef enum : NSUInteger {
|
|||
{
|
||||
case YapDatabaseViewChangeDelete :
|
||||
{
|
||||
TSInteraction * interaction = [self interactionAtIndexPath:rowChange.indexPath];
|
||||
[[TSAdapterCacheManager sharedManager] clearCacheEntryForInteractionId:interaction.uniqueId];
|
||||
[self.collectionView deleteItemsAtIndexPaths:@[ rowChange.indexPath ]];
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue