diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b93628..2341067 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 3.0.0 + +- The super update is not compatible with the previous version + + ## 2.3.5+4 - Fix bug diff --git a/android/build.gradle b/android/build.gradle index 1384208..fa7768b 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -53,5 +53,5 @@ dependencies { // 本地依赖,现将aar复制到libs/io/openim/core-sdk/0.0.1/ 下,命名core-sdk-0.0.1.aar // implementation 'io.openim:core-sdk:0.0.1@aar' // api 'io.openim:core-sdk:2.3.5-t44@aar' - api 'io.openim:core-sdk:3.0.0-t7@aar' + api 'io.openim:core-sdk:3.0.0-t101@aar' } \ No newline at end of file diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml index 20bc59f..7d4bb9e 100644 --- a/android/src/main/AndroidManifest.xml +++ b/android/src/main/AndroidManifest.xml @@ -1,3 +1,6 @@ + - + package="io.openim.flutter_openim_sdk"> + + + \ No newline at end of file diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/FlutterOpenimSdkPlugin.java b/android/src/main/java/io/openim/flutter_openim_sdk/FlutterOpenimSdkPlugin.java index 64654e8..85b8e8f 100644 --- a/android/src/main/java/io/openim/flutter_openim_sdk/FlutterOpenimSdkPlugin.java +++ b/android/src/main/java/io/openim/flutter_openim_sdk/FlutterOpenimSdkPlugin.java @@ -16,15 +16,14 @@ import io.flutter.plugin.common.MethodCall; import io.flutter.plugin.common.MethodChannel; import io.flutter.plugin.common.MethodChannel.MethodCallHandler; import io.flutter.plugin.common.MethodChannel.Result; +import io.openim.flutter_openim_sdk.connectivity.ConnectivityListener; +import io.openim.flutter_openim_sdk.connectivity.VisibilityListener; 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.manager.OrganizationManager; -import io.openim.flutter_openim_sdk.manager.SignalingManager; import io.openim.flutter_openim_sdk.manager.UserManager; -import io.openim.flutter_openim_sdk.manager.WorkMomentsManager; /** @@ -43,12 +42,14 @@ public class FlutterOpenimSdkPlugin implements FlutterPlugin, MethodCallHandler, private static MessageManager messageManager; private static ConversationManager conversationManager; private static GroupManager groupManager; - private static SignalingManager signalingManager; - private static WorkMomentsManager workMomentsManager; - private static OrganizationManager organizationManager; +// private static SignalingManager signalingManager; +// private static WorkMomentsManager workMomentsManager; +// private static OrganizationManager organizationManager; private static Activity activity; private static Context context; - + private ConnectivityListener connectivityListener; + private VisibilityListener visibilityListener; + public static boolean isInitialized; public FlutterOpenimSdkPlugin() { FlutterOpenimSdkPlugin.imManager = new IMManager(); @@ -57,9 +58,9 @@ public class FlutterOpenimSdkPlugin implements FlutterPlugin, MethodCallHandler, FlutterOpenimSdkPlugin.messageManager = new MessageManager(); FlutterOpenimSdkPlugin.conversationManager = new ConversationManager(); FlutterOpenimSdkPlugin.groupManager = new GroupManager(); - FlutterOpenimSdkPlugin.signalingManager = new SignalingManager(); - FlutterOpenimSdkPlugin.workMomentsManager = new WorkMomentsManager(); - FlutterOpenimSdkPlugin.organizationManager = new OrganizationManager(); +// FlutterOpenimSdkPlugin.signalingManager = new SignalingManager(); +// FlutterOpenimSdkPlugin.workMomentsManager = new WorkMomentsManager(); +// FlutterOpenimSdkPlugin.organizationManager = new OrganizationManager(); } @@ -68,6 +69,9 @@ public class FlutterOpenimSdkPlugin implements FlutterPlugin, MethodCallHandler, channel = new MethodChannel(flutterPluginBinding.getBinaryMessenger(), CHANNEL_NAME); context = flutterPluginBinding.getApplicationContext(); channel.setMethodCallHandler(this); + connectivityListener = new ConnectivityListener(context); + visibilityListener = new VisibilityListener(); + connectivityListener.register(); } @Override @@ -78,30 +82,32 @@ public class FlutterOpenimSdkPlugin implements FlutterPlugin, MethodCallHandler, @Override public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) { FlutterOpenimSdkPlugin.channel.setMethodCallHandler(null); + connectivityListener.unregisterReceiver(); } @Override public void onAttachedToActivity(@NonNull ActivityPluginBinding binding) { - activity = binding.getActivity(); + visibilityListener.register(activity = binding.getActivity()); } @Override public void onDetachedFromActivityForConfigChanges() { + visibilityListener.unregisterReceiver(activity); activity = null; } @Override public void onReattachedToActivityForConfigChanges(@NonNull ActivityPluginBinding binding) { - activity = binding.getActivity(); + visibilityListener.register(activity = binding.getActivity()); } @Override public void onDetachedFromActivity() { + visibilityListener.unregisterReceiver(activity); activity = null; } - void parse(@NonNull MethodCall call, @NonNull Result result) { try { String managerName = call.argument("ManagerName"); diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/connectivity/Connectivity.java b/android/src/main/java/io/openim/flutter_openim_sdk/connectivity/Connectivity.java new file mode 100644 index 0000000..85c8d58 --- /dev/null +++ b/android/src/main/java/io/openim/flutter_openim_sdk/connectivity/Connectivity.java @@ -0,0 +1,78 @@ +package io.openim.flutter_openim_sdk.connectivity; + +import android.net.ConnectivityManager; +import android.net.Network; +import android.net.NetworkCapabilities; +import android.os.Build; + +public class Connectivity { + static final String CONNECTIVITY_NONE = "none"; + static final String CONNECTIVITY_WIFI = "wifi"; + static final String CONNECTIVITY_MOBILE = "mobile"; + static final String CONNECTIVITY_ETHERNET = "ethernet"; + static final String CONNECTIVITY_BLUETOOTH = "bluetooth"; + static final String CONNECTIVITY_VPN = "vpn"; + private final ConnectivityManager connectivityManager; + + public Connectivity(ConnectivityManager connectivityManager) { + this.connectivityManager = connectivityManager; + } + + String getNetworkType() { + if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + Network network = connectivityManager.getActiveNetwork(); + NetworkCapabilities capabilities = connectivityManager.getNetworkCapabilities(network); + if (capabilities == null) { + return CONNECTIVITY_NONE; + } + if (capabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI)) { + return CONNECTIVITY_WIFI; + } + if (capabilities.hasTransport(NetworkCapabilities.TRANSPORT_ETHERNET)) { + return CONNECTIVITY_ETHERNET; + } + if (capabilities.hasTransport(NetworkCapabilities.TRANSPORT_VPN)) { + return CONNECTIVITY_VPN; + } + if (capabilities.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR)) { + return CONNECTIVITY_MOBILE; + } + if (capabilities.hasTransport(NetworkCapabilities.TRANSPORT_BLUETOOTH)) { + return CONNECTIVITY_BLUETOOTH; + } + } + + return getNetworkTypeLegacy(); + } + + @SuppressWarnings("deprecation") + private String getNetworkTypeLegacy() { + // handle type for Android versions less than Android 6 + android.net.NetworkInfo info = connectivityManager.getActiveNetworkInfo(); + if (info == null || !info.isConnected()) { + return CONNECTIVITY_NONE; + } + int type = info.getType(); + switch (type) { + case ConnectivityManager.TYPE_BLUETOOTH: + return CONNECTIVITY_BLUETOOTH; + case ConnectivityManager.TYPE_ETHERNET: + return CONNECTIVITY_ETHERNET; + case ConnectivityManager.TYPE_WIFI: + case ConnectivityManager.TYPE_WIMAX: + return CONNECTIVITY_WIFI; + case ConnectivityManager.TYPE_VPN: + return CONNECTIVITY_VPN; + case ConnectivityManager.TYPE_MOBILE: + case ConnectivityManager.TYPE_MOBILE_DUN: + case ConnectivityManager.TYPE_MOBILE_HIPRI: + return CONNECTIVITY_MOBILE; + default: + return CONNECTIVITY_NONE; + } + } + + public ConnectivityManager getConnectivityManager() { + return connectivityManager; + } +} diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/connectivity/ConnectivityListener.java b/android/src/main/java/io/openim/flutter_openim_sdk/connectivity/ConnectivityListener.java new file mode 100644 index 0000000..dc46c1f --- /dev/null +++ b/android/src/main/java/io/openim/flutter_openim_sdk/connectivity/ConnectivityListener.java @@ -0,0 +1,101 @@ +package io.openim.flutter_openim_sdk.connectivity; + + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.net.ConnectivityManager; +import android.net.Network; +import android.os.Build; + +import io.flutter.Log; +import io.openim.flutter_openim_sdk.FlutterOpenimSdkPlugin; +import open_im_sdk.Open_im_sdk; + + +public class ConnectivityListener implements open_im_sdk_callback.Base { + public static final String CONNECTIVITY_ACTION = "android.net.conn.CONNECTIVITY_CHANGE"; + private Context context; + private ConnectivityManager connectivityManager; + private Connectivity connectivity; + private ConnectivityBroadcastReceiver receiver; + private ConnectivityManager.NetworkCallback networkCallback; + + public ConnectivityListener(Context context) { + this.context = context; + this.connectivityManager = + (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); + this.connectivity = new Connectivity(connectivityManager); + this.receiver = new ConnectivityBroadcastReceiver(this); + } + + private void onChangedNetworkStatus() { + String status = connectivity.getNetworkType(); + if (Connectivity.CONNECTIVITY_MOBILE.equals(status) || Connectivity.CONNECTIVITY_WIFI.equals(status)) { + Log.i("ConnectivityListener", "networkStatusChanged: " + status); + if (FlutterOpenimSdkPlugin.isInitialized) { + Open_im_sdk.networkStatusChanged(this, String.valueOf(System.currentTimeMillis())); + } + } + } + + public void register() { + if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + networkCallback = new ConnectivityManager.NetworkCallback() { + @Override + public void onAvailable(Network network) { + onChangedNetworkStatus(); + } + + @Override + public void onLost(Network network) { + } + }; + connectivity.getConnectivityManager().registerDefaultNetworkCallback(networkCallback); + } else { + context.registerReceiver(receiver, new IntentFilter(CONNECTIVITY_ACTION)); + } + } + + public void unregisterReceiver() { + if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + if (networkCallback != null) { + connectivity.getConnectivityManager().unregisterNetworkCallback(networkCallback); + networkCallback = null; + } + } else { + try { + context.unregisterReceiver(receiver); + receiver = null; + } catch (Exception e) { + //listen never called, ignore the error + } + } + } + + @Override + public void onError(int i, String s) { + + } + + @Override + public void onSuccess(String s) { + + } + + public static class ConnectivityBroadcastReceiver extends BroadcastReceiver { + ConnectivityListener listener; + + public ConnectivityBroadcastReceiver(ConnectivityListener listener) { + this.listener = listener; + } + + @Override + public void onReceive(Context context, Intent intent) { + if (null != listener && CONNECTIVITY_ACTION.equals(intent.getAction())) { + listener.onChangedNetworkStatus(); + } + } + } +} diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/connectivity/VisibilityListener.java b/android/src/main/java/io/openim/flutter_openim_sdk/connectivity/VisibilityListener.java new file mode 100644 index 0000000..d6a4b92 --- /dev/null +++ b/android/src/main/java/io/openim/flutter_openim_sdk/connectivity/VisibilityListener.java @@ -0,0 +1,78 @@ +package io.openim.flutter_openim_sdk.connectivity; + +import android.app.Activity; +import android.app.Application; +import android.os.Bundle; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import io.flutter.Log; +import io.openim.flutter_openim_sdk.FlutterOpenimSdkPlugin; +import open_im_sdk.Open_im_sdk; + +public class VisibilityListener implements Application.ActivityLifecycleCallbacks, open_im_sdk_callback.Base { + public void register(Activity activity) { + if (null != activity) { + activity.getApplication().registerActivityLifecycleCallbacks(this); + } + } + + public void unregisterReceiver(Activity activity) { + if (null != activity) { + activity.getApplication().unregisterActivityLifecycleCallbacks(this); + } + } + + + @Override + public void onActivityCreated(@NonNull Activity activity, @Nullable Bundle savedInstanceState) { + Log.i("VisibilityListener", "onActivityCreated"); + } + + @Override + public void onActivityStarted(@NonNull Activity activity) { + Log.i("VisibilityListener", "onActivityStarted"); + } + + @Override + public void onActivityResumed(@NonNull Activity activity) { + Log.i("VisibilityListener", "onActivityResumed"); + if (FlutterOpenimSdkPlugin.isInitialized) { + Open_im_sdk.setAppBackgroundStatus(this, String.valueOf(System.currentTimeMillis()), false); + } + } + + @Override + public void onActivityPaused(@NonNull Activity activity) { + Log.i("VisibilityListener", "onActivityPaused"); + if (FlutterOpenimSdkPlugin.isInitialized) { + Open_im_sdk.setAppBackgroundStatus(this, String.valueOf(System.currentTimeMillis()), true); + } + } + + @Override + public void onActivityStopped(@NonNull Activity activity) { + Log.i("VisibilityListener", "onActivityStopped"); + } + + @Override + public void onActivitySaveInstanceState(@NonNull Activity activity, @NonNull Bundle outState) { + Log.i("VisibilityListener", "onActivitySaveInstanceState"); + } + + @Override + public void onActivityDestroyed(@NonNull Activity activity) { + Log.i("VisibilityListener", "onActivityDestroyed"); + } + + @Override + public void onError(int i, String s) { + + } + + @Override + public void onSuccess(String s) { + + } +} diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnAdvancedMsgListener.java b/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnAdvancedMsgListener.java index 98fe759..fe0964e 100644 --- a/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnAdvancedMsgListener.java +++ b/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnAdvancedMsgListener.java @@ -13,11 +13,19 @@ public class OnAdvancedMsgListener implements open_im_sdk_callback.OnAdvancedMsg this.id = listenerId; } + @Override + public void onMsgDeleted(String s) { + final Map values = new ArrayMap<>(); + values.put("id", id); + values.put("message", s); + CommonUtil.emitEvent("advancedMsgListener", "onMsgDeleted", values); + } + @Override public void onNewRecvMessageRevoked(String s) { final Map values = new ArrayMap<>(); values.put("id", id); - values.put("revokedMessageV2", s); + values.put("messageRevoked", s); CommonUtil.emitEvent("advancedMsgListener", "onNewRecvMessageRevoked", values); } @@ -25,7 +33,7 @@ public class OnAdvancedMsgListener implements open_im_sdk_callback.OnAdvancedMsg public void onRecvC2CReadReceipt(String s) { final Map values = new ArrayMap<>(); values.put("id", id); - values.put("c2cMessageReadReceipt", s); + values.put("msgReceiptList", s); CommonUtil.emitEvent("advancedMsgListener", "onRecvC2CReadReceipt", values); } @@ -33,16 +41,17 @@ public class OnAdvancedMsgListener implements open_im_sdk_callback.OnAdvancedMsg public void onRecvGroupReadReceipt(String s) { final Map values = new ArrayMap<>(); values.put("id", id); - values.put("groupMessageReadReceipt", s); + values.put("groupMsgReceiptList", s); CommonUtil.emitEvent("advancedMsgListener", "onRecvGroupReadReceipt", values); } + @Override public void onRecvMessageExtensionsAdded(String s, String s1) { final Map values = new ArrayMap<>(); values.put("id", id); values.put("msgID", s); - values.put("list", s1); + values.put("reactionExtensionList", s1); CommonUtil.emitEvent("advancedMsgListener", "onRecvMessageExtensionsAdded", values); } @@ -51,7 +60,7 @@ public class OnAdvancedMsgListener implements open_im_sdk_callback.OnAdvancedMsg final Map values = new ArrayMap<>(); values.put("id", id); values.put("msgID", s); - values.put("list", s1); + values.put("reactionExtensionList", s1); CommonUtil.emitEvent("advancedMsgListener", "onRecvMessageExtensionsChanged", values); } @@ -60,23 +69,23 @@ public class OnAdvancedMsgListener implements open_im_sdk_callback.OnAdvancedMsg final Map values = new ArrayMap<>(); values.put("id", id); values.put("msgID", s); - values.put("list", s1); + values.put("reactionExtensionKeyList", s1); CommonUtil.emitEvent("advancedMsgListener", "onRecvMessageExtensionsDeleted", values); } @Override - public void onRecvMessageRevoked(String s) { + public void onRecvNewMessage(String s) { final Map values = new ArrayMap<>(); values.put("id", id); - values.put("revokedMessage", s); - CommonUtil.emitEvent("advancedMsgListener", "onRecvMessageRevoked", values); + values.put("message", s); + CommonUtil.emitEvent("advancedMsgListener", "onRecvNewMessage", values); } @Override - public void onRecvNewMessage(String s) { + public void onRecvOfflineNewMessages(String s) { final Map values = new ArrayMap<>(); values.put("id", id); - values.put("newMessage", s); - CommonUtil.emitEvent("advancedMsgListener", "onRecvNewMessage", values); + values.put("messageList", s); + CommonUtil.emitEvent("advancedMsgListener", "onRecvOfflineNewMessages", values); } } diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnBaseListener.java b/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnBaseListener.java index 5d2c3bf..82fef79 100644 --- a/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnBaseListener.java +++ b/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnBaseListener.java @@ -19,13 +19,13 @@ public class OnBaseListener implements Base { @Override public void onError(int l, String s) { - Log.i("F-OpenIMSDK(flutter call native)", "method: 【 " + call.method + " 】, onError: { code:" + l + ", message:" + s + "}"); + Log.i("F-OpenIMSDK(native call flutter)", "method: 【 " + call.method + " 】, onError: { code:" + l + ", message:" + s + "}"); CommonUtil.runMainThreadReturnError(result, l, s, null); } @Override public void onSuccess(String s) { - Log.i("F-OpenIMSDK(flutter call native)", "method: 【 " + call.method + " 】, onSuccess: " + s); + Log.i("F-OpenIMSDK(native call flutter)", "method: 【 " + call.method + " 】, onSuccess: " + s); CommonUtil.runMainThreadReturn(result, s); } } diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnFriendshipListener.java b/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnFriendshipListener.java index f118a09..b1de1f7 100644 --- a/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnFriendshipListener.java +++ b/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnFriendshipListener.java @@ -6,12 +6,12 @@ public class OnFriendshipListener implements open_im_sdk_callback.OnFriendshipLi @Override public void onBlackAdded(String s) { - CommonUtil.emitEvent("friendListener", "onBlacklistAdded", s); + CommonUtil.emitEvent("friendListener", "onBlackAdded", s); } @Override public void onBlackDeleted(String s) { - CommonUtil.emitEvent("friendListener", "onBlacklistDeleted", s); + CommonUtil.emitEvent("friendListener", "onBlackDeleted", s); } @Override diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnGroupListener.java b/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnGroupListener.java index 711385d..9a4dba0 100644 --- a/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnGroupListener.java +++ b/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnGroupListener.java @@ -24,6 +24,11 @@ public class OnGroupListener implements open_im_sdk_callback.OnGroupListener { CommonUtil.emitEvent("groupListener", "onGroupApplicationRejected", s); } + @Override + public void onGroupDismissed(String s) { + CommonUtil.emitEvent("groupListener", "onGroupDismissed", s); + } + @Override public void onGroupInfoChanged(String s) { CommonUtil.emitEvent("groupListener", "onGroupInfoChanged", s); diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnOrganizationListener.java b/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnOrganizationListener.java index 4743ab2..d7e3ca3 100644 --- a/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnOrganizationListener.java +++ b/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnOrganizationListener.java @@ -2,9 +2,9 @@ package io.openim.flutter_openim_sdk.listener; import io.openim.flutter_openim_sdk.util.CommonUtil; -public class OnOrganizationListener implements open_im_sdk_callback.OnOrganizationListener { - @Override - public void onOrganizationUpdated() { - CommonUtil.emitEvent("organizationListener", "onOrganizationUpdated", null); - } +public class OnOrganizationListener /*implements open_im_sdk_callback.OnOrganizationListener*/ { +// @Override +// public void onOrganizationUpdated() { +// CommonUtil.emitEvent("organizationListener", "onOrganizationUpdated", null); +// } } diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnPutFileListener.java b/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnPutFileListener.java new file mode 100644 index 0000000..0a4157b --- /dev/null +++ b/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnPutFileListener.java @@ -0,0 +1,86 @@ +package io.openim.flutter_openim_sdk.listener; + +import android.util.ArrayMap; + +import java.util.Map; + +import io.flutter.plugin.common.MethodCall; +import io.flutter.plugin.common.MethodChannel; +import io.openim.flutter_openim_sdk.util.CommonUtil; +import open_im_sdk_callback.PutFileCallback; + +public class OnPutFileListener implements PutFileCallback { + final private MethodChannel.Result result; + final private Object putID; + + public OnPutFileListener(MethodChannel.Result result, MethodCall call) { + this.result = result; + this.putID = call.argument("putID"); + } + + @Override + public void hashComplete(String hash, long total) { + if (null != putID) { + final Map values = new ArrayMap<>(); + values.put("putID", putID); + values.put("hash", hash); + values.put("total", total); + CommonUtil.emitEvent("putFileListener", "hashComplete", values); + } + } + + @Override + public void hashProgress(long current, long total) { + if (null != putID) { + final Map values = new ArrayMap<>(); + values.put("putID", putID); + values.put("current", current); + values.put("total", total); + CommonUtil.emitEvent("putFileListener", "hashProgress", values); + } + } + + @Override + public void open(long size) { + if (null != putID) { + final Map values = new ArrayMap<>(); + values.put("putID", putID); + values.put("size", size); + CommonUtil.emitEvent("putFileListener", "open", values); + } + } + + @Override + public void putComplete(long total, long putType) { + if (null != putID) { + final Map values = new ArrayMap<>(); + values.put("putID", putID); + values.put("putType", putType); + values.put("total", total); + CommonUtil.emitEvent("putFileListener", "putComplete", values); + } + } + + @Override + public void putProgress(long save, long current, long total) { + if (null != putID) { + final Map values = new ArrayMap<>(); + values.put("putID", putID); + values.put("save", save); + values.put("current", current); + values.put("total", total); + CommonUtil.emitEvent("putFileListener", "putProgress", values); + } + } + + @Override + public void putStart(long current, long total) { + if (null != putID) { + final Map values = new ArrayMap<>(); + values.put("putID", putID); + values.put("current", current); + values.put("total", total); + CommonUtil.emitEvent("putFileListener", "putStart", values); + } + } +} diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnWorkMomentsListener.java b/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnWorkMomentsListener.java index 73c6927..18b235e 100644 --- a/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnWorkMomentsListener.java +++ b/android/src/main/java/io/openim/flutter_openim_sdk/listener/OnWorkMomentsListener.java @@ -2,11 +2,11 @@ package io.openim.flutter_openim_sdk.listener; import io.openim.flutter_openim_sdk.util.CommonUtil; -public class OnWorkMomentsListener implements open_im_sdk_callback.OnWorkMomentsListener { +public class OnWorkMomentsListener /*implements open_im_sdk_callback.OnWorkMomentsListener*/ { - @Override - public void onRecvNewNotification() { - CommonUtil.emitEvent("workMomentsListener", "OnRecvNewNotification", null); - } +// @Override +// public void onRecvNewNotification() { +// CommonUtil.emitEvent("workMomentsListener", "OnRecvNewNotification", null); +// } } diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/manager/ConversationManager.java b/android/src/main/java/io/openim/flutter_openim_sdk/manager/ConversationManager.java index a5aac52..094cf68 100644 --- a/android/src/main/java/io/openim/flutter_openim_sdk/manager/ConversationManager.java +++ b/android/src/main/java/io/openim/flutter_openim_sdk/manager/ConversationManager.java @@ -36,7 +36,7 @@ public class ConversationManager extends BaseManager { Open_im_sdk.getOneConversation( new OnBaseListener(result, methodCall), value(methodCall, "operationID"), - int2long(methodCall, "sessionType"), + value(methodCall, "sessionType"), value(methodCall, "sourceID") ); } @@ -49,13 +49,6 @@ public class ConversationManager extends BaseManager { ); } - public void deleteConversation(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.deleteConversation( - new OnBaseListener(result, methodCall), - value(methodCall, "operationID"), - value(methodCall, "conversationID") - ); - } public void setConversationDraft(MethodCall methodCall, MethodChannel.Result result) { Open_im_sdk.setConversationDraft( @@ -75,19 +68,19 @@ public class ConversationManager extends BaseManager { ); } -// public void markSingleMessageHasRead(MethodCall methodCall, MethodChannel.Result result) { -// Open_im_sdk.markSingleMessageHasRead( -// new OnBaseListener(result, methodCall), -// value(methodCall, "operationID"), -// value(methodCall, "userID") -// ); -// } + public void hideConversation(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.hideConversation( + new OnBaseListener(result, methodCall), + value(methodCall, "operationID"), + value(methodCall, "conversationID") + ); + } - public void markGroupMessageHasRead(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.markGroupMessageHasRead( + public void markConversationMessageAsRead(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.markConversationMessageAsRead( new OnBaseListener(result, methodCall), value(methodCall, "operationID"), - value(methodCall, "groupID") + value(methodCall, "conversationID") ); } @@ -98,17 +91,18 @@ public class ConversationManager extends BaseManager { ); } -// public void getConversationIDBySessionType(MethodCall methodCall, MethodChannel.Result result) { -// CommonUtil.runMainThreadReturn(result, Open_im_sdk.getConversationIDBySessionType( -// value(methodCall, "sourceID"), -// int2long(methodCall, "sessionType"))); -// } + public void getConversationIDBySessionType(MethodCall methodCall, MethodChannel.Result result) { + CommonUtil.runMainThreadReturn(result, Open_im_sdk.getConversationIDBySessionType( + value(methodCall, "operationID"), + value(methodCall, "sourceID"), + int2long(methodCall, "sessionType"))); + } public void setConversationRecvMessageOpt(MethodCall methodCall, MethodChannel.Result result) { Open_im_sdk.setConversationRecvMessageOpt( new OnBaseListener(result, methodCall), value(methodCall, "operationID"), - jsonValue(methodCall, "conversationIDList"), + value(methodCall, "conversationID"), int2long(methodCall, "status") ); } @@ -121,8 +115,8 @@ public class ConversationManager extends BaseManager { ); } - public void setOneConversationPrivateChat(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.setOneConversationPrivateChat( + public void setConversationPrivateChat(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.setConversationPrivateChat( new OnBaseListener(result, methodCall), value(methodCall, "operationID"), value(methodCall, "conversationID"), @@ -130,8 +124,16 @@ public class ConversationManager extends BaseManager { ); } - public void deleteConversationFromLocalAndSvr(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.deleteConversationFromLocalAndSvr( + public void clearConversationAndDeleteAllMsg(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.clearConversationAndDeleteAllMsg( + new OnBaseListener(result, methodCall), + value(methodCall, "operationID"), + value(methodCall, "conversationID") + ); + } + + public void deleteConversationAndDeleteAllMsg(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.deleteConversationAndDeleteAllMsg( new OnBaseListener(result, methodCall), value(methodCall, "operationID"), value(methodCall, "conversationID") @@ -153,9 +155,9 @@ public class ConversationManager extends BaseManager { ); } -// public void getAtAllTag(MethodCall methodCall, MethodChannel.Result result) { -// CommonUtil.runMainThreadReturn(result, Open_im_sdk.getAtAllTag()); -// } + public void getAtAllTag(MethodCall methodCall, MethodChannel.Result result) { + CommonUtil.runMainThreadReturn(result, Open_im_sdk.getAtAllTag(value(methodCall, "operationID"))); + } public void setGlobalRecvMessageOpt(MethodCall methodCall, MethodChannel.Result result) { Open_im_sdk.setGlobalRecvMessageOpt( @@ -165,8 +167,8 @@ public class ConversationManager extends BaseManager { ); } - public void setOneConversationBurnDuration(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.setOneConversationBurnDuration( + public void setConversationBurnDuration(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.setConversationBurnDuration( new OnBaseListener(result, methodCall), value(methodCall, "operationID"), value(methodCall, "conversationID"), diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/manager/FriendshipManager.java b/android/src/main/java/io/openim/flutter_openim_sdk/manager/FriendshipManager.java index 30ddf8c..5f28deb 100644 --- a/android/src/main/java/io/openim/flutter_openim_sdk/manager/FriendshipManager.java +++ b/android/src/main/java/io/openim/flutter_openim_sdk/manager/FriendshipManager.java @@ -16,10 +16,10 @@ public class FriendshipManager extends BaseManager { } public void getFriendsInfo(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.getDesignatedFriendsInfo( + Open_im_sdk.getSpecifiedFriendsInfo( new OnBaseListener(result, methodCall), value(methodCall, "operationID"), - jsonValue(methodCall, "uidList") + jsonValue(methodCall, "userIDList") ); } @@ -31,15 +31,15 @@ public class FriendshipManager extends BaseManager { ); } - public void getRecvFriendApplicationList(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.getRecvFriendApplicationList( + public void getFriendApplicationListAsRecipient(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.getFriendApplicationListAsRecipient( new OnBaseListener(result, methodCall), value(methodCall, "operationID") ); } - public void getSendFriendApplicationList(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.getSendFriendApplicationList( + public void getFriendApplicationListAsApplicant(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.getFriendApplicationListAsApplicant( new OnBaseListener(result, methodCall), value(methodCall, "operationID") ); @@ -64,7 +64,7 @@ public class FriendshipManager extends BaseManager { Open_im_sdk.addBlack( new OnBaseListener(result, methodCall), value(methodCall, "operationID"), - value(methodCall, "uid") + value(methodCall, "userID") ); } @@ -79,7 +79,7 @@ public class FriendshipManager extends BaseManager { Open_im_sdk.removeBlack( new OnBaseListener(result, methodCall), value(methodCall, "operationID"), - value(methodCall, "uid") + value(methodCall, "userID") ); } @@ -87,7 +87,7 @@ public class FriendshipManager extends BaseManager { Open_im_sdk.checkFriend( new OnBaseListener(result, methodCall), value(methodCall, "operationID"), - jsonValue(methodCall, "uidList") + jsonValue(methodCall, "userIDList") ); } @@ -95,7 +95,7 @@ public class FriendshipManager extends BaseManager { Open_im_sdk.deleteFriend( new OnBaseListener(result, methodCall), value(methodCall, "operationID"), - value(methodCall, "uid") + value(methodCall, "userID") ); } diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/manager/GroupManager.java b/android/src/main/java/io/openim/flutter_openim_sdk/manager/GroupManager.java index 116af46..3e6f609 100644 --- a/android/src/main/java/io/openim/flutter_openim_sdk/manager/GroupManager.java +++ b/android/src/main/java/io/openim/flutter_openim_sdk/manager/GroupManager.java @@ -18,9 +18,9 @@ public class GroupManager extends BaseManager { Open_im_sdk.inviteUserToGroup( new OnBaseListener(result, methodCall), value(methodCall, "operationID"), - value(methodCall, "gid"), + value(methodCall, "groupID"), value(methodCall, "reason"), - jsonValue(methodCall, "uidList") + jsonValue(methodCall, "userIDList") ); } @@ -28,18 +28,18 @@ public class GroupManager extends BaseManager { Open_im_sdk.kickGroupMember( new OnBaseListener(result, methodCall), value(methodCall, "operationID"), - value(methodCall, "gid"), + value(methodCall, "groupID"), value(methodCall, "reason"), - jsonValue(methodCall, "uidList") + jsonValue(methodCall, "userIDList") ); } public void getGroupMembersInfo(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.getGroupMembersInfo( + Open_im_sdk.getSpecifiedGroupMembersInfo( new OnBaseListener(result, methodCall), value(methodCall, "operationID"), - value(methodCall, "gid"), - jsonValue(methodCall, "uidList") + value(methodCall, "groupID"), + jsonValue(methodCall, "userIDList") ); } @@ -47,7 +47,7 @@ public class GroupManager extends BaseManager { Open_im_sdk.getGroupMemberList( new OnBaseListener(result, methodCall), value(methodCall, "operationID"), - value(methodCall, "gid"), + value(methodCall, "groupID"), value(methodCall, "filter"), value(methodCall, "offset"), value(methodCall, "count") @@ -66,8 +66,7 @@ public class GroupManager extends BaseManager { Open_im_sdk.createGroup( new OnBaseListener(result, methodCall), value(methodCall, "operationID"), - jsonValue(methodCall, "gInfo"), - jsonValue(methodCall, "memberList") + jsonValue(methodCall) ); } @@ -75,16 +74,15 @@ public class GroupManager extends BaseManager { Open_im_sdk.setGroupInfo( new OnBaseListener(result, methodCall), value(methodCall, "operationID"), - value(methodCall, "gid"), - jsonValue(methodCall, "gInfo") + jsonValue(methodCall, "groupInfo") ); } public void getGroupsInfo(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.getGroupsInfo( + Open_im_sdk.getSpecifiedGroupsInfo( new OnBaseListener(result, methodCall), value(methodCall, "operationID"), - jsonValue(methodCall, "gidList") + jsonValue(methodCall, "groupIDList") ); } @@ -92,7 +90,7 @@ public class GroupManager extends BaseManager { Open_im_sdk.joinGroup( new OnBaseListener(result, methodCall), value(methodCall, "operationID"), - value(methodCall, "gid"), + value(methodCall, "groupID"), value(methodCall, "reason"), value(methodCall, "joinSource") ); @@ -102,7 +100,7 @@ public class GroupManager extends BaseManager { Open_im_sdk.quitGroup( new OnBaseListener(result, methodCall), value(methodCall, "operationID"), - value(methodCall, "gid") + value(methodCall, "groupID") ); } @@ -110,20 +108,20 @@ public class GroupManager extends BaseManager { Open_im_sdk.transferGroupOwner( new OnBaseListener(result, methodCall), value(methodCall, "operationID"), - value(methodCall, "gid"), - value(methodCall, "uid") + value(methodCall, "groupID"), + value(methodCall, "userID") ); } - public void getRecvGroupApplicationList(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.getRecvGroupApplicationList( + public void getGroupApplicationListAsRecipient(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.getGroupApplicationListAsRecipient( new OnBaseListener(result, methodCall), value(methodCall, "operationID") ); } - public void getSendGroupApplicationList(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.getSendGroupApplicationList( + public void getGroupApplicationListAsApplicant(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.getGroupApplicationListAsApplicant( new OnBaseListener(result, methodCall), value(methodCall, "operationID") ); @@ -133,8 +131,8 @@ public class GroupManager extends BaseManager { Open_im_sdk.acceptGroupApplication( new OnBaseListener(result, methodCall), value(methodCall, "operationID"), - value(methodCall, "gid"), - value(methodCall, "uid"), + value(methodCall, "groupID"), + value(methodCall, "userID"), value(methodCall, "handleMsg") ); @@ -144,8 +142,8 @@ public class GroupManager extends BaseManager { Open_im_sdk.refuseGroupApplication( new OnBaseListener(result, methodCall), value(methodCall, "operationID"), - value(methodCall, "gid"), - value(methodCall, "uid"), + value(methodCall, "groupID"), + value(methodCall, "userID"), value(methodCall, "handleMsg") ); @@ -155,7 +153,7 @@ public class GroupManager extends BaseManager { Open_im_sdk.dismissGroup( new OnBaseListener(result, methodCall), value(methodCall, "operationID"), - value(methodCall, "gid") + value(methodCall, "groupID") ); } @@ -163,7 +161,7 @@ public class GroupManager extends BaseManager { Open_im_sdk.changeGroupMute( new OnBaseListener(result, methodCall), value(methodCall, "operationID"), - value(methodCall, "gid"), + value(methodCall, "groupID"), value(methodCall, "mute") ); } @@ -172,8 +170,8 @@ public class GroupManager extends BaseManager { Open_im_sdk.changeGroupMemberMute( new OnBaseListener(result, methodCall), value(methodCall, "operationID"), - value(methodCall, "gid"), - value(methodCall, "uid"), + value(methodCall, "groupID"), + value(methodCall, "userID"), int2long(methodCall, "seconds") ); } @@ -181,8 +179,8 @@ public class GroupManager extends BaseManager { public void setGroupMemberNickname(MethodCall methodCall, MethodChannel.Result result) { Open_im_sdk.setGroupMemberNickname(new OnBaseListener(result, methodCall), value(methodCall, "operationID"), - value(methodCall, "gid"), - value(methodCall, "uid"), + value(methodCall, "groupID"), + value(methodCall, "userID"), value(methodCall, "groupNickname") ); } @@ -259,4 +257,11 @@ public class GroupManager extends BaseManager { jsonValue(methodCall, "info") ); } + + public void isJoinGroup(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.isJoinGroup(new OnBaseListener(result, methodCall), + value(methodCall, "operationID"), + value(methodCall, "groupID") + ); + } } \ No newline at end of file diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/manager/IMManager.java b/android/src/main/java/io/openim/flutter_openim_sdk/manager/IMManager.java index 7838f06..fb3ac07 100644 --- a/android/src/main/java/io/openim/flutter_openim_sdk/manager/IMManager.java +++ b/android/src/main/java/io/openim/flutter_openim_sdk/manager/IMManager.java @@ -2,27 +2,30 @@ 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.FlutterOpenimSdkPlugin; import io.openim.flutter_openim_sdk.listener.OnBaseListener; import io.openim.flutter_openim_sdk.listener.OnConnListener; import io.openim.flutter_openim_sdk.listener.OnListenerForService; +import io.openim.flutter_openim_sdk.listener.OnPutFileListener; import io.openim.flutter_openim_sdk.util.CommonUtil; import open_im_sdk.Open_im_sdk; public class IMManager extends BaseManager { public void initSDK(MethodCall methodCall, MethodChannel.Result result) { - CommonUtil.runMainThreadReturn(result, Open_im_sdk.initSDK( + boolean initialized = Open_im_sdk.initSDK( new OnConnListener(), value(methodCall, "operationID"), - jsonValue(methodCall)) - ); + jsonValue(methodCall)); + FlutterOpenimSdkPlugin.isInitialized = initialized; + CommonUtil.runMainThreadReturn(result, initialized); } public void login(MethodCall methodCall, MethodChannel.Result result) { Open_im_sdk.login( new OnBaseListener(result, methodCall), value(methodCall, "operationID"), - value(methodCall, "uid"), + value(methodCall, "userID"), value(methodCall, "token") ); } @@ -34,24 +37,16 @@ public class IMManager extends BaseManager { ); } -// public void getLoginStatus(MethodCall methodCall, MethodChannel.Result result) { -// CommonUtil.runMainThreadReturn(result, Open_im_sdk.getLoginStatus()); -// } - - public void wakeUp(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.wakeUp( - new OnBaseListener(result, methodCall), - value(methodCall, "operationID") - ); + public void getLoginStatus(MethodCall methodCall, MethodChannel.Result result) { + CommonUtil.runMainThreadReturn(result, Open_im_sdk.getLoginStatus()); } - public void uploadImage(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.uploadImage( + public void putFile(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.putFile( new OnBaseListener(result, methodCall), value(methodCall, "operationID"), - value(methodCall, "path"), - value(methodCall, "token"), - value(methodCall, "obj") + jsonValue(methodCall), + new OnPutFileListener(result, methodCall) ); } @@ -72,17 +67,18 @@ public class IMManager extends BaseManager { ); } - public void networkChanged(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.networkChanged( + + public void networkStatusChanged(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.networkStatusChanged( new OnBaseListener(result, methodCall), value(methodCall, "operationID") ); } - public void setListenerForService(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.setListenerForService(new OnListenerForService()); - - result.success(null); - } +// public void setListenerForService(MethodCall methodCall, MethodChannel.Result result) { +// Open_im_sdk.setListenerForService(new OnListenerForService()); +// +// result.success(null); +// } } diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/manager/MessageManager.java b/android/src/main/java/io/openim/flutter_openim_sdk/manager/MessageManager.java index abd2658..c1e1770 100644 --- a/android/src/main/java/io/openim/flutter_openim_sdk/manager/MessageManager.java +++ b/android/src/main/java/io/openim/flutter_openim_sdk/manager/MessageManager.java @@ -100,33 +100,46 @@ public class MessageManager extends BaseManager { ); } - public void getHistoryMessageList(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.getHistoryMessageList( + public void revokeMessage(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.revokeMessage( new OnBaseListener(result, methodCall), value(methodCall, "operationID"), - jsonValue(methodCall) + value(methodCall, "conversationID"), + value(methodCall, "clientMsgID") ); } - public void revokeMessage(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.revokeMessage( + public void deleteMessageFromLocalStorage(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.deleteMessageFromLocalStorage( new OnBaseListener(result, methodCall), value(methodCall, "operationID"), - jsonValue(methodCall) + value(methodCall, "conversationID"), + value(methodCall, "clientMsgID") ); } - public void deleteMessageFromLocalStorage(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.deleteMessageFromLocalStorage( + public void deleteMessageFromLocalAndSvr(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.deleteMessage( new OnBaseListener(result, methodCall), value(methodCall, "operationID"), - jsonValue(methodCall) + value(methodCall, "conversationID"), + value(methodCall, "clientMsgID") ); } -// public void deleteMessages(MethodCall methodCall, MethodChannel.Result result) { -// Open_im_sdk.deleteMessages(new OnBaseListener(result, methodCall), CommonUtil.getSDKJsonParam(methodCall)); -// } + public void deleteAllMsgFromLocal(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.deleteAllMsgFromLocal( + new OnBaseListener(result, methodCall), + value(methodCall, "operationID") + ); + } + + public void deleteAllMsgFromLocalAndSvr(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.deleteAllMsgFromLocalAndSvr( + new OnBaseListener(result, methodCall), + value(methodCall, "operationID") + ); + } public void insertSingleMessageToLocalStorage(MethodCall methodCall, MethodChannel.Result result) { Open_im_sdk.insertSingleMessageToLocalStorage( @@ -148,20 +161,11 @@ public class MessageManager extends BaseManager { ); } - public void markC2CMessageAsRead(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.markC2CMessageAsRead( + public void markMessagesAsReadByMsgID(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.markMessagesAsReadByMsgID( new OnBaseListener(result, methodCall), value(methodCall, "operationID"), - value(methodCall, "userID"), - jsonValue(methodCall, "messageIDList") - ); - } - - public void markGroupMessageAsRead(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.markGroupMessageAsRead( - new OnBaseListener(result, methodCall), - value(methodCall, "operationID"), - value(methodCall, "groupID"), + value(methodCall, "conversationID"), jsonValue(methodCall, "messageIDList") ); } @@ -317,20 +321,23 @@ public class MessageManager extends BaseManager { )); } - public void clearC2CHistoryMessage(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.clearC2CHistoryMessage( - new OnBaseListener(result, methodCall), - value(methodCall, "operationID"), - value(methodCall, "userID") - ); + public void createAdvancedTextMessage(MethodCall methodCall, MethodChannel.Result result) { + CommonUtil.runMainThreadReturn(result, + Open_im_sdk.createAdvancedTextMessage( + value(methodCall, "operationID"), + value(methodCall, "text"), + jsonValue(methodCall, "richMessageInfoList") + )); } - public void clearGroupHistoryMessage(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.clearGroupHistoryMessage( - new OnBaseListener(result, methodCall), - value(methodCall, "operationID"), - value(methodCall, "groupID") - ); + public void createAdvancedQuoteMessage(MethodCall methodCall, MethodChannel.Result result) { + CommonUtil.runMainThreadReturn(result, + Open_im_sdk.createAdvancedQuoteMessage( + value(methodCall, "operationID"), + value(methodCall, "quoteText"), + jsonValue(methodCall, "quoteMessage"), + jsonValue(methodCall, "richMessageInfoList") + )); } public void searchLocalMessages(MethodCall methodCall, MethodChannel.Result result) { @@ -341,71 +348,26 @@ public class MessageManager extends BaseManager { ); } - public void deleteMessageFromLocalAndSvr(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.deleteMessageFromLocalAndSvr( - new OnBaseListener(result, methodCall), - value(methodCall, "operationID"), - jsonValue(methodCall) - ); - } - - public void deleteAllMsgFromLocal(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.deleteAllMsgFromLocal( - new OnBaseListener(result, methodCall), - value(methodCall, "operationID") - ); - } - - public void deleteAllMsgFromLocalAndSvr(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.deleteAllMsgFromLocalAndSvr( - new OnBaseListener(result, methodCall), - value(methodCall, "operationID") - ); - } - public void markMessageAsReadByConID(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.markMessageAsReadByConID( + public void clearConversationAndDeleteAllMsg(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.clearConversationAndDeleteAllMsg( new OnBaseListener(result, methodCall), value(methodCall, "operationID"), - value(methodCall, "conversationID"), - jsonValue(methodCall, "messageIDList") + value(methodCall, "conversationID") ); } - public void clearC2CHistoryMessageFromLocalAndSvr(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.clearC2CHistoryMessageFromLocalAndSvr( - new OnBaseListener(result, methodCall), - value(methodCall, "operationID"), - value(methodCall, "userID") - ); - } - public void clearGroupHistoryMessageFromLocalAndSvr(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.clearGroupHistoryMessageFromLocalAndSvr( - new OnBaseListener(result, methodCall), - value(methodCall, "operationID"), - value(methodCall, "groupID") - ); - } - - public void getHistoryMessageListReverse(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.getHistoryMessageListReverse( - new OnBaseListener(result, methodCall), - value(methodCall, "operationID"), - jsonValue(methodCall) - ); - } - - public void newRevokeMessage(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.newRevokeMessage( + public void getAdvancedHistoryMessageList(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.getAdvancedHistoryMessageList( new OnBaseListener(result, methodCall), value(methodCall, "operationID"), jsonValue(methodCall) ); } - public void getAdvancedHistoryMessageList(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.getAdvancedHistoryMessageList( + public void getAdvancedHistoryMessageListReverse(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.getAdvancedHistoryMessageListReverse( new OnBaseListener(result, methodCall), value(methodCall, "operationID"), jsonValue(methodCall) @@ -420,24 +382,6 @@ public class MessageManager extends BaseManager { ); } - public void createAdvancedTextMessage(MethodCall methodCall, MethodChannel.Result result) { - CommonUtil.runMainThreadReturn(result, - Open_im_sdk.createAdvancedTextMessage( - value(methodCall, "operationID"), - value(methodCall, "text"), - jsonValue(methodCall, "richMessageInfoList") - )); - } - - public void createAdvancedQuoteMessage(MethodCall methodCall, MethodChannel.Result result) { - CommonUtil.runMainThreadReturn(result, - Open_im_sdk.createAdvancedQuoteMessage( - value(methodCall, "operationID"), - value(methodCall, "quoteText"), - jsonValue(methodCall, "quoteMessage"), - jsonValue(methodCall, "richMessageInfoList") - )); - } public void sendMessageNotOss(MethodCall methodCall, MethodChannel.Result result) { Open_im_sdk.sendMessageNotOss( diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/manager/OrganizationManager.java b/android/src/main/java/io/openim/flutter_openim_sdk/manager/OrganizationManager.java index b1192cf..86623dd 100644 --- a/android/src/main/java/io/openim/flutter_openim_sdk/manager/OrganizationManager.java +++ b/android/src/main/java/io/openim/flutter_openim_sdk/manager/OrganizationManager.java @@ -1,13 +1,13 @@ -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.OnBaseListener; -import io.openim.flutter_openim_sdk.listener.OnOrganizationListener; -import open_im_sdk.Open_im_sdk; - -public class OrganizationManager extends BaseManager { - +//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.OnBaseListener; +//import io.openim.flutter_openim_sdk.listener.OnOrganizationListener; +//import open_im_sdk.Open_im_sdk; +// +//public class OrganizationManager extends BaseManager { +// // public void setOrganizationListener(MethodCall methodCall, MethodChannel.Result result) { // Open_im_sdk.setOrganizationListener(new OnOrganizationListener()); // @@ -67,4 +67,4 @@ public class OrganizationManager extends BaseManager { // int2long(methodCall, "count") // ); // } -} +//} diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/manager/SignalingManager.java b/android/src/main/java/io/openim/flutter_openim_sdk/manager/SignalingManager.java index a3ff7a6..1ba1473 100644 --- a/android/src/main/java/io/openim/flutter_openim_sdk/manager/SignalingManager.java +++ b/android/src/main/java/io/openim/flutter_openim_sdk/manager/SignalingManager.java @@ -1,75 +1,75 @@ -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.OnBaseListener; -import io.openim.flutter_openim_sdk.listener.OnSignalingListener; -import open_im_sdk.Open_im_sdk; - -public class SignalingManager extends BaseManager { - - public void setSignalingListener(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.setSignalingListener(new OnSignalingListener()); - - result.success(null); - } - - public void signalingInvite(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.signalingInvite( - new OnBaseListener(result, methodCall), - value(methodCall, "operationID"), - jsonValue(methodCall, "signalingInfo")); - } - - public void signalingInviteInGroup(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.signalingInviteInGroup( - new OnBaseListener(result, methodCall), - value(methodCall, "operationID"), - jsonValue(methodCall, "signalingInfo")); - } - - public void signalingAccept(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.signalingAccept( - new OnBaseListener(result, methodCall), - value(methodCall, "operationID"), - jsonValue(methodCall, "signalingInfo")); - } - - public void signalingReject(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.signalingReject( - new OnBaseListener(result, methodCall), - value(methodCall, "operationID"), - jsonValue(methodCall, "signalingInfo")); - } - - public void signalingCancel(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.signalingCancel( - new OnBaseListener(result, methodCall), - value(methodCall, "operationID"), - jsonValue(methodCall, "signalingInfo")); - } - - public void signalingHungUp(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.signalingHungUp( - new OnBaseListener(result, methodCall), - value(methodCall, "operationID"), - jsonValue(methodCall, "signalingInfo")); - } - - public void signalingGetRoomByGroupID(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.signalingGetRoomByGroupID( - new OnBaseListener(result, methodCall), - value(methodCall, "operationID"), - value(methodCall, "groupID")); - } - - public void signalingGetTokenByRoomID(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.signalingGetTokenByRoomID( - new OnBaseListener(result, methodCall), - value(methodCall, "operationID"), - value(methodCall, "roomID")); - } - +//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.OnBaseListener; +//import io.openim.flutter_openim_sdk.listener.OnSignalingListener; +//import open_im_sdk.Open_im_sdk; +// +//public class SignalingManager extends BaseManager { +// +// public void setSignalingListener(MethodCall methodCall, MethodChannel.Result result) { +// Open_im_sdk.setSignalingListener(new OnSignalingListener()); +// +// result.success(null); +// } +// +// public void signalingInvite(MethodCall methodCall, MethodChannel.Result result) { +// Open_im_sdk.signalingInvite( +// new OnBaseListener(result, methodCall), +// value(methodCall, "operationID"), +// jsonValue(methodCall, "signalingInfo")); +// } +// +// public void signalingInviteInGroup(MethodCall methodCall, MethodChannel.Result result) { +// Open_im_sdk.signalingInviteInGroup( +// new OnBaseListener(result, methodCall), +// value(methodCall, "operationID"), +// jsonValue(methodCall, "signalingInfo")); +// } +// +// public void signalingAccept(MethodCall methodCall, MethodChannel.Result result) { +// Open_im_sdk.signalingAccept( +// new OnBaseListener(result, methodCall), +// value(methodCall, "operationID"), +// jsonValue(methodCall, "signalingInfo")); +// } +// +// public void signalingReject(MethodCall methodCall, MethodChannel.Result result) { +// Open_im_sdk.signalingReject( +// new OnBaseListener(result, methodCall), +// value(methodCall, "operationID"), +// jsonValue(methodCall, "signalingInfo")); +// } +// +// public void signalingCancel(MethodCall methodCall, MethodChannel.Result result) { +// Open_im_sdk.signalingCancel( +// new OnBaseListener(result, methodCall), +// value(methodCall, "operationID"), +// jsonValue(methodCall, "signalingInfo")); +// } +// +// public void signalingHungUp(MethodCall methodCall, MethodChannel.Result result) { +// Open_im_sdk.signalingHungUp( +// new OnBaseListener(result, methodCall), +// value(methodCall, "operationID"), +// jsonValue(methodCall, "signalingInfo")); +// } +// +// public void signalingGetRoomByGroupID(MethodCall methodCall, MethodChannel.Result result) { +// Open_im_sdk.signalingGetRoomByGroupID( +// new OnBaseListener(result, methodCall), +// value(methodCall, "operationID"), +// value(methodCall, "groupID")); +// } +// +// public void signalingGetTokenByRoomID(MethodCall methodCall, MethodChannel.Result result) { +// Open_im_sdk.signalingGetTokenByRoomID( +// new OnBaseListener(result, methodCall), +// value(methodCall, "operationID"), +// value(methodCall, "roomID")); +// } +// // public void signalingUpdateMeetingInfo(MethodCall methodCall, MethodChannel.Result result) { // Open_im_sdk.signalingUpdateMeetingInfo( // new OnBaseListener(result, methodCall), @@ -122,4 +122,4 @@ public class SignalingManager extends BaseManager { // value(methodCall, "customInfo"), // value(methodCall, "roomID")); // } -} +//} diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/manager/UserManager.java b/android/src/main/java/io/openim/flutter_openim_sdk/manager/UserManager.java index 37ae394..1cf4f26 100644 --- a/android/src/main/java/io/openim/flutter_openim_sdk/manager/UserManager.java +++ b/android/src/main/java/io/openim/flutter_openim_sdk/manager/UserManager.java @@ -18,7 +18,7 @@ public class UserManager extends BaseManager { Open_im_sdk.getUsersInfo( new OnBaseListener(result, methodCall), value(methodCall, "operationID"), - jsonValue(methodCall, "uidList")); + jsonValue(methodCall, "userIDList")); } public void setSelfInfo(MethodCall methodCall, MethodChannel.Result result) { diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/manager/WorkMomentsManager.java b/android/src/main/java/io/openim/flutter_openim_sdk/manager/WorkMomentsManager.java index 7293c53..90fc192 100644 --- a/android/src/main/java/io/openim/flutter_openim_sdk/manager/WorkMomentsManager.java +++ b/android/src/main/java/io/openim/flutter_openim_sdk/manager/WorkMomentsManager.java @@ -1,33 +1,33 @@ -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.OnBaseListener; -import io.openim.flutter_openim_sdk.listener.OnWorkMomentsListener; -import open_im_sdk.Open_im_sdk; - -public class WorkMomentsManager extends BaseManager { - - public void setWorkMomentsListener(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.setWorkMomentsListener(new OnWorkMomentsListener()); - - result.success(null); - } - - public void getWorkMomentsUnReadCount(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.getWorkMomentsUnReadCount(new OnBaseListener(result, methodCall), - value(methodCall, "operationID")); - } - - public void getWorkMomentsNotification(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.getWorkMomentsNotification(new OnBaseListener(result, methodCall), - value(methodCall, "operationID"), - int2long(methodCall, "offset"), - int2long(methodCall, "count")); - } - - public void clearWorkMomentsNotification(MethodCall methodCall, MethodChannel.Result result) { - Open_im_sdk.clearWorkMomentsNotification(new OnBaseListener(result, methodCall), - value(methodCall, "operationID")); - } -} +//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.OnBaseListener; +//import io.openim.flutter_openim_sdk.listener.OnWorkMomentsListener; +//import open_im_sdk.Open_im_sdk; +// +//public class WorkMomentsManager extends BaseManager { +// +// public void setWorkMomentsListener(MethodCall methodCall, MethodChannel.Result result) { +// Open_im_sdk.setWorkMomentsListener(new OnWorkMomentsListener()); +// +// result.success(null); +// } +// +// public void getWorkMomentsUnReadCount(MethodCall methodCall, MethodChannel.Result result) { +// Open_im_sdk.getWorkMomentsUnReadCount(new OnBaseListener(result, methodCall), +// value(methodCall, "operationID")); +// } +// +// public void getWorkMomentsNotification(MethodCall methodCall, MethodChannel.Result result) { +// Open_im_sdk.getWorkMomentsNotification(new OnBaseListener(result, methodCall), +// value(methodCall, "operationID"), +// int2long(methodCall, "offset"), +// int2long(methodCall, "count")); +// } +// +// public void clearWorkMomentsNotification(MethodCall methodCall, MethodChannel.Result result) { +// Open_im_sdk.clearWorkMomentsNotification(new OnBaseListener(result, methodCall), +// value(methodCall, "operationID")); +// } +//} diff --git a/example/pubspec.lock b/example/pubspec.lock index 35ecb37..48d52b9 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -68,7 +68,7 @@ packages: path: ".." relative: true source: path - version: "2.3.5+3" + version: "2.3.5+4" flutter_test: dependency: "direct dev" description: flutter diff --git a/ios/Classes/Module/ConversationManager.swift b/ios/Classes/Module/ConversationManager.swift index e30d6d9..80b3754 100644 --- a/ios/Classes/Module/ConversationManager.swift +++ b/ios/Classes/Module/ConversationManager.swift @@ -10,22 +10,22 @@ public class ConversationManager: BaseServiceManager { self["getConversationListSplit"] = getConversationListSplit self["getOneConversation"] = getOneConversation self["getMultipleConversation"] = getMultipleConversation - self["deleteConversation"] = deleteConversation self["setConversationDraft"] = setConversationDraft self["pinConversation"] = pinConversation - // self["markSingleMessageHasRead"] = markSingleMessageHasRead - self["markGroupMessageHasRead"] = markGroupMessageHasRead + self["hideConversation"] = hideConversation + self["markConversationMessageAsRead"] = markConversationMessageAsRead self["getTotalUnreadMsgCount"] = getTotalUnreadMsgCount self["getConversationIDBySessionType"] = getConversationIDBySessionType self["setConversationRecvMessageOpt"] = setConversationRecvMessageOpt self["getConversationRecvMessageOpt"] = getConversationRecvMessageOpt - self["setOneConversationPrivateChat"] = setOneConversationPrivateChat - self["deleteConversationFromLocalAndSvr"] = deleteConversationFromLocalAndSvr + self["setConversationPrivateChat"] = setConversationPrivateChat + self["clearConversationAndDeleteAllMsg"] = clearConversationAndDeleteAllMsg + self["deleteConversationAndDeleteAllMsg"] = deleteConversationAndDeleteAllMsg self["deleteAllConversationFromLocal"] = deleteAllConversationFromLocal self["resetConversationGroupAtType"] = resetConversationGroupAtType self["getAtAllTag"] = getAtAllTag self["setGlobalRecvMessageOpt"] = setGlobalRecvMessageOpt - self["setOneConversationBurnDuration"] = setOneConversationBurnDuration + self["setConversationBurnDuration"] = setConversationBurnDuration } func setConversationListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ @@ -42,17 +42,13 @@ public class ConversationManager: BaseServiceManager { } func getOneConversation(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkGetOneConversation(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[int: "sessionType"], methodCall[string: "sourceID"]) + Open_im_sdkGetOneConversation(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[int32: "sessionType"], methodCall[string: "sourceID"]) } func getMultipleConversation(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ Open_im_sdkGetMultipleConversation(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "conversationIDList"]) } - func deleteConversation(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkDeleteConversation(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"]) - } - func setConversationDraft(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ Open_im_sdkSetConversationDraft(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"], methodCall[string: "draftText"]) } @@ -61,12 +57,12 @@ public class ConversationManager: BaseServiceManager { Open_im_sdkPinConversation(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"], methodCall[bool: "isPinned"]) } - // func markSingleMessageHasRead(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - // Open_im_sdkMarkSingleMessageHasRead(BaseCallback(result: result), methodCall[string: "userID"]) - // } + func hideConversation(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ + Open_im_sdkHideConversation(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"]) + } - func markGroupMessageHasRead(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkMarkGroupMessageHasRead(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"]) + func markConversationMessageAsRead(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ + Open_im_sdkMarkConversationMessageAsRead(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"]) } func getTotalUnreadMsgCount(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ @@ -74,24 +70,28 @@ public class ConversationManager: BaseServiceManager { } func getConversationIDBySessionType(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - let conversationID = Open_im_sdkGetConversationIDBySessionType(methodCall[string: "sourceID"], methodCall[int: "sessionType"]) + let conversationID = Open_im_sdkGetConversationIDBySessionType( methodCall[string: "operationID"],methodCall[string: "sourceID"], methodCall[int: "sessionType"]) callBack(result, conversationID) } func setConversationRecvMessageOpt(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkSetConversationRecvMessageOpt(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "conversationIDList"], methodCall[int: "status"]) + Open_im_sdkSetConversationRecvMessageOpt(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "conversationID"], methodCall[int: "status"]) } func getConversationRecvMessageOpt(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ Open_im_sdkGetConversationRecvMessageOpt(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "conversationIDList"]) } - func setOneConversationPrivateChat(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkSetOneConversationPrivateChat(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"],methodCall[bool: "isPrivate"]) + func setConversationPrivateChat(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ + Open_im_sdkSetConversationPrivateChat(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"],methodCall[bool: "isPrivate"]) + } + + func clearConversationAndDeleteAllMsg(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ + Open_im_sdkClearConversationAndDeleteAllMsg(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"]) } - func deleteConversationFromLocalAndSvr(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkDeleteConversationFromLocalAndSvr(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"]) + func deleteConversationAndDeleteAllMsg(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ + Open_im_sdkDeleteConversationAndDeleteAllMsg(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"]) } func deleteAllConversationFromLocal(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ @@ -103,15 +103,15 @@ public class ConversationManager: BaseServiceManager { } func getAtAllTag(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - callBack(result, Open_im_sdkGetAtAllTag()) + callBack(result, Open_im_sdkGetAtAllTag(methodCall[string: "operationID"])) } func setGlobalRecvMessageOpt(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ Open_im_sdkSetGlobalRecvMessageOpt(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[int: "status"]) } - func setOneConversationBurnDuration(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkSetOneConversationBurnDuration(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"], methodCall[int32: "burnDuration"]) + func setConversationBurnDuration(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ + Open_im_sdkSetConversationBurnDuration(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"], methodCall[int: "burnDuration"]) } } diff --git a/ios/Classes/Module/FriendshipManager.swift b/ios/Classes/Module/FriendshipManager.swift index 7cf4ae4..88b6a4b 100644 --- a/ios/Classes/Module/FriendshipManager.swift +++ b/ios/Classes/Module/FriendshipManager.swift @@ -8,8 +8,8 @@ public class FriendshipManager: BaseServiceManager { self["setFriendListener"] = setFriendListener self["getFriendsInfo"] = getFriendsInfo self["addFriend"] = addFriend - self["getRecvFriendApplicationList"] = getRecvFriendApplicationList - self["getSendFriendApplicationList"] = getSendFriendApplicationList + self["getFriendApplicationListAsRecipient"] = getFriendApplicationListAsRecipient + self["getFriendApplicationListAsApplicant"] = getFriendApplicationListAsApplicant self["getFriendList"] = getFriendList self["setFriendRemark"] = setFriendRemark self["addBlacklist"] = addBlacklist @@ -20,9 +20,6 @@ public class FriendshipManager: BaseServiceManager { self["acceptFriendApplication"] = acceptFriendApplication self["refuseFriendApplication"] = refuseFriendApplication self["searchFriends"] = searchFriends -// self["forceSyncFriendApplication"] = forceSyncFriendApplication -// self["forceSyncFriend"] = forceSyncFriend -// self["forceSyncBlackList"] = forceSyncBlackList } func setFriendListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ @@ -31,19 +28,19 @@ public class FriendshipManager: BaseServiceManager { } func getFriendsInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkGetDesignatedFriendsInfo(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "uidList"]) + Open_im_sdkGetSpecifiedFriendsInfo(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "userIDList"]) } func addFriend(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ Open_im_sdkAddFriend(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString()) } - func getRecvFriendApplicationList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkGetRecvFriendApplicationList(BaseCallback(result: result), methodCall[string: "operationID"]) + func getFriendApplicationListAsRecipient(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ + Open_im_sdkGetFriendApplicationListAsRecipient(BaseCallback(result: result), methodCall[string: "operationID"]) } - func getSendFriendApplicationList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkGetSendFriendApplicationList(BaseCallback(result: result), methodCall[string: "operationID"]) + func getFriendApplicationListAsApplicant(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ + Open_im_sdkGetFriendApplicationListAsApplicant(BaseCallback(result: result), methodCall[string: "operationID"]) } func getFriendList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ @@ -55,7 +52,7 @@ public class FriendshipManager: BaseServiceManager { } func addBlacklist(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkAddBlack(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "uid"]) + Open_im_sdkAddBlack(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "userID"]) } func getBlacklist(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ @@ -63,15 +60,15 @@ public class FriendshipManager: BaseServiceManager { } func removeBlacklist(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkRemoveBlack(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "uid"]) + Open_im_sdkRemoveBlack(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "userID"]) } func checkFriend(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkCheckFriend(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "uidList"]) + Open_im_sdkCheckFriend(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "userIDList"]) } func deleteFriend(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkDeleteFriend(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "uid"]) + Open_im_sdkDeleteFriend(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "userID"]) } func acceptFriendApplication(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ @@ -85,20 +82,6 @@ public class FriendshipManager: BaseServiceManager { func searchFriends(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ Open_im_sdkSearchFriends(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "searchParam"]) } -// func forceSyncFriendApplication(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ -// Open_im_sdkForceSyncFriendApplication() -// callBack(result) -// } -// -// func forceSyncFriend(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ -// Open_im_sdkForceSyncFriend() -// callBack(result) -// } -// -// func forceSyncBlackList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ -// Open_im_sdkForceSyncBlackList() -// callBack(result) -// } } public class FriendshipListener: NSObject, Open_im_sdk_callbackOnFriendshipListenerProtocol { @@ -109,11 +92,15 @@ public class FriendshipListener: NSObject, Open_im_sdk_callbackOnFriendshipListe } public func onBlackAdded(_ blackInfo: String?) { - CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onBlacklistAdded", errCode: nil, errMsg: nil, data: blackInfo) + CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onBlackAdded", errCode: nil, errMsg: nil, data: blackInfo) } public func onBlackDeleted(_ blackInfo: String?) { - CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onBlacklistDeleted", errCode: nil, errMsg: nil, data: blackInfo) + CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onBlackDeleted", errCode: nil, errMsg: nil, data: blackInfo) + } + + public func onFriendAdded(_ friendInfo: String?) { + CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onFriendAdded", errCode: nil, errMsg: nil, data: friendInfo) } public func onFriendApplicationAccepted(_ friendApplication: String?) { @@ -132,16 +119,12 @@ public class FriendshipListener: NSObject, Open_im_sdk_callbackOnFriendshipListe CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onFriendApplicationRejected", errCode: nil, errMsg: nil, data: friendApplication) } - public func onFriendInfoChanged(_ friendInfo: String?) { - CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onFriendInfoChanged", errCode: nil, errMsg: nil, data: friendInfo) - } - - public func onFriendAdded(_ friendInfo: String?) { - CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onFriendAdded", errCode: nil, errMsg: nil, data: friendInfo) - } - public func onFriendDeleted(_ friendInfo: String?) { CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onFriendDeleted", errCode: nil, errMsg: nil, data: friendInfo) } + + public func onFriendInfoChanged(_ friendInfo: String?) { + CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onFriendInfoChanged", errCode: nil, errMsg: nil, data: friendInfo) + } } diff --git a/ios/Classes/Module/GroupManager.swift b/ios/Classes/Module/GroupManager.swift index a967cd9..276b10d 100644 --- a/ios/Classes/Module/GroupManager.swift +++ b/ios/Classes/Module/GroupManager.swift @@ -17,8 +17,8 @@ public class GroupManager: BaseServiceManager { self["joinGroup"] = joinGroup self["quitGroup"] = quitGroup self["transferGroupOwner"] = transferGroupOwner - self["getRecvGroupApplicationList"] = getRecvGroupApplicationList - self["getSendGroupApplicationList"] = getSendGroupApplicationList + self["getGroupApplicationListAsRecipient"] = getGroupApplicationListAsRecipient + self["getGroupApplicationListAsApplicant"] = getGroupApplicationListAsApplicant self["acceptGroupApplication"] = acceptGroupApplication self["refuseGroupApplication"] = refuseGroupApplication self["dismissGroup"] = dismissGroup @@ -34,6 +34,7 @@ public class GroupManager: BaseServiceManager { self["getGroupMemberOwnerAndAdmin"] = getGroupMemberOwnerAndAdmin self["searchGroupMembers"] = searchGroupMembers self["setGroupMemberInfo"] = setGroupMemberInfo + self["isJoinGroup"] = isJoinGroup } func setGroupListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ @@ -42,21 +43,21 @@ public class GroupManager: BaseServiceManager { } func inviteUserToGroup(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkInviteUserToGroup(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "gid"], methodCall[string: "reason"], - methodCall[jsonString: "uidList"]) + Open_im_sdkInviteUserToGroup(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[string: "reason"], + methodCall[jsonString: "userIDList"]) } func kickGroupMember(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkKickGroupMember(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "gid"], methodCall[string: "reason"], - methodCall[jsonString: "uidList"]) + Open_im_sdkKickGroupMember(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[string: "reason"], + methodCall[jsonString: "userIDList"]) } func getGroupMembersInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkGetGroupMembersInfo(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "gid"], methodCall[jsonString: "uidList"]) + Open_im_sdkGetSpecifiedGroupMembersInfo(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[jsonString: "userIDList"]) } func getGroupMemberList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkGetGroupMemberList(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "gid"], methodCall[int32: "filter"], + Open_im_sdkGetGroupMemberList(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[int32: "filter"], methodCall[int32: "offset"], methodCall[int32: "count"]) } @@ -65,59 +66,59 @@ public class GroupManager: BaseServiceManager { } func createGroup(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkCreateGroup(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "gInfo"], methodCall[jsonString: "memberList"]) + Open_im_sdkCreateGroup(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString()) } func setGroupInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkSetGroupInfo(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "gid"], methodCall[jsonString: "gInfo"]) + Open_im_sdkSetGroupInfo(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "groupInfo"]) } func getGroupsInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkGetGroupsInfo(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "gidList"]) + Open_im_sdkGetSpecifiedGroupsInfo(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "groupIDList"]) } func joinGroup(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkJoinGroup(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "gid"], methodCall[string: "reason"], methodCall[int32: "joinSource"]) + Open_im_sdkJoinGroup(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[string: "reason"], methodCall[int32: "joinSource"]) } func quitGroup(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkQuitGroup(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "gid"]) + Open_im_sdkQuitGroup(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"]) } func transferGroupOwner(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkTransferGroupOwner(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "gid"], methodCall[string: "uid"]) + Open_im_sdkTransferGroupOwner(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[string: "userID"]) } - func getRecvGroupApplicationList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkGetRecvGroupApplicationList(BaseCallback(result: result), methodCall[string: "operationID"]) + func getGroupApplicationListAsRecipient(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ + Open_im_sdkGetGroupApplicationListAsRecipient(BaseCallback(result: result), methodCall[string: "operationID"]) } - func getSendGroupApplicationList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkGetSendGroupApplicationList(BaseCallback(result: result), methodCall[string: "operationID"]) + func getGroupApplicationListAsApplicant(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ + Open_im_sdkGetGroupApplicationListAsApplicant(BaseCallback(result: result), methodCall[string: "operationID"]) } func acceptGroupApplication(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkAcceptGroupApplication(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "gid"], methodCall[string: "uid"], methodCall[string: "handleMsg"]) + Open_im_sdkAcceptGroupApplication(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[string: "userID"], methodCall[string: "handleMsg"]) } func refuseGroupApplication(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkRefuseGroupApplication(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "gid"], methodCall[string: "uid"], methodCall[string: "handleMsg"]) + Open_im_sdkRefuseGroupApplication(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[string: "userID"], methodCall[string: "handleMsg"]) } func dismissGroup(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkDismissGroup(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "gid"]) + Open_im_sdkDismissGroup(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"]) } func changeGroupMute(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkChangeGroupMute(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "gid"], methodCall[bool: "mute"]) + Open_im_sdkChangeGroupMute(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[bool: "mute"]) } func changeGroupMemberMute(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkChangeGroupMemberMute(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "gid"], methodCall[string:"uid"],methodCall[int:"seconds"]) + Open_im_sdkChangeGroupMemberMute(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[string:"userID"],methodCall[int:"seconds"]) } func setGroupMemberNickname(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkSetGroupMemberNickname(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "gid"], methodCall[string:"uid"],methodCall[string:"groupNickname"]) + Open_im_sdkSetGroupMemberNickname(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[string:"userID"],methodCall[string:"groupNickname"]) } func searchGroups(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ @@ -155,16 +156,20 @@ public class GroupManager: BaseServiceManager { func setGroupMemberInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ Open_im_sdkSetGroupMemberInfo(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "info"]) } + + func isJoinGroup(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ + Open_im_sdkIsJoinGroup(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"]) + } } public class GroupListener: NSObject, Open_im_sdk_callbackOnGroupListenerProtocol { - + private let channel:FlutterMethodChannel init(channel:FlutterMethodChannel) { self.channel = channel } - + public func onGroupApplicationAccepted(_ s: String?) { CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onGroupApplicationAccepted", errCode: nil, errMsg: nil, data: s) } @@ -181,6 +186,10 @@ public class GroupListener: NSObject, Open_im_sdk_callbackOnGroupListenerProtoco CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onGroupApplicationRejected", errCode: nil, errMsg: nil, data: s) } + public func onGroupDismissed(_ s: String?) { + CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onGroupDismissed", errCode: nil, errMsg: nil, data: s) + } + public func onGroupInfoChanged(_ s: String?) { CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onGroupInfoChanged", errCode: nil, errMsg: nil, data: s) } diff --git a/ios/Classes/Module/IMManager.swift b/ios/Classes/Module/IMManager.swift index 9b7fece..0a5e4e3 100644 --- a/ios/Classes/Module/IMManager.swift +++ b/ios/Classes/Module/IMManager.swift @@ -9,11 +9,10 @@ public class IMMananger: BaseServiceManager { self["login"] = login self["logout"] = logout self["getLoginStatus"] = getLoginStatus - self["wakeUp"] = wakeUp - self["uploadImage"] = uploadImage + self["putFile"] = putFile self["updateFcmToken"] = updateFcmToken self["setAppBackgroundStatus"] = setAppBackgroundStatus - self["networkChanged"] = networkChanged + self["networkStatusChanged"] = networkStatusChanged } func initSDK(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ @@ -21,7 +20,7 @@ public class IMMananger: BaseServiceManager { } func login(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { - Open_im_sdkLogin(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "uid"], methodCall[string: "token"]) + Open_im_sdkLogin(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "userID"], methodCall[string: "token"]) } func logout(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { @@ -32,12 +31,8 @@ public class IMMananger: BaseServiceManager { callBack(result, Open_im_sdkGetLoginStatus()) } - func wakeUp(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { - Open_im_sdkWakeUp(BaseCallback(result: result), methodCall[string: "operationID"]) - } - - func uploadImage(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { - Open_im_sdkUploadImage(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "path"], methodCall[string: "token"], methodCall[string: "obj"]) + func putFile(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { + Open_im_sdkPutFile(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString(),PutFileListener(channel: self.channel,putID: methodCall[string: "putID"])) } func updateFcmToken(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { @@ -48,8 +43,8 @@ public class IMMananger: BaseServiceManager { Open_im_sdkSetAppBackgroundStatus(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[bool: "isBackground"]) } - func networkChanged(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { - Open_im_sdkNetworkChanged(BaseCallback(result: result), methodCall[string: "operationID"]) + func networkStatusChanged(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { + Open_im_sdkNetworkStatusChanged(BaseCallback(result: result), methodCall[string: "operationID"]) } } @@ -80,3 +75,61 @@ public class ConnListener: NSObject, Open_im_sdk_callbackOnConnListenerProtocol CommonUtil.emitEvent(channel: self.channel, method: "connectListener", type: "onUserTokenExpired", errCode: nil, errMsg: nil, data: nil) } } + +public class PutFileListener: NSObject, Open_im_sdk_callbackPutFileCallbackProtocol { + private let channel:FlutterMethodChannel + private let putID: String + + init(channel:FlutterMethodChannel, putID: String) { + self.channel = channel + self.putID = putID + } + + public func hashComplete(_ hash: String?, total: Int64) { + var values: [String: Any] = [:] + values["putID"] = putID + values["hash"] = hash + values["total"] = total + CommonUtil.emitEvent(channel: channel, method: "putFileListener", type: "hashComplete", errCode: nil, errMsg: nil, data: values) + } + + public func hashProgress(_ current: Int64, total: Int64) { + var values: [String: Any] = [:] + values["putID"] = putID + values["current"] = current + values["total"] = total + CommonUtil.emitEvent(channel: channel, method: "putFileListener", type: "hashProgress", errCode: nil, errMsg: nil, data: values) + } + + public func open(_ size: Int64) { + var values: [String: Any] = [:] + values["putID"] = putID + values["size"] = size + CommonUtil.emitEvent(channel: channel, method: "putFileListener", type: "open", errCode: nil, errMsg: nil, data: values) + } + + public func putComplete(_ total: Int64, putType: Int) { + var values: [String: Any] = [:] + values["putID"] = putID + values["putType"] = putType + values["total"] = total + CommonUtil.emitEvent(channel: channel, method: "putFileListener", type: "putComplete", errCode: nil, errMsg: nil, data: values) + } + + public func putProgress(_ save: Int64, current: Int64, total: Int64) { + var values: [String: Any] = [:] + values["putID"] = putID + values["save"] = save + values["current"] = current + values["total"] = total + CommonUtil.emitEvent(channel: channel, method: "putFileListener", type: "putProgress", errCode: nil, errMsg: nil, data: values) + } + + public func putStart(_ current: Int64, total: Int64) { + var values: [String: Any] = [:] + values["putID"] = putID + values["current"] = current + values["total"] = total + CommonUtil.emitEvent(channel: channel, method: "putFileListener", type: "putStart", errCode: nil, errMsg: nil, data: values) + } +} diff --git a/ios/Classes/Module/MessageManager.swift b/ios/Classes/Module/MessageManager.swift index 8d8e58f..61f1507 100644 --- a/ios/Classes/Module/MessageManager.swift +++ b/ios/Classes/Module/MessageManager.swift @@ -9,13 +9,14 @@ public class MessageManager: BaseServiceManager { super.registerHandlers() self["setAdvancedMsgListener"] = setAdvancedMsgListener self["sendMessage"] = sendMessage - self["getHistoryMessageList"] = getHistoryMessageList self["revokeMessage"] = revokeMessage self["deleteMessageFromLocalStorage"] = deleteMessageFromLocalStorage + self["deleteMessageFromLocalAndSvr"] = deleteMessageFromLocalAndSvr + self["deleteAllMsgFromLocal"] = deleteAllMsgFromLocal + self["deleteAllMsgFromLocalAndSvr"] = deleteAllMsgFromLocalAndSvr self["insertSingleMessageToLocalStorage"] = insertSingleMessageToLocalStorage self["insertGroupMessageToLocalStorage"] = insertGroupMessageToLocalStorage - self["markC2CMessageAsRead"] = markC2CMessageAsRead - self["markGroupMessageAsRead"] = markGroupMessageAsRead + self["markMessagesAsReadByMsgID"] = markMessagesAsReadByMsgID self["typingStatusUpdate"] = typingStatusUpdate self["createTextMessage"] = createTextMessage self["createTextAtMessage"] = createTextAtMessage @@ -34,21 +35,17 @@ public class MessageManager: BaseServiceManager { self["createQuoteMessage"] = createQuoteMessage self["createCardMessage"] = createCardMessage self["createFaceMessage"] = createFaceMessage - self["clearC2CHistoryMessage"] = clearC2CHistoryMessage - self["clearGroupHistoryMessage"] = clearGroupHistoryMessage + self["createAdvancedTextMessage"] = createAdvancedTextMessage + self["createAdvancedQuoteMessage"] = createAdvancedQuoteMessage + self["searchLocalMessages"] = searchLocalMessages - self["deleteMessageFromLocalAndSvr"] = deleteMessageFromLocalAndSvr - self["deleteAllMsgFromLocal"] = deleteAllMsgFromLocal - self["deleteAllMsgFromLocalAndSvr"] = deleteAllMsgFromLocalAndSvr - self["markMessageAsReadByConID"] = markMessageAsReadByConID - self["clearC2CHistoryMessageFromLocalAndSvr"] = clearC2CHistoryMessageFromLocalAndSvr - self["clearGroupHistoryMessageFromLocalAndSvr"] = clearGroupHistoryMessageFromLocalAndSvr - self["getHistoryMessageListReverse"] = getHistoryMessageListReverse - self["newRevokeMessage"] = newRevokeMessage + self["clearConversationAndDeleteAllMsg"] = clearConversationAndDeleteAllMsg + self["getAdvancedHistoryMessageList"] = getAdvancedHistoryMessageList + self["getAdvancedHistoryMessageListReverse"] = getAdvancedHistoryMessageListReverse + self["findMessageList"] = findMessageList - self["createAdvancedTextMessage"] = createAdvancedTextMessage - self["createAdvancedQuoteMessage"] = createAdvancedQuoteMessage + self["sendMessageNotOss"] = sendMessageNotOss self["createImageMessageByURL"] = createImageMessageByURL self["createSoundMessageByURL"] = createSoundMessageByURL @@ -56,11 +53,7 @@ public class MessageManager: BaseServiceManager { self["createFileMessageByURL"] = createFileMessageByURL self["setCustomBusinessListener"] = setCustomBusinessListener self["setMessageKvInfoListener"] = setMessageKvInfoListener - self["setMessageReactionExtensions"] = setMessageReactionExtensions - self["deleteMessageReactionExtensions"] = deleteMessageReactionExtensions - self["getMessageListReactionExtensions"] = getMessageListReactionExtensions - self["addMessageReactionExtensions"] = addMessageReactionExtensions - self["getMessageListSomeReactionExtensions"] = getMessageListSomeReactionExtensions + } func setAdvancedMsgListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ @@ -76,18 +69,25 @@ public class MessageManager: BaseServiceManager { methodCall[string: "groupID"], methodCall[jsonString: "offlinePushInfo"]) } - func getHistoryMessageList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkGetHistoryMessageList(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString()) - } - func revokeMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkRevokeMessage(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString()) + Open_im_sdkRevokeMessage(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"],methodCall[string: "clientMsgID"]) } func deleteMessageFromLocalStorage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkDeleteMessageFromLocalStorage(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString()) + Open_im_sdkDeleteMessageFromLocalStorage(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"],methodCall[string: "clientMsgID"]) + } + + func deleteMessageFromLocalAndSvr(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ + Open_im_sdkDeleteMessage(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"],methodCall[string: "clientMsgID"]) + } + + func deleteAllMsgFromLocal(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ + Open_im_sdkDeleteAllMsgFromLocal(BaseCallback(result: result), methodCall[string: "operationID"]) } + func deleteAllMsgFromLocalAndSvr(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ + Open_im_sdkDeleteAllMsgFromLocalAndSvr(BaseCallback(result: result), methodCall[string: "operationID"]) + } func insertSingleMessageToLocalStorage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ Open_im_sdkInsertSingleMessageToLocalStorage(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "message"], @@ -99,12 +99,8 @@ public class MessageManager: BaseServiceManager { methodCall[string: "groupID"], methodCall[string: "senderID"]) } - func markC2CMessageAsRead(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkMarkC2CMessageAsRead(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "userID"], methodCall[jsonString: "messageIDList"]) - } - - func markGroupMessageAsRead(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkMarkGroupMessageAsRead(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[jsonString: "messageIDList"]) + func markMessagesAsReadByMsgID(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ + Open_im_sdkMarkMessagesAsReadByMsgID(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"], methodCall[jsonString: "messageIDList"]) } func typingStatusUpdate(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ @@ -201,54 +197,23 @@ public class MessageManager: BaseServiceManager { callBack(result, prama) } - func clearC2CHistoryMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkClearC2CHistoryMessage(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "userID"]) - } - - func clearGroupHistoryMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkClearGroupHistoryMessage(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"]) - } - func searchLocalMessages(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ Open_im_sdkSearchLocalMessages(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "filter"]) } - func deleteMessageFromLocalAndSvr(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { - Open_im_sdkDeleteMessageFromLocalAndSvr(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString()) - } - - func deleteAllMsgFromLocal(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { - Open_im_sdkDeleteAllMsgFromLocal(BaseCallback(result: result), methodCall[string: "operationID"]) - } - - func deleteAllMsgFromLocalAndSvr(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { - Open_im_sdkDeleteAllMsgFromLocalAndSvr(BaseCallback(result: result), methodCall[string: "operationID"]) - } - - func markMessageAsReadByConID(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { - Open_im_sdkMarkMessageAsReadByConID(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"], methodCall[jsonString: "messageIDList"]) - } - - func clearC2CHistoryMessageFromLocalAndSvr(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkClearC2CHistoryMessageFromLocalAndSvr(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "userID"]) - } - - func clearGroupHistoryMessageFromLocalAndSvr(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkClearGroupHistoryMessageFromLocalAndSvr(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"]) - } - - func getHistoryMessageListReverse(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkGetHistoryMessageListReverse(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString()) - } - - func newRevokeMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkNewRevokeMessage(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString()) + func clearConversationAndDeleteAllMsg(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ + Open_im_sdkClearConversationAndDeleteAllMsg(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"]) } func getAdvancedHistoryMessageList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ Open_im_sdkGetAdvancedHistoryMessageList(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString()) } + func getAdvancedHistoryMessageListReverse(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ + Open_im_sdkGetAdvancedHistoryMessageListReverse(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString()) + } + + func findMessageList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ Open_im_sdkFindMessageList(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "searchParams"]) } @@ -284,26 +249,6 @@ public class MessageManager: BaseServiceManager { Open_im_sdkSetMessageKvInfoListener(MessageKvInfoListener(channel: channel)) callBack(result) } - - func setMessageReactionExtensions(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkSetMessageReactionExtensions(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "message"], methodCall[jsonString: "list"]) - } - - func deleteMessageReactionExtensions(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkDeleteMessageReactionExtensions(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "message"], methodCall[jsonString: "list"]) - } - - func getMessageListReactionExtensions(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkGetMessageListReactionExtensions(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "messageList"]) - } - - func addMessageReactionExtensions(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkAddMessageReactionExtensions(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "message"], methodCall[jsonString: "list"]) - } - - func getMessageListSomeReactionExtensions(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkGetMessageListSomeReactionExtensions(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "messageList"], methodCall[jsonString: "list"]) - } } public class SendMsgProgressListener: NSObject, Open_im_sdk_callbackSendMsgCallBackProtocol { @@ -336,7 +281,6 @@ public class SendMsgProgressListener: NSObject, Open_im_sdk_callbackSendMsgCallB } public class AdvancedMsgListener: NSObject, Open_im_sdk_callbackOnAdvancedMsgListenerProtocol { - private let channel: FlutterMethodChannel private let id: String @@ -345,46 +289,47 @@ public class AdvancedMsgListener: NSObject, Open_im_sdk_callbackOnAdvancedMsgLis self.id = id } - public func onRecvC2CReadReceipt(_ msgReceiptList: String?) { + public func onMsgDeleted(_ message: String?) { var values: [String: Any] = [:] values["id"] = id - values["c2cMessageReadReceipt"] = msgReceiptList - CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onRecvC2CReadReceipt", errCode: nil, errMsg: nil, data: values) + values["message"] = message + CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onMsgDeleted", errCode: nil, errMsg: nil, data: values);<#code#> } - public func onRecvGroupReadReceipt(_ groupMsgReceiptList: String?) { + public func onNewRecvMessageRevoked(_ messageRevoked: String?) { var values: [String: Any] = [:] values["id"] = id - values["groupMessageReadReceipt"] = groupMsgReceiptList - CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onRecvGroupReadReceipt", errCode: nil, errMsg: nil, data: values) + values["messageRevoked"] = messageRevoked + CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onNewRecvMessageRevoked", errCode: nil, errMsg: nil, data: values) } - public func onRecvMessageRevoked(_ msgId: String?) { + public func onRecvC2CReadReceipt(_ msgReceiptList: String?) { var values: [String: Any] = [:] values["id"] = id - values["revokedMessage"] = msgId - CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onRecvMessageRevoked", errCode: nil, errMsg: nil, data: values) + values["msgReceiptList"] = msgReceiptList + CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onRecvC2CReadReceipt", errCode: nil, errMsg: nil, data: values) } - public func onRecvNewMessage(_ message: String?) { + public func onRecvGroupReadReceipt(_ groupMsgReceiptList: String?) { var values: [String: Any] = [:] values["id"] = id - values["newMessage"] = message - CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onRecvNewMessage", errCode: nil, errMsg: nil, data: values) + values["groupMsgReceiptList"] = groupMsgReceiptList + CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onRecvGroupReadReceipt", errCode: nil, errMsg: nil, data: values) } - public func onNewRecvMessageRevoked(_ messageRevoked: String?) { + public func onRecvMessageExtensionsAdded(_ msgID: String?, reactionExtensionList: String?) { var values: [String: Any] = [:] values["id"] = id - values["revokedMessageV2"] = messageRevoked - CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onNewRecvMessageRevoked", errCode: nil, errMsg: nil, data: values) + values["msgID"] = msgID + values["reactionExtensionList"] = reactionExtensionList + CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onRecvMessageExtensionsAdded", errCode: nil, errMsg: nil, data: values) } public func onRecvMessageExtensionsChanged(_ msgID: String?, reactionExtensionList: String?) { var values: [String: Any] = [:] values["id"] = id values["msgID"] = msgID - values["list"] = reactionExtensionList + values["reactionExtensionList"] = reactionExtensionList CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onRecvMessageExtensionsChanged", errCode: nil, errMsg: nil, data: values) } @@ -392,18 +337,25 @@ public class AdvancedMsgListener: NSObject, Open_im_sdk_callbackOnAdvancedMsgLis var values: [String: Any] = [:] values["id"] = id values["msgID"] = msgID - values["list"] = reactionExtensionKeyList + values["reactionExtensionKeyList"] = reactionExtensionKeyList CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onRecvMessageExtensionsDeleted", errCode: nil, errMsg: nil, data: values) } - public func onRecvMessageExtensionsAdded(_ msgID: String?, reactionExtensionList: String?) { + public func onRecvNewMessage(_ message: String?) { var values: [String: Any] = [:] values["id"] = id - values["msgID"] = msgID - values["list"] = reactionExtensionList - CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onRecvMessageExtensionsAdded", errCode: nil, errMsg: nil, data: values) + values["message"] = message + CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onRecvNewMessage", errCode: nil, errMsg: nil, data: values) } + + public func onRecvOfflineNewMessages(_ messageList: String?) { + var values: [String: Any] = [:] + values["id"] = id + values["messageList"] = messageList + CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onRecvOfflineNewMessages", errCode: nil, errMsg: nil, data: values);<#code#> + } + } public class CustomBusinessListener: NSObject, Open_im_sdk_callbackOnCustomBusinessListenerProtocol { diff --git a/ios/Classes/Module/OrganizationManager.swift b/ios/Classes/Module/OrganizationManager.swift index 8041767..3d96e51 100644 --- a/ios/Classes/Module/OrganizationManager.swift +++ b/ios/Classes/Module/OrganizationManager.swift @@ -1,59 +1,59 @@ -import Foundation -import OpenIMCore - -public class OrganizationManager: BaseServiceManager { - - public override func registerHandlers() { - super.registerHandlers() - self["setOrganizationListener"] = setOrganizationListener - self["getSubDepartment"] = getSubDepartment - self["getDepartmentMember"] = getDepartmentMember - self["getUserInDepartment"] = getUserInDepartment - self["getDepartmentMemberAndSubDepartment"] = getDepartmentMemberAndSubDepartment - self["getDepartmentInfo"] = getDepartmentInfo - self["searchOrganization"] = searchOrganization - } - - func setOrganizationListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkSetOrganizationListener(OrganizationListener(channel: channel)) - callBack(result) - } - - func getSubDepartment(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { - Open_im_sdkGetSubDepartment(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "departmentID"], methodCall[int: "offset"], methodCall[int: "count"]) - } - - func getDepartmentMember(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { - Open_im_sdkGetDepartmentMember(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "departmentID"], methodCall[int: "offset"], methodCall[int: "count"]) - } - - func getUserInDepartment(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { - Open_im_sdkGetUserInDepartment(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "userID"]) - } - - func getDepartmentMemberAndSubDepartment(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { - Open_im_sdkGetDepartmentMemberAndSubDepartment(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "departmentID"]) - } - - func getDepartmentInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { - Open_im_sdkGetDepartmentInfo(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "departmentID"]) - } - - func searchOrganization(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { - Open_im_sdkSearchOrganization(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "searchParam"], methodCall[int: "offset"], methodCall[int: "count"]) - } -} - -public class OrganizationListener: NSObject, Open_im_sdk_callbackOnOrganizationListenerProtocol { - - private let channel:FlutterMethodChannel - - init(channel:FlutterMethodChannel) { - self.channel = channel - } - - public func onOrganizationUpdated() { - CommonUtil.emitEvent(channel: self.channel, method: "organizationListener", type: "onOrganizationUpdated", errCode: nil, errMsg: nil, data: nil) - } - -} +//import Foundation +//import OpenIMCore +// +//public class OrganizationManager: BaseServiceManager { +// +// public override func registerHandlers() { +// super.registerHandlers() +// self["setOrganizationListener"] = setOrganizationListener +// self["getSubDepartment"] = getSubDepartment +// self["getDepartmentMember"] = getDepartmentMember +// self["getUserInDepartment"] = getUserInDepartment +// self["getDepartmentMemberAndSubDepartment"] = getDepartmentMemberAndSubDepartment +// self["getDepartmentInfo"] = getDepartmentInfo +// self["searchOrganization"] = searchOrganization +// } +// +// func setOrganizationListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ +// Open_im_sdkSetOrganizationListener(OrganizationListener(channel: channel)) +// callBack(result) +// } +// +// func getSubDepartment(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { +// Open_im_sdkGetSubDepartment(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "departmentID"], methodCall[int: "offset"], methodCall[int: "count"]) +// } +// +// func getDepartmentMember(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { +// Open_im_sdkGetDepartmentMember(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "departmentID"], methodCall[int: "offset"], methodCall[int: "count"]) +// } +// +// func getUserInDepartment(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { +// Open_im_sdkGetUserInDepartment(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "userID"]) +// } +// +// func getDepartmentMemberAndSubDepartment(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { +// Open_im_sdkGetDepartmentMemberAndSubDepartment(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "departmentID"]) +// } +// +// func getDepartmentInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { +// Open_im_sdkGetDepartmentInfo(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "departmentID"]) +// } +// +// func searchOrganization(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { +// Open_im_sdkSearchOrganization(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "searchParam"], methodCall[int: "offset"], methodCall[int: "count"]) +// } +//} +// +//public class OrganizationListener: NSObject, Open_im_sdk_callbackOnOrganizationListenerProtocol { +// +// private let channel:FlutterMethodChannel +// +// init(channel:FlutterMethodChannel) { +// self.channel = channel +// } +// +// public func onOrganizationUpdated() { +// CommonUtil.emitEvent(channel: self.channel, method: "organizationListener", type: "onOrganizationUpdated", errCode: nil, errMsg: nil, data: nil) +// } +// +//} diff --git a/ios/Classes/Module/SignalingManager.swift b/ios/Classes/Module/SignalingManager.swift index d5febff..abb403b 100644 --- a/ios/Classes/Module/SignalingManager.swift +++ b/ios/Classes/Module/SignalingManager.swift @@ -1,148 +1,148 @@ -import Foundation -import OpenIMCore - -public class SignalingManager: BaseServiceManager { - - public override func registerHandlers() { - super.registerHandlers() - self["setSignalingListener"] = setSignalingListener - self["signalingInvite"] = signalingInvite - self["signalingInviteInGroup"] = signalingInviteInGroup - self["signalingAccept"] = signalingAccept - self["signalingReject"] = signalingReject - self["signalingCancel"] = signalingCancel - self["signalingHungUp"] = signalingHungUp - self["signalingGetRoomByGroupID"] = signalingGetRoomByGroupID - self["signalingGetTokenByRoomID"] = signalingGetTokenByRoomID - self["signalingUpdateMeetingInfo"] = signalingUpdateMeetingInfo - self["signalingCreateMeeting"] = signalingCreateMeeting - self["signalingJoinMeeting"] = signalingJoinMeeting - self["signalingOperateStream"] = signalingOperateStream - self["signalingGetMeetings"] = signalingGetMeetings - self["signalingCloseRoom"] = signalingCloseRoom - self["signalingSendCustomSignal"] = signalingSendCustomSignal - } - - func setSignalingListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkSetSignalingListener(SignalingListener(channel: channel)) - callBack(result) - } - - func signalingInvite(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkSignalingInvite(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "signalingInfo"]) - } - - func signalingInviteInGroup(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkSignalingInviteInGroup(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "signalingInfo"]) - } - - func signalingAccept(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkSignalingAccept(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "signalingInfo"]) - } - - func signalingReject(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkSignalingReject(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "signalingInfo"]) - } - - func signalingCancel(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkSignalingCancel(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "signalingInfo"]) - } - - func signalingHungUp(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkSignalingHungUp(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "signalingInfo"]) - } - - func signalingGetRoomByGroupID(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkSignalingGetRoomByGroupID(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"]) - } - - func signalingGetTokenByRoomID(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkSignalingGetTokenByRoomID(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "roomID"]) - } - - func signalingUpdateMeetingInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkSignalingUpdateMeetingInfo(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "info"]) - } - - func signalingCreateMeeting(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkSignalingCreateMeeting(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "info"]) - } - - func signalingJoinMeeting(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkSignalingJoinMeeting(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "info"]) - } - - func signalingOperateStream(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkSignalingOperateStream(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "streamType"], methodCall[string: "roomID"], methodCall[string: "userID"], methodCall[bool: "mute"], methodCall[bool: "muteAll"]) - } - - func signalingGetMeetings(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkSignalingGetMeetings(BaseCallback(result: result), methodCall[string: "operationID"]) - } - - func signalingCloseRoom(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkSignalingCloseRoom(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "roomID"]) - } - - func signalingSendCustomSignal(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkSignalingSendCustomSignal(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "customInfo"], methodCall[string: "roomID"]) - } -} -public class SignalingListener: NSObject, Open_im_sdk_callbackOnSignalingListenerProtocol { - - - private let channel:FlutterMethodChannel - - init(channel:FlutterMethodChannel) { - self.channel = channel - } - - public func onInvitationCancelled(_ s: String?) { - CommonUtil.emitEvent(channel: channel, method: "signalingListener", type: "onInvitationCancelled", errCode: nil, errMsg: nil, data: s) - } - - public func onInvitationTimeout(_ s: String?) { - CommonUtil.emitEvent(channel: channel, method: "signalingListener", type: "onInvitationTimeout", errCode: nil, errMsg: nil, data: s) - } - - public func onInviteeAccepted(_ s: String?) { - CommonUtil.emitEvent(channel: channel, method: "signalingListener", type: "onInviteeAccepted", errCode: nil, errMsg: nil, data: s) - } - - public func onInviteeAccepted(byOtherDevice s: String?) { - CommonUtil.emitEvent(channel: channel, method: "signalingListener", type: "onInviteeAcceptedByOtherDevice", errCode: nil, errMsg: nil, data: s) - } - - public func onInviteeRejected(_ s: String?) { - CommonUtil.emitEvent(channel: channel, method: "signalingListener", type: "onInviteeRejected", errCode: nil, errMsg: nil, data: s) - } - - public func onInviteeRejected(byOtherDevice s: String?) { - CommonUtil.emitEvent(channel: channel, method: "signalingListener", type: "onInviteeRejectedByOtherDevice", errCode: nil, errMsg: nil, data: s) - } - - public func onReceiveNewInvitation(_ s: String?) { - CommonUtil.emitEvent(channel: channel, method: "signalingListener", type: "onReceiveNewInvitation", errCode: nil, errMsg: nil, data: s) - } - - public func onHangUp(_ s: String?) { - CommonUtil.emitEvent(channel: channel, method: "signalingListener", type: "onHangUp", errCode: nil, errMsg: nil, data: s) - } - - public func onRoomParticipantConnected(_ s: String?) { - CommonUtil.emitEvent(channel: channel, method: "signalingListener", type: "onRoomParticipantConnected", errCode: nil, errMsg: nil, data: s) - } - - public func onRoomParticipantDisconnected(_ s: String?) { - CommonUtil.emitEvent(channel: channel, method: "signalingListener", type: "onRoomParticipantDisconnected", errCode: nil, errMsg: nil, data: s) - } - - public func onStreamChange(_ s: String?) { - CommonUtil.emitEvent(channel: channel, method: "signalingListener", type: "onStreamChange", errCode: nil, errMsg: nil, data: s) - } - - public func onReceiveCustomSignal(_ s: String?) { - CommonUtil.emitEvent(channel: channel, method: "signalingListener", type: "onReceiveCustomSignal", errCode: nil, errMsg: nil, data: s) - } - -} +//import Foundation +//import OpenIMCore +// +//public class SignalingManager: BaseServiceManager { +// +// public override func registerHandlers() { +// super.registerHandlers() +// self["setSignalingListener"] = setSignalingListener +// self["signalingInvite"] = signalingInvite +// self["signalingInviteInGroup"] = signalingInviteInGroup +// self["signalingAccept"] = signalingAccept +// self["signalingReject"] = signalingReject +// self["signalingCancel"] = signalingCancel +// self["signalingHungUp"] = signalingHungUp +// self["signalingGetRoomByGroupID"] = signalingGetRoomByGroupID +// self["signalingGetTokenByRoomID"] = signalingGetTokenByRoomID +// self["signalingUpdateMeetingInfo"] = signalingUpdateMeetingInfo +// self["signalingCreateMeeting"] = signalingCreateMeeting +// self["signalingJoinMeeting"] = signalingJoinMeeting +// self["signalingOperateStream"] = signalingOperateStream +// self["signalingGetMeetings"] = signalingGetMeetings +// self["signalingCloseRoom"] = signalingCloseRoom +// self["signalingSendCustomSignal"] = signalingSendCustomSignal +// } +// +// func setSignalingListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ +// Open_im_sdkSetSignalingListener(SignalingListener(channel: channel)) +// callBack(result) +// } +// +// func signalingInvite(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ +// Open_im_sdkSignalingInvite(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "signalingInfo"]) +// } +// +// func signalingInviteInGroup(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ +// Open_im_sdkSignalingInviteInGroup(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "signalingInfo"]) +// } +// +// func signalingAccept(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ +// Open_im_sdkSignalingAccept(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "signalingInfo"]) +// } +// +// func signalingReject(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ +// Open_im_sdkSignalingReject(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "signalingInfo"]) +// } +// +// func signalingCancel(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ +// Open_im_sdkSignalingCancel(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "signalingInfo"]) +// } +// +// func signalingHungUp(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ +// Open_im_sdkSignalingHungUp(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "signalingInfo"]) +// } +// +// func signalingGetRoomByGroupID(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ +// Open_im_sdkSignalingGetRoomByGroupID(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"]) +// } +// +// func signalingGetTokenByRoomID(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ +// Open_im_sdkSignalingGetTokenByRoomID(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "roomID"]) +// } +// +// func signalingUpdateMeetingInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ +// Open_im_sdkSignalingUpdateMeetingInfo(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "info"]) +// } +// +// func signalingCreateMeeting(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ +// Open_im_sdkSignalingCreateMeeting(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "info"]) +// } +// +// func signalingJoinMeeting(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ +// Open_im_sdkSignalingJoinMeeting(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "info"]) +// } +// +// func signalingOperateStream(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ +// Open_im_sdkSignalingOperateStream(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "streamType"], methodCall[string: "roomID"], methodCall[string: "userID"], methodCall[bool: "mute"], methodCall[bool: "muteAll"]) +// } +// +// func signalingGetMeetings(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ +// Open_im_sdkSignalingGetMeetings(BaseCallback(result: result), methodCall[string: "operationID"]) +// } +// +// func signalingCloseRoom(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ +// Open_im_sdkSignalingCloseRoom(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "roomID"]) +// } +// +// func signalingSendCustomSignal(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ +// Open_im_sdkSignalingSendCustomSignal(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "customInfo"], methodCall[string: "roomID"]) +// } +//} +//public class SignalingListener: NSObject, Open_im_sdk_callbackOnSignalingListenerProtocol { +// +// +// private let channel:FlutterMethodChannel +// +// init(channel:FlutterMethodChannel) { +// self.channel = channel +// } +// +// public func onInvitationCancelled(_ s: String?) { +// CommonUtil.emitEvent(channel: channel, method: "signalingListener", type: "onInvitationCancelled", errCode: nil, errMsg: nil, data: s) +// } +// +// public func onInvitationTimeout(_ s: String?) { +// CommonUtil.emitEvent(channel: channel, method: "signalingListener", type: "onInvitationTimeout", errCode: nil, errMsg: nil, data: s) +// } +// +// public func onInviteeAccepted(_ s: String?) { +// CommonUtil.emitEvent(channel: channel, method: "signalingListener", type: "onInviteeAccepted", errCode: nil, errMsg: nil, data: s) +// } +// +// public func onInviteeAccepted(byOtherDevice s: String?) { +// CommonUtil.emitEvent(channel: channel, method: "signalingListener", type: "onInviteeAcceptedByOtherDevice", errCode: nil, errMsg: nil, data: s) +// } +// +// public func onInviteeRejected(_ s: String?) { +// CommonUtil.emitEvent(channel: channel, method: "signalingListener", type: "onInviteeRejected", errCode: nil, errMsg: nil, data: s) +// } +// +// public func onInviteeRejected(byOtherDevice s: String?) { +// CommonUtil.emitEvent(channel: channel, method: "signalingListener", type: "onInviteeRejectedByOtherDevice", errCode: nil, errMsg: nil, data: s) +// } +// +// public func onReceiveNewInvitation(_ s: String?) { +// CommonUtil.emitEvent(channel: channel, method: "signalingListener", type: "onReceiveNewInvitation", errCode: nil, errMsg: nil, data: s) +// } +// +// public func onHangUp(_ s: String?) { +// CommonUtil.emitEvent(channel: channel, method: "signalingListener", type: "onHangUp", errCode: nil, errMsg: nil, data: s) +// } +// +// public func onRoomParticipantConnected(_ s: String?) { +// CommonUtil.emitEvent(channel: channel, method: "signalingListener", type: "onRoomParticipantConnected", errCode: nil, errMsg: nil, data: s) +// } +// +// public func onRoomParticipantDisconnected(_ s: String?) { +// CommonUtil.emitEvent(channel: channel, method: "signalingListener", type: "onRoomParticipantDisconnected", errCode: nil, errMsg: nil, data: s) +// } +// +// public func onStreamChange(_ s: String?) { +// CommonUtil.emitEvent(channel: channel, method: "signalingListener", type: "onStreamChange", errCode: nil, errMsg: nil, data: s) +// } +// +// public func onReceiveCustomSignal(_ s: String?) { +// CommonUtil.emitEvent(channel: channel, method: "signalingListener", type: "onReceiveCustomSignal", errCode: nil, errMsg: nil, data: s) +// } +// +//} diff --git a/ios/Classes/Module/UserManager.swift b/ios/Classes/Module/UserManager.swift index ddc03a6..49f5253 100644 --- a/ios/Classes/Module/UserManager.swift +++ b/ios/Classes/Module/UserManager.swift @@ -17,7 +17,7 @@ public class UserManager: BaseServiceManager { } func getUsersInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { - Open_im_sdkGetUsersInfo(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "uidList"]) + Open_im_sdkGetUsersInfo(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "userIDList"]) } func setSelfInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { diff --git a/ios/Classes/Module/WorkMomentsManager.swift b/ios/Classes/Module/WorkMomentsManager.swift index d00b166..25315d1 100644 --- a/ios/Classes/Module/WorkMomentsManager.swift +++ b/ios/Classes/Module/WorkMomentsManager.swift @@ -1,44 +1,44 @@ -import Foundation -import OpenIMCore - -public class WorkMomentsManager: BaseServiceManager { - - public override func registerHandlers() { - super.registerHandlers() - self["setWorkMomentsListener"] = setWorkMomentsListener - self["getWorkMomentsUnReadCount"] = getWorkMomentsUnReadCount - self["getWorkMomentsNotification"] = getWorkMomentsNotification - self["clearWorkMomentsNotification"] = clearWorkMomentsNotification - } - - func setWorkMomentsListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkSetWorkMomentsListener(WorkMomentsListener(channel: channel)) - callBack(result) - } - - func getWorkMomentsUnReadCount(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { - Open_im_sdkGetWorkMomentsUnReadCount(BaseCallback(result: result), methodCall[string: "operationID"]) - } - - func getWorkMomentsNotification(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { - Open_im_sdkGetWorkMomentsNotification(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[int: "offset"], methodCall[int: "count"]) - } - - func clearWorkMomentsNotification(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { - Open_im_sdkClearWorkMomentsNotification(BaseCallback(result: result), methodCall[string: "operationID"]) - } -} - -public class WorkMomentsListener: NSObject, Open_im_sdk_callbackOnWorkMomentsListenerProtocol { - - private let channel:FlutterMethodChannel - - init(channel:FlutterMethodChannel) { - self.channel = channel - } - - public func onRecvNewNotification() { - CommonUtil.emitEvent(channel: self.channel, method: "workMomentsListener", type: "OnRecvNewNotification", errCode: nil, errMsg: nil, data: nil) - } - -} +//import Foundation +//import OpenIMCore +// +//public class WorkMomentsManager: BaseServiceManager { +// +// public override func registerHandlers() { +// super.registerHandlers() +// self["setWorkMomentsListener"] = setWorkMomentsListener +// self["getWorkMomentsUnReadCount"] = getWorkMomentsUnReadCount +// self["getWorkMomentsNotification"] = getWorkMomentsNotification +// self["clearWorkMomentsNotification"] = clearWorkMomentsNotification +// } +// +// func setWorkMomentsListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ +// Open_im_sdkSetWorkMomentsListener(WorkMomentsListener(channel: channel)) +// callBack(result) +// } +// +// func getWorkMomentsUnReadCount(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { +// Open_im_sdkGetWorkMomentsUnReadCount(BaseCallback(result: result), methodCall[string: "operationID"]) +// } +// +// func getWorkMomentsNotification(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { +// Open_im_sdkGetWorkMomentsNotification(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[int: "offset"], methodCall[int: "count"]) +// } +// +// func clearWorkMomentsNotification(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { +// Open_im_sdkClearWorkMomentsNotification(BaseCallback(result: result), methodCall[string: "operationID"]) +// } +//} +// +//public class WorkMomentsListener: NSObject, Open_im_sdk_callbackOnWorkMomentsListenerProtocol { +// +// private let channel:FlutterMethodChannel +// +// init(channel:FlutterMethodChannel) { +// self.channel = channel +// } +// +// public func onRecvNewNotification() { +// CommonUtil.emitEvent(channel: self.channel, method: "workMomentsListener", type: "OnRecvNewNotification", errCode: nil, errMsg: nil, data: nil) +// } +// +//} diff --git a/ios/Classes/SwiftFlutterOpenimSdkPlugin.swift b/ios/Classes/SwiftFlutterOpenimSdkPlugin.swift index 0e07bf7..7132f6f 100644 --- a/ios/Classes/SwiftFlutterOpenimSdkPlugin.swift +++ b/ios/Classes/SwiftFlutterOpenimSdkPlugin.swift @@ -8,9 +8,9 @@ public class SwiftFlutterOpenimSdkPlugin: NSObject, FlutterPlugin { let messageManager: MessageManager let groupManager: GroupManager let userManger: UserManager - let signalingManager: SignalingManager - let workMomentsManager: WorkMomentsManager - let organizationManager: OrganizationManager +// let signalingManager: SignalingManager +// let workMomentsManager: WorkMomentsManager +// let organizationManager: OrganizationManager init(channel: FlutterMethodChannel) { self.imManager = IMMananger(channel: channel) @@ -19,9 +19,9 @@ public class SwiftFlutterOpenimSdkPlugin: NSObject, FlutterPlugin { self.messageManager = MessageManager(channel: channel) self.groupManager = GroupManager(channel: channel) self.userManger = UserManager(channel: channel) - self.signalingManager = SignalingManager(channel: channel) - self.workMomentsManager = WorkMomentsManager(channel: channel) - self.organizationManager = OrganizationManager(channel: channel) +// self.signalingManager = SignalingManager(channel: channel) +// self.workMomentsManager = WorkMomentsManager(channel: channel) +// self.organizationManager = OrganizationManager(channel: channel) } public static func register(with registrar: FlutterPluginRegistrar) { @@ -45,12 +45,12 @@ public class SwiftFlutterOpenimSdkPlugin: NSObject, FlutterPlugin { groupManager.handleMethod(call: call, result: result) case "userManager": userManger.handleMethod(call: call, result: result) - case "signalingManager": - signalingManager.handleMethod(call: call, result: result) - case "workMomentsManager": - workMomentsManager.handleMethod(call: call, result: result) - case "organizationManager": - organizationManager.handleMethod(call: call, result: result) +// case "signalingManager": +// signalingManager.handleMethod(call: call, result: result) +// case "workMomentsManager": +// workMomentsManager.handleMethod(call: call, result: result) +// case "organizationManager": +// organizationManager.handleMethod(call: call, result: result) default: print("Handle ManagerName Error: \(managerName) not found") } diff --git a/ios/flutter_openim_sdk.podspec b/ios/flutter_openim_sdk.podspec index 0939b98..fdef3f8 100644 --- a/ios/flutter_openim_sdk.podspec +++ b/ios/flutter_openim_sdk.podspec @@ -17,7 +17,7 @@ A new Flutter project. s.dependency 'Flutter' s.platform = :ios, '11.0' - s.dependency 'OpenIMSDKCore','2.3.6' + s.dependency 'OpenIMSDKCore','3.0.0-beta' s.static_framework = true # s.vendored_frameworks = 'Framework/*.framework' # Flutter.framework does not contain a i386 slice. diff --git a/lib/flutter_openim_sdk.dart b/lib/flutter_openim_sdk.dart index 4741598..57726f3 100644 --- a/lib/flutter_openim_sdk.dart +++ b/lib/flutter_openim_sdk.dart @@ -20,6 +20,7 @@ export 'src/listener/listener_for_service.dart'; export 'src/listener/message_kv_info_listener.dart'; export 'src/listener/msg_send_progress_listener.dart'; export 'src/listener/organization_listener.dart'; +export 'src/listener/put_file_listener.dart'; export 'src/listener/signaling_listener.dart'; export 'src/listener/user_listener.dart'; export 'src/listener/workmoments_listener.dart'; diff --git a/lib/src/enum/group_role_level.dart b/lib/src/enum/group_role_level.dart index 27bd8cd..826d57b 100644 --- a/lib/src/enum/group_role_level.dart +++ b/lib/src/enum/group_role_level.dart @@ -1,11 +1,11 @@ /// 群成员角色 class GroupRoleLevel { - /// 普通成员 - static const member = 1; - /// 群主 - static const owner = 2; + static const owner = 100; /// 管理员 - static const admin = 3; + static const admin = 60; + + /// 普通成员 + static const member = 20; } diff --git a/lib/src/enum/listener_type.dart b/lib/src/enum/listener_type.dart index 33e3cd4..7dac888 100644 --- a/lib/src/enum/listener_type.dart +++ b/lib/src/enum/listener_type.dart @@ -14,4 +14,5 @@ class ListenerType { static const customBusinessListener = "customBusinessListener"; static const messageKvInfoListener = "messageKvInfoListener"; static const listenerForService = "listenerForService"; + static const putFileListener = "putFileListener"; } diff --git a/lib/src/enum/message_type.dart b/lib/src/enum/message_type.dart index 985ad46..5d114b8 100644 --- a/lib/src/enum/message_type.dart +++ b/lib/src/enum/message_type.dart @@ -30,9 +30,6 @@ class MessageType { /// 自定义 static const custom = 110; - /// 撤回 - static const revoke = 111; - /// 已读回执 static const has_read_receipt = 112; @@ -51,9 +48,6 @@ class MessageType { /// 富文本消息 static const advancedText = 117; - /// 高级撤回 - static const advancedRevoke = 118; - static const customMsgNotTriggerConversation = 119; static const customMsgOnlineOnly = 120; @@ -154,6 +148,12 @@ class MessageType { /// 群成员信息改变 static const groupMemberInfoChangedNotification = 1516; + /// 群公告修改 + static const groupNoticeChangedNotification = 1519; + + /// 群名字修改 + static const groupNameChangedNotification = 1520; + static const signalingNotificationBegin = 1600; /// 信令 @@ -165,4 +165,7 @@ class MessageType { static const burnAfterReadingNotification = 1701; static const notificationEnd = 2000; + + /// 撤回消息 + static const revokeMessageNotification = 2101; } diff --git a/lib/src/enum/sdk_error_code.dart b/lib/src/enum/sdk_error_code.dart index d127bd9..de63dae 100644 --- a/lib/src/enum/sdk_error_code.dart +++ b/lib/src/enum/sdk_error_code.dart @@ -1,18 +1,18 @@ /// 消息发送失败 class MessageFailedCode { /// 被对方拉黑 - static const int blockedByFriend = 600; + static const int blockedByFriend = 1302; /// 被对方删除 static const int deletedByFriend = 601; /// 已被移除群聊/群已解散 - static const int notInGroup = 302; + static const int notInGroup = 1205; } /// 添加好友失败 class AddFriendFailedCode { /// 该用户已设置不可添加 - static const int refuseToAddFriends = 10007; + static const int refuseToAddFriends = 10013; } diff --git a/lib/src/listener/advanced_msg_listener.dart b/lib/src/listener/advanced_msg_listener.dart index 90e5bd4..c027994 100644 --- a/lib/src/listener/advanced_msg_listener.dart +++ b/lib/src/listener/advanced_msg_listener.dart @@ -2,52 +2,53 @@ import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; /// 消息监听 class OnAdvancedMsgListener { - Function(List list)? onRecvC2CMessageReadReceipt; - Function(List list)? onRecvGroupMessageReadReceipt; - Function(String msgId)? onRecvMessageRevoked; - Function(Message msg)? onRecvNewMessage; - Function(RevokedInfo info)? onRecvMessageRevokedV2; + Function(Message msg)? onMsgDeleted; + Function(RevokedInfo info)? onNewRecvMessageRevoked; + Function(List list)? onRecvC2CReadReceipt; + Function(List list)? onRecvGroupReadReceipt; + Function(String msgID, List list)? onRecvMessageExtensionsAdded; Function(String msgID, List list)? onRecvMessageExtensionsChanged; Function(String msgID, List list)? onRecvMessageExtensionsDeleted; - Function(String msgID, List list)? onRecvMessageExtensionsAdded; + Function(Message msg)? onRecvNewMessage; + Function(List list)? onRecvOfflineNewMessages; /// Uniquely identifies String id; OnAdvancedMsgListener({ - this.onRecvC2CMessageReadReceipt, - this.onRecvGroupMessageReadReceipt, - @deprecated this.onRecvMessageRevoked, - this.onRecvNewMessage, - this.onRecvMessageRevokedV2, + this.onMsgDeleted, + this.onNewRecvMessageRevoked, + this.onRecvC2CReadReceipt, + this.onRecvGroupReadReceipt, + this.onRecvMessageExtensionsAdded, this.onRecvMessageExtensionsChanged, this.onRecvMessageExtensionsDeleted, - this.onRecvMessageExtensionsAdded, + this.onRecvNewMessage, + this.onRecvOfflineNewMessages, }) : id = "id_${DateTime.now().microsecondsSinceEpoch}"; - /// C2C消息已读回执 - void recvC2CMessageReadReceipt(List list) { - onRecvC2CMessageReadReceipt?.call(list); + void msgDeleted(Message msg) { + onMsgDeleted?.call(msg); } - /// 群消息已读回执 - void recvGroupMessageReadReceipt(List list) { - onRecvGroupMessageReadReceipt?.call(list); + /// 消息被撤回 + void newRecvMessageRevoked(RevokedInfo info) { + onNewRecvMessageRevoked?.call(info); } - /// 消息被撤回 - void recvMessageRevoked(String msgId) { - onRecvMessageRevoked?.call(msgId); + /// C2C消息已读回执 + void recvC2CReadReceipt(List list) { + onRecvC2CReadReceipt?.call(list); } - /// 收到了一条新消息 - void recvNewMessage(Message msg) { - onRecvNewMessage?.call(msg); + /// 群消息已读回执 + void recvGroupReadReceipt(List list) { + onRecvGroupReadReceipt?.call(list); } - /// 消息被撤回 - void recvMessageRevokedV2(RevokedInfo info) { - onRecvMessageRevokedV2?.call(info); + /// 收到拓展消息kv新增 + void recvMessageExtensionsAdded(String msgID, List list) { + onRecvMessageExtensionsAdded?.call(msgID, list); } /// 收到拓展消息kv改变 @@ -61,8 +62,12 @@ class OnAdvancedMsgListener { onRecvMessageExtensionsDeleted?.call(msgID, list); } - /// 收到拓展消息kv新增 - void recvMessageExtensionsAdded(String msgID, List list) { - onRecvMessageExtensionsAdded?.call(msgID, list); + /// 收到了一条新消息 + void recvNewMessage(Message msg) { + onRecvNewMessage?.call(msg); + } + + void recvOfflineNewMessages(List list) { + onRecvOfflineNewMessages?.call(list); } } diff --git a/lib/src/listener/friendship_listener.dart b/lib/src/listener/friendship_listener.dart index 7f8701f..d3ea4d7 100644 --- a/lib/src/listener/friendship_listener.dart +++ b/lib/src/listener/friendship_listener.dart @@ -2,19 +2,19 @@ import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; /// 好友关系监听 class OnFriendshipListener { + Function(BlacklistInfo i)? onBlackAdded; + Function(BlacklistInfo i)? onBlackDeleted; + Function(FriendInfo i)? onFriendAdded; + Function(FriendApplicationInfo i)? onFriendApplicationAccepted; Function(FriendApplicationInfo i)? onFriendApplicationAdded; Function(FriendApplicationInfo i)? onFriendApplicationDeleted; - Function(FriendApplicationInfo i)? onFriendApplicationAccepted; Function(FriendApplicationInfo i)? onFriendApplicationRejected; - Function(FriendInfo i)? onFriendAdded; Function(FriendInfo i)? onFriendDeleted; Function(FriendInfo i)? onFriendInfoChanged; - Function(BlacklistInfo i)? onBlacklistAdded; - Function(BlacklistInfo i)? onBlacklistDeleted; OnFriendshipListener({ - this.onBlacklistAdded, - this.onBlacklistDeleted, + this.onBlackAdded, + this.onBlackDeleted, this.onFriendAdded, this.onFriendApplicationAccepted, this.onFriendApplicationAdded, @@ -25,13 +25,13 @@ class OnFriendshipListener { }); /// 已被加入黑名单 - void blacklistAdded(BlacklistInfo u) { - onBlacklistAdded?.call(u); + void blackAdded(BlacklistInfo u) { + onBlackAdded?.call(u); } /// 已从黑名单移除 - void blacklistDeleted(BlacklistInfo u) { - onBlacklistDeleted?.call(u); + void blackDeleted(BlacklistInfo u) { + onBlackDeleted?.call(u); } /// 好友已添加 diff --git a/lib/src/listener/group_listener.dart b/lib/src/listener/group_listener.dart index 15e0d96..df250d4 100644 --- a/lib/src/listener/group_listener.dart +++ b/lib/src/listener/group_listener.dart @@ -6,6 +6,7 @@ class OnGroupListener { Function(GroupApplicationInfo info)? onGroupApplicationAdded; Function(GroupApplicationInfo info)? onGroupApplicationDeleted; Function(GroupApplicationInfo info)? onGroupApplicationRejected; + Function(GroupInfo info)? onGroupDismissed; Function(GroupInfo info)? onGroupInfoChanged; Function(GroupMembersInfo info)? onGroupMemberAdded; Function(GroupMembersInfo info)? onGroupMemberDeleted; @@ -18,6 +19,7 @@ class OnGroupListener { this.onGroupApplicationAdded, this.onGroupApplicationDeleted, this.onGroupApplicationRejected, + this.onGroupDismissed, this.onGroupInfoChanged, this.onGroupMemberAdded, this.onGroupMemberDeleted, @@ -46,6 +48,10 @@ class OnGroupListener { onGroupApplicationRejected?.call(info); } + void groupDismissed(GroupInfo info) { + onGroupDismissed?.call(info); + } + /// 群资料发生改变 void groupInfoChanged(GroupInfo info) { onGroupInfoChanged?.call(info); diff --git a/lib/src/listener/organization_listener.dart b/lib/src/listener/organization_listener.dart index f91dd86..1a055ea 100644 --- a/lib/src/listener/organization_listener.dart +++ b/lib/src/listener/organization_listener.dart @@ -1,11 +1,11 @@ -/// 组织架构监听 -class OnOrganizationListener { - Function()? onOrganizationUpdated; - - OnOrganizationListener({this.onOrganizationUpdated}); - - /// 组织架构有更新 - void organizationUpdated() { - onOrganizationUpdated?.call(); - } -} +// /// 组织架构监听 +// class OnOrganizationListener { +// Function()? onOrganizationUpdated; +// +// OnOrganizationListener({this.onOrganizationUpdated}); +// +// /// 组织架构有更新 +// void organizationUpdated() { +// onOrganizationUpdated?.call(); +// } +// } diff --git a/lib/src/listener/put_file_listener.dart b/lib/src/listener/put_file_listener.dart new file mode 100644 index 0000000..63ee26c --- /dev/null +++ b/lib/src/listener/put_file_listener.dart @@ -0,0 +1,32 @@ +class OnPutFileListener { + Function(String putID, String hash, int total)? onHashComplete; + Function(String putID, int current, int total)? onHashProgress; + Function(String putID, int size)? onOpen; + Function(String putID, int total, int putType)? onPutComplete; + Function(String putID, int save, int current, int total)? onPutProgress; + Function(String putID, int current, int total)? onPutStart; + + void hashComplete(String putID, String hash, int total) { + onHashComplete?.call(putID, hash, total); + } + + void hashProgress(String putID, int current, int total) { + onHashProgress?.call(putID, current, total); + } + + void open(String putID, int size) { + onOpen?.call(putID, size); + } + + void putComplete(String putID, int total, int putType) { + onPutComplete?.call(putID, total, putType); + } + + void putProgress(String putID, int save, int current, int total) { + onPutProgress?.call(putID, save, current, total); + } + + void putStart(String putID, int current, int total) { + onPutStart?.call(putID, current, total); + } +} diff --git a/lib/src/listener/workmoments_listener.dart b/lib/src/listener/workmoments_listener.dart index 6f7dc9d..eccb703 100644 --- a/lib/src/listener/workmoments_listener.dart +++ b/lib/src/listener/workmoments_listener.dart @@ -1,11 +1,11 @@ -/// 朋友圈监听 -class OnWorkMomentsListener { - Function()? onRecvNewNotification; - - OnWorkMomentsListener({this.onRecvNewNotification}); - - /// 朋友圈信息发送改变 - void recvNewNotification() { - onRecvNewNotification?.call(); - } -} +// /// 朋友圈监听 +// class OnWorkMomentsListener { +// Function()? onRecvNewNotification; +// +// OnWorkMomentsListener({this.onRecvNewNotification}); +// +// /// 朋友圈信息发送改变 +// void recvNewNotification() { +// onRecvNewNotification?.call(); +// } +// } diff --git a/lib/src/manager/im_conversation_manager.dart b/lib/src/manager/im_conversation_manager.dart index 908a535..40c1638 100644 --- a/lib/src/manager/im_conversation_manager.dart +++ b/lib/src/manager/im_conversation_manager.dart @@ -1,3 +1,5 @@ +import 'dart:developer'; + import 'package:flutter/services.dart'; import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; @@ -71,26 +73,13 @@ class ConversationManager { }) => _channel .invokeMethod( - 'getMultipleConversation', - _buildParam({ - "conversationIDList": conversationIDList, - "operationID": Utils.checkOperationID(operationID), - })) - .then((value) => - Utils.toList(value, (map) => ConversationInfo.fromJson(map))); - - /// 通过会话id删除指定会话 - /// [conversationID] 被删除的会话的id - Future deleteConversation({ - required String conversationID, - String? operationID, - }) => - _channel.invokeMethod( - 'deleteConversation', + 'getMultipleConversation', _buildParam({ - "conversationID": conversationID, + "conversationIDList": conversationIDList, "operationID": Utils.checkOperationID(operationID), - })); + })) + .then((value) => + Utils.toList(value, (map) => ConversationInfo.fromJson(map))); /// 设置会话草稿 /// [conversationID] 会话id @@ -124,6 +113,19 @@ class ConversationManager { "operationID": Utils.checkOperationID(operationID), })); + /// 置顶会话 + /// [conversationID] 会话id + Future hideConversation({ + required String conversationID, + String? operationID, + }) => + _channel.invokeMethod( + 'hideConversation', + _buildParam({ + "conversationID": conversationID, + "operationID": Utils.checkOperationID(operationID), + })); + /// 获取未读消息总数 /// int.tryParse(count) ?? 0; Future getTotalUnreadMsgCount({ @@ -138,29 +140,29 @@ class ConversationManager { /// 查询会话id /// [sourceID] 如果是单聊值传用户ID,如果是群聊值传组ID /// [sessionType] 参考[ConversationType] - Future getConversationIDBySessionType({ - required String sourceID, - required int sessionType, - }) => - _channel.invokeMethod( - 'getConversationIDBySessionType', - _buildParam({ - "sourceID": sourceID, - "sessionType": sessionType, - })); + // Future getConversationIDBySessionType({ + // required String sourceID, + // required int sessionType, + // }) => + // _channel.invokeMethod( + // 'getConversationIDBySessionType', + // _buildParam({ + // "sourceID": sourceID, + // "sessionType": sessionType, + // })); /// 消息免打扰设置 - /// [conversationIDList] 会话id列表 + /// [conversationID] 会话id /// [status] 0:正常;1:不接受消息;2:接受在线消息不接受离线消息; Future setConversationRecvMessageOpt({ - required List conversationIDList, + required String conversationID, required int status, String? operationID, }) => _channel.invokeMethod( 'setConversationRecvMessageOpt', _buildParam({ - "conversationIDList": conversationIDList, + "conversationID": conversationID, "status": status, "operationID": Utils.checkOperationID(operationID), })); @@ -184,13 +186,13 @@ class ConversationManager { /// 阅后即焚 /// [conversationID] 会话id /// [isPrivate] true:开启,false:关闭 - Future setOneConversationPrivateChat({ + Future setConversationPrivateChat({ required String conversationID, required bool isPrivate, String? operationID, }) => _channel.invokeMethod( - 'setOneConversationPrivateChat', + 'setConversationPrivateChat', _buildParam({ "conversationID": conversationID, "isPrivate": isPrivate, @@ -199,12 +201,25 @@ class ConversationManager { /// 删除本地以及服务器的会话 /// [conversationID] 会话ID - Future deleteConversationFromLocalAndSvr({ + Future deleteConversationAndDeleteAllMsg({ + required String conversationID, + String? operationID, + }) => + _channel.invokeMethod( + 'deleteConversationAndDeleteAllMsg', + _buildParam({ + "conversationID": conversationID, + "operationID": Utils.checkOperationID(operationID), + })); + + /// 清空会话里的消息 + /// [conversationID] 会话ID + Future clearConversationAndDeleteAllMsg({ required String conversationID, String? operationID, }) => _channel.invokeMethod( - 'deleteConversationFromLocalAndSvr', + 'clearConversationAndDeleteAllMsg', _buildParam({ "conversationID": conversationID, "operationID": Utils.checkOperationID(operationID), @@ -234,8 +249,14 @@ class ConversationManager { })); /// 查询@所有人标识 - Future getAtAllTag() => - _channel.invokeMethod('getAtAllTag', _buildParam({})); + Future getAtAllTag({ + String? operationID, + }) => + _channel.invokeMethod( + 'getAtAllTag', + _buildParam({ + "operationID": Utils.checkOperationID(operationID), + })); /// 查询@所有人标识 String get atAllTag => 'atAllTag'; @@ -256,19 +277,33 @@ class ConversationManager { /// 设置阅后即焚时长 /// [conversationID] 会话id /// [burnDuration] 时长s,默认30s - Future setOneConversationBurnDuration({ + Future setConversationBurnDuration({ required String conversationID, int burnDuration = 30, String? operationID, }) => _channel.invokeMethod( - 'setOneConversationBurnDuration', + 'setConversationBurnDuration', _buildParam({ "conversationID": conversationID, "burnDuration": burnDuration, "operationID": Utils.checkOperationID(operationID), })); + /// 标记消息已读 + /// [conversationID] 会话ID + /// [messageIDList] 被标记的消息clientMsgID + Future markConversationMessageAsRead({ + required String conversationID, + String? operationID, + }) => + _channel.invokeMethod( + 'markConversationMessageAsRead', + _buildParam({ + "conversationID": conversationID, + "operationID": Utils.checkOperationID(operationID), + })); + /// 会话列表自定义排序规则。 List simpleSort(List list) => list ..sort((a, b) { @@ -279,23 +314,24 @@ class ConversationManager { : a.latestMsgSendTime!; int bCompare = b.draftTextTime! > b.latestMsgSendTime! ? b.draftTextTime! - : b.latestMsgSendTime!; - if (aCompare > bCompare) { - return -1; - } else if (aCompare < bCompare) { - return 1; - } else { - return 0; - } - } else if (a.isPinned == true && b.isPinned != true) { - return -1; - } else { - return 1; - } - }); + : b.latestMsgSendTime!; + if (aCompare > bCompare) { + return -1; + } else if (aCompare < bCompare) { + return 1; + } else { + return 0; + } + } else if (a.isPinned == true && b.isPinned != true) { + return -1; + } else { + return 1; + } + }); static Map _buildParam(Map param) { param["ManagerName"] = "conversationManager"; + log('param: $param'); return param; } } diff --git a/lib/src/manager/im_friendship_manager.dart b/lib/src/manager/im_friendship_manager.dart index 687de61..fa76bb8 100644 --- a/lib/src/manager/im_friendship_manager.dart +++ b/lib/src/manager/im_friendship_manager.dart @@ -14,42 +14,42 @@ class FriendshipManager { } /// 查询好友信息 - /// [uidList] userID集合 + /// [userIDList] userID集合 Future> getFriendsInfo({ - required List uidList, + required List userIDList, String? operationID, }) => _channel .invokeMethod( 'getFriendsInfo', _buildParam({ - "uidList": uidList, + "userIDList": userIDList, "operationID": Utils.checkOperationID(operationID), })) .then((value) => Utils.toList(value, (v) => UserInfo.fromJson(v))); /// 发送一个好友请求,需要对方调用同意申请才能成为好友。 - /// [uid] 被邀请的用户ID + /// [userID] 被邀请的用户ID /// [reason] 备注说明 Future addFriend({ - required String uid, + required String userID, String? reason, String? operationID, }) => _channel.invokeMethod( 'addFriend', _buildParam({ - "toUserID": uid, + "toUserID": userID, "reqMsg": reason, "operationID": Utils.checkOperationID(operationID), })); /// 获取别人加我为好友的申请 - Future> getRecvFriendApplicationList( + Future> getFriendApplicationListAsRecipient( {String? operationID}) => _channel .invokeMethod( - 'getRecvFriendApplicationList', + 'getFriendApplicationListAsRecipient', _buildParam({ "operationID": Utils.checkOperationID(operationID), })) @@ -57,11 +57,11 @@ class FriendshipManager { Utils.toList(value, (v) => FriendApplicationInfo.fromJson(v))); /// 获取我发出的好友申请 - Future> getSendFriendApplicationList( + Future> getFriendApplicationListAsApplicant( {String? operationID}) => _channel .invokeMethod( - 'getSendFriendApplicationList', + 'getFriendApplicationListAsApplicant', _buildParam({ "operationID": Utils.checkOperationID(operationID), })) @@ -87,31 +87,31 @@ class FriendshipManager { .then((value) => Utils.toListMap(value)); /// 设置好友备注 - /// [uid] 好友的userID + /// [userID] 好友的userID /// [remark] 好友的备注 Future setFriendRemark({ - required String uid, + required String userID, required String remark, String? operationID, }) => _channel.invokeMethod( 'setFriendRemark', _buildParam({ - 'toUserID': uid, + 'toUserID': userID, 'remark': remark, "operationID": Utils.checkOperationID(operationID), })); /// 加入黑名单 - /// [uid] 被加入黑名单的好友ID + /// [userID] 被加入黑名单的好友ID Future addBlacklist({ - required String uid, + required String userID, String? operationID, }) => _channel.invokeMethod( 'addBlacklist', _buildParam({ - "uid": uid, + "userID": userID, "operationID": Utils.checkOperationID(operationID), })); @@ -125,75 +125,75 @@ class FriendshipManager { .then((value) => Utils.toList(value, (v) => UserInfo.fromJson(v))); /// 从黑名单移除 - /// [uid] 用户ID + /// [userID] 用户ID Future removeBlacklist({ - required String uid, + required String userID, String? operationID, }) => _channel.invokeMethod( 'removeBlacklist', _buildParam({ - "uid": uid, + "userID": userID, "operationID": Utils.checkOperationID(operationID), })); /// 检查友好关系 - /// [uidList] userID列表 + /// [userIDList] userID列表 Future> checkFriend({ - required List uidList, + required List userIDList, String? operationID, }) => _channel .invokeMethod( 'checkFriend', _buildParam({ - 'uidList': uidList, + 'userIDList': userIDList, "operationID": Utils.checkOperationID(operationID), })) .then((value) => Utils.toList(value, (v) => FriendshipInfo.fromJson(v))); /// 删除好友 - /// [uid] 用户ID + /// [userID] 用户ID Future deleteFriend({ - required String uid, + required String userID, String? operationID, }) => _channel.invokeMethod( 'deleteFriend', _buildParam({ - "uid": uid, + "userID": userID, "operationID": Utils.checkOperationID(operationID), })); /// 接受好友请求 - /// [uid] 用户ID + /// [userID] 用户ID /// [handleMsg]备注说明 Future acceptFriendApplication({ - required String uid, + required String userID, String? handleMsg, String? operationID, }) => _channel.invokeMethod( 'acceptFriendApplication', _buildParam({ - "toUserID": uid, + "toUserID": userID, "handleMsg": handleMsg, "operationID": Utils.checkOperationID(operationID), })); /// 拒绝好友请求 - /// [uid] 用户ID + /// [userID] 用户ID /// [handleMsg]备注说明 Future refuseFriendApplication({ - required String uid, + required String userID, String? handleMsg, String? operationID, }) => _channel.invokeMethod( 'refuseFriendApplication', _buildParam({ - "toUserID": uid, + "toUserID": userID, "handleMsg": handleMsg, "operationID": Utils.checkOperationID(operationID), })); diff --git a/lib/src/manager/im_group_manager.dart b/lib/src/manager/im_group_manager.dart index 446f08d..40688df 100644 --- a/lib/src/manager/im_group_manager.dart +++ b/lib/src/manager/im_group_manager.dart @@ -1,3 +1,5 @@ +import 'dart:developer'; + import 'package:flutter/services.dart'; import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; @@ -14,11 +16,11 @@ class GroupManager { } /// 邀请进组,直接进组无需同意。 - /// [groupId] 组ID - /// [uidList] 用户ID列表 + /// [groupID] 组ID + /// [userIDList] 用户ID列表 Future> inviteUserToGroup({ - required String groupId, - required List uidList, + required String groupID, + required List userIDList, String? reason, String? operationID, }) => @@ -26,21 +28,21 @@ class GroupManager { .invokeMethod( 'inviteUserToGroup', _buildParam({ - 'gid': groupId, + 'groupID': groupID, + 'userIDList': userIDList, 'reason': reason, - 'uidList': uidList, "operationID": Utils.checkOperationID(operationID), })) .then((value) => Utils.toList(value, (map) => GroupInviteResult.fromJson(map))); /// 移除组成员 - /// [groupId] 组ID - /// [uidList] 用户ID列表 + /// [groupID] 组ID + /// [userIDList] 用户ID列表 /// [reason] 备注说明 Future> kickGroupMember({ - required String groupId, - required List uidList, + required String groupID, + required List userIDList, String? reason, String? operationID, }) => @@ -48,40 +50,40 @@ class GroupManager { .invokeMethod( 'kickGroupMember', _buildParam({ - 'gid': groupId, + 'groupID': groupID, + 'userIDList': userIDList, 'reason': reason, - 'uidList': uidList, "operationID": Utils.checkOperationID(operationID), })) .then((value) => Utils.toList(value, (map) => GroupInviteResult.fromJson(map))); /// 查询组成员资料 - /// [groupId] 组ID - /// [uidList] 用户ID列表 + /// [groupID] 组ID + /// [userIDList] 用户ID列表 Future> getGroupMembersInfo({ - required String groupId, - required List uidList, + required String groupID, + required List userIDList, String? operationID, }) => _channel .invokeMethod( 'getGroupMembersInfo', _buildParam({ - 'gid': groupId, - 'uidList': uidList, + 'groupID': groupID, + 'userIDList': userIDList, "operationID": Utils.checkOperationID(operationID), })) .then((value) => Utils.toList(value, (map) => GroupMembersInfo.fromJson(map))); /// 分页获取组成员列表 - /// [groupId] 群ID - /// [filter] 过滤成员 0所有,1普通成员, 2群主,3管理员,4管理员+普通成员 + /// [groupID] 群ID + /// [filter] 过滤成员 0所有,1群主 , 2管理员,3普通成员,4管理员+普通成员 5,群主+管理员 /// [offset] 开始下标 /// [count] 总数 Future> getGroupMemberList({ - required String groupId, + required String groupID, int filter = 0, int offset = 0, int count = 0, @@ -91,7 +93,7 @@ class GroupManager { .invokeMethod( 'getGroupMemberList', _buildParam({ - 'gid': groupId, + 'groupID': groupID, 'filter': filter, 'offset': offset, 'count': count, @@ -101,12 +103,12 @@ class GroupManager { Utils.toList(value, (map) => GroupMembersInfo.fromJson(map))); /// 分页获取组成员列表 - /// [groupId] 群ID - /// [filter] 过滤成员 0所有,1普通成员, 2群主,3管理员,4管理员+普通成员 + /// [groupID] 群ID + /// [filter] 过滤成员 0所有,1群主 , 2管理员,3普通成员,4管理员+普通成员 5,群主+管理员 /// [offset] 开始下标 /// [count] 总数 Future> getGroupMemberListMap({ - required String groupId, + required String groupID, int filter = 0, int offset = 0, int count = 0, @@ -116,7 +118,7 @@ class GroupManager { .invokeMethod( 'getGroupMemberList', _buildParam({ - 'gid': groupId, + 'groupID': groupID, 'filter': filter, 'offset': offset, 'count': count, @@ -143,14 +145,19 @@ class GroupManager { .then((value) => Utils.toListMap(value)); /// 检查是否已加入组 - /// [gid] 组ID + /// [groupID] 组ID Future isJoinedGroup({ - required String gid, + required String groupID, String? operationID, }) => - getJoinedGroupList( - operationID: Utils.checkOperationID(operationID), - ).then((list) => list.where((e) => e.groupID == gid).length > 0); + _channel + .invokeMethod( + 'isJoinGroup', + _buildParam({ + 'groupID': groupID, + 'operationID': Utils.checkOperationID(operationID), + })) + .then((value) => value == 'true' ? true : false); /// 创建一个组 /// [groupName] 群名 @@ -161,28 +168,20 @@ class GroupManager { /// [ex] 额外信息 /// [list] 初创群成员以及其角色列表[GroupMemberRole] Future createGroup({ - String? groupName, - String? notification, - String? introduction, - String? faceUrl, - int? groupType, - String? ex, - required List list, + required GroupInfo groupInfo, + List memberUserIDs = const [], + List adminUserIDs = const [], + String? ownerUserID, String? operationID, }) => _channel .invokeMethod( 'createGroup', _buildParam({ - 'gInfo': { - "groupName": groupName, - "notification": notification, - "introduction": introduction, - "faceURL": faceUrl, - "groupType": groupType, - "ex": ex, - }, - 'memberList': list.map((e) => e.toJson()).toList(), + 'groupInfo': groupInfo.toJson(), + 'memberUserIDs': memberUserIDs, + 'adminUserIDs': adminUserIDs, + 'ownerUserID': ownerUserID, 'operationID': Utils.checkOperationID(operationID), })) .then( @@ -193,43 +192,48 @@ class GroupManager { /// [groupName] 新的群名 /// [notification] 新的公告 /// [introduction] 新的群介绍 - /// [faceUrl] 新的群头像 + /// [faceURL] 新的群头像 /// [ex] 新的额外信息 Future setGroupInfo({ required String groupID, String? groupName, String? notification, String? introduction, - String? faceUrl, + String? faceURL, String? ex, + int? needVerification, + int? lookMemberInfo, + int? applyMemberFriend, String? operationID, }) => _channel.invokeMethod( 'setGroupInfo', _buildParam({ - "gid": groupID, - 'gInfo': { - // "groupID": groupID, + 'groupInfo': { + "groupID": groupID, "groupName": groupName, "notification": notification, "introduction": introduction, - "faceURL": faceUrl, + "faceURL": faceURL, "ex": ex, + 'needVerification': needVerification, + 'lookMemberInfo': lookMemberInfo, + 'applyMemberFriend': applyMemberFriend, }, 'operationID': Utils.checkOperationID(operationID), })); /// 查询组信息 - /// [gidList] 组ID列表 + /// [groupIDList] 组ID列表 Future> getGroupsInfo({ - required List gidList, + required List groupIDList, String? operationID, }) => _channel .invokeMethod( 'getGroupsInfo', _buildParam({ - 'gidList': gidList, + 'groupIDList': groupIDList, 'operationID': Utils.checkOperationID(operationID), })) .then( @@ -238,7 +242,7 @@ class GroupManager { /// 申请加入组,需要通过管理员/群组同意。 /// [joinSource] 2:通过邀请 3:通过搜索 4:通过二维码 Future joinGroup({ - required String gid, + required String groupID, String? reason, String? operationID, int joinSource = 3, @@ -246,7 +250,7 @@ class GroupManager { _channel.invokeMethod( 'joinGroup', _buildParam({ - 'gid': gid, + 'groupID': groupID, 'reason': reason, 'joinSource': joinSource, 'operationID': Utils.checkOperationID(operationID), @@ -254,38 +258,38 @@ class GroupManager { /// 退出组 Future quitGroup({ - required String gid, + required String groupID, String? operationID, }) => _channel.invokeMethod( 'quitGroup', _buildParam({ - 'gid': gid, + 'groupID': groupID, 'operationID': Utils.checkOperationID(operationID), })); /// 转移组拥有者权限 - /// [gid] 组ID - /// [uid] 新拥有者ID + /// [groupID] 组ID + /// [userID] 新拥有者ID Future transferGroupOwner({ - required String gid, - required String uid, + required String groupID, + required String userID, String? operationID, }) => _channel.invokeMethod( 'transferGroupOwner', _buildParam({ - 'gid': gid, - 'uid': uid, + 'groupID': groupID, + 'userID': userID, 'operationID': Utils.checkOperationID(operationID), })); /// 作为群主或者管理员,收到的群成员入群申请 - Future> getRecvGroupApplicationList( + Future> getGroupApplicationListAsRecipient( {String? operationID}) => _channel .invokeMethod( - 'getRecvGroupApplicationList', + 'getGroupApplicationListAsRecipient', _buildParam({ 'operationID': Utils.checkOperationID(operationID), })) @@ -293,11 +297,11 @@ class GroupManager { Utils.toList(value, (map) => GroupApplicationInfo.fromJson(map))); /// 获取自己发出的入群申请记录 - Future> getSendGroupApplicationList( + Future> getGroupApplicationListAsApplicant( {String? operationID}) => _channel .invokeMethod( - 'getSendGroupApplicationList', + 'getGroupApplicationListAsApplicant', _buildParam({ 'operationID': Utils.checkOperationID(operationID), })) @@ -306,39 +310,39 @@ class GroupManager { /// 管理员或者群主同意某人进入某群 /// 注:主动申请入群需要通过管理员/群组处理,被别人拉入群不需要管理员/群组处理 - /// [gid] 组id - /// [uid] 申请者用户ID + /// [groupID] 组id + /// [userID] 申请者用户ID Future acceptGroupApplication({ - required String gid, - required String uid, + required String groupID, + required String userID, String? handleMsg, String? operationID, }) => _channel.invokeMethod( 'acceptGroupApplication', _buildParam({ - 'gid': gid, - 'uid': uid, + 'groupID': groupID, + 'userID': userID, 'handleMsg': handleMsg, 'operationID': Utils.checkOperationID(operationID), })); /// 管理员或者群主拒绝某人进入某群 /// 注:主动申请入群需要通过管理员/群组处理,被别人拉入群不需要管理员/群组处理 - /// [gid] 组id - /// [uid] 申请者用户ID + /// [groupID] 组id + /// [userID] 申请者用户ID /// [handleMsg] 说明 Future refuseGroupApplication({ - required String gid, - required String uid, + required String groupID, + required String userID, String? handleMsg, String? operationID, }) => _channel.invokeMethod( 'refuseGroupApplication', _buildParam({ - 'gid': gid, - 'uid': uid, + 'groupID': groupID, + 'userID': userID, 'handleMsg': handleMsg, 'operationID': Utils.checkOperationID(operationID), })); @@ -352,7 +356,7 @@ class GroupManager { _channel.invokeMethod( 'dismissGroup', _buildParam({ - 'gid': groupID, + 'groupID': groupID, 'operationID': Utils.checkOperationID(operationID), })); @@ -367,7 +371,7 @@ class GroupManager { _channel.invokeMethod( 'changeGroupMute', _buildParam({ - 'gid': groupID, + 'groupID': groupID, 'mute': mute, 'operationID': Utils.checkOperationID(operationID), })); @@ -385,8 +389,8 @@ class GroupManager { _channel.invokeMethod( 'changeGroupMemberMute', _buildParam({ - 'gid': groupID, - 'uid': userID, + 'groupID': groupID, + 'userID': userID, 'seconds': seconds, 'operationID': Utils.checkOperationID(operationID), })); @@ -404,8 +408,8 @@ class GroupManager { _channel.invokeMethod( 'setGroupMemberNickname', _buildParam({ - 'gid': groupID, - 'uid': userID, + 'groupID': groupID, + 'userID': userID, 'groupNickname': groupNickname ?? '', 'operationID': Utils.checkOperationID(operationID), })); @@ -633,6 +637,7 @@ class GroupManager { static Map _buildParam(Map param) { param["ManagerName"] = "groupManager"; + log('param: $param'); return param; } } diff --git a/lib/src/manager/im_manager.dart b/lib/src/manager/im_manager.dart index b734393..c9b031d 100644 --- a/lib/src/manager/im_manager.dart +++ b/lib/src/manager/im_manager.dart @@ -15,13 +15,15 @@ class IMManager { // late OfflinePushManager offlinePushManager; late SignalingManager signalingManager; - late WorkMomentsManager workMomentsManager; - late OrganizationManager organizationManager; + + // late WorkMomentsManager workMomentsManager; + // late OrganizationManager organizationManager; late OnConnectListener _connectListener; OnListenerForService? _listenerForService; - late String uid; - late UserInfo uInfo; + OnPutFileListener? _putFileListener; + late String userID; + late UserInfo userInfo; bool isLogined = false; String? token; String? _objectStorage; @@ -34,8 +36,8 @@ class IMManager { userManager = UserManager(_channel); // offlinePushManager = OfflinePushManager(_channel); signalingManager = SignalingManager(_channel); - workMomentsManager = WorkMomentsManager(_channel); - organizationManager = OrganizationManager(_channel); + // workMomentsManager = WorkMomentsManager(_channel); + // organizationManager = OrganizationManager(_channel); _addNativeCallback(_channel); } @@ -69,8 +71,8 @@ class IMManager { dynamic data = call.arguments['data']; switch (type) { case 'onSelfInfoUpdated': - uInfo = Utils.toObj(data, (map) => UserInfo.fromJson(map)); - userManager.listener.selfInfoUpdated(uInfo); + userInfo = Utils.toObj(data, (map) => UserInfo.fromJson(map)); + userManager.listener.selfInfoUpdated(userInfo); break; } } else if (call.method == ListenerType.groupListener) { @@ -97,6 +99,10 @@ class IMManager { data, (map) => GroupApplicationInfo.fromJson(map)); groupManager.listener.groupApplicationRejected(i); break; + case 'onGroupDismissed': + final i = Utils.toObj(data, (map) => GroupInfo.fromJson(map)); + groupManager.listener.groupDismissed(i); + break; case 'onGroupInfoChanged': final i = Utils.toObj(data, (map) => GroupInfo.fromJson(map)); groupManager.listener.groupInfoChanged(i); @@ -129,52 +135,59 @@ class IMManager { var type = call.arguments['type']; // var id = call.arguments['data']['id']; switch (type) { - case 'onRecvNewMessage': - var value = call.arguments['data']['newMessage']; + case 'onMsgDeleted': + var value = call.arguments['data']['message']; final msg = Utils.toObj(value, (map) => Message.fromJson(map)); - messageManager.msgListener.recvNewMessage(msg); + messageManager.msgListener.msgDeleted(msg); break; - case 'onRecvMessageRevoked': - var msgID = call.arguments['data']['revokedMessage']; - messageManager.msgListener.recvMessageRevoked(msgID); + case 'onNewRecvMessageRevoked': + var value = call.arguments['data']['messageRevoked']; + var info = Utils.toObj(value, (map) => RevokedInfo.fromJson(map)); + messageManager.msgListener.newRecvMessageRevoked(info); break; case 'onRecvC2CReadReceipt': - var value = call.arguments['data']['c2cMessageReadReceipt']; + var value = call.arguments['data']['msgReceiptList']; var list = Utils.toList(value, (map) => ReadReceiptInfo.fromJson(map)); - messageManager.msgListener.recvC2CMessageReadReceipt(list); + messageManager.msgListener.recvC2CReadReceipt(list); break; case 'onRecvGroupReadReceipt': - var value = call.arguments['data']['groupMessageReadReceipt']; + var value = call.arguments['data']['groupMsgReceiptList']; var list = Utils.toList(value, (map) => ReadReceiptInfo.fromJson(map)); - messageManager.msgListener.recvGroupMessageReadReceipt(list); + messageManager.msgListener.recvGroupReadReceipt(list); break; - case 'onNewRecvMessageRevoked': - var value = call.arguments['data']['revokedMessageV2']; - var info = Utils.toObj(value, (map) => RevokedInfo.fromJson(map)); - messageManager.msgListener.recvMessageRevokedV2(info); + case 'onRecvMessageExtensionsAdded': + var msgID = call.arguments['data']['msgID']; + var value = call.arguments['data']['reactionExtensionList']; + var list = Utils.toList(value, (map) => KeyValue.fromJson(map)); + messageManager.msgListener + .recvMessageExtensionsAdded(msgID, list); break; case 'onRecvMessageExtensionsChanged': var msgID = call.arguments['data']['msgID']; - var value = call.arguments['data']['list']; + var value = call.arguments['data']['reactionExtensionList']; var list = Utils.toList(value, (map) => KeyValue.fromJson(map)); messageManager.msgListener .recvMessageExtensionsChanged(msgID, list); break; case 'onRecvMessageExtensionsDeleted': var msgID = call.arguments['data']['msgID']; - var value = call.arguments['data']['list']; + var value = call.arguments['data']['reactionExtensionKeyList']; var list = Utils.toList(value, (map) => '$map'); messageManager.msgListener .recvMessageExtensionsDeleted(msgID, list); break; - case 'onRecvMessageExtensionsAdded': - var msgID = call.arguments['data']['msgID']; - var value = call.arguments['data']['list']; - var list = Utils.toList(value, (map) => KeyValue.fromJson(map)); - messageManager.msgListener - .recvMessageExtensionsAdded(msgID, list); + + case 'onRecvNewMessage': + var value = call.arguments['data']['message']; + final msg = Utils.toObj(value, (map) => Message.fromJson(map)); + messageManager.msgListener.recvNewMessage(msg); + break; + case 'onRecvOfflineNewMessages': + var value = call.arguments['data']['messageList']; + final list = Utils.toList(value, (map) => Message.fromJson(map)); + messageManager.msgListener.recvOfflineNewMessages(list); break; } } else if (call.method == ListenerType.msgSendProgressListener) { @@ -224,13 +237,17 @@ class IMManager { dynamic data = call.arguments['data']; switch (type) { - case 'onBlacklistAdded': + case 'onBlackAdded': final u = Utils.toObj(data, (map) => BlacklistInfo.fromJson(map)); - friendshipManager.listener.blacklistAdded(u); + friendshipManager.listener.blackAdded(u); break; - case 'onBlacklistDeleted': + case 'onBlackDeleted': final u = Utils.toObj(data, (map) => BlacklistInfo.fromJson(map)); - friendshipManager.listener.blacklistDeleted(u); + friendshipManager.listener.blackDeleted(u); + break; + case 'onFriendAdded': + final u = Utils.toObj(data, (map) => FriendInfo.fromJson(map)); + friendshipManager.listener.friendAdded(u); break; case 'onFriendApplicationAccepted': final u = Utils.toObj( @@ -252,18 +269,14 @@ class IMManager { data, (map) => FriendApplicationInfo.fromJson(map)); friendshipManager.listener.friendApplicationRejected(u); break; - case 'onFriendInfoChanged': - final u = Utils.toObj(data, (map) => FriendInfo.fromJson(map)); - friendshipManager.listener.friendInfoChanged(u); - break; - case 'onFriendAdded': - final u = Utils.toObj(data, (map) => FriendInfo.fromJson(map)); - friendshipManager.listener.friendAdded(u); - break; case 'onFriendDeleted': final u = Utils.toObj(data, (map) => FriendInfo.fromJson(map)); friendshipManager.listener.friendDeleted(u); break; + case 'onFriendInfoChanged': + final u = Utils.toObj(data, (map) => FriendInfo.fromJson(map)); + friendshipManager.listener.friendInfoChanged(u); + break; } } else if (call.method == ListenerType.signalingListener) { String type = call.arguments['type']; @@ -323,7 +336,8 @@ class IMManager { signalingManager.listener.receiveCustomSignal(info); break; } - } else if (call.method == ListenerType.workMomentsListener) { + } + /*else if (call.method == ListenerType.workMomentsListener) { String type = call.arguments['type']; switch (type) { case 'OnRecvNewNotification': @@ -337,7 +351,8 @@ class IMManager { organizationManager.listener.organizationUpdated(); break; } - } else if (call.method == ListenerType.customBusinessListener) { + }*/ + else if (call.method == ListenerType.customBusinessListener) { String type = call.arguments['type']; String data = call.arguments['data']; switch (type) { @@ -385,6 +400,47 @@ class IMManager { _listenerForService?.recvNewMessage(msg); break; } + } else if (call.method == ListenerType.putFileListener) { + String type = call.arguments['type']; + dynamic data = call.arguments['data']; + switch (type) { + case 'hashComplete': + String putID = data['putID']; + String hash = data['hash']; + int total = data['total']; + _putFileListener?.hashComplete(putID, hash, total); + break; + case 'hashProgress': + String putID = data['putID']; + int current = data['current']; + int total = data['total']; + _putFileListener?.hashProgress(putID, current, total); + break; + case 'open': + String putID = data['putID']; + int size = data['size']; + _putFileListener?.open(putID, size); + break; + case 'putComplete': + String putID = data['putID']; + int putType = data['putType']; + int total = data['total']; + _putFileListener?.putComplete(putID, putType, total); + break; + case 'putProgress': + String putID = data['putID']; + int save = data['save']; + int current = data['current']; + int total = data['total']; + _putFileListener?.putProgress(putID, save, current, total); + break; + case 'putStart': + String putID = data['putID']; + int current = data['current']; + int total = data['total']; + _putFileListener?.putStart(putID, current, total); + break; + } } } catch (error, stackTrace) { Logger.print( @@ -404,7 +460,7 @@ class IMManager { /// [enabledEncryption] true:加密 /// [enabledCompression] true:压缩 Future initSDK({ - required int platform, + required int platformID, required String apiAddr, required String wsAddr, required String dataDir, @@ -412,9 +468,11 @@ class IMManager { int logLevel = 6, String objectStorage = 'cos', String? encryptionKey, - bool enabledEncryption = false, - bool enabledCompression = false, + bool isNeedEncryption = false, + bool isCompression = false, bool isExternalExtensions = false, + bool isLogStandardOutput = true, + String? logFilePath, String? operationID, }) { this._connectListener = listener; @@ -423,32 +481,29 @@ class IMManager { 'initSDK', _buildParam( { - "platform": platform, - "api_addr": apiAddr, - "ws_addr": wsAddr, - "data_dir": dataDir, - "log_level": logLevel, - "object_storage": objectStorage, - "encryption_key": encryptionKey, - "is_need_encryption": enabledEncryption, - "is_compression": enabledCompression, - "is_external_extensions": isExternalExtensions, + "platformID": platformID, + "apiAddr": apiAddr, + "wsAddr": wsAddr, + "dataDir": dataDir, + "logLevel": logLevel, + "objectStorage": objectStorage, + "encryptionKey": encryptionKey, + "isNeedEncryption": isNeedEncryption, + "isCompression": isCompression, + "isExternalExtensions": isExternalExtensions, + "isLogStandardOutput": isLogStandardOutput, + "logFilePath": logFilePath, "operationID": Utils.checkOperationID(operationID), }, )); } - /// 反初始化SDK - Future unInitSDK() { - return _channel.invokeMethod('unInitSDK', _buildParam({})); - } - /// 登录 /// [uid] 用户id /// [token] 登录token,从业务服务器上获取 /// [defaultValue] 获取失败后使用的默认值 Future login({ - required String uid, + required String userID, required String token, String? operationID, Future Function()? defaultValue, @@ -456,20 +511,20 @@ class IMManager { await _channel.invokeMethod( 'login', _buildParam({ - 'uid': uid, + 'userID': userID, 'token': token, 'operationID': Utils.checkOperationID(operationID), }), ); this.isLogined = true; - this.uid = uid; + this.userID = userID; this.token = token; try { - return this.uInfo = await userManager.getSelfUserInfo(); + return this.userInfo = await userManager.getSelfUserInfo(); } catch (error, stackTrace) { log('login e: $error s: $stackTrace'); if (null != defaultValue) { - return this.uInfo = await (defaultValue.call()); + return this.userInfo = await (defaultValue.call()); } return Future.error(error, stackTrace); } @@ -493,34 +548,24 @@ class IMManager { _channel.invokeMethod('getLoginStatus', _buildParam({})); /// 获取当前登录用户id - Future getLoginUserID() async => uid; + Future getLoginUserID() async => userID; /// 获取当前登录用户信息 - Future getLoginUserInfo() async => uInfo; - - /// 从后台回到前台立刻唤醒 - Future wakeUp({String? operationID}) => _channel.invokeMethod( - 'wakeUp', - _buildParam({ - 'operationID': Utils.checkOperationID(operationID), - })); + Future getLoginUserInfo() async => userInfo; - /// 上传图片到服务器 - /// [path] 图片路径 - /// [token] im token - /// [objectStorage] 存储对象 cos/minio - Future uploadImage({ - required String path, - String? token, - String? objectStorage, + /// + Future putFile({ + required String putID, + required String filePath, + required String fileName, String? operationID, }) => _channel.invokeMethod( - 'uploadImage', + 'putFile', _buildParam({ - 'path': path, - 'token': token ?? this.token, - 'obj': objectStorage ?? this._objectStorage, + 'putID': putID, + 'filePath': filePath, + 'name': fileName, 'operationID': Utils.checkOperationID(operationID), })); @@ -538,26 +583,30 @@ class IMManager { })); /// 标记app处于后台 - Future setAppBackgroundStatus({ - required bool isBackground, - String? operationID, - }) => - _channel.invokeMethod( - 'setAppBackgroundStatus', - _buildParam({ - 'isBackground': isBackground, - 'operationID': Utils.checkOperationID(operationID), - })); + // Future setAppBackgroundStatus({ + // required bool isBackground, + // String? operationID, + // }) => + // _channel.invokeMethod( + // 'setAppBackgroundStatus', + // _buildParam({ + // 'isBackground': isBackground, + // 'operationID': Utils.checkOperationID(operationID), + // })); /// 网络改变 - Future networkChanged({ - String? operationID, - }) => - _channel.invokeMethod( - 'networkChanged', - _buildParam({ - 'operationID': Utils.checkOperationID(operationID), - })); + // Future networkStatusChanged({ + // String? operationID, + // }) => + // _channel.invokeMethod( + // 'networkStatusChanged', + // _buildParam({ + // 'operationID': Utils.checkOperationID(operationID), + // })); + + void setPutFileListener(OnPutFileListener listener) { + _putFileListener = listener; + } /// Future setListenerForService(OnListenerForService listener) { diff --git a/lib/src/manager/im_message_manager.dart b/lib/src/manager/im_message_manager.dart index 14e5f8f..c93c9a2 100644 --- a/lib/src/manager/im_message_manager.dart +++ b/lib/src/manager/im_message_manager.dart @@ -52,59 +52,56 @@ class MessageManager { })) .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); - /// 获取聊天记录(以startMsg为节点,以前的聊天记录) - /// [userID] 接收消息的用户id - /// [conversationID] 会话id,查询通知时可用 - /// [groupID] 接收消息的组id - /// [startMsg] 从这条消息开始查询[count]条,获取的列表index==length-1为最新消息,所以获取下一页历史记录startMsg=list.first - /// [count] 一次拉取的总数 - Future> getHistoryMessageList({ - String? userID, - String? groupID, - String? conversationID, - Message? startMsg, - int? count, + /// 删除本地消息 + /// [message] 被删除的消息体 + Future deleteMessageFromLocalStorage({ + required String conversationID, + required String clientMsgID, String? operationID, }) => - _channel - .invokeMethod( - 'getHistoryMessageList', - _buildParam({ - 'userID': userID ?? '', - 'groupID': groupID ?? '', - 'conversationID': conversationID ?? '', - 'startClientMsgID': startMsg?.clientMsgID ?? '', - 'count': count ?? 10, - 'operationID': Utils.checkOperationID(operationID), - })) - .then((value) => Utils.toList(value, (map) => Message.fromJson(map))); + _channel.invokeMethod( + 'deleteMessageFromLocalStorage', + _buildParam({ + "conversationID": conversationID, + "clientMsgID": clientMsgID, + "operationID": Utils.checkOperationID(operationID), + })); - /// 撤回消息[revokeMessageV2] - /// [message] 被撤回的消息体 - @deprecated - Future revokeMessage({ - required Message message, + /// core-sdk: DeleteMessage + /// 删除本地跟服务器的指定的消息 + /// [message] 被删除的消息 + Future deleteMessageFromLocalAndSvr({ + required String conversationID, + required String clientMsgID, String? operationID, }) => _channel.invokeMethod( - 'revokeMessage', - _buildParam(message.toJson() - ..addAll({ - "operationID": Utils.checkOperationID(operationID), - }))); + 'deleteMessageFromLocalAndSvr', + _buildParam({ + "conversationID": conversationID, + "clientMsgID": clientMsgID, + "operationID": Utils.checkOperationID(operationID), + })); - /// 删除本地消息 - /// [message] 被删除的消息体 - Future deleteMessageFromLocalStorage({ - required Message message, + /// 删除本地所有聊天记录 + Future deleteAllMsgFromLocal({ String? operationID, }) => _channel.invokeMethod( - 'deleteMessageFromLocalStorage', - _buildParam(message.toJson() - ..addAll({ - "operationID": Utils.checkOperationID(operationID), - }))); + 'deleteAllMsgFromLocal', + _buildParam({ + "operationID": Utils.checkOperationID(operationID), + })); + + /// 删除本地跟服务器所有聊天记录 + Future deleteAllMsgFromLocalAndSvr({ + String? operationID, + }) => + _channel.invokeMethod( + 'deleteAllMsgFromLocalAndSvr', + _buildParam({ + "operationID": Utils.checkOperationID(operationID), + })); /// 插入单聊消息到本地 /// [receiverID] 接收者id @@ -148,37 +145,6 @@ class MessageManager { })) .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); - /// 标记c2c单条消息已读 - /// [userID] 消息来源的userID - /// [messageIDList] 消息clientMsgID集合 - Future markC2CMessageAsRead({ - required String userID, - required List messageIDList, - String? operationID, - }) => - _channel.invokeMethod( - 'markC2CMessageAsRead', - _buildParam({ - "messageIDList": messageIDList, - "userID": userID, - "operationID": Utils.checkOperationID(operationID), - })); - - /// 标记群聊消息已读 - /// [groupID] 群id - /// [messageIDList] 消息clientMsgID集合 - Future markGroupMessageAsRead({ - required String groupID, - required List messageIDList, - String? operationID, - }) => - _channel.invokeMethod( - 'markGroupMessageAsRead', - _buildParam({ - "messageIDList": messageIDList, - "groupID": groupID, - "operationID": Utils.checkOperationID(operationID), - })); /// 正在输入提示 /// [msgTip] 自定义内容 @@ -489,14 +455,22 @@ class MessageManager { /// 创建卡片消息 /// [data] 自定义数据 Future createCardMessage({ - required Map data, + required String userID, + required String nickname, + String? faceURL, + String? ex, String? operationID, }) => _channel .invokeMethod( 'createCardMessage', _buildParam({ - 'cardMessage': data, + 'cardMessage': { + 'userID': userID, + 'nickname': nickname, + 'faceURL': faceURL, + 'ex': ex, + }, "operationID": Utils.checkOperationID(operationID), })) .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); @@ -519,32 +493,6 @@ class MessageManager { })) .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); - /// 清空单聊消息记录 - /// [uid] 单聊对象id - Future clearC2CHistoryMessage({ - required String uid, - String? operationID, - }) => - _channel.invokeMethod( - 'clearC2CHistoryMessage', - _buildParam({ - "userID": uid, - "operationID": Utils.checkOperationID(operationID), - })); - - /// 清空组消息记录 - /// [gid] 组id - Future clearGroupHistoryMessage({ - required String gid, - String? operationID, - }) => - _channel.invokeMethod( - 'clearGroupHistoryMessage', - _buildParam({ - "groupID": gid, - "operationID": Utils.checkOperationID(operationID), - })); - /// 搜索消息 /// [conversationID] 根据会话查询,如果是全局搜索传null /// [keywordList] 搜索关键词列表,目前仅支持一个关键词搜索 @@ -587,143 +535,77 @@ class MessageManager { .then((value) => Utils.toObj(value, (map) => SearchResult.fromJson(map))); - /// 删除本地跟服务器的指定的消息 - /// [message] 被删除的消息 - Future deleteMessageFromLocalAndSvr({ - required Message message, - String? operationID, - }) => - _channel.invokeMethod( - 'deleteMessageFromLocalAndSvr', - _buildParam(message.toJson() - ..addAll({ - "operationID": Utils.checkOperationID(operationID), - }))); - - /// 删除本地所有聊天记录 - Future deleteAllMsgFromLocal({ - String? operationID, - }) => - _channel.invokeMethod( - 'deleteAllMsgFromLocal', - _buildParam({ - "operationID": Utils.checkOperationID(operationID), - })); - - /// 删除本地跟服务器所有聊天记录 - Future deleteAllMsgFromLocalAndSvr({ + /// 撤回消息 + /// [message] 被撤回的消息体 + Future revokeMessage({ + required String conversationID, + required String clientMsgID, String? operationID, }) => _channel.invokeMethod( - 'deleteAllMsgFromLocalAndSvr', + 'revokeMessage', _buildParam({ + 'conversationID': conversationID, + 'clientMsgID': clientMsgID, "operationID": Utils.checkOperationID(operationID), })); /// 标记消息已读 /// [conversationID] 会话ID /// [messageIDList] 被标记的消息clientMsgID - Future markMessageAsReadByConID({ + Future markMessagesAsReadByMsgID({ required String conversationID, required List messageIDList, String? operationID, }) => _channel.invokeMethod( - 'markMessageAsReadByConID', + 'markMessagesAsReadByMsgID', _buildParam({ - "messageIDList": messageIDList, "conversationID": conversationID, + "messageIDList": messageIDList, "operationID": Utils.checkOperationID(operationID), })); - /// 删除本地跟服务器的单聊聊天记录 - /// [uid] 聊天对象的userID - Future clearC2CHistoryMessageFromLocalAndSvr({ - required String uid, - String? operationID, - }) => - _channel.invokeMethod( - 'clearC2CHistoryMessageFromLocalAndSvr', - _buildParam({ - "userID": uid, - "operationID": Utils.checkOperationID(operationID), - })); - - /// 删除本地跟服务器的群聊天记录 - /// [gid] 组id - Future clearGroupHistoryMessageFromLocalAndSvr({ - required String gid, - String? operationID, - }) => - _channel.invokeMethod( - 'clearGroupHistoryMessageFromLocalAndSvr', - _buildParam({ - "groupID": gid, - "operationID": Utils.checkOperationID(operationID), - })); - - /// 获取聊天记录(以startMsg为节点,新收到的聊天记录),用在全局搜索定位某一条消息,然后此条消息后新增的消息 - /// [userID] 接收消息的用户id + /// 获取聊天记录(以startMsg为节点,以前的聊天记录) /// [conversationID] 会话id,查询通知时可用 - /// [groupID] 接收消息的组id - /// [startMsg] 从这条消息开始查询[count]条,获取的列表index==length-1为最新消息,所以获取下一页历史记录startMsg=list.last + /// [startMsg] 从这条消息开始查询[count]条,获取的列表index==length-1为最新消息,所以获取下一页历史记录startMsg=list.first /// [count] 一次拉取的总数 - Future> getHistoryMessageListReverse({ - String? userID, - String? groupID, + /// [lastMinSeq] 第一页消息不用传,获取第二页开始必传 跟[startMsg]一样 + Future getAdvancedHistoryMessageList({ String? conversationID, Message? startMsg, + int? lastMinSeq, int? count, String? operationID, }) => _channel .invokeMethod( - 'getHistoryMessageListReverse', + 'getAdvancedHistoryMessageList', _buildParam({ - 'userID': userID ?? '', - 'groupID': groupID ?? '', 'conversationID': conversationID ?? '', 'startClientMsgID': startMsg?.clientMsgID ?? '', - 'count': count ?? 10, + 'count': count ?? 40, + 'lastMinSeq': lastMinSeq ?? 0, 'operationID': Utils.checkOperationID(operationID), })) - .then((value) => Utils.toList(value, (map) => Message.fromJson(map))); - - /// 撤回消息 - /// [message] 被撤回的消息体 - Future revokeMessageV2({ - required Message message, - String? operationID, - }) => - _channel.invokeMethod( - 'newRevokeMessage', - _buildParam(message.toJson() - ..addAll({ - "operationID": Utils.checkOperationID(operationID), - }))); + .then((value) => + Utils.toObj(value, (map) => AdvancedMessage.fromJson(map))); - /// 获取聊天记录(以startMsg为节点,以前的聊天记录) - /// [userID] 接收消息的用户id + /// 获取聊天记录(以startMsg为节点,新收到的聊天记录),用在全局搜索定位某一条消息,然后此条消息后新增的消息 /// [conversationID] 会话id,查询通知时可用 - /// [groupID] 接收消息的组id - /// [startMsg] 从这条消息开始查询[count]条,获取的列表index==length-1为最新消息,所以获取下一页历史记录startMsg=list.first + /// [startMsg] 从这条消息开始查询[count]条,获取的列表index==length-1为最新消息,所以获取下一页历史记录startMsg=list.last /// [count] 一次拉取的总数 - /// [lastMinSeq] 第一页消息不用传,获取第二页开始必传 跟[startMsg]一样 - Future getAdvancedHistoryMessageList({ - String? userID, - String? groupID, + Future getAdvancedHistoryMessageListReverse({ String? conversationID, - int? lastMinSeq, Message? startMsg, + int? lastMinSeq, int? count, String? operationID, }) => _channel .invokeMethod( - 'getAdvancedHistoryMessageList', + 'getAdvancedHistoryMessageListReverse', _buildParam({ - 'userID': userID ?? '', - 'groupID': groupID ?? '', 'conversationID': conversationID ?? '', 'startClientMsgID': startMsg?.clientMsgID ?? '', 'count': count ?? 40, @@ -876,7 +758,7 @@ class MessageManager { })) .then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); - /// 用户资料改变监听 + /// Future setCustomBusinessListener(OnCustomBusinessListener listener) { this.customBusinessListener = listener; return _channel.invokeMethod('setCustomBusinessListener', _buildParam({})); diff --git a/lib/src/manager/im_organization_manager.dart b/lib/src/manager/im_organization_manager.dart index 7a3b655..7e91297 100644 --- a/lib/src/manager/im_organization_manager.dart +++ b/lib/src/manager/im_organization_manager.dart @@ -1,162 +1,162 @@ -import 'package:flutter/services.dart'; -import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; - -class OrganizationManager { - MethodChannel _channel; - late OnOrganizationListener listener; - - OrganizationManager(this._channel); - - /// 组织架构发生变化回调 - Future setOrganizationListener(OnOrganizationListener listener) { - this.listener = listener; - return _channel.invokeMethod('setOrganizationListener', _buildParam({})); - } - - /// 获取子部门列表,返回当前部门下的一级子部门 - /// [departmentID] 当前部门id - /// [offset] 开始下标 - /// [count] 每页大小 - Future> getSubDept({ - required String departmentID, - int offset = 0, - int count = 40, - String? operationID, - }) => - _channel - .invokeMethod( - 'getSubDepartment', - _buildParam({ - 'departmentID': departmentID, - 'offset': offset, - 'count': count, - 'operationID': Utils.checkOperationID(operationID), - })) - .then((value) => Utils.toList(value, (v) => DeptInfo.fromJson(v))); - - /// 获取部门下的成员列表,返回当前部门下的一级成员 - /// [departmentID] 当前部门id - /// [offset] 开始下标 - /// [count] 每页大小 - Future> getDeptMember({ - required String departmentID, - int offset = 0, - int count = 40, - String? operationID, - }) => - _channel - .invokeMethod( - 'getDepartmentMember', - _buildParam({ - 'departmentID': departmentID, - 'offset': offset, - 'count': count, - 'operationID': Utils.checkOperationID(operationID), - })) - .then((value) => - Utils.toList(value, (v) => DeptMemberInfo.fromJson(v))); - - /// 获取成员所在的部门 - /// [userID] 成员ID - Future> getUserInDept({ - required String userID, - String? operationID, - }) => - _channel - .invokeMethod( - 'getUserInDepartment', - _buildParam({ - 'userID': userID, - 'operationID': Utils.checkOperationID(operationID), - })) - .then((value) => Utils.toList(value, (v) => UserInDept.fromJson(v))); - - /// 获取部门下的子部门跟员工 - /// [departmentID] 当前部门id - Future getDeptMemberAndSubDept({ - required String departmentID, - // int departmentOffset = 0, - // int departmentCount = 40, - // int memberOffset = 0, - // int memberCount = 40, - String? operationID, - }) => - _channel - .invokeMethod( - 'getDepartmentMemberAndSubDepartment', - _buildParam({ - 'departmentID': departmentID, - // 'departmentOffset': departmentOffset, - // 'departmentCount': departmentCount, - // 'memberOffset': memberOffset, - // 'memberCount': memberCount, - 'operationID': Utils.checkOperationID(operationID), - })) - .then((value) => - Utils.toObj(value, (v) => DeptMemberAndSubDept.fromJson(v))); - - /// 查询部门信息 - /// [departmentID] 部门ID - Future getDeptInfo({ - required String departmentID, - String? operationID, - }) => - _channel - .invokeMethod( - 'getDepartmentInfo', - _buildParam({ - 'departmentID': departmentID, - 'operationID': Utils.checkOperationID(operationID), - })) - .then((value) => Utils.toObj(value, (v) => DeptInfo.fromJson(v))); - - /// 搜索组织人员 - /// [keyWord] 关键字 - /// [isSearchUserName] 是否匹配用户名 - /// [isSearchEnglishName] 是否匹配英文名 - /// [isSearchPosition] 是否匹配职位 - /// [isSearchUserID] 是否匹配用户ID - /// [isSearchMobile] 是否匹配手机号 - /// [isSearchEmail] 是否匹配邮箱号 - /// [isSearchTelephone] 是否匹配电话号码 - /// [offset] 开始下标 - /// [count] 分页大小 - Future searchOrganization({ - required String keyWord, - bool isSearchUserName = false, - bool isSearchEnglishName = false, - bool isSearchPosition = false, - bool isSearchUserID = false, - bool isSearchMobile = false, - bool isSearchEmail = false, - bool isSearchTelephone = false, - int offset = 0, - int count = 40, - String? operationID, - }) => - _channel - .invokeMethod( - 'searchOrganization', - _buildParam({ - 'searchParam': { - 'keyWord': keyWord, - 'isSearchUserName': isSearchUserName, - 'isSearchEnglishName': isSearchEnglishName, - 'isSearchPosition': isSearchPosition, - 'isSearchUserID': isSearchUserID, - 'isSearchMobile': isSearchMobile, - 'isSearchEmail': isSearchEmail, - 'isSearchTelephone': isSearchTelephone, - }, - 'offset': offset, - 'count': count, - 'operationID': Utils.checkOperationID(operationID), - })) - .then((value) => - Utils.toObj(value, (v) => OrganizationSearchResult.fromJson(v))); - - static Map _buildParam(Map param) { - param["ManagerName"] = "organizationManager"; - return param; - } -} +// import 'package:flutter/services.dart'; +// import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; +// +// class OrganizationManager { +// MethodChannel _channel; +// late OnOrganizationListener listener; +// +// OrganizationManager(this._channel); +// +// /// 组织架构发生变化回调 +// Future setOrganizationListener(OnOrganizationListener listener) { +// this.listener = listener; +// return _channel.invokeMethod('setOrganizationListener', _buildParam({})); +// } +// +// /// 获取子部门列表,返回当前部门下的一级子部门 +// /// [departmentID] 当前部门id +// /// [offset] 开始下标 +// /// [count] 每页大小 +// Future> getSubDept({ +// required String departmentID, +// int offset = 0, +// int count = 40, +// String? operationID, +// }) => +// _channel +// .invokeMethod( +// 'getSubDepartment', +// _buildParam({ +// 'departmentID': departmentID, +// 'offset': offset, +// 'count': count, +// 'operationID': Utils.checkOperationID(operationID), +// })) +// .then((value) => Utils.toList(value, (v) => DeptInfo.fromJson(v))); +// +// /// 获取部门下的成员列表,返回当前部门下的一级成员 +// /// [departmentID] 当前部门id +// /// [offset] 开始下标 +// /// [count] 每页大小 +// Future> getDeptMember({ +// required String departmentID, +// int offset = 0, +// int count = 40, +// String? operationID, +// }) => +// _channel +// .invokeMethod( +// 'getDepartmentMember', +// _buildParam({ +// 'departmentID': departmentID, +// 'offset': offset, +// 'count': count, +// 'operationID': Utils.checkOperationID(operationID), +// })) +// .then((value) => +// Utils.toList(value, (v) => DeptMemberInfo.fromJson(v))); +// +// /// 获取成员所在的部门 +// /// [userID] 成员ID +// Future> getUserInDept({ +// required String userID, +// String? operationID, +// }) => +// _channel +// .invokeMethod( +// 'getUserInDepartment', +// _buildParam({ +// 'userID': userID, +// 'operationID': Utils.checkOperationID(operationID), +// })) +// .then((value) => Utils.toList(value, (v) => UserInDept.fromJson(v))); +// +// /// 获取部门下的子部门跟员工 +// /// [departmentID] 当前部门id +// Future getDeptMemberAndSubDept({ +// required String departmentID, +// // int departmentOffset = 0, +// // int departmentCount = 40, +// // int memberOffset = 0, +// // int memberCount = 40, +// String? operationID, +// }) => +// _channel +// .invokeMethod( +// 'getDepartmentMemberAndSubDepartment', +// _buildParam({ +// 'departmentID': departmentID, +// // 'departmentOffset': departmentOffset, +// // 'departmentCount': departmentCount, +// // 'memberOffset': memberOffset, +// // 'memberCount': memberCount, +// 'operationID': Utils.checkOperationID(operationID), +// })) +// .then((value) => +// Utils.toObj(value, (v) => DeptMemberAndSubDept.fromJson(v))); +// +// /// 查询部门信息 +// /// [departmentID] 部门ID +// Future getDeptInfo({ +// required String departmentID, +// String? operationID, +// }) => +// _channel +// .invokeMethod( +// 'getDepartmentInfo', +// _buildParam({ +// 'departmentID': departmentID, +// 'operationID': Utils.checkOperationID(operationID), +// })) +// .then((value) => Utils.toObj(value, (v) => DeptInfo.fromJson(v))); +// +// /// 搜索组织人员 +// /// [keyWord] 关键字 +// /// [isSearchUserName] 是否匹配用户名 +// /// [isSearchEnglishName] 是否匹配英文名 +// /// [isSearchPosition] 是否匹配职位 +// /// [isSearchUserID] 是否匹配用户ID +// /// [isSearchMobile] 是否匹配手机号 +// /// [isSearchEmail] 是否匹配邮箱号 +// /// [isSearchTelephone] 是否匹配电话号码 +// /// [offset] 开始下标 +// /// [count] 分页大小 +// Future searchOrganization({ +// required String keyWord, +// bool isSearchUserName = false, +// bool isSearchEnglishName = false, +// bool isSearchPosition = false, +// bool isSearchUserID = false, +// bool isSearchMobile = false, +// bool isSearchEmail = false, +// bool isSearchTelephone = false, +// int offset = 0, +// int count = 40, +// String? operationID, +// }) => +// _channel +// .invokeMethod( +// 'searchOrganization', +// _buildParam({ +// 'searchParam': { +// 'keyWord': keyWord, +// 'isSearchUserName': isSearchUserName, +// 'isSearchEnglishName': isSearchEnglishName, +// 'isSearchPosition': isSearchPosition, +// 'isSearchUserID': isSearchUserID, +// 'isSearchMobile': isSearchMobile, +// 'isSearchEmail': isSearchEmail, +// 'isSearchTelephone': isSearchTelephone, +// }, +// 'offset': offset, +// 'count': count, +// 'operationID': Utils.checkOperationID(operationID), +// })) +// .then((value) => +// Utils.toObj(value, (v) => OrganizationSearchResult.fromJson(v))); +// +// static Map _buildParam(Map param) { +// param["ManagerName"] = "organizationManager"; +// return param; +// } +// } diff --git a/lib/src/manager/im_user_manager.dart b/lib/src/manager/im_user_manager.dart index 99aa744..3dc3dad 100644 --- a/lib/src/manager/im_user_manager.dart +++ b/lib/src/manager/im_user_manager.dart @@ -14,16 +14,16 @@ class UserManager { } /// 获取用户资料 - /// [uidList] 用户ID列表 + /// [userIDList] 用户ID列表 Future> getUsersInfo({ - required List uidList, + required List userIDList, String? operationID, }) => _channel .invokeMethod( 'getUsersInfo', _buildParam({ - 'uidList': uidList, + 'userIDList': userIDList, 'operationID': Utils.checkOperationID(operationID), })) .then((value) => Utils.toList(value, (v) => UserInfo.fromJson(v))); diff --git a/lib/src/manager/im_workmoments_manager.dart b/lib/src/manager/im_workmoments_manager.dart index 08c1134..699f8aa 100644 --- a/lib/src/manager/im_workmoments_manager.dart +++ b/lib/src/manager/im_workmoments_manager.dart @@ -1,61 +1,61 @@ -import 'package:flutter/services.dart'; -import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; - -class WorkMomentsManager { - MethodChannel _channel; - late OnWorkMomentsListener listener; - - WorkMomentsManager(this._channel); - - /// 朋友圈信息发送变化通知 - Future setWorkMomentsListener(OnWorkMomentsListener listener) { - this.listener = listener; - return _channel.invokeMethod('setWorkMomentsListener', _buildParam({})); - } - - /// 获取朋友圈未读消息总数 - Future getWorkMomentsUnReadCount({ - String? operationID, - }) => - _channel - .invokeMethod( - 'getWorkMomentsUnReadCount', - _buildParam({ - 'operationID': Utils.checkOperationID(operationID), - })) - .then((value) => Utils.toObj(value, (map) => map['unreadCount'])); - - /// 获取通知列表 - /// [offset] 开始下标 - /// [count] 每页大小 - Future> getWorkMomentsNotification({ - required int offset, - required int count, - String? operationID, - }) => - _channel - .invokeMethod( - 'getWorkMomentsNotification', - _buildParam({ - 'offset': offset, - 'count': count, - 'operationID': Utils.checkOperationID(operationID), - })) - .then((value) => - Utils.toList(value, (map) => WorkMomentsInfo.fromJson(map))); - - /// 清除通知列表 - Future clearWorkMomentsNotification({ - String? operationID, - }) => - _channel.invokeMethod( - 'clearWorkMomentsNotification', - _buildParam({ - 'operationID': Utils.checkOperationID(operationID), - })); - - static Map _buildParam(Map param) { - param["ManagerName"] = "workMomentsManager"; - return param; - } -} +// import 'package:flutter/services.dart'; +// import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; +// +// class WorkMomentsManager { +// MethodChannel _channel; +// late OnWorkMomentsListener listener; +// +// WorkMomentsManager(this._channel); +// +// /// 朋友圈信息发送变化通知 +// Future setWorkMomentsListener(OnWorkMomentsListener listener) { +// this.listener = listener; +// return _channel.invokeMethod('setWorkMomentsListener', _buildParam({})); +// } +// +// /// 获取朋友圈未读消息总数 +// Future getWorkMomentsUnReadCount({ +// String? operationID, +// }) => +// _channel +// .invokeMethod( +// 'getWorkMomentsUnReadCount', +// _buildParam({ +// 'operationID': Utils.checkOperationID(operationID), +// })) +// .then((value) => Utils.toObj(value, (map) => map['unreadCount'])); +// +// /// 获取通知列表 +// /// [offset] 开始下标 +// /// [count] 每页大小 +// Future> getWorkMomentsNotification({ +// required int offset, +// required int count, +// String? operationID, +// }) => +// _channel +// .invokeMethod( +// 'getWorkMomentsNotification', +// _buildParam({ +// 'offset': offset, +// 'count': count, +// 'operationID': Utils.checkOperationID(operationID), +// })) +// .then((value) => +// Utils.toList(value, (map) => WorkMomentsInfo.fromJson(map))); +// +// /// 清除通知列表 +// Future clearWorkMomentsNotification({ +// String? operationID, +// }) => +// _channel.invokeMethod( +// 'clearWorkMomentsNotification', +// _buildParam({ +// 'operationID': Utils.checkOperationID(operationID), +// })); +// +// static Map _buildParam(Map param) { +// param["ManagerName"] = "workMomentsManager"; +// return param; +// } +// } diff --git a/lib/src/models/message.dart b/lib/src/models/message.dart index a110b76..b37b253 100644 --- a/lib/src/models/message.dart +++ b/lib/src/models/message.dart @@ -43,7 +43,7 @@ class Message { String? groupID; /// 消息内容 - String? content; + // String? content; /// 消息的seq int? seq; @@ -57,6 +57,10 @@ class Message { /// 消息发送状态[MessageStatus] int? status; + bool? isReact; + + bool? isExternalExtensions; + /// 离线显示内容 OfflinePushInfo? offlinePush; @@ -67,7 +71,7 @@ class Message { String? ex; /// 自定义扩展信息,目前用于客服端处理消息时间分段 - dynamic ext; + Map exMap = {}; /// 图片 PictureElem? pictureElem; @@ -82,7 +86,7 @@ class Message { FileElem? fileElem; /// @信息 - AtElem? atElem; + AtTextElem? atTextElem; /// 位置 LocationElem? locationElem; @@ -105,9 +109,17 @@ class Message { /// 附加信息 AttachedInfoElem? attachedInfoElem; - bool? isReact; + /// 文本内容 + TextElem? textElem; + + /// 个人名片 + CardElem? cardElem; - bool? isExternal; + /// + AdvancedTextElem? advancedTextElem; + + /// + TypingElem? typingElem; Message({ this.clientMsgID, @@ -123,7 +135,7 @@ class Message { this.senderNickname, this.senderFaceUrl, this.groupID, - this.content, + // this.content, this.seq, this.isRead, this.hasReadTime, @@ -131,12 +143,12 @@ class Message { this.offlinePush, this.attachedInfo, this.ex, - this.ext, + this.exMap = const {}, this.pictureElem, this.soundElem, this.videoElem, this.fileElem, - this.atElem, + this.atTextElem, this.locationElem, this.customElem, this.quoteElem, @@ -144,8 +156,12 @@ class Message { this.notificationElem, this.faceElem, this.attachedInfoElem, - this.isExternal, + this.isExternalExtensions, this.isReact, + this.textElem, + this.cardElem, + this.advancedTextElem, + this.typingElem, }); Message.fromJson(Map json) { @@ -161,7 +177,7 @@ class Message { senderNickname = json['senderNickname']; senderFaceUrl = json['senderFaceUrl']; groupID = json['groupID']; - content = json['content']; + // content = json['content']; seq = json['seq']; isRead = json['isRead']; status = json['status']; @@ -170,7 +186,7 @@ class Message { : null; attachedInfo = json['attachedInfo']; ex = json['ex']; - ext = json['ext']; + exMap = json['exMap'] ?? {}; sessionType = json['sessionType']; pictureElem = json['pictureElem'] != null ? PictureElem.fromJson(json['pictureElem']) @@ -183,7 +199,9 @@ class Message { : null; fileElem = json['fileElem'] != null ? FileElem.fromJson(json['fileElem']) : null; - atElem = json['atElem'] != null ? AtElem.fromJson(json['atElem']) : null; + atTextElem = json['atTextElem'] != null + ? AtTextElem.fromJson(json['atTextElem']) + : null; locationElem = json['locationElem'] != null ? LocationElem.fromJson(json['locationElem']) : null; @@ -206,8 +224,18 @@ class Message { ? AttachedInfoElem.fromJson(json['attachedInfoElem']) : null; hasReadTime = json['hasReadTime'] ?? attachedInfoElem?.hasReadTime; - isExternal = json['isExternal']; + isExternalExtensions = json['isExternalExtensions']; isReact = json['isReact']; + textElem = + json['textElem'] != null ? TextElem.fromJson(json['textElem']) : null; + cardElem = + json['cardElem'] != null ? CardElem.fromJson(json['cardElem']) : null; + advancedTextElem = json['advancedTextElem'] != null + ? AdvancedTextElem.fromJson(json['advancedTextElem']) + : null; + typingElem = json['typingElem'] != null + ? TypingElem.fromJson(json['typingElem']) + : null; } Map toJson() { @@ -224,7 +252,7 @@ class Message { data['senderNickname'] = this.senderNickname; data['senderFaceUrl'] = this.senderFaceUrl; data['groupID'] = this.groupID; - data['content'] = this.content; + // data['content'] = this.content; data['seq'] = this.seq; data['isRead'] = this.isRead; data['hasReadTime'] = this.hasReadTime; @@ -232,13 +260,13 @@ class Message { data['offlinePush'] = this.offlinePush?.toJson(); data['attachedInfo'] = this.attachedInfo; data['ex'] = this.ex; - data['ext'] = this.ext; + data['exMap'] = this.exMap; data['sessionType'] = this.sessionType; data['pictureElem'] = this.pictureElem?.toJson(); data['soundElem'] = this.soundElem?.toJson(); data['videoElem'] = this.videoElem?.toJson(); data['fileElem'] = this.fileElem?.toJson(); - data['atElem'] = this.atElem?.toJson(); + data['atTextElem'] = this.atTextElem?.toJson(); data['locationElem'] = this.locationElem?.toJson(); data['customElem'] = this.customElem?.toJson(); data['quoteElem'] = this.quoteElem?.toJson(); @@ -246,8 +274,12 @@ class Message { data['notificationElem'] = this.notificationElem?.toJson(); data['faceElem'] = this.faceElem?.toJson(); data['attachedInfoElem'] = this.attachedInfoElem?.toJson(); - data['isExternal'] = this.isExternal; + data['isExternalExtensions'] = this.isExternalExtensions; data['isReact'] = this.isReact; + data['textElem'] = this.textElem?.toJson(); + data['cardElem'] = this.cardElem?.toJson(); + data['advancedTextElem'] = this.advancedTextElem?.toJson(); + data['typingElem'] = this.typingElem?.toJson(); return data; } @@ -274,7 +306,7 @@ class Message { senderNickname = message.senderNickname; senderFaceUrl = message.senderFaceUrl; groupID = message.groupID; - content = message.content; + // content = message.content; seq = message.seq; isRead = message.isRead; hasReadTime = message.hasReadTime; @@ -282,13 +314,13 @@ class Message { offlinePush = message.offlinePush; attachedInfo = message.attachedInfo; ex = message.ex; - ext = message.ext; + exMap = message.exMap; sessionType = message.sessionType; pictureElem = message.pictureElem; soundElem = message.soundElem; videoElem = message.videoElem; fileElem = message.fileElem; - atElem = message.atElem; + atTextElem = message.atTextElem; locationElem = message.locationElem; customElem = message.customElem; quoteElem = message.quoteElem; @@ -296,6 +328,10 @@ class Message { notificationElem = message.notificationElem; faceElem = message.faceElem; attachedInfoElem = message.attachedInfoElem; + textElem = message.textElem; + cardElem = message.cardElem; + advancedTextElem = message.advancedTextElem; + typingElem = message.typingElem; } /// 单聊消息 @@ -568,7 +604,7 @@ class FileElem { } /// @消息内容 -class AtElem { +class AtTextElem { /// 消息内容 String? text; @@ -584,7 +620,7 @@ class AtElem { /// 被回复的消息体,回复别人并@了人 Message? quoteMessage; - AtElem({ + AtTextElem({ this.text, this.atUserList, this.isAtSelf, @@ -592,7 +628,7 @@ class AtElem { this.quoteMessage, }); - AtElem.fromJson(Map json) { + AtTextElem.fromJson(Map json) { text = json['text']; if (json['atUserList'] is List) { atUserList = (json['atUserList'] as List).map((e) => '$e').toList(); @@ -836,6 +872,115 @@ class AttachedInfoElem { } } +class TextElem { + String? content; + + TextElem({this.content}); + + TextElem.fromJson(Map json) { + content = json['content']; + } + + Map toJson() { + final data = Map(); + data['content'] = content; + return data; + } +} + +class CardElem { + String? userID; + String? nickname; + String? faceURL; + String? ex; + + CardElem({this.userID, this.nickname, this.faceURL, this.ex}); + + CardElem.fromJson(Map json) { + userID = json['userID']; + nickname = json['nickname']; + faceURL = json['faceURL']; + ex = json['ex']; + } + + Map toJson() { + final data = Map(); + data['userID'] = userID; + data['nickname'] = nickname; + data['faceURL'] = faceURL; + data['ex'] = ex; + return data; + } +} + +class TypingElem { + String? msgTips; + + TypingElem({this.msgTips}); + + TypingElem.fromJson(Map json) { + msgTips = json['msgTips']; + } + + Map toJson() { + final data = Map(); + data['msgTips'] = msgTips; + return data; + } +} + +class AdvancedTextElem { + String? text; + List? messageEntityList; + + AdvancedTextElem({this.text, this.messageEntityList}); + + AdvancedTextElem.fromJson(Map json) { + text = json['text']; + messageEntityList = json['messageEntityList'] == null + ? null + : (json['messageEntityList'] as List) + .map((e) => MessageEntity.fromJson(e)) + .toList(); + } + + Map toJson() { + final data = Map(); + data['text'] = text; + data['messageEntityList'] = + messageEntityList?.map((e) => e.toJson()).toList(); + return data; + } +} + +class MessageEntity { + String? type; + int? offset; + int? length; + String? url; + String? ex; + + MessageEntity({this.type, this.offset, this.length, this.url, this.ex}); + + MessageEntity.fromJson(Map json) { + type = json['type']; + offset = json['offset']; + length = json['length']; + url = json['url']; + ex = json['ex']; + } + + Map toJson() { + final data = Map(); + data['type'] = type; + data['offset'] = offset; + data['length'] = length; + data['url'] = url; + data['ex'] = ex; + return data; + } +} + /// 群消息已读信息 class GroupHasReadInfo { /// 已读的用户id列表 diff --git a/lib/src/models/user_info.dart b/lib/src/models/user_info.dart index b6359f4..8817a8a 100644 --- a/lib/src/models/user_info.dart +++ b/lib/src/models/user_info.dart @@ -20,11 +20,8 @@ class UserInfo { /// 手机号 String? phoneNumber; - /// 使用[birthTime] - int? birth; - /// 出生时间 - String? birthTime; + int? birth; /// 邮箱 String? email; @@ -38,21 +35,6 @@ class UserInfo { /// 备注 String? remark; - /// 用户公开的资料 - PublicUserInfo? publicInfo; - - /// 好友才能查看的资料 - FriendInfo? friendInfo; - - /// 黑名单资料 - BlacklistInfo? blackInfo; - - /// 是否好友关系 - bool? isFriendship; - - /// 是否黑名单 - bool? isBlacklist; - /// 全局免打扰 0:正常;1:不接受消息;2:接受在线消息不接受离线消息; int? globalRecvMsgOpt; @@ -68,6 +50,21 @@ class UserInfo { /// 禁止登录 int? forbidden; + /// 用户公开的资料 + PublicUserInfo? publicInfo; + + /// 好友才能查看的资料 + FriendInfo? friendInfo; + + /// 黑名单资料 + BlacklistInfo? blackInfo; + + /// 是否好友关系 + bool? isFriendship; + + /// 是否黑名单 + bool? isBlacklist; + UserInfo({ this.publicInfo, this.friendInfo, @@ -80,7 +77,6 @@ class UserInfo { this.faceURL, this.phoneNumber, this.birth, - this.birthTime, this.gender, this.email, this.ex, @@ -125,7 +121,6 @@ class UserInfo { gender = json['gender'] ?? _gender; phoneNumber = json['phoneNumber'] ?? _phoneNumber; birth = json['birth'] ?? _birth; - birthTime = json['birthTime'] ?? _birthTime; email = json['email'] ?? _email; remark = json['remark'] ?? _remark; ex = json['ex'] ?? _ex; @@ -151,7 +146,6 @@ class UserInfo { data['gender'] = this.gender; data['phoneNumber'] = this.phoneNumber; data['birth'] = this.birth; - data['birthTime'] = this.birthTime; data['email'] = this.email; data['ex'] = this.ex; data['createTime'] = this.createTime; diff --git a/lib/src/models/workmoments_info.dart b/lib/src/models/workmoments_info.dart index bc4698b..6def4df 100644 --- a/lib/src/models/workmoments_info.dart +++ b/lib/src/models/workmoments_info.dart @@ -1,56 +1,56 @@ -class WorkMomentsInfo { - int? notificationMsgType; - String? replyUserName; - String? replyUserID; - String? content; - String? contentID; - String? workMomentID; - String? userID; - String? userName; - String? faceURL; - String? workMomentContent; - int? createTime; - - WorkMomentsInfo( - {this.notificationMsgType, - this.replyUserName, - this.replyUserID, - this.content, - this.contentID, - this.workMomentID, - this.userID, - this.userName, - this.faceURL, - this.workMomentContent, - this.createTime}); - - WorkMomentsInfo.fromJson(Map json) { - notificationMsgType = json['notificationMsgType']; - replyUserName = json['replyUserName']; - replyUserID = json['replyUserID']; - content = json['content']; - contentID = json['contentID']; - workMomentID = json['workMomentID']; - userID = json['userID']; - userName = json['userName']; - faceURL = json['faceURL']; - workMomentContent = json['workMomentContent']; - createTime = json['createTime']; - } - - Map toJson() { - final Map data = new Map(); - data['notificationMsgType'] = this.notificationMsgType; - data['replyUserName'] = this.replyUserName; - data['replyUserID'] = this.replyUserID; - data['content'] = this.content; - data['contentID'] = this.contentID; - data['workMomentID'] = this.workMomentID; - data['userID'] = this.userID; - data['userName'] = this.userName; - data['faceURL'] = this.faceURL; - data['workMomentContent'] = this.workMomentContent; - data['createTime'] = this.createTime; - return data; - } -} +// class WorkMomentsInfo { +// int? notificationMsgType; +// String? replyUserName; +// String? replyUserID; +// String? content; +// String? contentID; +// String? workMomentID; +// String? userID; +// String? userName; +// String? faceURL; +// String? workMomentContent; +// int? createTime; +// +// WorkMomentsInfo( +// {this.notificationMsgType, +// this.replyUserName, +// this.replyUserID, +// this.content, +// this.contentID, +// this.workMomentID, +// this.userID, +// this.userName, +// this.faceURL, +// this.workMomentContent, +// this.createTime}); +// +// WorkMomentsInfo.fromJson(Map json) { +// notificationMsgType = json['notificationMsgType']; +// replyUserName = json['replyUserName']; +// replyUserID = json['replyUserID']; +// content = json['content']; +// contentID = json['contentID']; +// workMomentID = json['workMomentID']; +// userID = json['userID']; +// userName = json['userName']; +// faceURL = json['faceURL']; +// workMomentContent = json['workMomentContent']; +// createTime = json['createTime']; +// } +// +// Map toJson() { +// final Map data = new Map(); +// data['notificationMsgType'] = this.notificationMsgType; +// data['replyUserName'] = this.replyUserName; +// data['replyUserID'] = this.replyUserID; +// data['content'] = this.content; +// data['contentID'] = this.contentID; +// data['workMomentID'] = this.workMomentID; +// data['userID'] = this.userID; +// data['userName'] = this.userName; +// data['faceURL'] = this.faceURL; +// data['workMomentContent'] = this.workMomentContent; +// data['createTime'] = this.createTime; +// return data; +// } +// }