new add ios support

This commit is contained in:
hrxiang
2021-07-06 11:39:31 +08:00
parent d613703524
commit 073b91ba99
47 changed files with 4554 additions and 170 deletions

View File

@@ -0,0 +1,88 @@
//
// ConversationManager.swift
// Runner
//
// Created by z1u24 on 2021/6/29.
//
import Foundation
import OpenIMCore
public class ConversationManager:NSObject{
private let channel:FlutterMethodChannel
init(channel:FlutterMethodChannel) {
self.channel = channel
}
func setConversationListener(methodCall: FlutterMethodCall, result: FlutterResult){
Open_im_sdkSetConversationListener(ConversationListenerImpl(channel: channel))
}
func getAllConversationList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetAllConversationList(BaseImpl(result: result))
}
func getOneConversation(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetOneConversation(CommonUtil.getConversationId(methodCall: methodCall), CommonUtil.getSessionType(methodCall: methodCall), BaseImpl(result: result))
}
func getMultipleConversation(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetMultipleConversation(CommonUtil.getConversationIds(methodCall: methodCall), BaseImpl(result: result))
}
func deleteConversation(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkDeleteConversation(CommonUtil.getConversationId(methodCall: methodCall), BaseImpl(result: result))
}
func setConversationDraft(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkSetConversationDraft(CommonUtil.getConversationId(methodCall: methodCall), CommonUtil.getConversationDraft(methodCall: methodCall), BaseImpl(result: result))
}
func pinConversation(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkPinConversation(CommonUtil.getConversationId(methodCall: methodCall), CommonUtil.isPinnedConversation(methodCall: methodCall), BaseImpl(result: result))
}
func getTotalUnreadMsgCount(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetTotalUnreadMsgCount(BaseImpl(result: result))
}
}
public class ConversationListenerImpl:NSObject,Open_im_sdkOnConversationListenerProtocol {
private let channel:FlutterMethodChannel
init(channel:FlutterMethodChannel) {
self.channel = channel
}
public func onConversationChanged(_ conversationList: String?) {
CommonUtil.emitEvent(channel: channel, method: "conversationListener", type: "onConversationChanged", errCode: nil, errMsg: nil, data: conversationList)
}
public func onNewConversation(_ conversationList: String?) {
CommonUtil.emitEvent(channel: channel, method: "conversationListener", type: "onNewConversation", errCode: nil, errMsg: nil, data: conversationList)
}
public func onSyncServerFailed() {
CommonUtil.emitEvent(channel: channel, method: "conversationListener", type: "onSyncServerFailed", errCode: nil, errMsg: nil, data: nil)
}
public func onSyncServerFinish() {
CommonUtil.emitEvent(channel: channel, method: "conversationListener", type: "onSyncServerFinish", errCode: nil, errMsg: nil, data: nil)
}
public func onSyncServerStart() {
CommonUtil.emitEvent(channel: channel, method: "conversationListener", type: "onSyncServerStart", errCode: nil, errMsg: nil, data: nil)
}
public func onTotalUnreadMessageCountChanged(_ totalUnreadCount: Int32) {
CommonUtil.emitEvent(channel: channel, method: "conversationListener", type: "onTotalUnreadMessageCountChanged", errCode: nil, errMsg: nil, data: totalUnreadCount)
}
}

View File

