@@ -84,40 +84,7 @@ final class MineMessageEntity: MessageEntity {
8484
8585``` swift
8686class CustomMessageListController : MessageListController {
87-
88- // 要实现微信样式(followInput),需要同时重载下面的方法以及仿系统 UIActionSheet 样式(ActionSheet)的方法
89- override func processFollowInputAttachmentAction () {
90- if Appearance.chat.messageAttachmentMenuStyle == .followInput {
91- if let fileItem = Appearance.chat.inputExtendActions.first (where : { $0 .tag == " File" }) {
92- fileItem.action = { [weak self ] item,object in
93- self ? .handleAttachmentAction (item : item)
94- }
95- }
96- if let photoItem = Appearance.chat.inputExtendActions.first (where : { $0 .tag == " Photo" }) {
97- photoItem.action = { [weak self ] item,object in
98- self ? .handleAttachmentAction (item : item)
99- }
100- }
101- if let cameraItem = Appearance.chat.inputExtendActions.first (where : { $0 .tag == " Camera" }) {
102- cameraItem.action = { [weak self ] item,object in
103- self ? .handleAttachmentAction (item : item)
104- }
105- }
106- if let contactItem = Appearance.chat.inputExtendActions.first (where : { $0 .tag == " Contact" }) {
107- contactItem.action = { [weak self ] item,object in
108- self ? .handleAttachmentAction (item : item)
109- }
110- }
111- if let redPackageItem = Appearance.chat.inputExtendActions.first (where : { $0 .tag == " Red" }) {
112- redPackageItem.action = { [weak self ] item,object in
113- self ? .handleAttachmentAction (item : item)
114- }
115- }
116-
117- }
118- }
11987
120- // 仿系统 UIActionSheet 样式(ActionSheet)只需要重载以下方法
12188 override func handleAttachmentAction (item : any ActionSheetItemProtocol) {
12289 switch item.tag {
12390 case " File" : self .selectFile ()
@@ -191,7 +158,8 @@ extension MessageListViewModel {
191158 ComponentsRegister.shared .MessageRenderEntity = MineMessageEntity.self
192159 ComponentsRegister.shared .Conversation = MineConversationInfo.self
193160 ComponentsRegister.shared .MessageViewController = CustomMessageListController.self
194- ComponentsRegister.shared .registerCustomizeCellClass (cellType : RedPackageCell.self )
161+ // redPackageIdentifier 为Cell的唯一标识,也是环信自定义消息的时间类型
162+ ComponentsRegister.shared .registerCustomCellClasses (cellType : RedPackageCell.self ,identifier : redPackageIdentifier)
195163```
196164
197165这里的 ` ComponentsRegister.shared.Conversation = MineConversationInfo.self ` 用于在会话列表中展示收到的新类型的自定义消息内容。
0 commit comments