1
0
mirror of https://github.com/danog/Telegram.git synced 2025-01-05 20:48:36 +01:00
Telegram/Watch/Bridge/TGBridgeChatMessageListView+TGChatMessageListView.m
2015-10-01 19:19:52 +03:00

27 lines
1.1 KiB
Objective-C

#import "TGBridgeChatMessageListView+TGChatMessageListView.h"
#import "TGBridgeMessage+TGMessage.h"
#import "TGChatMessageListView.h"
@implementation TGBridgeChatMessageListView (TGChatMessageListView)
+ (TGBridgeChatMessageListView *)chatMessageListViewWithTGChatMessageListView:(TGChatMessageListView *)messageListView isChannel:(bool)isChannel
{
TGBridgeChatMessageListView *bridgeMessageListView = [[TGBridgeChatMessageListView alloc] init];
NSMutableArray *bridgeMessages = [[NSMutableArray alloc] init];
for (TGMessage *message in messageListView.messages)
{
TGBridgeMessage *bridgeMessage = isChannel ? [TGBridgeMessage channelMessageWithTGMessage:message] : [TGBridgeMessage messageWithTGMessage:message];
if (bridgeMessage != nil)
[bridgeMessages addObject:bridgeMessage];
}
bridgeMessageListView->_messages = bridgeMessages;
bridgeMessageListView->_earlierReferenceMessageId = messageListView.earlierReferenceMessageId;
bridgeMessageListView->_laterReferenceMessageId = messageListView.laterReferenceMessageId;
return bridgeMessageListView;
}
@end