From 7df89765590cc3badc3a5237c3c9a1147f7f61a6 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Thu, 30 Aug 2018 10:03:14 -0400 Subject: [PATCH] Fix breakage in production builds. --- .../src/ViewControllers/DebugUI/DebugUIMessages.m | 13 +++++++++++++ Signal/src/ViewControllers/DebugUI/DebugUIStress.m | 10 ++++++++++ 2 files changed, 23 insertions(+) diff --git a/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m b/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m index ac92bff14..34b7f1635 100644 --- a/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m +++ b/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m @@ -51,6 +51,8 @@ NS_ASSUME_NONNULL_BEGIN return @"Messages"; } +#ifdef DEBUG + - (NSArray *)itemsForActions:(NSArray *)actions { NSMutableArray *items = [NSMutableArray new]; @@ -75,12 +77,16 @@ NS_ASSUME_NONNULL_BEGIN return items; } +#endif + - (nullable OWSTableSection *)sectionForThread:(nullable TSThread *)thread { OWSAssert(thread); NSMutableArray *items = [NSMutableArray new]; +#ifdef DEBUG + [items addObject:[OWSTableItem itemWithTitle:@"Delete all messages in thread" actionBlock:^{ [DebugUIMessages deleteAllMessagesInThread:thread]; @@ -297,9 +303,14 @@ NS_ASSUME_NONNULL_BEGIN [DebugUIMessages sendMessages:1 toAllMembersOfGroup:groupThread]; }]]; } + +#endif + return [OWSTableSection sectionWithTitle:self.name items:items]; } +#ifdef DEBUG + + (void)sendMessages:(NSUInteger)count toAllMembersOfGroup:(TSGroupThread *)groupThread { for (NSString *recipientId in groupThread.groupModel.groupMemberIds) { @@ -4655,6 +4666,8 @@ typedef OWSContact * (^OWSContactBlock)(YapDatabaseReadWriteTransaction *transac } } +#endif + @end NS_ASSUME_NONNULL_END diff --git a/Signal/src/ViewControllers/DebugUI/DebugUIStress.m b/Signal/src/ViewControllers/DebugUI/DebugUIStress.m index 536b4effb..612253963 100644 --- a/Signal/src/ViewControllers/DebugUI/DebugUIStress.m +++ b/Signal/src/ViewControllers/DebugUI/DebugUIStress.m @@ -33,6 +33,9 @@ NS_ASSUME_NONNULL_BEGIN OWSAssert(thread); NSMutableArray *items = [NSMutableArray new]; + +#ifdef DEBUG + [items addObject:[OWSTableItem itemWithTitle:@"Send empty message" actionBlock:^{ [DebugUIStress sendStressMessage:thread block:^(SignalRecipient *recipient) { @@ -440,9 +443,14 @@ NS_ASSUME_NONNULL_BEGIN [DebugUIStress hallucinateTwinGroup:groupThread]; }]]; } + +#endif + return [OWSTableSection sectionWithTitle:self.name items:items]; } +#ifdef DEBUG + + (void)ensureGroupOfDataBuilder:(SSKProtoDataMessageBuilder *)dataBuilder thread:(TSThread *)thread { OWSAssert(dataBuilder); @@ -515,6 +523,8 @@ NS_ASSUME_NONNULL_BEGIN [SignalApp.sharedApp presentConversationForThread:thread animated:YES]; } +#endif + @end NS_ASSUME_NONNULL_END