import Foundation import OpenIMCore public class ChannelManager: BaseServiceManager { public override func registerHandlers() { super.registerHandlers() // self["changeChannelMemberMute"] = changeChannelMemberMute // self["changeChannelMute"] = changeChannelMute // self["getChannelMemberList"] = getChannelMemberList self["getChannelMembersInfo"] = getChannelMembersInfo self["getChannelsInfo"] = getChannelsInfo self["getUsersInChannel"] = getUsersInChannel self["isJoinChannel"] = isJoinChannel self["joinChannel"] = joinChannel self["quitChannel"] = quitChannel self["setChannelListener"] = setChannelListener } // func changeChannelMemberMute(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { // Open_im_sdkChangeChannelMemberMute(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "channelID"], methodCall[string:"userID"], methodCall[int:"seconds"]) // } // // func changeChannelMute(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { // Open_im_sdkChangeChannelMute(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "channelID"], methodCall[bool: "mute"]) // } // // func getChannelMemberList(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { // Open_im_sdkGetChannelMemberList(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "channelID"], methodCall[int32: "filter"], // methodCall[int32: "offset"], methodCall[int32: "count"]) // } func getChannelMembersInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { Open_im_sdkGetSpecifiedChannelMembersInfo(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "channelID"], methodCall[jsonString: "userIDList"]) } func getChannelsInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { Open_im_sdkGetSpecifiedChannelsInfo(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "channelIDList"]) } func getUsersInChannel(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { Open_im_sdkGetUsersInChannel(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "channelID"], methodCall[jsonString: "userIDs"]) } func isJoinChannel(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { Open_im_sdkIsJoinChannel(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "channelID"]) } func joinChannel(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { Open_im_sdkJoinChannel(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "channelID"], methodCall[string: "reason"], methodCall[int32: "joinSource"], methodCall[jsonString: "ex"]) } func quitChannel(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { Open_im_sdkQuitChannel(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "channelID"]) } func setChannelListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { Open_im_sdkSetChannelListener(ChannelListener(channel: channel)) callBack(result) } } public class ChannelListener: NSObject, Open_im_sdk_callbackOnChannelListenerProtocol { private let channel: FlutterMethodChannel init(channel: FlutterMethodChannel) { self.channel = channel } public func onChannelDismissed(_ s: String?) { CommonUtil.emitEvent(channel: channel, method: "channelListener", type: "onChannelDismissed", errCode: nil, errMsg: nil, data: s) } public func onChannelInfoChanged(_ s: String?) { CommonUtil.emitEvent(channel: channel, method: "channelListener", type: "onChannelInfoChanged", errCode: nil, errMsg: nil, data: s) } public func onChannelMemberAdded(_ s: String?) { CommonUtil.emitEvent(channel: channel, method: "channelListener", type: "onChannelMemberAdded", errCode: nil, errMsg: nil, data: s) } public func onChannelMemberDeleted(_ s: String?) { CommonUtil.emitEvent(channel: channel, method: "channelListener", type: "onChannelMemberDeleted", errCode: nil, errMsg: nil, data: s) } public func onChannelMemberInfoChanged(_ s: String?) { CommonUtil.emitEvent(channel: channel, method: "channelListener", type: "onChannelMemberInfoChanged", errCode: nil, errMsg: nil, data: s) } }