From df0cf76603c65c6fd059272f1e2c14d580fb14b8 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Tue, 18 Jul 2017 15:18:52 -0400 Subject: [PATCH] Assert that mapping is set whenever accessing // FREEBIE --- Signal/src/ViewControllers/SignalsViewController.m | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Signal/src/ViewControllers/SignalsViewController.m b/Signal/src/ViewControllers/SignalsViewController.m index 887af45f8..52493574e 100644 --- a/Signal/src/ViewControllers/SignalsViewController.m +++ b/Signal/src/ViewControllers/SignalsViewController.m @@ -234,8 +234,6 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState }; [super viewDidLoad]; [self.navigationController.navigationBar setTranslucent:NO]; - [self tableViewSetUp]; - self.editingDbConnection = TSStorageManager.sharedManager.newDatabaseConnection; // Create the database connection. @@ -243,6 +241,11 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState }; [self showInboxGrouping]; + // because this uses the table data source, `tableViewSetup` must happen + // after mappings have been set up in `showInboxGrouping` + [self tableViewSetUp]; + + self.segmentedControl = [[UISegmentedControl alloc] initWithItems:@[ NSLocalizedString(@"WHISPER_NAV_BAR_TITLE", nil), NSLocalizedString(@"ARCHIVE_NAV_BAR_TITLE", nil) @@ -800,6 +803,12 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState }; #pragma mark - Groupings +- (YapDatabaseViewMappings *)threadMappings +{ + OWSAssert(_threadMappings != nil); + return _threadMappings; +} + - (void)showInboxGrouping { self.viewingThreadsIn = kInboxState;