Skip to content

Commit

Permalink
add sample code (#403)
Browse files Browse the repository at this point in the history
* add sample code

* update Podfile

---------

Co-authored-by: 张诗文 <[email protected]>
  • Loading branch information
zsw666 and 张诗文 authored Sep 30, 2024
1 parent c392e82 commit a3b9a07
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 9 deletions.
14 changes: 7 additions & 7 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ target 'app' do

# 基础库
pod 'NIMSDK_LITE','10.3.1-beta'
pod 'NEChatKit', '10.3.0'
pod 'NEChatKit', '10.3.1'

# UI 组件,依次为通讯录组件、会话列表组件、会话(聊天)组件、群相关设置组件
pod 'NEChatUIKit', '10.3.0'
pod 'NEContactUIKit', '10.3.0'
pod 'NEConversationUIKit', '10.3.0'
pod 'NETeamUIKit', '10.3.0'
pod 'NEChatUIKit', '10.3.1'
pod 'NEContactUIKit', '10.3.1'
pod 'NEConversationUIKit', '10.3.1'
pod 'NETeamUIKit', '10.3.1'

# 扩展库 - 地理位置组件
pod 'NEMapKit', '10.3.0'
pod 'NEMapKit', '10.3.1'

# 扩展库 - AI 划词搜索
pod 'NEAISearchKit', '1.0.0'
pod 'NEAISearchKit', '1.0.2'

# 扩展库 - 呼叫组件
pod 'NERtcCallKit/NOS_Special', '2.4.0'
Expand Down
5 changes: 3 additions & 2 deletions app/Custom/CustomP2PChatViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,9 @@ class CustomP2PChatViewController: P2PChatViewController {
}

@objc func sendCustomButton() {
// type 字段必须指定,且不可为 101、102(UIKit 内部已使用),否则解析为【未知消息体】
let dataDic: [String: Any] = ["type": customMessageType]
// type 自定义消息类型,该字段必须指定,且不可为 101、102(UIKit 内部已使用),否则解析为【未知消息体】
// customHeight 自定义消息的高度
let dataDic: [String: Any] = ["type": customMessageType, "customHeight": 100]
let dataJson = NECommonUtil.getJSONStringFromDictionary(dataDic)
let customMessage = MessageUtils.customMessage(text: "this is a custom message, create time:\(Date.timeIntervalSinceReferenceDate)",
rawAttachment: dataJson)
Expand Down
19 changes: 19 additions & 0 deletions app/Main/NETabBarController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,33 @@ class NETabBarController: UITabBarController, NEConversationListener, NEContactL
}
}

// 设置通讯录未读显示状态
func setUpContactBadgeValue() {
ContactRepo.shared.getUnreadApplicationCount { [self] unreadCount, error in
contactUnreadCount = unreadCount

// 显示红点
if unreadCount > 0 {
tabBar.showBadgOn(index: 1, tabbarItemNums: 3)
} else {
tabBar.hideBadg(on: 1)
}

// // 显示未读数
// setupContactBadge(unreadCount: unreadCount)
}
}

// 设置通讯录显示未读数
func setupContactBadge(unreadCount: Int) {
if unreadCount > 0 {
if unreadCount > 99 {
tabBar.setServerBadge(count: "99+")
} else {
tabBar.setServerBadge(count: "\(unreadCount)")
}
} else {
tabBar.setServerBadge(count: nil)
}
}

Expand Down

0 comments on commit a3b9a07

Please sign in to comment.