下面是内存溢出 jb51.cc 通过网络收集整理的代码片段。
内存溢出小编现在分享给大家,也给大家做个参考。
ID<IemmessageBody> messageBody = [bodIEs firstObject]; chatContentModel.messageBody = messageBody; chatContentModel.ContentType = type; //普通文本消息和依靠普通文本消息扩展出来的消息类型 GJGcmessageExtendModel *extendModel = [[GJGcmessageExtendModel alloc]initWithDictionary:msgModel.ext]; switch ([messageBody messageBodyType]) { case eMessageBodyType_Image: { chatContentModel.ContentType = GJGCChatFrIEndContentTypeImage; } break; case eMessageBodyType_Text: { NSLog(@"解析扩展内容:%@",[extendModel contentDictionary]); //普通文本消息 if (!extendModel.isExtendMessageContent) { chatContentModel.ContentType = GJGCChatFrIEndContentTypeText; EMTextMessageBody *textMessageBody = (EMTextMessageBody *)messageBody; if (!GJCFNSCacheGetValue(textMessageBody.text)) { [GJGCChatFrIEndCellStyle formateSimpleTextMessage:textMessageBody.text]; } chatContentModel.originTextMessage = textMessageBody.text; } //扩展消息类型 if (extendModel.isExtendMessageContent) { chatContentModel.ContentType = extendModel.chatFrIEndContentType; //是否支持显示的扩展消息 if (extendModel.isSupportdisplay) { //进一步解析消息内容 switch (extendModel.chatFrIEndContentType) { case GJGCChatFrIEndContentTypeGif: { GJGcmessageExtendContentGIFModel *gifContent = (GJGcmessageExtendContentGIFModel *)extendModel.messageContent; chatContentModel.gifLocalID = gifContent.Emojicode; } break; case GJGCChatFrIEndContentTypeMusicShare: { GJGcmessageExtendMusicShareModel *musicContent = (GJGcmessageExtendMusicShareModel *)extendModel.messageContent; chatContentModel.musicSongID = musicContent.songID; chatContentModel.musicSongname = musicContent.Title; chatContentModel.musicSongUrl = musicContent.songUrl; chatContentModel.musicSongAuthor = musicContent.author; } break; case GJGCChatFrIEndContentTypeWebPage: { GJGcmessageExtendContentWebPageModel *webPageContent = (GJGcmessageExtendContentWebPageModel *)extendModel.messageContent; chatContentModel.webPageThumbImageData = [webPageContent.thumbImageBase64 base64DecodedData]; chatContentModel.webPageTitle = webPageContent.Title; chatContentModel.webPageSumary = webPageContent.sumary; chatContentModel.webPageUrl = webPageContent.url; } break; default: break; } } //如果不支持,需要将消息显示成文本消息 if (![extendModel isSupportdisplay]) { chatContentModel.ContentType = GJGCChatFrIEndContentTypeText; EMTextMessageBody *textMessageBody = (EMTextMessageBody *)messageBody; if (!GJCFNSCacheGetValue(textMessageBody.text)) { [GJGCChatFrIEndCellStyle formateSimpleTextMessage:textMessageBody.text]; } chatContentModel.originTextMessage = textMessageBody.text; } } } break; case eMessageBodyType_Command: { } break; case eMessageBodyType_file: { } break; case eMessageBodyType_Location: { } break; case eMessageBodyType_VIDeo: { } break; case eMessageBodyType_Voice: { chatContentModel.ContentType = GJGCChatFrIEndContentTypeAudio; EMVoiceMessageBody *voiceMessageBody = (EMVoiceMessageBody *)messageBody; chatContentModel.audioModel.localStorePath = voiceMessageBody.localPath; chatContentModel.audioModel.duration = voiceMessageBody.duration; chatContentModel.audioDuration = [GJGCChatFrIEndCellStyle formateAudioDuration:GJCFStringFromInt(chatContentModel.audioModel.duration)]; } break; default: break; } type = chatContentModel.ContentType; //解析用户信息 chatContentModel.headUrl = extendModel.userInfo.headThumb; if (chatContentModel.talkType == GJGCChatFrIEndTalkTypeGroup) { chatContentModel.sendername = [GJGCChatFrIEndCellStyle formateGroupChatSendername:extendModel.userInfo.nickname]; }
以上是内存溢出(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
总结以上是内存溢出为你收集整理的聊天框架,利用环信服务,实现的单聊群聊功能,音乐分享,网页分享扩展全部内容,希望文章能够帮你解决聊天框架,利用环信服务,实现的单聊群聊功能,音乐分享,网页分享扩展所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)