Files
real-e-party-iOS/YuMi/Modules/YMMessage/View/NIMMessageUtils.m
edwinQQQ a35a711be6 chore: Initial clean commit
- Removed YuMi/Library/ (138 MB, not tracked)
- Removed YuMi/Resources/ (23 MB, not tracked)
- Removed old version assets (566 files, not tracked)
- Excluded Pods/, xcuserdata/ and other build artifacts
- Clean repository optimized for company server deployment
2025-10-09 16:19:14 +08:00

97 lines
3.8 KiB
Objective-C

//
// NIMMessageUtils.m
// YUMI
//
// Created by zu on 2021/11/26.
//
#import "NIMMessageUtils.h"
#import "AttachmentModel.h"
#import "ClientConfig.h"
#import "YUMIConstant.h"
@implementation NIMMessageUtils
+ (NSString *)messageContent:(NIMMessage*)message {
NSString *text = @"";
switch (message.messageType) {
case NIMMessageTypeTip:
case NIMMessageTypeText:
text = message.text;
break;
case NIMMessageTypeAudio:
text = YMLocalizedString(@"NIMMessageUtils0");
break;
case NIMMessageTypeImage:
text = YMLocalizedString(@"NIMMessageUtils1");
break;
case NIMMessageTypeVideo:
text = YMLocalizedString(@"NIMMessageUtils2");
break;
case NIMMessageTypeLocation:
text = YMLocalizedString(@"NIMMessageUtils3");
break;
case NIMMessageTypeFile:
text = YMLocalizedString(@"NIMMessageUtils4");
break;
case NIMMessageTypeCustom: {
NIMCustomObject *obj = (NIMCustomObject *) message.messageObject;
AttachmentModel *attachment = (AttachmentModel *) obj.attachment;
if (attachment.first == CustomMessageType_Secretary) {
if (attachment.second == Custom_Message_Sub_Secretary_Router) {
text = attachment.data[@"title"];
}
} else if(attachment.first == CustomMessageType_Gift) {
if (attachment.second == Custom_Message_Sub_Gift_Send) {
text = YMLocalizedString(@"NIMMessageUtils5");
}
} else if(attachment.first == CustomMessageType_Hall || attachment.first == CustomMessageType_New_Hall) {
text = YMLocalizedString(@"NIMMessageUtils6");
} else if(attachment.first == CustomMessageType_Member_Online && attachment.second == Custom_Message_Type_Attention_Member_Online) {
return YMLocalizedString(@"NIMMessageUtils7");
} else if(attachment.first == CustomMessageType_Application_Share && attachment.second == Custom_Message_Sub_Application_Share_Room) {
return YMLocalizedString(@"NIMMessageUtils8");
}else if(attachment.first == CustomMessageType_User_UpGrade && (attachment.second == Custom_Message_Sub_User_UpGrade_Charm || attachment.second == Custom_Message_Sub_User_UpGrade_Exper)) {
return YMLocalizedString(@"NIMMessageUtils9");
} else if(attachment.first == CustomMessageType_Tweet && attachment.second == Custom_Message_Sub_Tweet_News) {
return YMLocalizedString(@"NIMMessageUtils10");
} else if(attachment.first == CustomMessageType_FindNew && attachment.second == Custom_Message_Find_New_Greet_New_User) {
NSString * text = attachment.data[@"message"];
return text.length > 0 ? text : YMLocalizedString(@"NIMMessageUtils11");
} else if(attachment.first == CustomMessageType_Monents && attachment.second == Custom_Message_Sub_Monents_Share) {
return YMLocalizedString(@"NIMMessageUtils12");;
} else if(attachment.first == CustomMessageType_RedPacket && attachment.second == Custom_Message_Sub_AllDiamandRedPacket) {
return YMLocalizedString(@"NIMMessageUtils13");;
} else {
text = YMLocalizedString(@"NIMMessageUtils14");;
}
if (!text) {
text = message.text;
}
}
break;
default:
text = YMLocalizedString(@"NIMMessageUtils15");;
break;
}
return text;
}
+ (BOOL)isOfficalAccount:(NSString *)uid {
if (uid.integerValue <= 0) {
return NO;
}
if ([[ClientConfig shareConfig].configInfo.officialMsgUids containsObject:uid]) {
return YES;
}
if ([[ClientConfig shareConfig].configInfo.officialAccountUids containsObject:uid]) {
return YES;
}
return ([KeyWithType(KeyType_SecretaryUidKey) isEqualToString:uid] || [KeyWithType(KeyType_SystemNotifiUidKey) isEqualToString:uid] || [KeyWithType(KeyType_GuildUidKey) isEqualToString:uid]);
return NO;
}
@end