No Description

MessageModel.m 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /************************************************************
  2. * * EaseMob CONFIDENTIAL
  3. * __________________
  4. * Copyright (C) 2013-2014 EaseMob Technologies. All rights reserved.
  5. *
  6. * NOTICE: All information contained herein is, and remains
  7. * the property of EaseMob Technologies.
  8. * Dissemination of this information or reproduction of this material
  9. * is strictly forbidden unless prior written permission is obtained
  10. * from EaseMob Technologies.
  11. */
  12. #import "MessageModel.h"
  13. @implementation MessageModel
  14. - (instancetype)init
  15. {
  16. self = [super init];
  17. if (self)
  18. {
  19. //code
  20. }
  21. return self;
  22. }
  23. - (void)dealloc{
  24. }
  25. - (BOOL)isSummaryMessage {
  26. if (self.message.ext) {
  27. NSString *type = self.message.ext[EXT_MSG_MESSAGE_TYPE];
  28. if (type && type.intValue == 1) {
  29. return YES;
  30. } else {
  31. NSDictionary *dict = self.message.ext[EXT_MSG_TYPE_V2];
  32. if ([dict isKindOfClass:[NSDictionary class]]) {
  33. NSString *trackType = dict[EXT_MSG_TYPE_TRACK_V2];
  34. NSString *orderType = dict[EXT_MSG_TYPE_ORDER_V2];
  35. if (trackType || orderType) {
  36. return YES;
  37. }
  38. }
  39. }
  40. }
  41. return NO;
  42. }
  43. - (BOOL)isEnquiryMessage {
  44. NSString *ctrlType = self.message.ext[@"weichat"][@"ctrlType"];
  45. if ([ctrlType isKindOfClass:[NSString class]] && [ctrlType isEqualToString:@"inviteEnquiry"]) {
  46. return YES;
  47. }
  48. return NO;
  49. }
  50. - (BOOL)isAssistantMessage {
  51. if (self.message.ext) {
  52. NSString *type = self.message.ext[EXT_MSG_MESSAGE_TYPE];
  53. if (type.intValue >= 3 && type.intValue <= 5) {
  54. return YES;
  55. }
  56. }
  57. return NO;
  58. }
  59. - (AssistantMessageType)getAssistantMessageType {
  60. if (self.message.ext) {
  61. NSString *type = self.message.ext[EXT_MSG_MESSAGE_TYPE];
  62. if (type) { return (AssistantMessageType)type.intValue; }
  63. }
  64. return AssistantMessageTypeDefault;
  65. }
  66. - (EMMessageStatus)status
  67. {
  68. return _message.status;
  69. }
  70. @end