This commit is contained in:
hrxiang
2021-09-15 10:11:16 +08:00
parent 7d1ca50283
commit 32a2e6e8c5
13 changed files with 556 additions and 259 deletions

View File

@@ -180,6 +180,11 @@ public class CommonUtil {
return result
}
public static func getGroupMessageGroupid(methodCall: FlutterMethodCall)->String{
let result: String = getParamValue(methodCall: methodCall, param: KEY_GROUP_MESSAGE_GROUPID) as! String
return result
}
public static func getSingleMessageSender(methodCall: FlutterMethodCall)->String{
let result: String = getParamValue(methodCall: methodCall, param: KEY_SINGLE_MESSAGE_SENDER) as! String
return result
@@ -203,7 +208,7 @@ public class CommonUtil {
}
public static func getConversationSourceId(methodCall: FlutterMethodCall)->String {
let result: String = getParamValue(methodCall: methodCall, param: KEY_CONVERSATION_SOURCE_ID);
let result: String = getParamValue(methodCall: methodCall, param: KEY_CONVERSATION_SOURCE_ID) as! String;
return result
}
@@ -273,7 +278,7 @@ public class CommonUtil {
private static let KEY_TEXT: String = "text";
private static let KEY_AT_USER_LIST: String = "atUserList";
private static let KEY_IMAGE_PATH: String = "imagePath";
private static let KEY_SOUND_PATH: String= "soundPath";
private static let KEY_SOUND_PATH: String = "soundPath";
private static let KEY_SOUND_DURATION: String = "duration";
private static let KEY_VIDEO_PATH: String = "videoPath";
private static let KEY_VIDEO_TYPE: String = "videoType";

View File

@@ -75,60 +75,70 @@ public class GroupManager:NSObject{
Open_im_sdkRefuseGroupApplication(CommonUtil.getGroupApplicationInfo(methodCall: methodCall), CommonUtil.getGroupOpReason(methodCall: methodCall), BaseImpl(result: result))
}
func forceSyncApplyGroupRequest(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkForceSyncApplyGroupRequest()
}
func forceSyncGroupRequest(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkForceSyncGroupRequest()
}
func forceSyncJoinedGroup(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkForceSyncJoinedGroup()
}
func forceSyncJoinedGroupMember(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkForceSyncJoinedGroupMember()
}
// func forceSyncApplyGroupRequest(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
// Open_im_sdkForceSyncApplyGroupRequest()
// }
//
// func forceSyncGroupRequest(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
// Open_im_sdkForceSyncGroupRequest()
// }
//
// func forceSyncJoinedGroup(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
// Open_im_sdkForceSyncJoinedGroup()
// }
//
// func forceSyncJoinedGroupMember(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
// Open_im_sdkForceSyncJoinedGroupMember()
// }
}
public class GroupListener:NSObject,Open_im_sdkOnGroupListenerProtocol {
private let channel:FlutterMethodChannel
init(channel:FlutterMethodChannel) {
self.channel = channel
}
public func onApplicationProcessed(_ s: String?,s1: String?,i: Int?,s2: String?) {
public func onApplicationProcessed(_ groupId: String?, opUser: String?, agreeOrReject AgreeOrReject: Int32, opReason: String?) {
let values: NSMutableDictionary = NSMutableDictionary(capacity: 0)
values.setValue(s, forKey: "groupId")
values.setValue(s1, forKey: "opUser")
values.setValue(i, forKey: "agreeOrReject")
values.setValue(s2, forKey: "opReason")
values.setValue(groupId, forKey: "groupId")
values.setValue(opUser, forKey: "opUser")
values.setValue(AgreeOrReject, forKey: "agreeOrReject")
values.setValue(opReason, forKey: "opReason")
CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onApplicationProcessed", errCode: nil, errMsg: nil, data: values)
}
// public func onApplicationProcessed(_ s: String?,s1: String?,i: Int?,s2: String?) {
// let values: NSMutableDictionary = NSMutableDictionary(capacity: 0)
// values.setValue(s, forKey: "groupId")
// values.setValue(s1, forKey: "opUser")
// values.setValue(i, forKey: "agreeOrReject")
// values.setValue(s2, forKey: "opReason")
// CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onApplicationProcessed", errCode: nil, errMsg: nil, data: values)
// }
public func onGroupCreated(_ s: String?) {
let values: NSMutableDictionary = NSMutableDictionary(capacity: 0)
values.setValue(s, forKey: "groupId")
CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onGroupCreated", errCode: nil, errMsg: nil, data: values)
}
public func onGroupInfoChanged(_ s: String?,s1: String?) {
public func onGroupInfoChanged(_ s: String?,groupInfo s1: String?) {
let values: NSMutableDictionary = NSMutableDictionary(capacity: 0)
values.setValue(s, forKey: "groupId")
values.setValue(s1, forKey: "groupInfo")
CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onGroupInfoChanged", errCode: nil, errMsg: nil, data: values)
}
public func onMemberEnter(_ s: String?,s1: String?) {
public func onMemberEnter(_ s: String?,memberList s1: String?) {
let values: NSMutableDictionary = NSMutableDictionary(capacity: 0)
values.setValue(s, forKey: "groupId")
values.setValue(s1, forKey: "memberList")
CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onMemberEnter", errCode: nil, errMsg: nil, data: values)
}
public func onMemberInvited(_ s: String?,s1: String?,s2: String?) {
public func onMemberInvited(_ s: String?,opUser s1: String?,memberList s2: String?) {
let values: NSMutableDictionary = NSMutableDictionary(capacity: 0)
values.setValue(s, forKey: "groupId")
values.setValue(s1, forKey: "opUser")
@@ -136,7 +146,7 @@ public class GroupListener:NSObject,Open_im_sdkOnGroupListenerProtocol {
CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onMemberInvited", errCode: nil, errMsg: nil, data: values)
}
public func onMemberKicked(_ s: String?,s1: String?,s2: String?) {
public func onMemberKicked(_ s: String?,opUser s1: String?,memberList s2: String?) {
let values: NSMutableDictionary = NSMutableDictionary(capacity: 0)
values.setValue(s, forKey: "groupId")
values.setValue(s1, forKey: "opUser")
@@ -144,14 +154,14 @@ public class GroupListener:NSObject,Open_im_sdkOnGroupListenerProtocol {
CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onMemberKicked", errCode: nil, errMsg: nil, data: values)
}
public func onMemberLeave(_ s: String?,s1: String?) {
public func onMemberLeave(_ s: String?,member s1: String?) {
let values: NSMutableDictionary = NSMutableDictionary(capacity: 0)
values.setValue(s, forKey: "groupId")
values.setValue(s1, forKey: "member")
CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onMemberLeave", errCode: nil, errMsg: nil, data: values)
}
public func onReceiveJoinApplication(_ s: String?,s1: String?,s2: String?) {
public func onReceiveJoinApplication(_ s: String?,member s1: String?,opReason s2: String?) {
let values: NSMutableDictionary = NSMutableDictionary(capacity: 0)
values.setValue(s, forKey: "groupId")
values.setValue(s1, forKey: "member")

View File

@@ -33,7 +33,7 @@ public class IMMananger:NSObject{
}
func getLoginUid(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
DispatchQueue.main.async { result(Open_im_sdkGetLoginUid()) }
DispatchQueue.main.async { result(Open_im_sdkGetLoginUser()) }
}
func getUsersInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {

View File

@@ -42,11 +42,11 @@ public class MessageManager:NSObject{
}
func sendMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
let sendMsgProgressListener: SendMsgProgressListener= SendMsgProgressListener(channel: channel)
sendMsgProgressListener?.setCall(methodCall: methodCall)
sendMsgProgressListener?.setResult(result: result)
let sendMsgProgressListener: SendMsgProgressListener = SendMsgProgressListener(channel: channel)
sendMsgProgressListener.setCall(methodCall: methodCall)
sendMsgProgressListener.setResult(result: result)
print("===============sendMessage===============")
Open_im_sdkSendMessage(sendMsgProgressListener, CommonUtil.getSendMessageContent(methodCall: methodCall), CommonUtil.getSendMessageReceiver(methodCall: methodCall), CommonUtil.geSendMessageGroupId(methodCall: methodCall), CommonUtil.getSendMessageOnlineOnly(methodCall: methodCall))
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){
@@ -193,3 +193,4 @@ public class AdvancedMsgListener: NSObject, Open_im_sdkOnAdvancedMsgListenerProt
}
}

View File

@@ -58,7 +58,7 @@ public class SwiftFlutterOpenimSdkPlugin: NSObject, FlutterPlugin {
imManager.setSelfInfo(methodCall: call, result: result)
}else if method == "forceSyncLoginUerInfo" {
imManager.forceSyncLoginUerInfo(methodCall: call, result: result)
}}else if method == "forceReConn" {
}else if method == "forceReConn" {
imManager.forceReConn(methodCall: call, result: result)
}else{
print("Handle MethodName Error: IMManager method: \(method) not found")
@@ -164,7 +164,7 @@ public class SwiftFlutterOpenimSdkPlugin: NSObject, FlutterPlugin {
}else if method == "createForwardMessage" {
messageManager.createForwardMessage(methodCall: call, result: result)
}else if method == "getTotalUnreadMsgCount" {
conversationManager.getTotalUnreadMsgCount(methodCall: call, result: result)
messageManager.getTotalUnreadMsgCount(methodCall: call, result: result)
}else{
print("Handle MethodName Error: MessageManager method: \(method) not found")
}
@@ -202,14 +202,14 @@ public class SwiftFlutterOpenimSdkPlugin: NSObject, FlutterPlugin {
groupManager.acceptGroupApplication(methodCall: call, result: result)
}else if method == "refuseGroupApplication" {
groupManager.refuseGroupApplication(methodCall: call, result: result)
}else if method == "forceSyncApplyGroupRequest" {
groupManager.forceSyncApplyGroupRequest(methodCall: call, result: result)
}else if method == "forceSyncGroupRequest" {
groupManager.forceSyncGroupRequest(methodCall: call, result: result)
}else if method == "forceSyncJoinedGroup" {
groupManager.forceSyncJoinedGroup(methodCall: call, result: result)
}else if method == "forceSyncJoinedGroupMember" {
groupManager.forceSyncJoinedGroupMember(methodCall: call, result: result)
// }else if method == "forceSyncApplyGroupRequest" {
// groupManager.forceSyncApplyGroupRequest(methodCall: call, result: result)
// }else if method == "forceSyncGroupRequest" {
// groupManager.forceSyncGroupRequest(methodCall: call, result: result)
// }else if method == "forceSyncJoinedGroup" {
// groupManager.forceSyncJoinedGroup(methodCall: call, result: result)
// }else if method == "forceSyncJoinedGroupMember" {
// groupManager.forceSyncJoinedGroupMember(methodCall: call, result: result)
}else{
print("Handle MethodName Error: MessageManager method: \(method) not found")
}