mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
DebugUI: create fake unread messages
helpful for printing unread indicator // FREEBIE
This commit is contained in:
parent
7ffb0d98ec
commit
bef3a56e50
4 changed files with 28 additions and 0 deletions
|
@ -261,6 +261,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
adapter.outgoingMessageStatus = ((TSOutgoingMessage *)interaction).messageState;
|
||||
}
|
||||
|
||||
OWSAssert(adapter.date);
|
||||
return adapter;
|
||||
}
|
||||
|
||||
|
|
|
@ -1835,6 +1835,8 @@ typedef enum : NSUInteger {
|
|||
id<OWSMessageData> previousMessage =
|
||||
[self messageAtIndexPath:[NSIndexPath indexPathForItem:indexPath.row - 1 inSection:indexPath.section]];
|
||||
|
||||
OWSAssert(currentMessage.date);
|
||||
OWSAssert(previousMessage.date);
|
||||
NSTimeInterval timeDifference = [currentMessage.date timeIntervalSinceDate:previousMessage.date];
|
||||
if (timeDifference > kTSMessageSentDateShowTimeInterval) {
|
||||
showDate = YES;
|
||||
|
|
|
@ -77,6 +77,14 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
actionBlock:^{
|
||||
[DebugUIMessages sendFakeMessages:10 * 1000 thread:thread];
|
||||
}],
|
||||
[OWSTableItem itemWithTitle:@"Create 1 fake unread messages"
|
||||
actionBlock:^{
|
||||
[DebugUIMessages createFakeUnreadMessages:1 thread:thread];
|
||||
}],
|
||||
[OWSTableItem itemWithTitle:@"Create 10 fake unread messages"
|
||||
actionBlock:^{
|
||||
[DebugUIMessages createFakeUnreadMessages:10 thread:thread];
|
||||
}],
|
||||
[OWSTableItem itemWithTitle:@"Send text/x-signal-plain"
|
||||
actionBlock:^{
|
||||
[DebugUIMessages sendOversizeTextMessage:thread];
|
||||
|
@ -780,6 +788,21 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
return randomText;
|
||||
}
|
||||
|
||||
+ (void)createFakeUnreadMessages:(int)counter thread:(TSThread *)thread
|
||||
{
|
||||
[TSStorageManager.sharedManager.dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
||||
for (int i = 0; i < counter; i++) {
|
||||
NSString *randomText = [self randomText];
|
||||
TSIncomingMessage *message = [[TSIncomingMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
|
||||
inThread:thread
|
||||
authorId:@"+19174054215"
|
||||
sourceDeviceId:0
|
||||
messageBody:randomText];
|
||||
[message saveWithTransaction:transaction];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
+ (void)sendFakeMessages:(int)counter thread:(TSThread *)thread
|
||||
{
|
||||
[TSStorageManager.sharedManager.dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
||||
|
|
|
@ -24,6 +24,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
@property (nonatomic) UIImageView *imageView;
|
||||
@property (nonatomic) UILabel *titleLabel;
|
||||
|
||||
// override from JSQMessagesCollectionViewCell
|
||||
@property (nonatomic) UILabel *cellTopLabel;
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in a new issue