@@ -95,7 +95,7 @@ import UIKit
9595 fatalError ( " init(coder:) has not been implemented " )
9696 }
9797
98- private func sendTextMessage( text: String ) {
98+ @ objc open func sendTextMessage( text: String ) {
9999 self . service? . roomService? . sendMessage ( text: text, roomId: ChatroomContext . shared? . roomId ?? " " , completion: { [ weak self] message, error in
100100 if error == nil {
101101 self ? . chatList. showNewMessage ( message: message, gift: nil )
@@ -114,7 +114,7 @@ import UIKit
114114 /// This method binds your view to the model it serves. A ChatroomView can only call it once. There is judgment in this method. Calling it multiple times is invalid.
115115 /// - Parameter service: ``RoomService``
116116 @objc ( connectWithService: )
117- public func connectService( _ service: RoomService ) {
117+ open func connectService( _ service: RoomService ) {
118118 if self . service != nil {
119119 return
120120 }
@@ -137,7 +137,7 @@ import UIKit
137137 /// Disconnect room service
138138 /// - Parameter service: ``RoomService``
139139 @objc ( disconnectWithService: )
140- public func disconnectService( _ service: RoomService ) {
140+ open func disconnectService( _ service: RoomService ) {
141141 self . service? . leaveRoom ( completion: { [ weak self] error in
142142 if error == nil {
143143 self ? . service = nil
@@ -199,8 +199,16 @@ extension ChatroomView: GiftMessageListTransformAnimationDataSource {
199199extension ChatroomView : MessageListActionEventsHandler {
200200
201201 public func onMessageLongPressed( message: ChatMessage ) {
202+
203+ self . showLongPressDialog ( message: message, messageActions: self . filterMessageActions ( message: message) )
204+ for delegate in self . eventHandlers. allObjects {
205+ delegate. onMessageLongPressed ( message: message)
206+ }
207+ }
208+
209+ @objc open func filterMessageActions( message: ChatMessage ) -> [ ActionSheetItemProtocol ] {
202210 if message. body. type == . custom {
203- return
211+ return [ ]
204212 }
205213 let currentUser = ChatroomContext . shared? . currentUser? . userId ?? " "
206214 var messageActions = [ ActionSheetItemProtocol] ( )
@@ -255,10 +263,7 @@ extension ChatroomView: MessageListActionEventsHandler {
255263 if message. from. lowercased ( ) != currentUser. lowercased ( ) {
256264 messageActions. removeAll { $0. tag == " Recall " }
257265 }
258- self . showLongPressDialog ( message: message, messageActions: messageActions)
259- for delegate in self . eventHandlers. allObjects {
260- delegate. onMessageLongPressed ( message: message)
261- }
266+ return messageActions
262267 }
263268
264269 private func showLongPressDialog( message: ChatMessage , messageActions: [ ActionSheetItemProtocol ] ) {
0 commit comments