1
0
mirror of https://github.com/danog/Telegram.git synced 2024-12-11 17:09:46 +01:00
Telegram/Watch/Bridge/TGBridgeChatMessageListView+TGChatMessageListView.m
2016-02-25 01:03:51 +01:00

28 lines
1.2 KiB
Objective-C

#import "TGBridgeChatMessageListView+TGChatMessageListView.h"
#import "TGBridgeMessage+TGMessage.h"
#import "TGChatMessageListView.h"
@implementation TGBridgeChatMessageListView (TGChatMessageListView)
+ (TGBridgeChatMessageListView *)chatMessageListViewWithTGChatMessageListView:(TGChatMessageListView *)messageListView
{
TGBridgeChatMessageListView *bridgeMessageListView = [[TGBridgeChatMessageListView alloc] init];
NSMutableArray *bridgeMessages = [[NSMutableArray alloc] init];
NSArray *clippedMessages = messageListView.clippedMessages;
for (TGMessage *message in clippedMessages)
{
TGBridgeMessage *bridgeMessage = (messageListView.isChannel && !messageListView.isChannelGroup) ? [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