Elaborate Debug & Internal UI.

pull/1/head
Matthew Chen 7 years ago
parent 585f15a012
commit 32b3e89c54

@ -108,10 +108,16 @@
- (void)updateTableContents
{
OWSTableContents *contents = [OWSTableContents new];
OWSTableSection *section = [OWSTableSection new];
__weak AppSettingsViewController *weakSelf = self;
#ifdef INTERNAL
OWSTableSection *internalSection = [OWSTableSection new];
[section addItem:[OWSTableItem softCenterLabelItemWithText:@"Internal Build"]];
[contents addSection:internalSection];
#endif
OWSTableSection *section = [OWSTableSection new];
[section addItem:[OWSTableItem itemWithCustomCellBlock:^{
return [weakSelf profileHeaderCell];
}

@ -1,5 +1,5 @@
//
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import "DebugUIMessages.h"
@ -124,6 +124,10 @@ NS_ASSUME_NONNULL_BEGIN
actionBlock:^{
[DebugUIMessages sendFakeMessages:10 * 1000 thread:thread];
}],
[OWSTableItem itemWithTitle:@"Create 100k fake messages"
actionBlock:^{
[DebugUIMessages sendFakeMessages:100 * 1000 thread:thread];
}],
[OWSTableItem itemWithTitle:@"Create 1 fake unread messages"
actionBlock:^{
[DebugUIMessages createFakeUnreadMessages:1 thread:thread];
@ -282,9 +286,24 @@ NS_ASSUME_NONNULL_BEGIN
[DebugUIMessages createNewGroups:1000 recipientId:recipientId];
}]];
}
if ([thread isKindOfClass:[TSGroupThread class]]) {
TSGroupThread *groupThread = (TSGroupThread *)thread;
[items addObject:[OWSTableItem itemWithTitle:@"Send message to all members"
actionBlock:^{
[DebugUIMessages sendMessages:1 toAllMembersOfGroup:groupThread];
}]];
}
return [OWSTableSection sectionWithTitle:self.name items:items];
}
+ (void)sendMessages:(int)counter toAllMembersOfGroup:(TSGroupThread *)groupThread
{
for (NSString *recipientId in groupThread.groupModel.groupMemberIds) {
TSContactThread *contactThread = [TSContactThread getOrCreateThreadWithContactId:recipientId];
[DebugUIMessages sendTextMessages:counter thread:contactThread];
}
}
+ (void)sendTextMessageInThread:(TSThread *)thread counter:(int)counter
{
DDLogInfo(@"%@ sendTextMessageInThread: %d", self.logTag, counter);
@ -964,9 +983,15 @@ NS_ASSUME_NONNULL_BEGIN
+ (void)sendFakeMessages:(NSUInteger)counter thread:(TSThread *)thread
{
[TSStorageManager.dbReadWriteConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
[self sendFakeMessages:counter thread:thread transaction:transaction];
}];
NSUInteger remainder = counter;
while (remainder > 0) {
NSUInteger batchSize = MIN((NSUInteger)2500, remainder);
[TSStorageManager.dbReadWriteConnection
readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
[self sendFakeMessages:counter thread:thread transaction:transaction];
}];
remainder -= batchSize;
}
}
+ (void)sendFakeMessages:(NSUInteger)counter

@ -1,5 +1,5 @@
//
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import "SignalsNavigationController.h"
@ -36,7 +36,11 @@ static double const STALLED_PROGRESS = 0.9;
CGRect bar = self.navigationBar.frame;
_socketStatusView.frame = CGRectMake(0, bar.size.height - 1.0f, self.view.frame.size.width, 1.0f);
_socketStatusView.progress = 0.0f;
#ifdef INTERNAL
_socketStatusView.progressTintColor = [UIColor ows_destructiveRedColor];
#else
_socketStatusView.progressTintColor = [UIColor ows_fadedBlueColor];
#endif
if (![_socketStatusView superview]) {
[self.navigationBar addSubview:_socketStatusView];

Loading…
Cancel
Save