From caabae0024f28fe8e4532db260d542e7c71bafd5 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Thu, 6 Apr 2017 19:51:40 -0400 Subject: [PATCH] Add new debug method to delete session // FREEBIE --- .../DebugUITableViewController.m | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/Signal/src/ViewControllers/DebugUITableViewController.m b/Signal/src/ViewControllers/DebugUITableViewController.m index 2af90b643..300080ed3 100644 --- a/Signal/src/ViewControllers/DebugUITableViewController.m +++ b/Signal/src/ViewControllers/DebugUITableViewController.m @@ -67,12 +67,29 @@ NS_ASSUME_NONNULL_BEGIN }], ]]]; - [contents addSection:[OWSTableSection sectionWithTitle:@"Print to Debug Log" - items:@[ [OWSTableItem itemWithTitle:@"Print all sessions" - actionBlock:^{ - [[TSStorageManager sharedManager] - printAllSessions]; - }] ]]]; + [contents + addSection:[OWSTableSection + sectionWithTitle:@"Session State" + items:@[ + [OWSTableItem itemWithTitle:@"Print all sessions" + actionBlock:^{ + dispatch_async([OWSDispatch sessionStoreQueue], ^{ + [[TSStorageManager sharedManager] printAllSessions]; + }); + }], + [OWSTableItem itemWithTitle:@"Delete session (Contact Thread Only)" + actionBlock:^{ + if (![thread isKindOfClass:[TSContactThread class]]) { + DDLogError(@"Trying to delete session for group thread."); + OWSAssert(NO); + } + dispatch_async([OWSDispatch sessionStoreQueue], ^{ + [[TSStorageManager sharedManager] + deleteAllSessionsForContact:thread.contactIdentifier]; + }); + }], + + ]]]; DebugUITableViewController *viewController = [DebugUITableViewController new]; viewController.contents = contents;