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] : ''
相关推荐
曼巴UE53 分钟前
UE C++ 字符串的操作
java·开发语言·c++
天天进步20159 分钟前
Linux 实战:如何像查看文件一样“实时监控” System V 共享内存?
开发语言·c++·算法
凛_Lin~~11 分钟前
安卓/Java语言基础八股文
java·开发语言·安卓
老华带你飞11 分钟前
出行旅游安排|基于springboot出行旅游安排系统(源码+数据库+文档)
java·数据库·vue.js·spring boot·后端·spring·旅游
八年。。13 分钟前
Python 版本确认方法
开发语言·笔记·python
foundbug99915 分钟前
基于MATLAB Simulink的双向DC-DC变换器仿真程序实现
开发语言·matlab
张拭心17 分钟前
程序员越想创业,越不要急着动手
前端·人工智能
舒一笑20 分钟前
在低配云服务器上实现自动化部署:Drone CI + Gitee Webhook 的轻量级实践
前端·后端·程序员
龙国浪子23 分钟前
从零到一:打造专业级小说地图设计工具的技术实践
前端·electron
nvvas25 分钟前
Java AI开发入门指南
java·人工智能