diff --git a/Signal/src/view controllers/FingerprintViewController.h b/Signal/src/view controllers/FingerprintViewController.h index 3accbd335..d127e70bd 100644 --- a/Signal/src/view controllers/FingerprintViewController.h +++ b/Signal/src/view controllers/FingerprintViewController.h @@ -8,6 +8,7 @@ #import #import "TSContactThread.h" +#import "MessagesViewController.h" @interface FingerprintViewController : UIViewController diff --git a/Signal/src/view controllers/FingerprintViewController.m b/Signal/src/view controllers/FingerprintViewController.m index bf56ceaa7..d0a561b9a 100644 --- a/Signal/src/view controllers/FingerprintViewController.m +++ b/Signal/src/view controllers/FingerprintViewController.m @@ -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:^{ diff --git a/Signal/src/view controllers/MessagesViewController.m b/Signal/src/view controllers/MessagesViewController.m index ffbd64f03..316c5e1b7 100644 --- a/Signal/src/view controllers/MessagesViewController.m +++ b/Signal/src/view controllers/MessagesViewController.m @@ -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; }