@@ -0,0 +1,126 @@
//
// FriendshipManager.swift
// Runner
//
// Created by z1u24 on 2021/6/29.
//
import Foundation
import OpenIMCore
public class FriendshipManager:NSObject{
private let channel:FlutterMethodChannel
init(channel:FlutterMethodChannel) {
self.channel = channel
}
func setFriendListener(methodCall: FlutterMethodCall, result: FlutterResult){
Open_im_sdkSetFriendListener(FriendshipListenerImpl(channel: channel))
}
func getFriendsInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetFriendsInfo(BaseImpl(result: result), CommonUtil.getUidList(methodCall: methodCall))
}
func addFriend(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkAddFriend(BaseImpl(result: result), CommonUtil.getSDKJsonParam(methodCall: methodCall))
}
func getFriendApplicationList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetFriendApplicationList(BaseImpl(result: result))
}
func getFriendList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetFriendList(BaseImpl(result: result))
}
func setFriendInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkSetFriendInfo(CommonUtil.getSDKJsonParam(methodCall: methodCall), BaseImpl(result: result))
}
func addToBlackList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkAddToBlackList(BaseImpl(result: result), CommonUtil.getUserUid(methodCall: methodCall))
}
func getBlackList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetBlackList(BaseImpl(result: result))
}
func deleteFromBlackList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkDeleteFromBlackList(BaseImpl(result: result), CommonUtil.getUserUid(methodCall: methodCall))
}
func checkFriend(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkCheckFriend(BaseImpl(result: result), CommonUtil.getUidList(methodCall: methodCall))
}
func deleteFromFriendList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkDeleteFromFriendList(CommonUtil.getDeleteUid(methodCall: methodCall), BaseImpl(result: result))
}
func acceptFriendApplication(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkAcceptFriendApplication(BaseImpl(result: result), CommonUtil.getUid(methodCall: methodCall))
}
func refuseFriendApplication(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkRefuseFriendApplication(BaseImpl(result: result), CommonUtil.getUid(methodCall: methodCall))
}
func forceSyncFriendApplication(methodCall: FlutterMethodCall, result: FlutterResult){
Open_im_sdkForceSyncFriendApplication();
}
func forceSyncFriend(methodCall: FlutterMethodCall, result: FlutterResult){
Open_im_sdkForceSyncFriend()
}
func forceSyncBlackList(methodCall: FlutterMethodCall, result: FlutterResult){
Open_im_sdkForceSyncBlackList()
}
}
public class FriendshipListenerImpl:NSObject,Open_im_sdkOnFriendshipListenerProtocol {
private let channel:FlutterMethodChannel
init(channel:FlutterMethodChannel) {
self.channel = channel
}
public func onBlackListAdd(_ userInfo: String?) {
CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onBlackListAdd", errCode: nil, errMsg: nil, data: userInfo)
}
public func onBlackListDeleted(_ userInfo: String?) {
CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onBlackListDeleted", errCode: nil, errMsg: nil, data: userInfo)
}
public func onFriendApplicationListAccept(_ applyUserInfo: String?) {
CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onFriendApplicationListAccept", errCode: nil, errMsg: nil, data: applyUserInfo)
}
public func onFriendApplicationListAdded(_ applyUserInfo: String?) {
CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onFriendApplicationListAdded", errCode: nil, errMsg: nil, data: applyUserInfo)
}
public func onFriendApplicationListDeleted(_ applyUserInfo: String?) {
CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onFriendApplicationListDeleted", errCode: nil, errMsg: nil, data: applyUserInfo)
}
public func onFriendApplicationListReject(_ applyUserInfo: String?) {
CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onFriendApplicationListReject", errCode: nil, errMsg: nil, data: applyUserInfo)
}
public func onFriendInfoChanged(_ friendInfo: String?) {
CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onFriendInfoChanged", errCode: nil, errMsg: nil, data: friendInfo)
}
public func onFriendListAdded(_ friendInfo: String?) {
CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onFriendListAdded", errCode: nil, errMsg: nil, data: friendInfo)
}
public func onFriendListDeleted(_ friendInfo: String?) {
CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onFriendListDeleted", errCode: nil, errMsg: nil, data: friendInfo)
}
}

View File

