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] : ''
相关推荐
lljss202017 分钟前
Python11中创建虚拟环境、安装 TensorFlow
开发语言·python·tensorflow
代码的余温25 分钟前
Maven引入第三方JAR包实战指南
java·maven·jar
Python×CATIA工业智造3 小时前
Frida RPC高级应用:动态模拟执行Android so文件实战指南
开发语言·python·pycharm
pianmian14 小时前
类(JavaBean类)和对象
java
我叫小白菜4 小时前
【Java_EE】单例模式、阻塞队列、线程池、定时器
java·开发语言
狐凄4 小时前
Python实例题:基于 Python 的简单聊天机器人
开发语言·python
Albert Edison5 小时前
【最新版】IntelliJ IDEA 2025 创建 SpringBoot 项目
java·spring boot·intellij-idea
超级小忍5 小时前
JVM 中的垃圾回收算法及垃圾回收器详解
java·jvm
weixin_446122465 小时前
JAVA内存区域划分
java·开发语言·redis
小小小小宇5 小时前
虚拟列表兼容老DOM操作
前端