OfflinePushExtBusinessInfo.m 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. //
  2. // OfflinePushExtBusinessInfo.m
  3. // TUICore
  4. //
  5. // Created by cologne on 2024/3/19.
  6. // Copyright © 2024 Tencent. All rights reserved.
  7. #import "OfflinePushExtBusinessInfo.h"
  8. @implementation OfflinePushExtBusinessInfo
  9. - (void)configWithEntityDic:(NSDictionary *)entityDic {
  10. if (entityDic == nil || ![entityDic isKindOfClass:NSDictionary.class]) {
  11. return ;
  12. }
  13. if ([entityDic.allKeys containsObject:@"version"]) {
  14. NSInteger version = 0;
  15. version = [entityDic[@"version"] integerValue];
  16. self.version = version;
  17. }
  18. if ([entityDic.allKeys containsObject:@"chatType"]) {
  19. NSInteger chatType = 0;
  20. chatType = [entityDic[@"chatType"] integerValue];
  21. self.chatType = chatType;
  22. }
  23. if ([entityDic.allKeys containsObject:@"action"]) {
  24. NSInteger action = 0;
  25. action = [entityDic[@"action"] integerValue];
  26. self.action = action;
  27. }
  28. if ([entityDic.allKeys containsObject:@"sender"]) {
  29. NSString *sender = entityDic[@"sender"];
  30. if (sender.length > 0) {
  31. self.sender = sender;
  32. }
  33. }
  34. if ([entityDic.allKeys containsObject:@"nickname"]) {
  35. NSString *nickname = entityDic[@"nickname"];
  36. if (nickname.length > 0) {
  37. self.nickname = nickname;
  38. }
  39. }
  40. if ([entityDic.allKeys containsObject:@"faceUrl"]) {
  41. NSString *faceUrl = entityDic[@"faceUrl"];
  42. if (faceUrl.length > 0) {
  43. self.faceUrl = faceUrl;
  44. }
  45. }
  46. if ([entityDic.allKeys containsObject:@"content"]) {
  47. NSString *content = entityDic[@"content"];
  48. if (content.length > 0) {
  49. self.content = content;
  50. }
  51. }
  52. if ([entityDic.allKeys containsObject:@"customData"]) {
  53. NSData *customData = entityDic[@"customData"];
  54. if (customData) {
  55. self.customData = customData;
  56. }
  57. }
  58. }
  59. - (NSDictionary *)toReportData {
  60. NSMutableDictionary *dict = [NSMutableDictionary dictionary];
  61. dict[@"version"] = @(self.version);
  62. dict[@"chatType"] = @(self.chatType);
  63. dict[@"action"] = @(self.action);
  64. if (self.sender.length > 0) {
  65. dict[@"sender"] = self.sender;
  66. }
  67. if (self.nickname.length > 0) {
  68. dict[@"nickname"] = self.nickname;
  69. }
  70. if (self.faceUrl.length > 0) {
  71. dict[@"faceUrl"] = self.faceUrl;
  72. }
  73. if (self.content.length > 0) {
  74. dict[@"content"] = self.content;
  75. }
  76. if (self.customData) {
  77. dict[@"customData"] = self.customData;
  78. }
  79. return dict;
  80. }
  81. @end