@@ -0,0 +1,74 @@
//
// GroupManager.swift
// flutter_openim_sdk
//
// Created by z1u24 on 2021/7/5.
//
import Foundation
import OpenIMCore
public class GroupManager:NSObject{
private let channel:FlutterMethodChannel
init(channel:FlutterMethodChannel) {
self.channel = channel
}
func inviteUserToGroup(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkInviteUserToGroup(CommonUtil.getGroupId(methodCall: methodCall), CommonUtil.getGroupReason(methodCall: methodCall), CommonUtil.getGroupUserList(methodCall: methodCall), BaseImpl(result: result))
}
func kickGroupMember(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkKickGroupMember(CommonUtil.getGroupId(methodCall: methodCall), CommonUtil.getGroupUserList(methodCall: methodCall), CommonUtil.getGroupReason(methodCall: methodCall), BaseImpl(result: result))
}
func getGroupMembersInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetGroupMembersInfo(CommonUtil.getGroupId(methodCall: methodCall), CommonUtil.getGroupUserList(methodCall: methodCall), BaseImpl(result: result))
}
func getGroupMemberList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetGroupMemberList(CommonUtil.getGroupId(methodCall: methodCall), CommonUtil.getGroupFilter(methodCall: methodCall), CommonUtil.getGroupNext(methodCall: methodCall), BaseImpl(result: result))
}
func getJoinedGroupList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetJoinedGroupList(BaseImpl(result: result))
}
func createGroup(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkCreateGroup(CommonUtil.getGroupInfo(methodCall: methodCall), CommonUtil.getGroupMemberList(methodCall: methodCall), BaseImpl(result: result))
}
func setGroupInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkSetGroupInfo(CommonUtil.getGroupJsonInfo(methodCall: methodCall), BaseImpl(result: result))
}
func getGroupsInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetGroupsInfo(CommonUtil.getGroupIdList(methodCall: methodCall), BaseImpl(result: result))
}
func joinGroup(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkJoinGroup(CommonUtil.getGroupId(methodCall: methodCall), CommonUtil.getGroupMessage(methodCall: methodCall), BaseImpl(result: result))
}
func quitGroup(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkQuitGroup(CommonUtil.getGroupId(methodCall: methodCall), BaseImpl(result: result))
}
func transferGroupOwner(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkTransferGroupOwner(CommonUtil.getGroupId(methodCall: methodCall), CommonUtil.getGroupUserId(methodCall: methodCall), BaseImpl(result: result))
}
func getGroupApplicationList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetGroupApplicationList(BaseImpl(result: result))
}
func acceptGroupApplication(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkAcceptGroupApplication(CommonUtil.getGroupApplication(methodCall: methodCall), CommonUtil.getGroupReason(methodCall: methodCall), BaseImpl(result: result))
}
func refuseGroupApplication(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkRefuseGroupApplication(CommonUtil.getGroupApplication(methodCall: methodCall), CommonUtil.getGroupReason(methodCall: methodCall), BaseImpl(result: result))
}
}

View File

@@ -0,0 +1,101 @@
//
// IMManager.swift
// Runner
//
// Created by z1u24 on 2021/6/28.
//
import Foundation
import OpenIMCore
public class IMMananger:NSObject{
private let channel:FlutterMethodChannel
init(channel:FlutterMethodChannel) {
self.channel = channel
}
func initSDK(methodCall: FlutterMethodCall, result: FlutterResult){
Open_im_sdkInitSDK(CommonUtil.getSDKJsonParam(methodCall: methodCall), SDKListenerImpl(channel: self.channel))
}
func login(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkLogin(CommonUtil.getUid(methodCall: methodCall), CommonUtil.getToken(methodCall: methodCall), BaseImpl(result: result))
}
func logout(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkLogout(BaseImpl(result: result))
}
func getLoginStatus(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
DispatchQueue.main.async { result(Open_im_sdkGetLoginStatus()) }
}
func getLoginUid(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
DispatchQueue.main.async { result(Open_im_sdkGetLoginUser()) }
}
func getUsersInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkGetUsersInfo(CommonUtil.getUidList(methodCall: methodCall), BaseImpl(result: result))
}
func setSelfInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkSetSelfInfo(CommonUtil.getSDKJsonParam(methodCall: methodCall), BaseImpl(result: result))
}
func forceSyncLoginUerInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkForceSyncLoginUerInfo()
}
}
public class SDKListenerImpl:NSObject,Open_im_sdkIMSDKListenerProtocol {
private let channel:FlutterMethodChannel
init(channel:FlutterMethodChannel) {
self.channel = channel
}
public func onConnectFailed(_ errCode: Int, errMsg: String?) {
CommonUtil.emitEvent(channel: self.channel, method: "initSDKListener", type: "onConnectFailed", errCode: errCode, errMsg: errMsg, data: nil)
}
public func onConnectSuccess() {
CommonUtil.emitEvent(channel: self.channel, method: "initSDKListener", type: "onConnectSuccess", errCode: nil, errMsg: nil, data: nil);
}
public func onConnecting() {
CommonUtil.emitEvent(channel: self.channel, method: "initSDKListener", type: "onConnecting", errCode: nil, errMsg: nil, data: nil);
}
public func onKickedOffline() {
CommonUtil.emitEvent(channel: self.channel, method: "initSDKListener", type: "onKickedOffline", errCode: nil, errMsg: nil, data: nil);
}
public func onSelfInfoUpdated(_ userInfo: String?) {
CommonUtil.emitEvent(channel: self.channel, method: "initSDKListener", type: "onSelfInfoUpdated", errCode: nil, errMsg: nil, data: userInfo);
}
public func onUserTokenExpired() {
CommonUtil.emitEvent(channel: self.channel, method: "initSDKListener", type: "onUserTokenExpired", errCode: nil, errMsg: nil, data: nil);
}
}
public class BaseImpl:NSObject,Open_im_sdkBaseProtocol {
private let result:FlutterResult
init(result:@escaping FlutterResult) {
self.result = result
}
public func onError(_ errCode: Int, errMsg: String?) {
print("BaseImpl: " + errMsg!)
DispatchQueue.main.async { self.result(FlutterError(code: "\(errCode)", message: errMsg, details: nil)) }
}
public func onSuccess(_ data: String?) {
DispatchQueue.main.async { self.result(data) }
}
}

