扩展消息部分代码提交
This commit is contained in:
@@ -36,6 +36,7 @@ import {
|
||||
V2NIMMessageFileAttachment,
|
||||
V2NIMMessagePinNotification,
|
||||
V2NIMMessagePinState,
|
||||
V2NIMMessagePushConfig,
|
||||
V2NIMMessageRevokeNotification,
|
||||
V2NIMMessageSendingState,
|
||||
V2NIMMessageType,
|
||||
@@ -57,10 +58,10 @@ import { ChatKitConfig } from '../ChatKitConfig';
|
||||
import { sceneMap } from '@kit.MapKit';
|
||||
import { clearForwardAtMark, createForwardMessageListFileDetail, sendMessageFailedTips } from '../common/MessageHelper';
|
||||
import { instanceToPlain } from 'class-transformer';
|
||||
import { NECommonUtils } from '@nimkit/common';
|
||||
import { NECommonUtils, UserUtils } from '@nimkit/common';
|
||||
import { HashMap, JSON } from '@kit.ArkTS';
|
||||
import { assign } from '@nimsdk/vendor';
|
||||
import { BasicConstant, ChatExtModel } from '@itcast/basic';
|
||||
import { BasicConstant, ChatExtModel, preferenceStore } from '@itcast/basic';
|
||||
|
||||
@ObservedV2
|
||||
export class ChatBaseViewModel {
|
||||
@@ -654,13 +655,14 @@ export class ChatBaseViewModel {
|
||||
}
|
||||
|
||||
// 消息发送之前调用,用于配置消息通用参数
|
||||
beforeSendMessage(msg: V2NIMMessage): V2NIMMessage {
|
||||
beforeSendMessage(msg: V2NIMMessage){
|
||||
// if (ChatKitConfig.messageReadState) {
|
||||
// let msgConfig: V2NIMMessageConfig = {
|
||||
// readReceiptEnabled: false
|
||||
// }
|
||||
// msg.messageConfig = msgConfig
|
||||
// }
|
||||
|
||||
return msg
|
||||
}
|
||||
|
||||
@@ -689,12 +691,7 @@ export class ChatBaseViewModel {
|
||||
// let extension = JSON.stringify(instanceToPlain(extensionMap))
|
||||
// message.serverExtension = extension
|
||||
// }
|
||||
let extension:ChatExtModel= {
|
||||
gdxz_sessionType: '',
|
||||
gdxz_consult_uuid: '',
|
||||
gdxz_nickName: ''
|
||||
}
|
||||
message.serverExtension =JSON.stringify(extension)
|
||||
|
||||
|
||||
|
||||
//设置推送
|
||||
@@ -911,6 +908,19 @@ export class ChatBaseViewModel {
|
||||
* @param progress 消息发送进度
|
||||
*/
|
||||
async sendMessage(msg: V2NIMMessage, params?: V2NIMSendMessageParams, progress?: (percentage: number) => void) {
|
||||
let extension:ChatExtModel= {
|
||||
gdxz_sessionType: preferenceStore.getItemString('gdxz_sessionType'),
|
||||
gdxz_consult_uuid: preferenceStore.getItemString('gdxz_consult_uuid')+'',
|
||||
gdxz_nickName:await UserUtils.getAvatarName(ChatKitClient.nim.conversationIdUtil.parseConversationTargetId(this.conversationId),'')
|
||||
}
|
||||
msg.serverExtension =JSON.stringify(extension)
|
||||
// Map<String,Integer> p=new HashMap<>();
|
||||
// p.put("classification",1);
|
||||
// payload.put("vivoField",p);//vivo推送
|
||||
// payload.put("apns-collapse-id", "321");//ios需要
|
||||
// payload.put("apns-from-id", NimUIKit.getAccount());//ios需要
|
||||
// msg.pushConfig = {} as V2NIMMessagePushConfig
|
||||
// msg.pushConfig.pushPayload=''
|
||||
ChatRepo.sendMessage(this.beforeSendMessage(msg), this.conversationId!, params, progress)
|
||||
.catch((err: BusinessError) => {
|
||||
console.error("net ease send message error", err.code, err.message);
|
||||
|
||||
Reference in New Issue
Block a user