TXChatMusicMessage.m 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //
  2. // TXChatMusicMessage.m
  3. // TUIChat
  4. //
  5. // Created by 王智 on 2023/8/10.
  6. //
  7. #import "TXChatMusicMessage.h"
  8. #define TXHexRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
  9. @implementation TXChatMusicMessage
  10. + (TUIMessageCellData *)getCellData:(V2TIMMessage *)message {
  11. NSDictionary *param = [NSJSONSerialization JSONObjectWithData:message.customElem.data options:NSJSONReadingAllowFragments error:nil];
  12. TXChatMusicMessage *cellData = [[TXChatMusicMessage alloc] initWithDirection:message.isSelf ? MsgDirectionOutgoing : MsgDirectionIncoming];
  13. cellData.innerMessage = message;
  14. cellData.msgID = message.msgID;
  15. cellData.songName = param[@"songName"];
  16. cellData.teacherAvatar = param[@"teacherAvatar"];
  17. cellData.teacherName = param[@"teacherName"];
  18. cellData.chargeType = param[@"chargeType"];
  19. cellData.songAuth = param[@"songAuth"];
  20. cellData.musicTagNames = param[@"musicTagNames"];
  21. cellData.songId = param[@"songId"];
  22. return cellData;
  23. }
  24. + (NSString *)getDisplayString:(V2TIMMessage *)message {
  25. return @"[曲谱分享]";
  26. }
  27. - (CGSize)contentSize {
  28. CGFloat width = ([UIScreen mainScreen].bounds.size.width > [UIScreen mainScreen].bounds.size.height ? [UIScreen mainScreen].bounds.size.height : [UIScreen mainScreen].bounds.size.width);
  29. return CGSizeMake(width, 100+20);
  30. }
  31. @end