add group fuc
This commit is contained in:
@@ -16,6 +16,7 @@ import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
|
||||
import io.flutter.plugin.common.MethodChannel.Result;
|
||||
import io.openim.flutter_openim_sdk.manager.ConversationManager;
|
||||
import io.openim.flutter_openim_sdk.manager.FriendshipManager;
|
||||
import io.openim.flutter_openim_sdk.manager.GroupManager;
|
||||
import io.openim.flutter_openim_sdk.manager.IMManager;
|
||||
import io.openim.flutter_openim_sdk.manager.MessageManager;
|
||||
import io.openim.flutter_openim_sdk.util.CommonUtil;
|
||||
@@ -35,6 +36,7 @@ public class FlutterOpenimSdkPlugin implements FlutterPlugin, MethodCallHandler
|
||||
private static FriendshipManager friendshipManager;
|
||||
private static MessageManager messageManager;
|
||||
private static ConversationManager conversationManager;
|
||||
private static GroupManager groupManager;
|
||||
|
||||
public FlutterOpenimSdkPlugin() {
|
||||
}
|
||||
@@ -44,6 +46,7 @@ public class FlutterOpenimSdkPlugin implements FlutterPlugin, MethodCallHandler
|
||||
FlutterOpenimSdkPlugin.friendshipManager = new FriendshipManager();
|
||||
FlutterOpenimSdkPlugin.messageManager = new MessageManager();
|
||||
FlutterOpenimSdkPlugin.conversationManager = new ConversationManager();
|
||||
FlutterOpenimSdkPlugin.groupManager = new GroupManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,10 +6,10 @@ import java.util.Map;
|
||||
import io.openim.flutter_openim_sdk.util.CommonUtil;
|
||||
import open_im_sdk.OnAdvancedMsgListener;
|
||||
|
||||
public class AdvancedMsgListenerImpl implements OnAdvancedMsgListener {
|
||||
public class AdvancedMsgListener implements OnAdvancedMsgListener {
|
||||
final Map<String, String> values = new HashMap<>();
|
||||
|
||||
public AdvancedMsgListenerImpl(String listenerId) {
|
||||
public AdvancedMsgListener(String listenerId) {
|
||||
this.values.put("id", listenerId);
|
||||
}
|
||||
|
||||
@@ -6,11 +6,11 @@ import io.flutter.plugin.common.MethodChannel;
|
||||
import io.openim.flutter_openim_sdk.util.CommonUtil;
|
||||
import open_im_sdk.Base;
|
||||
|
||||
public class BaseImpl implements Base {
|
||||
public class BaseListener implements Base {
|
||||
|
||||
MethodChannel.Result result;
|
||||
|
||||
public BaseImpl(MethodChannel.Result result) {
|
||||
public BaseListener(MethodChannel.Result result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package io.openim.flutter_openim_sdk.listener;
|
||||
import io.openim.flutter_openim_sdk.util.CommonUtil;
|
||||
import open_im_sdk.OnConversationListener;
|
||||
|
||||
public class ConversationListenerImpl implements OnConversationListener {
|
||||
public class ConversationListener implements OnConversationListener {
|
||||
|
||||
|
||||
@Override
|
||||
@@ -3,7 +3,7 @@ package io.openim.flutter_openim_sdk.listener;
|
||||
import io.openim.flutter_openim_sdk.util.CommonUtil;
|
||||
import open_im_sdk.OnFriendshipListener;
|
||||
|
||||
public class FriendshipListenerImpl implements OnFriendshipListener {
|
||||
public class FriendshipListener implements OnFriendshipListener {
|
||||
|
||||
@Override
|
||||
public void onBlackListAdd(String s) {
|
||||
@@ -0,0 +1,77 @@
|
||||
package io.openim.flutter_openim_sdk.listener;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import io.openim.flutter_openim_sdk.util.CommonUtil;
|
||||
import open_im_sdk.OnGroupListener;
|
||||
|
||||
public class GroupListener implements OnGroupListener {
|
||||
@Override
|
||||
public void onApplicationProcessed(String s, String s1, int i, String s2) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("groupId", s);
|
||||
map.put("opUser", s1);
|
||||
map.put("agreeOrReject", i);
|
||||
map.put("opReason", s2);
|
||||
CommonUtil.emitEvent("groupListener", "onApplicationProcessed", map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGroupCreated(String s) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("groupId", s);
|
||||
CommonUtil.emitEvent("groupListener", "onGroupCreated", map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGroupInfoChanged(String s, String s1) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("groupId", s);
|
||||
map.put("groupInfo", s1);
|
||||
CommonUtil.emitEvent("groupListener", "onGroupInfoChanged", map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMemberEnter(String s, String s1) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("groupId", s);
|
||||
map.put("memberList", s1);
|
||||
CommonUtil.emitEvent("groupListener", "onMemberEnter", map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMemberInvited(String s, String s1, String s2) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("groupId", s);
|
||||
map.put("opUser", s1);
|
||||
map.put("memberList", s2);
|
||||
CommonUtil.emitEvent("groupListener", "onMemberInvited", map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMemberKicked(String s, String s1, String s2) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("groupId", s);
|
||||
map.put("opUser", s1);
|
||||
map.put("memberList", s2);
|
||||
CommonUtil.emitEvent("groupListener", "onMemberKicked", map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMemberLeave(String s, String s1) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("groupId", s);
|
||||
map.put("member", s1);
|
||||
CommonUtil.emitEvent("groupListener", "onMemberLeave", map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceiveJoinApplication(String s, String s1, String s2) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("groupId", s);
|
||||
map.put("member", s1);
|
||||
map.put("opReason", s2);
|
||||
CommonUtil.emitEvent("groupListener", "onReceiveJoinApplication", map);
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ package io.openim.flutter_openim_sdk.listener;
|
||||
import io.openim.flutter_openim_sdk.util.CommonUtil;
|
||||
import open_im_sdk.IMSDKListener;
|
||||
|
||||
public class SDKListenerImpl implements IMSDKListener {
|
||||
public class SDKListener implements IMSDKListener {
|
||||
|
||||
@Override
|
||||
public void onConnectFailed(long l, String s) {
|
||||
@@ -2,42 +2,53 @@ package io.openim.flutter_openim_sdk.manager;
|
||||
|
||||
import io.flutter.plugin.common.MethodCall;
|
||||
import io.flutter.plugin.common.MethodChannel;
|
||||
import io.openim.flutter_openim_sdk.listener.BaseImpl;
|
||||
import io.openim.flutter_openim_sdk.listener.ConversationListenerImpl;
|
||||
import io.openim.flutter_openim_sdk.listener.BaseListener;
|
||||
import io.openim.flutter_openim_sdk.listener.ConversationListener;
|
||||
import io.openim.flutter_openim_sdk.util.CommonUtil;
|
||||
import open_im_sdk.Open_im_sdk;
|
||||
|
||||
public class ConversationManager {
|
||||
|
||||
public void setConversationListener(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.setConversationListener(new ConversationListenerImpl());
|
||||
Open_im_sdk.setConversationListener(new ConversationListener());
|
||||
}
|
||||
|
||||
public void getAllConversationList(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getAllConversationList(new BaseImpl(result));
|
||||
Open_im_sdk.getAllConversationList(new BaseListener(result));
|
||||
}
|
||||
|
||||
public void getOneConversation(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getOneConversation(CommonUtil.getConversationSourceId(methodCall), CommonUtil.getConversationSessionType(methodCall), new BaseImpl(result));
|
||||
Open_im_sdk.getOneConversation(
|
||||
CommonUtil.getConversationSourceId(methodCall),
|
||||
CommonUtil.getConversationSessionType(methodCall),
|
||||
new BaseListener(result));
|
||||
}
|
||||
|
||||
public void getMultipleConversation(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getMultipleConversation(CommonUtil.getConversationIds(methodCall), new BaseImpl(result));
|
||||
Open_im_sdk.getMultipleConversation(
|
||||
CommonUtil.getConversationIds(methodCall),
|
||||
new BaseListener(result));
|
||||
}
|
||||
|
||||
public void deleteConversation(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.deleteConversation(CommonUtil.getConversationId(methodCall), new BaseImpl(result));
|
||||
Open_im_sdk.deleteConversation(CommonUtil.getConversationId(methodCall), new BaseListener(result));
|
||||
}
|
||||
|
||||
public void setConversationDraft(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.setConversationDraft(CommonUtil.getConversationId(methodCall), CommonUtil.getConversationDraft(methodCall), new BaseImpl(result));
|
||||
Open_im_sdk.setConversationDraft(
|
||||
CommonUtil.getConversationId(methodCall),
|
||||
CommonUtil.getConversationDraft(methodCall),
|
||||
new BaseListener(result));
|
||||
}
|
||||
|
||||
public void pinConversation(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.pinConversation(CommonUtil.getConversationId(methodCall), CommonUtil.isPinnedConversation(methodCall), new BaseImpl(result));
|
||||
Open_im_sdk.pinConversation(
|
||||
CommonUtil.getConversationId(methodCall),
|
||||
CommonUtil.isPinnedConversation(methodCall),
|
||||
new BaseListener(result));
|
||||
}
|
||||
|
||||
public void getTotalUnreadMsgCount(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getTotalUnreadMsgCount(new BaseImpl(result));
|
||||
Open_im_sdk.getTotalUnreadMsgCount(new BaseListener(result));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@ package io.openim.flutter_openim_sdk.manager;
|
||||
|
||||
import io.flutter.plugin.common.MethodCall;
|
||||
import io.flutter.plugin.common.MethodChannel;
|
||||
import io.openim.flutter_openim_sdk.listener.BaseImpl;
|
||||
import io.openim.flutter_openim_sdk.listener.FriendshipListenerImpl;
|
||||
import io.openim.flutter_openim_sdk.listener.BaseListener;
|
||||
import io.openim.flutter_openim_sdk.listener.FriendshipListener;
|
||||
import io.openim.flutter_openim_sdk.util.CommonUtil;
|
||||
import open_im_sdk.Open_im_sdk;
|
||||
|
||||
@@ -11,55 +11,55 @@ public class FriendshipManager {
|
||||
|
||||
|
||||
public void setFriendListener(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.setFriendListener(new FriendshipListenerImpl());
|
||||
Open_im_sdk.setFriendListener(new FriendshipListener());
|
||||
}
|
||||
|
||||
public void getFriendsInfo(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getFriendsInfo(new BaseImpl(result), CommonUtil.getUidList(methodCall));
|
||||
Open_im_sdk.getFriendsInfo(new BaseListener(result), CommonUtil.getUidList(methodCall));
|
||||
}
|
||||
|
||||
public void addFriend(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.addFriend(new BaseImpl(result), CommonUtil.getSDKJsonParam(methodCall));
|
||||
Open_im_sdk.addFriend(new BaseListener(result), CommonUtil.getSDKJsonParam(methodCall));
|
||||
}
|
||||
|
||||
public void getFriendApplicationList(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getFriendApplicationList(new BaseImpl(result));
|
||||
Open_im_sdk.getFriendApplicationList(new BaseListener(result));
|
||||
}
|
||||
|
||||
public void getFriendList(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getFriendList(new BaseImpl(result));
|
||||
Open_im_sdk.getFriendList(new BaseListener(result));
|
||||
}
|
||||
|
||||
public void setFriendInfo(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.setFriendInfo(CommonUtil.getSDKJsonParam(methodCall), new BaseImpl(result));
|
||||
Open_im_sdk.setFriendInfo(CommonUtil.getSDKJsonParam(methodCall), new BaseListener(result));
|
||||
}
|
||||
|
||||
public void addToBlackList(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.addToBlackList(new BaseImpl(result), CommonUtil.getJsonUid(methodCall));
|
||||
Open_im_sdk.addToBlackList(new BaseListener(result), CommonUtil.getJsonUid(methodCall));
|
||||
}
|
||||
|
||||
public void getBlackList(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getBlackList(new BaseImpl(result));
|
||||
Open_im_sdk.getBlackList(new BaseListener(result));
|
||||
}
|
||||
|
||||
public void deleteFromBlackList(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.deleteFromBlackList(new BaseImpl(result), CommonUtil.getJsonUid(methodCall));
|
||||
Open_im_sdk.deleteFromBlackList(new BaseListener(result), CommonUtil.getJsonUid(methodCall));
|
||||
}
|
||||
|
||||
public void checkFriend(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.checkFriend(new BaseImpl(result), CommonUtil.getUidList(methodCall));
|
||||
Open_im_sdk.checkFriend(new BaseListener(result), CommonUtil.getUidList(methodCall));
|
||||
}
|
||||
|
||||
public void deleteFromFriendList(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.deleteFromFriendList(CommonUtil.getJsonUid(methodCall), new BaseImpl(result));
|
||||
Open_im_sdk.deleteFromFriendList(CommonUtil.getJsonUid(methodCall), new BaseListener(result));
|
||||
}
|
||||
|
||||
public void acceptFriendApplication(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.acceptFriendApplication(new BaseImpl(result), CommonUtil.getJsonUid(methodCall));
|
||||
Open_im_sdk.acceptFriendApplication(new BaseListener(result), CommonUtil.getJsonUid(methodCall));
|
||||
}
|
||||
|
||||
public void refuseFriendApplication(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.refuseFriendApplication(new BaseImpl(result), CommonUtil.getJsonUid(methodCall));
|
||||
Open_im_sdk.refuseFriendApplication(new BaseListener(result), CommonUtil.getJsonUid(methodCall));
|
||||
}
|
||||
|
||||
public void forceSyncFriendApplication(MethodCall methodCall, MethodChannel.Result result) {
|
||||
|
||||
@@ -1,6 +1,113 @@
|
||||
package io.openim.flutter_openim_sdk.manager;
|
||||
|
||||
import io.flutter.plugin.common.MethodCall;
|
||||
import io.flutter.plugin.common.MethodChannel;
|
||||
import io.openim.flutter_openim_sdk.listener.BaseListener;
|
||||
import io.openim.flutter_openim_sdk.listener.GroupListener;
|
||||
import io.openim.flutter_openim_sdk.util.CommonUtil;
|
||||
import open_im_sdk.Open_im_sdk;
|
||||
|
||||
public class GroupManager {
|
||||
|
||||
public void setGroupListener(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.setGroupListener(new GroupListener());
|
||||
}
|
||||
|
||||
}
|
||||
public void inviteUserToGroup(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.inviteUserToGroup(
|
||||
CommonUtil.getGid(methodCall),
|
||||
CommonUtil.getGroupOpReason(methodCall),
|
||||
CommonUtil.getUidList(methodCall),
|
||||
new BaseListener(result));
|
||||
}
|
||||
|
||||
public void kickGroupMember(MethodCall methodCall, MethodChannel.Result result) {
|
||||
System.out.println("gid:" + CommonUtil.getGid(methodCall));
|
||||
System.out.println("reason:" + CommonUtil.getGroupOpReason(methodCall));
|
||||
System.out.println("uidList:" + CommonUtil.getUidList(methodCall));
|
||||
Open_im_sdk.kickGroupMember(
|
||||
CommonUtil.getGid(methodCall),
|
||||
CommonUtil.getGroupOpReason(methodCall),
|
||||
CommonUtil.getUidList(methodCall),
|
||||
new BaseListener(result));
|
||||
}
|
||||
|
||||
public void getGroupMembersInfo(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getGroupMembersInfo(
|
||||
CommonUtil.getGid(methodCall),
|
||||
CommonUtil.getUidList(methodCall),
|
||||
new BaseListener(result));
|
||||
}
|
||||
|
||||
public void getGroupMemberList(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getGroupMemberList(
|
||||
CommonUtil.getGid(methodCall),
|
||||
CommonUtil.getGroupListFilter(methodCall),
|
||||
CommonUtil.getGroupListNext(methodCall),
|
||||
new BaseListener(result));
|
||||
}
|
||||
|
||||
|
||||
public void getJoinedGroupList(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getJoinedGroupList(new BaseListener(result));
|
||||
}
|
||||
|
||||
public void createGroup(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.createGroup(
|
||||
CommonUtil.getGroupInfo(methodCall),
|
||||
CommonUtil.getGroupMemberRoleList(methodCall),
|
||||
new BaseListener(result));
|
||||
}
|
||||
|
||||
public void setGroupInfo(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.setGroupInfo(
|
||||
CommonUtil.getGroupInfo(methodCall),
|
||||
new BaseListener(result));
|
||||
}
|
||||
|
||||
public void getGroupsInfo(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getGroupsInfo(
|
||||
CommonUtil.getGidList(methodCall),
|
||||
new BaseListener(result));
|
||||
}
|
||||
|
||||
public void joinGroup(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.joinGroup(
|
||||
CommonUtil.getGid(methodCall),
|
||||
CommonUtil.getGroupOpReason(methodCall),
|
||||
new BaseListener(result));
|
||||
}
|
||||
|
||||
public void quitGroup(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.quitGroup(
|
||||
CommonUtil.getGid(methodCall),
|
||||
new BaseListener(result));
|
||||
}
|
||||
|
||||
public void transferGroupOwner(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.transferGroupOwner(
|
||||
CommonUtil.getGid(methodCall),
|
||||
CommonUtil.getUid(methodCall),
|
||||
new BaseListener(result));
|
||||
}
|
||||
|
||||
public void getGroupApplicationList(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getGroupApplicationList(new BaseListener(result));
|
||||
}
|
||||
|
||||
public void acceptGroupApplication(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.acceptGroupApplication(
|
||||
CommonUtil.getGroupApplicationInfo(methodCall),
|
||||
CommonUtil.getGroupOpReason(methodCall),
|
||||
new BaseListener(result));
|
||||
|
||||
}
|
||||
|
||||
public void refuseGroupApplication(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.refuseGroupApplication(
|
||||
CommonUtil.getGroupApplicationInfo(methodCall),
|
||||
CommonUtil.getGroupOpReason(methodCall),
|
||||
new BaseListener(result));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2,24 +2,24 @@ package io.openim.flutter_openim_sdk.manager;
|
||||
|
||||
import io.flutter.plugin.common.MethodCall;
|
||||
import io.flutter.plugin.common.MethodChannel;
|
||||
import io.openim.flutter_openim_sdk.listener.BaseImpl;
|
||||
import io.openim.flutter_openim_sdk.listener.SDKListenerImpl;
|
||||
import io.openim.flutter_openim_sdk.listener.BaseListener;
|
||||
import io.openim.flutter_openim_sdk.listener.SDKListener;
|
||||
import io.openim.flutter_openim_sdk.util.CommonUtil;
|
||||
import open_im_sdk.Open_im_sdk;
|
||||
|
||||
public class IMManager {
|
||||
|
||||
public void initSDK(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.initSDK(CommonUtil.getSDKJsonParam(methodCall), new SDKListenerImpl());
|
||||
Open_im_sdk.initSDK(CommonUtil.getSDKJsonParam(methodCall), new SDKListener());
|
||||
CommonUtil.runMainThreadReturn(result, null);
|
||||
}
|
||||
|
||||
public void login(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.login(CommonUtil.getUid(methodCall), CommonUtil.getToken(methodCall), new BaseImpl(result));
|
||||
Open_im_sdk.login(CommonUtil.getUid(methodCall), CommonUtil.getToken(methodCall), new BaseListener(result));
|
||||
}
|
||||
|
||||
public void logout(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.logout(new BaseImpl(result));
|
||||
Open_im_sdk.logout(new BaseListener(result));
|
||||
}
|
||||
|
||||
public void getLoginStatus(MethodCall methodCall, MethodChannel.Result result) {
|
||||
@@ -31,11 +31,11 @@ public class IMManager {
|
||||
}
|
||||
|
||||
public void getUsersInfo(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getUsersInfo(CommonUtil.getUidList(methodCall), new BaseImpl(result));
|
||||
Open_im_sdk.getUsersInfo(CommonUtil.getUidList(methodCall), new BaseListener(result));
|
||||
}
|
||||
|
||||
public void setSelfInfo(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.setSelfInfo(CommonUtil.getSDKJsonParam(methodCall), new BaseImpl(result));
|
||||
Open_im_sdk.setSelfInfo(CommonUtil.getSDKJsonParam(methodCall), new BaseListener(result));
|
||||
}
|
||||
|
||||
public void forceSyncLoginUerInfo(MethodCall methodCall, MethodChannel.Result result) {
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
package io.openim.flutter_openim_sdk.manager;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import io.flutter.plugin.common.MethodCall;
|
||||
import io.flutter.plugin.common.MethodChannel;
|
||||
import io.openim.flutter_openim_sdk.listener.AdvancedMsgListenerImpl;
|
||||
import io.openim.flutter_openim_sdk.listener.BaseImpl;
|
||||
import io.openim.flutter_openim_sdk.listener.AdvancedMsgListener;
|
||||
import io.openim.flutter_openim_sdk.listener.BaseListener;
|
||||
import io.openim.flutter_openim_sdk.listener.MsgSendProgressListener;
|
||||
import io.openim.flutter_openim_sdk.util.CommonUtil;
|
||||
import open_im_sdk.OnAdvancedMsgListener;
|
||||
@@ -22,7 +20,7 @@ public class MessageManager {
|
||||
public void addAdvancedMsgListener(MethodCall methodCall, MethodChannel.Result result) {
|
||||
String key = methodCall.argument(KEY_ID);
|
||||
if (!listeners.containsKey(key)) {
|
||||
AdvancedMsgListenerImpl listener = new AdvancedMsgListenerImpl(key);
|
||||
AdvancedMsgListener listener = new AdvancedMsgListener(key);
|
||||
listeners.put(methodCall.argument(KEY_ID), listener);
|
||||
Open_im_sdk.addAdvancedMsgListener(listener);
|
||||
}
|
||||
@@ -36,19 +34,23 @@ public class MessageManager {
|
||||
|
||||
public void sendMessage(MethodCall methodCall, MethodChannel.Result result) {
|
||||
MsgSendProgressListener listener = new MsgSendProgressListener(result, methodCall);
|
||||
Open_im_sdk.sendMessage(listener, CommonUtil.getSendMessageContent(methodCall), CommonUtil.getSendMessageReceiver(methodCall), CommonUtil.geSendMessageGroupId(methodCall), CommonUtil.getSendMessageOnlineOnly(methodCall));
|
||||
Open_im_sdk.sendMessage(listener,
|
||||
CommonUtil.getSendMessageContent(methodCall),
|
||||
CommonUtil.getSendMessageReceiver(methodCall),
|
||||
CommonUtil.geSendMessageGroupId(methodCall),
|
||||
CommonUtil.getSendMessageOnlineOnly(methodCall));
|
||||
}
|
||||
|
||||
public void getHistoryMessageList(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getHistoryMessageList(new BaseImpl(result), CommonUtil.getSDKJsonParam(methodCall));
|
||||
Open_im_sdk.getHistoryMessageList(new BaseListener(result), CommonUtil.getSDKJsonParam(methodCall));
|
||||
}
|
||||
|
||||
public void revokeMessage(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.revokeMessage(new BaseImpl(result), CommonUtil.getSDKJsonParam(methodCall));
|
||||
Open_im_sdk.revokeMessage(new BaseListener(result), CommonUtil.getSDKJsonParam(methodCall));
|
||||
}
|
||||
|
||||
public void deleteMessageFromLocalStorage(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.deleteMessageFromLocalStorage(new BaseImpl(result), CommonUtil.getSDKJsonParam(methodCall));
|
||||
Open_im_sdk.deleteMessageFromLocalStorage(new BaseListener(result), CommonUtil.getSDKJsonParam(methodCall));
|
||||
}
|
||||
|
||||
public void deleteMessages(MethodCall methodCall, MethodChannel.Result result) {
|
||||
@@ -56,46 +58,81 @@ public class MessageManager {
|
||||
}
|
||||
|
||||
public void insertSingleMessageToLocalStorage(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.insertSingleMessageToLocalStorage(new BaseImpl(result), CommonUtil.getSingleMessageContent(methodCall), CommonUtil.getSingleMessageUserid(methodCall), CommonUtil.getSingleMessageSender(methodCall));
|
||||
Open_im_sdk.insertSingleMessageToLocalStorage(new BaseListener(result),
|
||||
CommonUtil.getSingleMessageContent(methodCall),
|
||||
CommonUtil.getSingleMessageUserid(methodCall),
|
||||
CommonUtil.getSingleMessageSender(methodCall));
|
||||
}
|
||||
|
||||
public void findMessages(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.findMessages(new BaseImpl(result), CommonUtil.getFindMessageIds(methodCall));
|
||||
Open_im_sdk.findMessages(new BaseListener(result), CommonUtil.getFindMessageIds(methodCall));
|
||||
}
|
||||
|
||||
public void markSingleMessageHasRead(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.markSingleMessageHasRead(new BaseImpl(result), CommonUtil.getSingleMessageUserid(methodCall));
|
||||
Open_im_sdk.markSingleMessageHasRead(new BaseListener(result), CommonUtil.getSingleMessageUserid(methodCall));
|
||||
}
|
||||
|
||||
public void markGroupMessageHasRead(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.markGroupMessageHasRead(new BaseListener(result), CommonUtil.getGroupMessageGroupid(methodCall));
|
||||
}
|
||||
|
||||
public void markC2CMessageAsRead(MethodCall methodCall, MethodChannel.Result result) {
|
||||
// Open_im_sdk.markC2CMessageAsRead(new BaseImpl(result), CommonUtil.getSingleMessageUserid(methodCall));
|
||||
}
|
||||
|
||||
public void createTextMessage(MethodCall methodCall, MethodChannel.Result result) {
|
||||
CommonUtil.runMainThreadReturn(result, Open_im_sdk.createTextMessage(CommonUtil.getMessageText(methodCall)));
|
||||
CommonUtil.runMainThreadReturn(result,
|
||||
Open_im_sdk.createTextMessage(
|
||||
CommonUtil.getMessageText(methodCall)));
|
||||
}
|
||||
|
||||
public void createTextAtMessage(MethodCall methodCall, MethodChannel.Result result) {
|
||||
CommonUtil.runMainThreadReturn(result, Open_im_sdk.createTextAtMessage(CommonUtil.getMessageText(methodCall), CommonUtil.getAtUserList(methodCall)));
|
||||
CommonUtil.runMainThreadReturn(result,
|
||||
Open_im_sdk.createTextAtMessage(
|
||||
CommonUtil.getMessageText(methodCall),
|
||||
CommonUtil.getAtUserList(methodCall)));
|
||||
}
|
||||
|
||||
public void createImageMessage(MethodCall methodCall, MethodChannel.Result result) {
|
||||
CommonUtil.runMainThreadReturn(result, Open_im_sdk.createImageMessage(CommonUtil.getImagePath(methodCall)));
|
||||
CommonUtil.runMainThreadReturn(result,
|
||||
Open_im_sdk.createImageMessage(
|
||||
CommonUtil.getImagePath(methodCall)));
|
||||
}
|
||||
|
||||
public void createSoundMessage(MethodCall methodCall, MethodChannel.Result result) {
|
||||
CommonUtil.runMainThreadReturn(result, Open_im_sdk.createSoundMessage(CommonUtil.getSoundPath(methodCall), CommonUtil.getSoundDuration(methodCall)));
|
||||
CommonUtil.runMainThreadReturn(result,
|
||||
Open_im_sdk.createSoundMessage(
|
||||
CommonUtil.getSoundPath(methodCall),
|
||||
CommonUtil.getSoundDuration(methodCall)));
|
||||
}
|
||||
|
||||
public void createVideoMessage(MethodCall methodCall, MethodChannel.Result result) {
|
||||
CommonUtil.runMainThreadReturn(result, Open_im_sdk.createVideoMessage(CommonUtil.getVideoPath(methodCall), CommonUtil.getVideoType(methodCall), CommonUtil.getVideoDuration(methodCall), CommonUtil.getVideoSnapshotPath(methodCall)));
|
||||
CommonUtil.runMainThreadReturn(result,
|
||||
Open_im_sdk.createVideoMessage(
|
||||
CommonUtil.getVideoPath(methodCall),
|
||||
CommonUtil.getVideoType(methodCall),
|
||||
CommonUtil.getVideoDuration(methodCall),
|
||||
CommonUtil.getVideoSnapshotPath(methodCall)));
|
||||
}
|
||||
|
||||
public void createFileMessage(MethodCall methodCall, MethodChannel.Result result) {
|
||||
CommonUtil.runMainThreadReturn(result, Open_im_sdk.createFileMessage(CommonUtil.getFilePath(methodCall), CommonUtil.getFileName(methodCall)));
|
||||
CommonUtil.runMainThreadReturn(result,
|
||||
Open_im_sdk.createFileMessage(
|
||||
CommonUtil.getFilePath(methodCall),
|
||||
CommonUtil.getFileName(methodCall)));
|
||||
}
|
||||
|
||||
public void createMergerMessage(MethodCall methodCall, MethodChannel.Result result) {
|
||||
CommonUtil.runMainThreadReturn(result, Open_im_sdk.createMergerMessage(CommonUtil.getMergerMessageList(methodCall), CommonUtil.getMergerMessageTitle(methodCall), CommonUtil.getSummaryList(methodCall)));
|
||||
CommonUtil.runMainThreadReturn(result,
|
||||
Open_im_sdk.createMergerMessage(
|
||||
CommonUtil.getMergerMessageList(methodCall),
|
||||
CommonUtil.getMergerMessageTitle(methodCall),
|
||||
CommonUtil.getSummaryList(methodCall)));
|
||||
}
|
||||
|
||||
public void createForwardMessage(MethodCall methodCall, MethodChannel.Result result) {
|
||||
CommonUtil.runMainThreadReturn(result, Open_im_sdk.createForwardMessage(CommonUtil.getForwardMessage(methodCall)));
|
||||
CommonUtil.runMainThreadReturn(result,
|
||||
Open_im_sdk.createForwardMessage(
|
||||
CommonUtil.getForwardMessage(methodCall)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,15 +85,15 @@ public class CommonUtil {
|
||||
///////////////////////////////////////
|
||||
//////////////////////////////////////
|
||||
public static String getUid(MethodCall methodCall) {
|
||||
return getParamValue(methodCall, KEY_LOGIN_UID);
|
||||
return getParamValue(methodCall, KEY_UID);
|
||||
}
|
||||
|
||||
public static String getJsonUid(MethodCall methodCall) {
|
||||
return JsonUtil.toString(getParamValue(methodCall, KEY_LOGIN_UID));
|
||||
return JsonUtil.toString(getParamValue(methodCall, KEY_UID));
|
||||
}
|
||||
|
||||
public static String getToken(MethodCall methodCall) {
|
||||
return getParamValue(methodCall, KEY_LOGIN_TOKEN);
|
||||
return getParamValue(methodCall, KEY_TOKEN);
|
||||
}
|
||||
|
||||
public static String getMessageText(MethodCall methodCall) {
|
||||
@@ -191,6 +191,10 @@ public class CommonUtil {
|
||||
return getParamValue(methodCall, KEY_SINGLE_MESSAGE_USERID);
|
||||
}
|
||||
|
||||
public static String getGroupMessageGroupid(MethodCall methodCall) {
|
||||
return getParamValue(methodCall, KEY_GROUP_MESSAGE_GROUPID);
|
||||
}
|
||||
|
||||
public static String getSingleMessageSender(MethodCall methodCall) {
|
||||
return getParamValue(methodCall, KEY_SINGLE_MESSAGE_SENDER);
|
||||
}
|
||||
@@ -227,10 +231,41 @@ public class CommonUtil {
|
||||
return getSDKJsonParam(methodCall, KEY_USER_IDS);
|
||||
}
|
||||
|
||||
public static String getGid(MethodCall methodCall) {
|
||||
return getParamValue(methodCall, KEY_GROUP_ID);
|
||||
}
|
||||
|
||||
public static String getGidList(MethodCall methodCall) {
|
||||
return getSDKJsonParam(methodCall, KEY_GROUP_IDS);
|
||||
}
|
||||
|
||||
public static String getGroupOpReason(MethodCall methodCall) {
|
||||
return getParamValue(methodCall, KEY_GROUP_OP_REASON);
|
||||
}
|
||||
|
||||
public static int getGroupListFilter(MethodCall methodCall) {
|
||||
return getParamValue(methodCall, KEY_GROUP_LIST_FILTER);
|
||||
}
|
||||
|
||||
public static int getGroupListNext(MethodCall methodCall) {
|
||||
return getParamValue(methodCall, KEY_GROUP_LIST_NEXT);
|
||||
}
|
||||
|
||||
public static String getGroupInfo(MethodCall methodCall) {
|
||||
return getSDKJsonParam(methodCall, KEY_GROUP_INFO);
|
||||
}
|
||||
|
||||
public static String getGroupMemberRoleList(MethodCall methodCall) {
|
||||
return getSDKJsonParam(methodCall, KEY_GROUP_MEMBER_ROLE_LIST);
|
||||
}
|
||||
|
||||
public static String getGroupApplicationInfo(MethodCall methodCall) {
|
||||
return getSDKJsonParam(methodCall, KEY_GROUP_APPLICATION_INFO);
|
||||
}
|
||||
|
||||
//login
|
||||
final static String KEY_LOGIN_UID = "uid";
|
||||
final static String KEY_LOGIN_TOKEN = "token";
|
||||
final static String KEY_UID = "uid";
|
||||
final static String KEY_TOKEN = "token";
|
||||
//create message body
|
||||
final static String KEY_TEXT = "text";
|
||||
final static String KEY_AT_USER_LIST = "atUserList";
|
||||
@@ -257,6 +292,8 @@ public class CommonUtil {
|
||||
final static String KEY_SINGLE_MESSAGE_CONTENT = "message";
|
||||
final static String KEY_SINGLE_MESSAGE_USERID = "userID";
|
||||
final static String KEY_SINGLE_MESSAGE_SENDER = "sender";
|
||||
//group chat
|
||||
final static String KEY_GROUP_MESSAGE_GROUPID = "groupID";
|
||||
// find message
|
||||
final static String KEY_FIND_MESSAGE_IDS = "messageIDList";
|
||||
// conversation
|
||||
@@ -268,4 +305,15 @@ public class CommonUtil {
|
||||
final static String KEY_CONVERSATION_SESSION_TYPE = "sessionType";
|
||||
// user info
|
||||
final static String KEY_USER_IDS = "uidList";
|
||||
// group
|
||||
final static String KEY_GROUP_ID = "gid";
|
||||
final static String KEY_GROUP_IDS = "gidList";
|
||||
final static String KEY_GROUP_OP_REASON = "reason";
|
||||
// final static String KEY_GROUP_USER_ID = "uid";
|
||||
// final static String KEY_GROUP_USER_IDS = "uidList";
|
||||
final static String KEY_GROUP_LIST_FILTER = "filter";
|
||||
final static String KEY_GROUP_LIST_NEXT = "next";
|
||||
final static String KEY_GROUP_INFO = "gInfo";
|
||||
final static String KEY_GROUP_MEMBER_ROLE_LIST = "memberList";
|
||||
final static String KEY_GROUP_APPLICATION_INFO = "application";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user