/************************************************************ * * EaseMob CONFIDENTIAL * __________________ * Copyright (C) 2013-2014 EaseMob Technologies. All rights reserved. * * NOTICE: All information contained herein is, and remains * the property of EaseMob Technologies. * Dissemination of this information or reproduction of this material * is strictly forbidden unless prior written permission is obtained * from EaseMob Technologies. */ #import "MessageModel.h" @implementation MessageModel - (instancetype)init { self = [super init]; if (self) { //code } return self; } - (void)dealloc{ } - (BOOL)isSummaryMessage { if (self.message.ext) { NSString *type = self.message.ext[EXT_MSG_MESSAGE_TYPE]; if (type && type.intValue == 1) { return YES; } else { NSDictionary *dict = self.message.ext[EXT_MSG_TYPE_V2]; if ([dict isKindOfClass:[NSDictionary class]]) { NSString *trackType = dict[EXT_MSG_TYPE_TRACK_V2]; NSString *orderType = dict[EXT_MSG_TYPE_ORDER_V2]; if (trackType || orderType) { return YES; } } } } return NO; } - (BOOL)isEnquiryMessage { NSString *ctrlType = self.message.ext[@"weichat"][@"ctrlType"]; if ([ctrlType isKindOfClass:[NSString class]] && [ctrlType isEqualToString:@"inviteEnquiry"]) { return YES; } return NO; } - (BOOL)isAssistantMessage { if (self.message.ext) { NSString *type = self.message.ext[EXT_MSG_MESSAGE_TYPE]; if (type.intValue >= 3 && type.intValue <= 5) { return YES; } } return NO; } - (AssistantMessageType)getAssistantMessageType { if (self.message.ext) { NSString *type = self.message.ext[EXT_MSG_MESSAGE_TYPE]; if (type) { return (AssistantMessageType)type.intValue; } } return AssistantMessageTypeDefault; } - (EMMessageStatus)status { return _message.status; } @end