E10鸿蒙App

入口:EntryAbility -> onWindowStageCreate windowStage.loadContent

jsApi:JSNameConstants

App主页面:MainPage

消息主页面:MessageCenterPage

会话列表:SessionListView+IMHeaderView+AppImageKnifeComponent

会话详情:SessionPage

消息列表Item:SessionMessageListView->MessageListItemView

消息组件:

MsgReplyView

MsgRefView

TextMessageView

ImageMessageView

LocationMessageView

FileMessageView

EntityMessageView

GroupShareMessageView

UserCardMessageView

LinkMessageView

UserCardMessageView

NoticeMessageView

ExpressionMessageView

InnerMsgView

GroupSolitaireMessageView

MessageRecordView

AddOneMessageView

RevokeMessageView

ImageAndTxtView

MsgRichTxtView

VideoMessageView

VoiceMessageView

NotSupportMessageView

表情回复:MsgEmojiReplyView

消息长按操作菜单:menuContentBuilder

消息长按菜单点击:menuItemClick

群设置:GroupChatInfoPage

群成员:GroupMemberListPage

群管理:GroupManageNewPage

http接口请求:

接口在ImHttpFunctions中添加如:
  getSessionGroup(callBack:imHttpCallBack){
    let getHttpPo: ImHttpPO = new ImHttpPO()
    getHttpPo.url = ImHttpAPIConstants.getSessionGroup
    getHttpPo.method = 'get'
    interface params {
      'version':string
    }
    let par: params = {
      'version': '1'
    }
    getHttpPo.params = par
    ImHttpManager.getInstance().imSdkHttpGet(getHttpPo, {
      onSuccess(data: string) {
        let dataObj: ImHttpResponsePO = JSON.parse(data) as ImHttpResponsePO
        if(dataObj.data){
          callBack.onSuccess(dataObj.data)
        }
      },
      onError(error: string) {
        callBack.onError(error)
      }
    })
  }

sdk请求

sdk相关码ImOpcode

通知code:IMSdkNotice sdk操作码:IMSdkOpcode

//只需回调成功、失败
ImSdkFunctions.getInstance().setSessionRemind(sessionVo, optType,{
          onSuccess(jsonKey,JsonValue){

          }
        })

//ImSdkFunctions下
  setSessionRemind(sessionVo:SessionListVO,optType:string,callBack: ImOnResponse){
    let pStr = JSON.stringify({
      'group_id': 'xxx',
      'flag': 'xxx'
    })
    getDataAndSetCallback(IMSdkOpcode.kOPSetGroupAdmin, pStr, callBack)
  }


//2.需要回调数据
ImSdkFunctions.getInstance().getGroupInfo(this.groupId, {
        onSuccess(jsonKey: string, jsonStr: string) {
          let data: GroupListData = JSON.parse(jsonStr);
          if (data != null && data.datas != null && data.datas.length > 0) {
            let itemData: GroupItemData = data.datas[0];
            if (itemData != null && itemData.groupinfo != null) {
                //...
            }
          }

        }
      })

//ImSdkFunctions下
  getGroupInfo(groupId:string,callBack: ImOnResponse): boolean{
    let pStr = JSON.stringify({
      'group_ids': [groupId],
      'api_get_type':"1",
    })
    return getDataAndSetCallback(IMSdkOpcode.kOPGetGroupInfo, pStr, callBack)
  }

请求人员

PersonManager.getPerson(checkUtil.checkStr(messageVO.suid), checkUtil.checkStr(messageVO.scid), person => {
          try {
            if (person) {
//            messageParser.parseAvatarInfo(messageVO, person)
            }
            resolve(messageVO)
          } catch (e) {
            reject(e)
          }
        })

消息开关:MsgInfoSettingUtils

界面路由

//ImPageOpenUtils
  openGroupManagePage(session: SessionListVO | undefined) {
    router.pushNamedRoute({
      name: 'groupManageNewPage',
      params: {
        session: session ?? new SessionListVO()
      }
    })
  }

@Entry({ routeName: 'groupManageNewPage' })
@Component
export struct GroupManageNewPage {

}

//main_pages下
{
  "src": [
    //...
    "session/pages/GroupManageNewPage"
  ]
}

//imStaticLibrary/index下
export { GroupManageNewPage } from "./src/main/ets/session/pages/GroupManageNewPage"

多语言:

1、本地code多语言
LanguageUtils.getData(LanguageUtils.LABEL_TOPIC_SETTING, "话题设置");

2、网络code多语言
let moduleLabel: object  = ImCacheFunctions.getInstance().moudleLabelPO_ALl.label as object let str = moduleLabel[txt.id18n] ? moduleLabel[txt.id18n] : ''
相关推荐
fangxiang200810 分钟前
spring boot 集成 knife4j
java·spring boot
C++小厨神19 分钟前
Bash语言的计算机基础
开发语言·后端·golang
BinaryBardC22 分钟前
Bash语言的软件工程
开发语言·后端·golang
飞yu流星28 分钟前
C++ 函数 模板
开发语言·c++·算法
没有名字的鬼33 分钟前
C_字符数组存储汉字字符串及其索引
c语言·开发语言·数据结构
王先生技术栈42 分钟前
思维导图,Android版本实现
java·前端
生如夏花℡44 分钟前
JAVA学习记录3
java·学习·idea
专注于开发微信小程序打工人1 小时前
庐山派k230使用串口通信发送数据驱动四个轮子并且实现摄像头画面识别目标检测功能
开发语言·python
土豆凌凌七1 小时前
GO:sync.Map
开发语言·后端·golang
{⌐■_■}1 小时前
【gRPC】对称与非对称加解密和单向TLS与双向TLS讲解与go案例
java·servlet·golang