View File

@@ -0,0 +1,187 @@
//
// MessageManager.swift
// Runner
//
// Created by z1u24 on 2021/6/29.
//
import Foundation
import OpenIMCore
public class MessageManager:NSObject{
private let KEY_ID: String = "id"
private let channel:FlutterMethodChannel
private let listeners: NSMutableDictionary = NSMutableDictionary(capacity: 0)
private var sendMsgProgressListener: SendMsgProgressListener?
init(channel:FlutterMethodChannel) {
self.channel = channel
}
func addAdvancedMsgListener(methodCall: FlutterMethodCall, result: FlutterResult){
if sendMsgProgressListener == nil {
sendMsgProgressListener = SendMsgProgressListener(channel: channel)
}
let d = methodCall.arguments as! NSDictionary
let key = d.value(forKey: KEY_ID) as! String
if !listeners.allKeys.contains(where: {($0 as! String).compare(key) == .orderedSame}) {
let lis = AdvancedMsgListenerImpl(channel: channel, id: key)
let k = methodCall.arguments as! NSDictionary
let s = k.value(forKey: KEY_ID) as! String
listeners.setValue(lis, forKey: s)
Open_im_sdkAddAdvancedMsgListener(lis)
print("=================add msg listener======\n\(lis)");
}
}
func removeAdvancedMsgListener(methodCall: FlutterMethodCall, result: FlutterResult){
let k = methodCall.arguments as! NSDictionary
let s = k.value(forKey: KEY_ID) as! String
if listeners.allKeys.contains(where: {($0 as! String).compare(s) == .orderedSame}) {
let lis = listeners.value(forKey: s) as! AdvancedMsgListenerImpl
listeners.removeObject(forKey: s)
Open_im_sdkRemoveAdvancedMsgListener(lis)
}
}
func sendMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
sendMsgProgressListener?.setCall(methodCall: methodCall)
sendMsgProgressListener?.setResult(result: result)
print("===============sendMessage===============")
Open_im_sdkSendMessage(sendMsgProgressListener, CommonUtil.getSendMessageContent(methodCall: methodCall), CommonUtil.getSendMessageReceiver(methodCall: methodCall), CommonUtil.getSendMessageGroupId(methodCall: methodCall), CommonUtil.getSendMessageOnlineOnly(methodCall: methodCall))
}
func getHistoryMessageList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetHistoryMessageList(BaseImpl(result: result), CommonUtil.getSDKJsonParam(methodCall: methodCall))
}
func revokeMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkRevokeMessage(BaseImpl(result: result), CommonUtil.getSDKJsonParam(methodCall: methodCall))
}
func deleteMessageFromLocalStorage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkDeleteMessageFromLocalStorage(BaseImpl(result: result), CommonUtil.getSDKJsonParam(methodCall: methodCall))
}
func deleteMessages(methodCall: FlutterMethodCall, result: FlutterResult){
}
func insertSingleMessageToLocalStorage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkInsertSingleMessageToLocalStorage(BaseImpl(result: result), CommonUtil.getSingleMessageContent(methodCall: methodCall), CommonUtil.getSingleMessageUserid(methodCall: methodCall), CommonUtil.getSingleMessageSender(methodCall: methodCall))
}
func findMessages(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkFindMessages(BaseImpl(result: result), CommonUtil.getFindMessageIds(methodCall: methodCall))
}
func markSingleMessageHasRead(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkMarkSingleMessageHasRead(BaseImpl(result: result), CommonUtil.getSingleMessageUserid(methodCall: methodCall))
}
func createTextMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
let prama = Open_im_sdkCreateTextMessage(CommonUtil.getMessageText(methodCall: methodCall))
DispatchQueue.main.async { result(prama) }
}
func createTextAtMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
let prama = Open_im_sdkCreateTextAtMessage(CommonUtil.getMessageText(methodCall: methodCall), CommonUtil.getAtUserList(methodCall: methodCall))
DispatchQueue.main.async { result(prama) }
}
func createImageMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
let prama = Open_im_sdkCreateImageMessage(CommonUtil.getImagePath(methodCall: methodCall))
DispatchQueue.main.async { result(prama) }
}
func createSoundMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
let prama = Open_im_sdkCreateSoundMessage(CommonUtil.getSoundPath(methodCall: methodCall),CommonUtil.getSoundDuration(methodCall: methodCall))
DispatchQueue.main.async { result(prama) }
}
func createVideoMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
let prama = Open_im_sdkCreateVideoMessage(CommonUtil.getVideoPath(methodCall: methodCall), CommonUtil.getVideoType(methodCall: methodCall), CommonUtil.getVideoDuration(methodCall: methodCall), CommonUtil.getVideoSnapshotPath(methodCall: methodCall))
DispatchQueue.main.async { result(prama) }
}
func createFileMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
let prama = Open_im_sdkCreateFileMessage(CommonUtil.getFilePath(methodCall: methodCall), CommonUtil.getFileName(methodCall: methodCall))
DispatchQueue.main.async { result(prama) }
}
func createMergerMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
let prama = Open_im_sdkCreateMergerMessage(CommonUtil.getMergerMessageList(methodCall: methodCall), CommonUtil.getMergerMessageTitle(methodCall: methodCall), CommonUtil.getSummaryList(methodCall: methodCall))
DispatchQueue.main.async { result(prama) }
}
func createForwardMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
let prama = Open_im_sdkCreateForwardMessage(CommonUtil.getForwardMessage(methodCall: methodCall))
DispatchQueue.main.async { result(prama) }
}
}
public class SendMsgProgressListener:NSObject, Open_im_sdkSendMsgCallBackProtocol {
private let channel: FlutterMethodChannel
private var result: FlutterResult?
private var call: FlutterMethodCall?
private let values: NSMutableDictionary = NSMutableDictionary(capacity: 0)
init(channel: FlutterMethodChannel) {
self.channel = channel
}
func setResult(result: @escaping FlutterResult){
self.result = result
}
func setCall(methodCall: FlutterMethodCall){
self.call = methodCall
}
public func onError(_ errCode: Int, errMsg: String?) {
print("=================onError============\nerrcode:\(errCode),errMsg:\(errMsg!)");
DispatchQueue.main.async { self.result!(FlutterError(code: "\(errCode)", message: errMsg, details: nil)) }
}
public func onProgress(_ progress: Int) {
print("=================onProgress============\nprogress:\(progress)");
values.setValue(CommonUtil.getSendMessageClientMsgID(methodCall: self.call!), forKey: "clientMsgID")
values.setValue(progress, forKey: "progress")
CommonUtil.emitEvent(channel: channel, method: "messageProgressListener", type: "onProgress", errCode: nil, errMsg: nil, data: values)
}
public func onSuccess(_ data: String?) {
print("=================onSuccess============\nsuccess:\(data!)");
DispatchQueue.main.async { self.result!(data) }
}
}
public class AdvancedMsgListenerImpl: NSObject, Open_im_sdkOnAdvancedMsgListenerProtocol {
private let channel: FlutterMethodChannel
private let values: NSMutableDictionary = NSMutableDictionary(capacity: 0)
init(channel: FlutterMethodChannel, id: String) {
self.channel = channel
values.setValue(id, forKey: "id")
}
public func onRecvC2CReadReceipt(_ msgReceiptList: String?) {
values.setValue(msgReceiptList, forKey: "message")
CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onRecvC2CReadReceipt", errCode: nil, errMsg: nil, data: values)
}
public func onRecvMessageRevoked(_ msgId: String?) {
values.setValue(msgId, forKey: "message")
CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onRecvMessageRevoked", errCode: nil, errMsg: nil, data: values)
}
public func onRecvNewMessage(_ message: String?) {
values.setValue(message, forKey: "message")
CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onRecvNewMessage", errCode: nil, errMsg: nil, data: values)
}
}