Compare commits

...

85 Commits

Author SHA1 Message Date
std-s
87360c5f69 [Update] aar & framework. 2023-07-25 16:59:21 +08:00
std-s
a4e7ae13ee [Update] aar. 2023-07-24 11:24:02 +08:00
std-s
2da3a5e557 [Fix] Adjust the monitoring function parameters for uploading files. 2023-07-24 11:23:46 +08:00
hrxiang
cfc94c06da 3.0-enterprise 2023-07-13 18:28:02 +08:00
hrxiang
3527c80e7b enterprise 3.0 2023-07-13 17:21:44 +08:00
hrxiang
cdb994d5e3 enterprise 3.0 2023-07-13 16:13:23 +08:00
hrxiang
e12799da0b putFile -> uploadFile 2023-07-12 20:28:15 +08:00
hrxiang
0c7124a2a5 Update error code 2023-07-12 16:35:35 +08:00
hrxiang
b1fa710117 Add regularly delete 2023-07-10 17:15:24 +08:00
hrxiang
b06dbe122e 3.0.0-enterprise
delete Organization and WorkMoments
2023-07-07 13:39:23 +08:00
hrxiang
021a262325 3.0.0-enterprise 2023-07-05 15:02:18 +08:00
hrxiang
9994a3939d 3.0.0-enterprise 2023-07-04 17:18:06 +08:00
hrxiang
c1f62d0661 3.0 enterprise 2023-07-04 15:06:22 +08:00
hrxiang
5bdb9879a7 Login to add login status judgment 2023-07-03 15:04:30 +08:00
hrxiang
79cbae718c open 3.0 2023-06-30 18:26:50 +08:00
hrxiang
61fb9b7dd9 open 3.0 2023-06-30 17:03:31 +08:00
std-s
bd364ea2fd [Update] core. 2023-06-29 20:08:39 +08:00
std-s
d43259d171 Merge branch 'open_3.0' of https://github.com/OpenIMSDK/Open-IM-SDK-Flutter into open_3.0 2023-06-29 19:56:01 +08:00
std-s
ce0c6ff832 [Update] iOS。 2023-06-29 19:55:36 +08:00
hrxiang
1f6312d9d3 open 3.0 2023-06-29 19:39:34 +08:00
hrxiang
63e5ecf896 core-sdk:3.0.0-beta01 2023-06-29 19:36:44 +08:00
hrxiang
70a46ed151 open 3.0 2023-06-29 16:48:59 +08:00
hrxiang
f04d45f6b8 3.0 2023-05-16 18:49:24 +08:00
hrxiang
80c79d0fc6 test-3.0 2023-05-16 15:08:41 +08:00
hrxiang
4d8ba65f9b 2.3.5+4 2023-05-15 18:45:46 +08:00
hrxiang
9df556b837 2.3.5+4 2023-05-08 18:55:09 +08:00
hrxiang
96d6b755cd 2.3.5+3 2023-04-24 11:11:52 +08:00
hrxiang
3af726a6f7 Fix bug 2023-03-17 18:38:43 +08:00
hrxiang
041d6656bc Fix bug 2023-03-13 11:48:38 +08:00
hrxiang
43afb8775a Fix bug 2023-03-10 15:08:33 +08:00
hrxiang
39727feb8a Fix bug 2023-03-08 15:52:16 +08:00
hrxiang
c6d1669bdd 添加aar包本地依赖方式说明 2023-03-06 18:37:39 +08:00
hrxiang
02202051e1 添加aar包本地依赖方式说明 2023-03-06 18:36:38 +08:00
hrxiang
d0a4530314 New add 2023-03-03 15:17:40 +08:00
hrxiang
958c118e84 Fix bug for signaling 2023-03-01 11:44:14 +08:00
hrxiang
cdef7ffda8 Fix bug callback 'onUserTokenExpired' 2023-02-20 16:34:38 +08:00
hrxiang
bac4bd0884 Fix bug 2023-02-20 15:29:57 +08:00
hrxiang
377b07ef05 Fix bug 2023-02-20 09:33:08 +08:00
hrxiang
025487fbf3 Fix bug 2023-02-09 14:31:25 +08:00
hrxiang
ba3767da42 Fix bug 2023-02-08 09:53:39 +08:00
hrxiang
fc6fd3dd93 Fix bug 2023-02-08 09:45:53 +08:00
hrxiang
c6d9815e64 Fix bug 2023-01-18 10:48:52 +08:00
hrxiang
8e0c736d29 Merge pull request #105 from johnzerTang/main
feat:补充conversation_info的遗漏
2023-01-16 09:35:35 +08:00
johnzer
15854a2c27 feat:补充conversation_info的遗漏 2023-01-09 16:27:48 +08:00
hrxiang
3e1ee249c9 Fix bug 2023-01-03 16:25:08 +08:00
hrxiang
29eac1bf91 Fix bug 2022-12-30 18:58:57 +08:00
skiffer-git
bea820ff27 Update README.md 2022-12-14 10:36:02 +08:00
hrxiang
a85062ce79 Fix bug 2022-12-12 10:51:20 +08:00
hrxiang
98b2774dc1 Fix bug 2022-12-09 16:45:25 +08:00
hrxiang
e823df62a8 Fix bug 2022-12-09 15:08:27 +08:00
hrxiang
2c40b626e4 Fix bug 2022-12-09 11:25:44 +08:00
hrxiang
3b5f47c9f0 V2.3.5 2022-12-08 12:05:21 +08:00
hrxiang
4c540fbff5 Update 2022-12-02 10:50:48 +08:00
hrxiang
b8a51374a3 Update 2022-11-25 17:03:50 +08:00
hrxiang
099cb9849a Merge branch 'main' of https://github.com/OpenIMSDK/Open-IM-SDK-Flutter 2022-11-16 16:46:35 +08:00
hrxiang
025334d32f Fix bug 2022-11-16 16:45:12 +08:00
hrxiang
5adc50b963 Merge pull request #102 from yohom/main
fix: 所有的设置Listener方法都调用result.success(null), 否则dart端的Future会一直挂起不返回.
2022-11-16 16:42:41 +08:00
yohom
ebbe5c882f fix: 所有的设置Listener方法都调用result.success(null), 否则dart端的Future会一直挂起不返回. 2022-11-16 16:28:48 +08:00
hrxiang
eb3361c4b3 Fix bug 2022-11-14 14:28:33 +08:00
hrxiang
9c5aa56609 Fix bug 2022-11-11 14:22:17 +08:00
hrxiang
3e03460300 Fix bug 2022-11-08 12:04:09 +08:00
hrxiang
788ab524c2 Fix bug 2022-11-08 11:22:44 +08:00
hrxiang
eed59f468c Fix bug 2022-11-07 10:32:05 +08:00
hrxiang
d758f3fca1 Fix bug 2022-10-31 10:27:54 +08:00
hrxiang
b8ee9276a2 Add some new function 2022-10-25 11:45:30 +08:00
hrxiang
a77c86e87a Fix bug 2022-10-09 13:55:47 +08:00
hrxiang
c99d1e4d67 Fix bug 2022-10-09 13:54:26 +08:00
hrxiang
b53d4dfcfd Fix bug 2022-10-08 18:53:29 +08:00
hrxiang
bb49d6b27a Core sdk upgrade to 2.3.4 2022-09-30 17:29:22 +08:00
hrxiang
2b78f83b20 Core sdk upgrade to 2.3.4 2022-09-30 17:28:30 +08:00
hrxiang
38a899d32c Core sdk upgrade to 2.3.3 2022-09-20 11:04:58 +08:00
hrxiang
0a0635bb71 2.3.2 2022-09-16 09:37:21 +08:00
xianghr
c44575ec0e Merge branch 'main' of https://github.com/OpenIMSDK/Open-IM-SDK-Flutter 2022-09-09 18:46:27 +08:00
std-s
14624c717b [Update] 2022-09-09 18:44:28 +08:00
xianghr
0900df2aa2 3.2.2 2022-09-09 18:31:06 +08:00
xianghr
cd06c3bb5a 3.2.2 2022-09-09 17:17:31 +08:00
hrxiang
a6aea5496a [Super Group]2.3.0 2022-08-24 11:46:15 +08:00
hrxiang
72111053bd [Super Group]2.3.0 2022-08-03 17:30:40 +08:00
hrxiang
18f099c437 [Super Group] 2022-07-22 12:12:55 +08:00
hrxiang
cff0a4cce2 [Super Group] 2022-07-18 10:13:04 +08:00
hrxiang
e415961d64 [Super Group] 2022-07-15 18:35:48 +08:00
hrxiang
b3aebeb318 [Super Group] 2022-07-15 18:34:21 +08:00
hrxiang
c76bfeb07a [Super Group] 2022-07-15 18:19:17 +08:00
hrxiang
a9343bf892 update 2022-07-05 10:25:59 +08:00
hrxiang
bf354c4103 update 2022-07-04 11:56:02 +08:00
117 changed files with 5129 additions and 1646 deletions

View File

@@ -15,6 +15,21 @@
<excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/flutter_openim_sdk/example/.dart_tool" /> <excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/flutter_openim_sdk/example/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/flutter_openim_sdk/example/.pub" /> <excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/flutter_openim_sdk/example/.pub" />
<excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/flutter_openim_sdk/example/build" /> <excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/flutter_openim_sdk/example/build" />
<excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/.pub" />
<excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/build" />
<excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/.pub" />
<excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/build" />
<excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/.pub" />
<excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/build" />
<excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/build" />
<excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/.pub" />
<excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/.pub" />
<excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/ios/.symlinks/plugins/flutter_openim_sdk/example/build" />
</content> </content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />

View File

@@ -20,7 +20,6 @@
<root url="file://$USER_HOME$/Development/flutter/bin/cache/dart-sdk/lib/typed_data" /> <root url="file://$USER_HOME$/Development/flutter/bin/cache/dart-sdk/lib/typed_data" />
<root url="file://$USER_HOME$/Development/flutter/bin/cache/dart-sdk/lib/web_audio" /> <root url="file://$USER_HOME$/Development/flutter/bin/cache/dart-sdk/lib/web_audio" />
<root url="file://$USER_HOME$/Development/flutter/bin/cache/dart-sdk/lib/web_gl" /> <root url="file://$USER_HOME$/Development/flutter/bin/cache/dart-sdk/lib/web_gl" />
<root url="file://$USER_HOME$/Development/flutter/bin/cache/dart-sdk/lib/web_sql" />
</CLASSES> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES /> <SOURCES />

View File

@@ -1,3 +1,147 @@
## 3.0.0
- The super update is not compatible with the previous version
## 2.3.5+4
- Fix bug
## 2.3.5+3
- Fix bug for signaling
- Add networkChanged method
- Add setListenerForService method
## 2.3.5+2
- Add onRecvMessageExtensionsAdded method for OnAdvancedMsgListener
- Add addMessageReactionExtensions method for MessageManager
- Add getMessageListSomeReactionExtensions method for MessageManager
- Add isExternal field for MessageManager
- Add isReact method field MessageManager
- Add params isExternalExtensions for initSDK
## 2.3.5+1
- Add birthTime for UserInfo
- Add setMessageKvInfoListener method for MessageManager
- Add setMessageReactionExtensions method for MessageManager
- Add deleteMessageReactionExtensions method for MessageManager
- Add getMessageListReactionExtensions method for MessageManager
- Add onRecvMessageExtensionsChanged method for OnAdvancedMsgListener
- Add onRecvMessageExtensionsDeleted method for OnAdvancedMsgListener
- Add OnMessageKvInfoListener listener
- Add class KeyValue
- Add class UserExInfo
- Add class SingleTypeKeyInfoSum
- Add class MessageKv
- Add class TypeKeySetResult
- Add class MessageTypeKeyMapping
## 2.3.5
- Add setCustomBusinessListener method for MessageManager
- Add OnCustomBusinessListener listener
- Add message encryption config
- Add message compression config
- Add setGroupMemberInfo for GroupManager
## 2.3.4+6
- Add setAppBackgroundStatus method for IMManager
## 2.3.4+5
- Fix bug
- Add setOneConversationBurnDuration method for ConversationManager
- Add signalingSendCustomSignal method for SignalingManager
- Add onReceiveCustomSignal listener for OnSignalingListener
- Add burnDuration field for ConversationInfo
- Add burnDuration field for AttachedInfoElem
## 2.3.4+4
- Fix bug
- Replace maven repository address
## 2.3.4+3
- Fix bug
## 2.3.4+2
- Add streamChangedEvent listener for OnSignalingListener
- Add signalingJoinMeeting method for SignalingManager
- Add signalingCreateMeeting method for SignalingManager
- Add signalingOperateStream method for SignalingManager
- Add signalingGetMeetings method for SignalingManager
- Add signalingCloseRoom method for SignalingManager
- Add signalingUpdateMeetingInfo method for SignalingManager
- Update findMessageList method
- Add sendMessageNotOss method for MessageManager
- Add createImageMessageByURL method for MessageManager
- Add createSoundMessageByURL method for MessageManager
- Add createVideoMessageByURL method for MessageManager
- Add createFileMessageByURL method for MessageManager
## 2.3.4+1
- Add signalingGetTokenByRoomID method for SignalingManager
## 2.3.4
- Fix bug
- Add signalGetRoomByGroupID method for SignalingManager
- Add class RoomCallingInfo
- Add onRoomParticipantConnected listener for OnSignalingListener
- Add onRoomParticipantDisconnected listener for OnSignalingListener
- Add busyLineUserIDList field for SignalingCertificate
## 2.3.3
- Fix bug
## 2.3.2
- Fix bug
- Add createAdvancedQuoteMessage method for MessageManager
- Add createAdvancedTextMessage method for MessageManager
## 2.3.0+1
- Fix bug
- enum class MessageType new add customMsgNotTriggerConversation
- enum class MessageType new add customMsgOnlineOnly
- class IMManager new add updateFcmToken method
- class MessageManager new add findMessageList method
- initSDK method add encryptionKey param
## 2.3.0
- Fix bug
- Super group
- Add setGroupLookMemberInfo method for GroupManager
- Add setGroupApplyMemberFriend method for GroupManager
- Add getGroupOwnerAndAdmin method for GroupManager
- Add revokeMessageV2 method for MessageManager
- Add lookMemberInfo field for GroupInfo
- Add applyMemberFriend field for GroupInfo
- Add notificationUpdateTime field for GroupInfo
- Add notificationUserID field for GroupInfo
- Add inviterUserID field for GroupMembersInfo
- Add joinSource field for joinGroup method
- Add advanced revoke type
- Add recvMessageRevokedV2 callback for OnAdvancedMsgListener
- Add joinSource field for GroupApplicationInfo
- Add inviterUserID field for GroupApplicationInfo
- Add getAdvancedHistoryMessageList method for MessageManager
- Add searchGroupMembers method for GroupManager
## 2.2.0
1.Fix bug </br>
## 2.1.0+1 ## 2.1.0+1
1.Add setGroupVerification method </br> 1.Add setGroupVerification method </br>
@@ -155,33 +299,42 @@ Fix bug
2. Add createFileMessageFromFullPath method 2. Add createFileMessageFromFullPath method
## 0.0.9+4 ## 0.0.9+4
Fix ios friendship params error Fix ios friendship params error
## 0.0.9+3 ## 0.0.9+3
Ios native remove method 'removeAdvancedMsgListener' Ios native remove method 'removeAdvancedMsgListener'
## 0.0.9+2 ## 0.0.9+2
1. Fix bug 1. Fix bug
2. Upgrade sdk 2. Upgrade sdk
## 0.0.9+1 ## 0.0.9+1
Fix bug Fix bug
## 0.0.9 ## 0.0.9
Add ios support Add ios support
## 0.0.8 ## 0.0.8
Upgrade sdk to 0.0.14 </br> Upgrade sdk to 0.0.14 </br>
Sending a message adds a retry mechanism Sending a message adds a retry mechanism
## 0.0.7 ## 0.0.7
1. Add a new method to obtain conversation id based on user id or group id </br> 1. Add a new method to obtain conversation id based on user id or group id </br>
2. Modify the type of conversation manager input parameter sessionType to int 2. Modify the type of conversation manager input parameter sessionType to int
## 0.0.6 ## 0.0.6
Fix bug Fix bug
## 0.0.5 ## 0.0.5
Upgrade sdk </br> Upgrade sdk </br>
Fix message error bug Fix message error bug
@@ -190,11 +343,14 @@ Fix message error bug
Replace the input parameters of the createCustomMessage method from Uint8List to Map Replace the input parameters of the createCustomMessage method from Uint8List to Map
## 0.0.3 ## 0.0.3
Upgrade sdk </br> Upgrade sdk </br>
Fix bug </br> Fix bug </br>
## 0.0.2 ## 0.0.2
1. Move the markSingleMessageHasRead, markGroupMessageHasRead and getTotalUnreadMsgCount methods from the MessageManager class to the ConversationManager class. </br>
1. Move the markSingleMessageHasRead, markGroupMessageHasRead and getTotalUnreadMsgCount methods
from the MessageManager class to the ConversationManager class. </br>
2. Modify the parameters of the setFriendInfo method. </br> 2. Modify the parameters of the setFriendInfo method. </br>
3. Modify the parameters of the createGroup and setGroupInfo methods. 3. Modify the parameters of the createGroup and setGroupInfo methods.

View File

@@ -1,4 +1,5 @@
# flutter_openim_sdk # flutter_openim_sdk
![avatar](https://github.com/OpenIMSDK/OpenIM-Docs/blob/main/docs/images/WechatIMG20.jpeg)
[![pub package](https://img.shields.io/pub/v/flutter_openim_sdk.svg)](https://pub.flutter-io.cn/packages/flutter_openim_sdk) [![pub package](https://img.shields.io/pub/v/flutter_openim_sdk.svg)](https://pub.flutter-io.cn/packages/flutter_openim_sdk)
[![Generic badge](https://img.shields.io/badge/platform-android%20|%20ios%20-blue.svg)](https://pub.dev/packages/flutter_openim_sdk) [![Generic badge](https://img.shields.io/badge/platform-android%20|%20ios%20-blue.svg)](https://pub.dev/packages/flutter_openim_sdk)
[![GitHub license](https://img.shields.io/github/license/OpenIMSDK/Open-IM-SDK-Flutter)](https://github.com/OpenIMSDK/Open-IM-SDK-Flutter/blob/main/LICENSE) [![GitHub license](https://img.shields.io/github/license/OpenIMSDK/Open-IM-SDK-Flutter)](https://github.com/OpenIMSDK/Open-IM-SDK-Flutter/blob/main/LICENSE)

View File

@@ -1,12 +1,21 @@
group 'io.openim.flutter_openim_sdk' group 'io.openim.flutter_openim_sdk'
version '1.0' version '1.0'
def dir = getCurrentProjectDir()
// 将aar放到libs本地仓库替换远程仓库
def getCurrentProjectDir() {
String result = ""
rootProject.allprojects { project ->
if (project.properties.get("name").toString() == "flutter_openim_sdk") {
result = project.properties.get("projectDir").toString()
}
}
return result
}
buildscript { buildscript {
repositories { repositories {
maven {
url 'http://121.37.25.71:8081/repository/maven2/'
allowInsecureProtocol = true
}
google() google()
mavenCentral() mavenCentral()
} }
@@ -18,10 +27,9 @@ buildscript {
rootProject.allprojects { rootProject.allprojects {
repositories { repositories {
maven { // 将aar放到libs本地仓库替换远程仓库
url 'http://121.37.25.71:8081/repository/maven2/' // maven { url "$dir/libs" }
allowInsecureProtocol = true maven { url 'https://open-im-online.rentsoft.cn:51000/repository/maven2/' }
}
google() google()
mavenCentral() mavenCentral()
} }
@@ -40,6 +48,9 @@ android {
targetCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8
} }
} }
dependencies { dependencies {
implementation 'io.openim:core-sdk:2.1.0.2@aar' // 本地依赖现将aar复制到libs/io/openim/core-sdk/0.0.1/ 下命名core-sdk-0.0.1.aar
// implementation 'io.openim:core-sdk:0.0.1@aar'
implementation 'io.openim:core-sdk:3.0.1-e+1@aar'
} }

View File

@@ -0,0 +1,9 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.openim</groupId>
<artifactId>core-sdk</artifactId>
<version>0.0.1</version>
</project>

View File

@@ -1,3 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.openim.flutter_openim_sdk"> package="io.openim.flutter_openim_sdk">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest> </manifest>

View File

@@ -1,5 +1,6 @@
package io.openim.flutter_openim_sdk; package io.openim.flutter_openim_sdk;
import android.app.Activity;
import android.content.Context; import android.content.Context;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@@ -9,30 +10,32 @@ import java.lang.reflect.Method;
import io.flutter.Log; import io.flutter.Log;
import io.flutter.embedding.engine.plugins.FlutterPlugin; import io.flutter.embedding.engine.plugins.FlutterPlugin;
import io.flutter.embedding.engine.plugins.activity.ActivityAware;
import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding;
import io.flutter.plugin.common.MethodCall; import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel; import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.MethodChannel.MethodCallHandler; import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
import io.flutter.plugin.common.MethodChannel.Result; 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.ConversationManager;
import io.openim.flutter_openim_sdk.manager.FriendshipManager; import io.openim.flutter_openim_sdk.manager.FriendshipManager;
import io.openim.flutter_openim_sdk.manager.GroupManager; import io.openim.flutter_openim_sdk.manager.GroupManager;
import io.openim.flutter_openim_sdk.manager.IMManager; import io.openim.flutter_openim_sdk.manager.IMManager;
import io.openim.flutter_openim_sdk.manager.MessageManager; 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.SignalingManager;
import io.openim.flutter_openim_sdk.manager.UserManager; import io.openim.flutter_openim_sdk.manager.UserManager;
import io.openim.flutter_openim_sdk.manager.WorkMomentsManager;
/** /**
* FlutterOpenimSdkPlugin * FlutterOpenimSdkPlugin
*/ */
public class FlutterOpenimSdkPlugin implements FlutterPlugin, MethodCallHandler { public class FlutterOpenimSdkPlugin implements FlutterPlugin, MethodCallHandler, ActivityAware {
/// The MethodChannel that will the communication between Flutter and native Android /// The MethodChannel that will the communication between Flutter and native Android
/// ///
/// This local reference serves to register the plugin with the Flutter Engine and unregister it /// This local reference serves to register the plugin with the Flutter Engine and unregister it
/// when the Flutter Engine is detached from the Activity /// when the Flutter Engine is detached from the Activity
private static final String CHANNEL_NAME = "flutter_openim_sdk";
public static MethodChannel channel; public static MethodChannel channel;
private static IMManager imManager; private static IMManager imManager;
private static UserManager userManager; private static UserManager userManager;
@@ -41,13 +44,13 @@ public class FlutterOpenimSdkPlugin implements FlutterPlugin, MethodCallHandler
private static ConversationManager conversationManager; private static ConversationManager conversationManager;
private static GroupManager groupManager; private static GroupManager groupManager;
private static SignalingManager signalingManager; private static SignalingManager signalingManager;
private static WorkMomentsManager workMomentsManager; private static Activity activity;
private static OrganizationManager organizationManager; private static Context context;
private ConnectivityListener connectivityListener;
private VisibilityListener visibilityListener;
public static boolean isInitialized;
public FlutterOpenimSdkPlugin() { public FlutterOpenimSdkPlugin() {
}
private FlutterOpenimSdkPlugin(Context context) {
FlutterOpenimSdkPlugin.imManager = new IMManager(); FlutterOpenimSdkPlugin.imManager = new IMManager();
FlutterOpenimSdkPlugin.userManager = new UserManager(); FlutterOpenimSdkPlugin.userManager = new UserManager();
FlutterOpenimSdkPlugin.friendshipManager = new FriendshipManager(); FlutterOpenimSdkPlugin.friendshipManager = new FriendshipManager();
@@ -55,15 +58,17 @@ public class FlutterOpenimSdkPlugin implements FlutterPlugin, MethodCallHandler
FlutterOpenimSdkPlugin.conversationManager = new ConversationManager(); FlutterOpenimSdkPlugin.conversationManager = new ConversationManager();
FlutterOpenimSdkPlugin.groupManager = new GroupManager(); FlutterOpenimSdkPlugin.groupManager = new GroupManager();
FlutterOpenimSdkPlugin.signalingManager = new SignalingManager(); FlutterOpenimSdkPlugin.signalingManager = new SignalingManager();
FlutterOpenimSdkPlugin.workMomentsManager = new WorkMomentsManager();
FlutterOpenimSdkPlugin.organizationManager = new OrganizationManager();
} }
@Override @Override
public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) { public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) {
FlutterOpenimSdkPlugin.channel = new MethodChannel(flutterPluginBinding.getBinaryMessenger(), "flutter_openim_sdk"); channel = new MethodChannel(flutterPluginBinding.getBinaryMessenger(), CHANNEL_NAME);
FlutterOpenimSdkPlugin.channel.setMethodCallHandler(new FlutterOpenimSdkPlugin(flutterPluginBinding.getApplicationContext())); context = flutterPluginBinding.getApplicationContext();
// channel.setMethodCallHandler(this); channel.setMethodCallHandler(this);
connectivityListener = new ConnectivityListener(context);
visibilityListener = new VisibilityListener();
connectivityListener.register();
} }
@Override @Override
@@ -74,6 +79,30 @@ public class FlutterOpenimSdkPlugin implements FlutterPlugin, MethodCallHandler
@Override @Override
public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) { public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {
FlutterOpenimSdkPlugin.channel.setMethodCallHandler(null); FlutterOpenimSdkPlugin.channel.setMethodCallHandler(null);
connectivityListener.unregisterReceiver();
}
@Override
public void onAttachedToActivity(@NonNull ActivityPluginBinding binding) {
visibilityListener.register(activity = binding.getActivity());
}
@Override
public void onDetachedFromActivityForConfigChanges() {
visibilityListener.unregisterReceiver(activity);
activity = null;
}
@Override
public void onReattachedToActivityForConfigChanges(@NonNull ActivityPluginBinding binding) {
visibilityListener.register(activity = binding.getActivity());
}
@Override
public void onDetachedFromActivity() {
visibilityListener.unregisterReceiver(activity);
activity = null;
} }
void parse(@NonNull MethodCall call, @NonNull Result result) { void parse(@NonNull MethodCall call, @NonNull Result result) {

View File

@@ -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;
}
}

View File

@@ -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();
}
}
}
}

View File

@@ -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) {
}
}

View File

@@ -13,11 +13,27 @@ public class OnAdvancedMsgListener implements open_im_sdk_callback.OnAdvancedMsg
this.id = listenerId; this.id = listenerId;
} }
@Override
public void onMsgDeleted(String s) {
final Map<String, String> values = new ArrayMap<>();
values.put("id", id);
values.put("message", s);
CommonUtil.emitEvent("advancedMsgListener", "onMsgDeleted", values);
}
@Override
public void onNewRecvMessageRevoked(String s) {
final Map<String, String> values = new ArrayMap<>();
values.put("id", id);
values.put("messageRevoked", s);
CommonUtil.emitEvent("advancedMsgListener", "onNewRecvMessageRevoked", values);
}
@Override @Override
public void onRecvC2CReadReceipt(String s) { public void onRecvC2CReadReceipt(String s) {
final Map<String, String> values = new ArrayMap<>(); final Map<String, String> values = new ArrayMap<>();
values.put("id", id); values.put("id", id);
values.put("c2cMessageReadReceipt", s); values.put("msgReceiptList", s);
CommonUtil.emitEvent("advancedMsgListener", "onRecvC2CReadReceipt", values); CommonUtil.emitEvent("advancedMsgListener", "onRecvC2CReadReceipt", values);
} }
@@ -25,23 +41,51 @@ public class OnAdvancedMsgListener implements open_im_sdk_callback.OnAdvancedMsg
public void onRecvGroupReadReceipt(String s) { public void onRecvGroupReadReceipt(String s) {
final Map<String, String> values = new ArrayMap<>(); final Map<String, String> values = new ArrayMap<>();
values.put("id", id); values.put("id", id);
values.put("groupMessageReadReceipt", s); values.put("groupMsgReceiptList", s);
CommonUtil.emitEvent("advancedMsgListener", "onRecvGroupReadReceipt", values); CommonUtil.emitEvent("advancedMsgListener", "onRecvGroupReadReceipt", values);
} }
@Override @Override
public void onRecvMessageRevoked(String s) { public void onRecvMessageExtensionsAdded(String s, String s1) {
final Map<String, String> values = new ArrayMap<>(); final Map<String, String> values = new ArrayMap<>();
values.put("id", id); values.put("id", id);
values.put("revokedMessage", s); values.put("msgID", s);
CommonUtil.emitEvent("advancedMsgListener", "onRecvMessageRevoked", values); values.put("reactionExtensionList", s1);
CommonUtil.emitEvent("advancedMsgListener", "onRecvMessageExtensionsAdded", values);
}
@Override
public void onRecvMessageExtensionsChanged(String s, String s1) {
final Map<String, String> values = new ArrayMap<>();
values.put("id", id);
values.put("msgID", s);
values.put("reactionExtensionList", s1);
CommonUtil.emitEvent("advancedMsgListener", "onRecvMessageExtensionsChanged", values);
}
@Override
public void onRecvMessageExtensionsDeleted(String s, String s1) {
final Map<String, String> values = new ArrayMap<>();
values.put("id", id);
values.put("msgID", s);
values.put("reactionExtensionKeyList", s1);
CommonUtil.emitEvent("advancedMsgListener", "onRecvMessageExtensionsDeleted", values);
} }
@Override @Override
public void onRecvNewMessage(String s) { public void onRecvNewMessage(String s) {
final Map<String, String> values = new ArrayMap<>(); final Map<String, String> values = new ArrayMap<>();
values.put("id", id); values.put("id", id);
values.put("newMessage", s); values.put("message", s);
CommonUtil.emitEvent("advancedMsgListener", "onRecvNewMessage", values); CommonUtil.emitEvent("advancedMsgListener", "onRecvNewMessage", values);
} }
@Override
public void onRecvOfflineNewMessage(String s) {
final Map<String, String> values = new ArrayMap<>();
values.put("id", id);
values.put("message", s);
CommonUtil.emitEvent("advancedMsgListener", "onRecvOfflineNewMessage", values);
}
} }

View File

@@ -19,13 +19,15 @@ public class OnBaseListener implements Base {
@Override @Override
public void onError(int l, String s) { public void onError(int l, String s) {
Log.i("F-OpenIMSDK(flutter call native)", "method: 【 " + call.method + " 】, onError: { code:" + l + ", message:" + s + "}"); String threadName = Thread.currentThread().getName();
Log.i("F-OpenIMSDK(native call flutter)", "thread: " + threadName + " method: 【 " + call.method + " 】, onError: { code:" + l + ", message:" + s + "}");
CommonUtil.runMainThreadReturnError(result, l, s, null); CommonUtil.runMainThreadReturnError(result, l, s, null);
} }
@Override @Override
public void onSuccess(String s) { public void onSuccess(String s) {
Log.i("F-OpenIMSDK(flutter call native)", "method: 【 " + call.method + " 】, onSuccess: " + s); String threadName = Thread.currentThread().getName();
Log.i("F-OpenIMSDK(native call flutter)", "thread: " + threadName + " method: 【 " + call.method + " 】, onSuccess: " + s);
CommonUtil.runMainThreadReturn(result, s); CommonUtil.runMainThreadReturn(result, s);
} }
} }

View File

@@ -0,0 +1,10 @@
package io.openim.flutter_openim_sdk.listener;
import io.openim.flutter_openim_sdk.util.CommonUtil;
public class OnCustomBusinessListener implements open_im_sdk_callback.OnCustomBusinessListener {
@Override
public void onRecvCustomBusinessMessage(String s) {
CommonUtil.emitEvent("customBusinessListener", "onRecvCustomBusinessMessage", s);
}
}

View File

@@ -6,12 +6,12 @@ public class OnFriendshipListener implements open_im_sdk_callback.OnFriendshipLi
@Override @Override
public void onBlackAdded(String s) { public void onBlackAdded(String s) {
CommonUtil.emitEvent("friendListener", "onBlacklistAdded", s); CommonUtil.emitEvent("friendListener", "onBlackAdded", s);
} }
@Override @Override
public void onBlackDeleted(String s) { public void onBlackDeleted(String s) {
CommonUtil.emitEvent("friendListener", "onBlacklistDeleted", s); CommonUtil.emitEvent("friendListener", "onBlackDeleted", s);
} }
@Override @Override

View File

@@ -24,6 +24,11 @@ public class OnGroupListener implements open_im_sdk_callback.OnGroupListener {
CommonUtil.emitEvent("groupListener", "onGroupApplicationRejected", s); CommonUtil.emitEvent("groupListener", "onGroupApplicationRejected", s);
} }
@Override
public void onGroupDismissed(String s) {
CommonUtil.emitEvent("groupListener", "onGroupDismissed", s);
}
@Override @Override
public void onGroupInfoChanged(String s) { public void onGroupInfoChanged(String s) {
CommonUtil.emitEvent("groupListener", "onGroupInfoChanged", s); CommonUtil.emitEvent("groupListener", "onGroupInfoChanged", s);

View File

@@ -0,0 +1,30 @@
package io.openim.flutter_openim_sdk.listener;
import io.openim.flutter_openim_sdk.util.CommonUtil;
public class OnListenerForService implements open_im_sdk_callback.OnListenerForService {
@Override
public void onFriendApplicationAccepted(String s) {
CommonUtil.emitEvent("listenerForService", "onFriendApplicationAccepted", s);
}
@Override
public void onFriendApplicationAdded(String s) {
CommonUtil.emitEvent("listenerForService", "onFriendApplicationAdded", s);
}
@Override
public void onGroupApplicationAccepted(String s) {
CommonUtil.emitEvent("listenerForService", "onGroupApplicationAccepted", s);
}
@Override
public void onGroupApplicationAdded(String s) {
CommonUtil.emitEvent("listenerForService", "onGroupApplicationAdded", s);
}
@Override
public void onRecvNewMessage(String s) {
CommonUtil.emitEvent("listenerForService", "onRecvNewMessage", s);
}
}

View File

@@ -0,0 +1,12 @@
package io.openim.flutter_openim_sdk.listener;
import io.openim.flutter_openim_sdk.util.CommonUtil;
public class OnMessageKvInfoListener implements open_im_sdk_callback.OnMessageKvInfoListener {
// 经过聚合后的kv计算了总数判断了是否包含自己
@Override
public void onMessageKvInfoChanged(String s) {
CommonUtil.emitEvent("messageKvInfoListener", "onMessageKvInfoChanged", s);
}
}

View File

@@ -1,10 +0,0 @@
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);
}
}

View File

@@ -34,11 +34,31 @@ public class OnSignalingListener implements open_im_sdk_callback.OnSignalingList
CommonUtil.emitEvent("signalingListener", "onInviteeRejectedByOtherDevice", s); CommonUtil.emitEvent("signalingListener", "onInviteeRejectedByOtherDevice", s);
} }
@Override
public void onReceiveCustomSignal(String s) {
CommonUtil.emitEvent("signalingListener", "onReceiveCustomSignal", s);
}
@Override @Override
public void onReceiveNewInvitation(String s) { public void onReceiveNewInvitation(String s) {
CommonUtil.emitEvent("signalingListener", "onReceiveNewInvitation", s); CommonUtil.emitEvent("signalingListener", "onReceiveNewInvitation", s);
} }
@Override
public void onRoomParticipantConnected(String s) {
CommonUtil.emitEvent("signalingListener", "onRoomParticipantConnected", s);
}
@Override
public void onRoomParticipantDisconnected(String s) {
CommonUtil.emitEvent("signalingListener", "onRoomParticipantDisconnected", s);
}
@Override
public void onStreamChange(String s) {
CommonUtil.emitEvent("signalingListener", "onStreamChange", s);
}
@Override @Override
public void onHangUp(String s) { public void onHangUp(String s) {
CommonUtil.emitEvent("signalingListener", "onHangUp", s); CommonUtil.emitEvent("signalingListener", "onHangUp", s);

View File

@@ -0,0 +1,110 @@
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.UploadFileCallback;
public class OnUploadFileListener implements UploadFileCallback {
final private MethodChannel.Result result;
final private Object id;
public OnUploadFileListener(MethodChannel.Result result, MethodCall call) {
this.result = result;
this.id = call.argument("id");
}
@Override
public void complete(long size, String url, long type) {
if (null != id) {
final Map<String, Object> values = new ArrayMap<>();
values.put("id", id);
values.put("size", size);
values.put("url", url);
values.put("type", type);
CommonUtil.emitEvent("uploadFileListener", "complete", values);
}
}
@Override
public void hashPartComplete(String partHash, String fileHash) {
if (null != id) {
final Map<String, Object> values = new ArrayMap<>();
values.put("id", id);
values.put("partHash", partHash);
values.put("fileHash", fileHash);
CommonUtil.emitEvent("uploadFileListener", "hashPartComplete", values);
}
}
@Override
public void hashPartProgress(long index, long size, String partHash) {
if (null != id) {
final Map<String, Object> values = new ArrayMap<>();
values.put("id", id);
values.put("index", index);
values.put("size", size);
values.put("partHash", partHash);
CommonUtil.emitEvent("uploadFileListener", "hashPartProgress", values);
}
}
@Override
public void open(long size) {
if (null != id) {
final Map<String, Object> values = new ArrayMap<>();
values.put("id", id);
values.put("size", size);
CommonUtil.emitEvent("uploadFileListener", "open", values);
}
}
@Override
public void partSize(long partSize, long num) {
if (null != id) {
final Map<String, Object> values = new ArrayMap<>();
values.put("id", id);
values.put("partSize", partSize);
values.put("num", num);
CommonUtil.emitEvent("uploadFileListener", "partSize", values);
}
}
@Override
public void uploadComplete(long fileSize, long streamSize, long storageSize) {
if (null != id) {
final Map<String, Object> values = new ArrayMap<>();
values.put("id", id);
values.put("fileSize", fileSize);
values.put("streamSize", streamSize);
values.put("storageSize", storageSize);
CommonUtil.emitEvent("uploadFileListener", "uploadProgress", values);
}
}
@Override
public void uploadID(String uploadID) {
if (null != id) {
final Map<String, Object> values = new ArrayMap<>();
values.put("id", id);
values.put("uploadID", uploadID);
CommonUtil.emitEvent("uploadFileListener", "uploadID", values);
}
}
@Override
public void uploadPartComplete(long index, long partSize, String partHash) {
if (null != id) {
final Map<String, Object> values = new ArrayMap<>();
values.put("id", id);
values.put("index", index);
values.put("partSize", partSize);
values.put("partHash", partHash);
CommonUtil.emitEvent("uploadFileListener", "uploadPartComplete", values);
}
}
}

View File

@@ -1,12 +0,0 @@
package io.openim.flutter_openim_sdk.listener;
import io.openim.flutter_openim_sdk.util.CommonUtil;
public class OnWorkMomentsListener implements open_im_sdk_callback.OnWorkMomentsListener {
@Override
public void onRecvNewNotification() {
CommonUtil.emitEvent("workMomentsListener", "OnRecvNewNotification", null);
}
}

View File

@@ -11,6 +11,8 @@ public class ConversationManager extends BaseManager {
public void setConversationListener(MethodCall methodCall, MethodChannel.Result result) { public void setConversationListener(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.setConversationListener(new OnConversationListener()); Open_im_sdk.setConversationListener(new OnConversationListener());
result.success(null);
} }
@@ -34,7 +36,7 @@ public class ConversationManager extends BaseManager {
Open_im_sdk.getOneConversation( Open_im_sdk.getOneConversation(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
int2long(methodCall, "sessionType"), value(methodCall, "sessionType"),
value(methodCall, "sourceID") value(methodCall, "sourceID")
); );
} }
@@ -47,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) { public void setConversationDraft(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.setConversationDraft( Open_im_sdk.setConversationDraft(
@@ -73,19 +68,19 @@ public class ConversationManager extends BaseManager {
); );
} }
// public void markSingleMessageHasRead(MethodCall methodCall, MethodChannel.Result result) { public void hideConversation(MethodCall methodCall, MethodChannel.Result result) {
// Open_im_sdk.markSingleMessageHasRead( Open_im_sdk.hideConversation(
// new OnBaseListener(result, methodCall),
// value(methodCall, "operationID"),
// value(methodCall, "userID")
// );
// }
public void markGroupMessageHasRead(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.markGroupMessageHasRead(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
value(methodCall, "groupID") value(methodCall, "conversationID")
);
}
public void markConversationMessageAsRead(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.markConversationMessageAsRead(
new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
value(methodCall, "conversationID")
); );
} }
@@ -98,6 +93,7 @@ public class ConversationManager extends BaseManager {
public void getConversationIDBySessionType(MethodCall methodCall, MethodChannel.Result result) { public void getConversationIDBySessionType(MethodCall methodCall, MethodChannel.Result result) {
CommonUtil.runMainThreadReturn(result, Open_im_sdk.getConversationIDBySessionType( CommonUtil.runMainThreadReturn(result, Open_im_sdk.getConversationIDBySessionType(
value(methodCall, "operationID"),
value(methodCall, "sourceID"), value(methodCall, "sourceID"),
int2long(methodCall, "sessionType"))); int2long(methodCall, "sessionType")));
} }
@@ -106,7 +102,7 @@ public class ConversationManager extends BaseManager {
Open_im_sdk.setConversationRecvMessageOpt( Open_im_sdk.setConversationRecvMessageOpt(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
jsonValue(methodCall, "conversationIDList"), value(methodCall, "conversationID"),
int2long(methodCall, "status") int2long(methodCall, "status")
); );
} }
@@ -119,8 +115,8 @@ public class ConversationManager extends BaseManager {
); );
} }
public void setOneConversationPrivateChat(MethodCall methodCall, MethodChannel.Result result) { public void setConversationPrivateChat(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.setOneConversationPrivateChat( Open_im_sdk.setConversationPrivateChat(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
value(methodCall, "conversationID"), value(methodCall, "conversationID"),
@@ -128,8 +124,16 @@ public class ConversationManager extends BaseManager {
); );
} }
public void deleteConversationFromLocalAndSvr(MethodCall methodCall, MethodChannel.Result result) { public void clearConversationAndDeleteAllMsg(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.deleteConversationFromLocalAndSvr( 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), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
value(methodCall, "conversationID") value(methodCall, "conversationID")
@@ -152,7 +156,7 @@ public class ConversationManager extends BaseManager {
} }
public void getAtAllTag(MethodCall methodCall, MethodChannel.Result result) { public void getAtAllTag(MethodCall methodCall, MethodChannel.Result result) {
CommonUtil.runMainThreadReturn(result, Open_im_sdk.getAtAllTag()); CommonUtil.runMainThreadReturn(result, Open_im_sdk.getAtAllTag(value(methodCall, "operationID")));
} }
public void setGlobalRecvMessageOpt(MethodCall methodCall, MethodChannel.Result result) { public void setGlobalRecvMessageOpt(MethodCall methodCall, MethodChannel.Result result) {
@@ -162,4 +166,31 @@ public class ConversationManager extends BaseManager {
int2long(methodCall, "status") int2long(methodCall, "status")
); );
} }
public void setConversationBurnDuration(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.setConversationBurnDuration(
new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
value(methodCall, "conversationID"),
value(methodCall, "burnDuration")
);
}
public void setConversationIsMsgDestruct(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.setConversationIsMsgDestruct(
new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
value(methodCall, "conversationID"),
value(methodCall, "isMsgDestruct")
);
}
public void setConversationMsgDestructTime(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.setConversationMsgDestructTime(
new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
value(methodCall, "conversationID"),
int2long(methodCall, "duration")
);
}
} }

View File

@@ -11,13 +11,15 @@ public class FriendshipManager extends BaseManager {
public void setFriendListener(MethodCall methodCall, MethodChannel.Result result) { public void setFriendListener(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.setFriendListener(new OnFriendshipListener()); Open_im_sdk.setFriendListener(new OnFriendshipListener());
result.success(null);
} }
public void getFriendsInfo(MethodCall methodCall, MethodChannel.Result result) { public void getFriendsInfo(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.getDesignatedFriendsInfo( Open_im_sdk.getSpecifiedFriendsInfo(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
jsonValue(methodCall, "uidList") jsonValue(methodCall, "userIDList")
); );
} }
@@ -29,15 +31,15 @@ public class FriendshipManager extends BaseManager {
); );
} }
public void getRecvFriendApplicationList(MethodCall methodCall, MethodChannel.Result result) { public void getFriendApplicationListAsRecipient(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.getRecvFriendApplicationList( Open_im_sdk.getFriendApplicationListAsRecipient(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID") value(methodCall, "operationID")
); );
} }
public void getSendFriendApplicationList(MethodCall methodCall, MethodChannel.Result result) { public void getFriendApplicationListAsApplicant(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.getSendFriendApplicationList( Open_im_sdk.getFriendApplicationListAsApplicant(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID") value(methodCall, "operationID")
); );
@@ -62,7 +64,7 @@ public class FriendshipManager extends BaseManager {
Open_im_sdk.addBlack( Open_im_sdk.addBlack(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
value(methodCall, "uid") value(methodCall, "userID")
); );
} }
@@ -77,7 +79,7 @@ public class FriendshipManager extends BaseManager {
Open_im_sdk.removeBlack( Open_im_sdk.removeBlack(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
value(methodCall, "uid") value(methodCall, "userID")
); );
} }
@@ -85,7 +87,7 @@ public class FriendshipManager extends BaseManager {
Open_im_sdk.checkFriend( Open_im_sdk.checkFriend(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
jsonValue(methodCall, "uidList") jsonValue(methodCall, "userIDList")
); );
} }
@@ -93,7 +95,7 @@ public class FriendshipManager extends BaseManager {
Open_im_sdk.deleteFriend( Open_im_sdk.deleteFriend(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
value(methodCall, "uid") value(methodCall, "userID")
); );
} }

View File

@@ -10,15 +10,17 @@ public class GroupManager extends BaseManager {
public void setGroupListener(MethodCall methodCall, MethodChannel.Result result) { public void setGroupListener(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.setGroupListener(new OnGroupListener()); Open_im_sdk.setGroupListener(new OnGroupListener());
result.success(null);
} }
public void inviteUserToGroup(MethodCall methodCall, MethodChannel.Result result) { public void inviteUserToGroup(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.inviteUserToGroup( Open_im_sdk.inviteUserToGroup(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
value(methodCall, "gid"), value(methodCall, "groupID"),
value(methodCall, "reason"), value(methodCall, "reason"),
jsonValue(methodCall, "uidList") jsonValue(methodCall, "userIDList")
); );
} }
@@ -26,18 +28,18 @@ public class GroupManager extends BaseManager {
Open_im_sdk.kickGroupMember( Open_im_sdk.kickGroupMember(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
value(methodCall, "gid"), value(methodCall, "groupID"),
value(methodCall, "reason"), value(methodCall, "reason"),
jsonValue(methodCall, "uidList") jsonValue(methodCall, "userIDList")
); );
} }
public void getGroupMembersInfo(MethodCall methodCall, MethodChannel.Result result) { public void getGroupMembersInfo(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.getGroupMembersInfo( Open_im_sdk.getSpecifiedGroupMembersInfo(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
value(methodCall, "gid"), value(methodCall, "groupID"),
jsonValue(methodCall, "uidList") jsonValue(methodCall, "userIDList")
); );
} }
@@ -45,7 +47,7 @@ public class GroupManager extends BaseManager {
Open_im_sdk.getGroupMemberList( Open_im_sdk.getGroupMemberList(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
value(methodCall, "gid"), value(methodCall, "groupID"),
value(methodCall, "filter"), value(methodCall, "filter"),
value(methodCall, "offset"), value(methodCall, "offset"),
value(methodCall, "count") value(methodCall, "count")
@@ -64,8 +66,7 @@ public class GroupManager extends BaseManager {
Open_im_sdk.createGroup( Open_im_sdk.createGroup(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
jsonValue(methodCall, "gInfo"), jsonValue(methodCall)
jsonValue(methodCall, "memberList")
); );
} }
@@ -73,16 +74,15 @@ public class GroupManager extends BaseManager {
Open_im_sdk.setGroupInfo( Open_im_sdk.setGroupInfo(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
value(methodCall, "gid"), jsonValue(methodCall, "groupInfo")
jsonValue(methodCall, "gInfo")
); );
} }
public void getGroupsInfo(MethodCall methodCall, MethodChannel.Result result) { public void getGroupsInfo(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.getGroupsInfo( Open_im_sdk.getSpecifiedGroupsInfo(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
jsonValue(methodCall, "gidList") jsonValue(methodCall, "groupIDList")
); );
} }
@@ -90,8 +90,9 @@ public class GroupManager extends BaseManager {
Open_im_sdk.joinGroup( Open_im_sdk.joinGroup(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
value(methodCall, "gid"), value(methodCall, "groupID"),
value(methodCall, "reason") value(methodCall, "reason"),
value(methodCall, "joinSource")
); );
} }
@@ -99,7 +100,7 @@ public class GroupManager extends BaseManager {
Open_im_sdk.quitGroup( Open_im_sdk.quitGroup(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
value(methodCall, "gid") value(methodCall, "groupID")
); );
} }
@@ -107,20 +108,20 @@ public class GroupManager extends BaseManager {
Open_im_sdk.transferGroupOwner( Open_im_sdk.transferGroupOwner(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
value(methodCall, "gid"), value(methodCall, "groupID"),
value(methodCall, "uid") value(methodCall, "userID")
); );
} }
public void getRecvGroupApplicationList(MethodCall methodCall, MethodChannel.Result result) { public void getGroupApplicationListAsRecipient(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.getRecvGroupApplicationList( Open_im_sdk.getGroupApplicationListAsRecipient(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID") value(methodCall, "operationID")
); );
} }
public void getSendGroupApplicationList(MethodCall methodCall, MethodChannel.Result result) { public void getGroupApplicationListAsApplicant(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.getSendGroupApplicationList( Open_im_sdk.getGroupApplicationListAsApplicant(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID") value(methodCall, "operationID")
); );
@@ -130,8 +131,8 @@ public class GroupManager extends BaseManager {
Open_im_sdk.acceptGroupApplication( Open_im_sdk.acceptGroupApplication(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
value(methodCall, "gid"), value(methodCall, "groupID"),
value(methodCall, "uid"), value(methodCall, "userID"),
value(methodCall, "handleMsg") value(methodCall, "handleMsg")
); );
@@ -141,8 +142,8 @@ public class GroupManager extends BaseManager {
Open_im_sdk.refuseGroupApplication( Open_im_sdk.refuseGroupApplication(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
value(methodCall, "gid"), value(methodCall, "groupID"),
value(methodCall, "uid"), value(methodCall, "userID"),
value(methodCall, "handleMsg") value(methodCall, "handleMsg")
); );
@@ -152,7 +153,7 @@ public class GroupManager extends BaseManager {
Open_im_sdk.dismissGroup( Open_im_sdk.dismissGroup(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
value(methodCall, "gid") value(methodCall, "groupID")
); );
} }
@@ -160,7 +161,7 @@ public class GroupManager extends BaseManager {
Open_im_sdk.changeGroupMute( Open_im_sdk.changeGroupMute(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
value(methodCall, "gid"), value(methodCall, "groupID"),
value(methodCall, "mute") value(methodCall, "mute")
); );
} }
@@ -169,8 +170,8 @@ public class GroupManager extends BaseManager {
Open_im_sdk.changeGroupMemberMute( Open_im_sdk.changeGroupMemberMute(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
value(methodCall, "gid"), value(methodCall, "groupID"),
value(methodCall, "uid"), value(methodCall, "userID"),
int2long(methodCall, "seconds") int2long(methodCall, "seconds")
); );
} }
@@ -178,8 +179,8 @@ public class GroupManager extends BaseManager {
public void setGroupMemberNickname(MethodCall methodCall, MethodChannel.Result result) { public void setGroupMemberNickname(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.setGroupMemberNickname(new OnBaseListener(result, methodCall), Open_im_sdk.setGroupMemberNickname(new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
value(methodCall, "gid"), value(methodCall, "groupID"),
value(methodCall, "uid"), value(methodCall, "userID"),
value(methodCall, "groupNickname") value(methodCall, "groupNickname")
); );
} }
@@ -219,4 +220,48 @@ public class GroupManager extends BaseManager {
value(methodCall, "needVerification") value(methodCall, "needVerification")
); );
} }
public void setGroupLookMemberInfo(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.setGroupLookMemberInfo(new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
value(methodCall, "groupID"),
value(methodCall, "status")
);
}
public void setGroupApplyMemberFriend(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.setGroupApplyMemberFriend(new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
value(methodCall, "groupID"),
value(methodCall, "status")
);
}
public void getGroupMemberOwnerAndAdmin(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.getGroupMemberOwnerAndAdmin(new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
value(methodCall, "groupID")
);
}
public void searchGroupMembers(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.searchGroupMembers(new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
jsonValue(methodCall, "searchParam")
);
}
public void setGroupMemberInfo(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.setGroupMemberInfo(new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
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")
);
}
} }

View File

@@ -2,26 +2,29 @@ package io.openim.flutter_openim_sdk.manager;
import io.flutter.plugin.common.MethodCall; import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel; 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.OnBaseListener;
import io.openim.flutter_openim_sdk.listener.OnConnListener; import io.openim.flutter_openim_sdk.listener.OnConnListener;
import io.openim.flutter_openim_sdk.listener.OnUploadFileListener;
import io.openim.flutter_openim_sdk.util.CommonUtil; import io.openim.flutter_openim_sdk.util.CommonUtil;
import open_im_sdk.Open_im_sdk; import open_im_sdk.Open_im_sdk;
public class IMManager extends BaseManager { public class IMManager extends BaseManager {
public void initSDK(MethodCall methodCall, MethodChannel.Result result) { public void initSDK(MethodCall methodCall, MethodChannel.Result result) {
CommonUtil.runMainThreadReturn(result, Open_im_sdk.initSDK( boolean initialized = Open_im_sdk.initSDK(
new OnConnListener(), new OnConnListener(),
value(methodCall, "operationID"), value(methodCall, "operationID"),
jsonValue(methodCall)) jsonValue(methodCall));
); FlutterOpenimSdkPlugin.isInitialized = initialized;
CommonUtil.runMainThreadReturn(result, initialized);
} }
public void login(MethodCall methodCall, MethodChannel.Result result) { public void login(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.login( Open_im_sdk.login(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
value(methodCall, "uid"), value(methodCall, "userID"),
value(methodCall, "token") value(methodCall, "token")
); );
} }
@@ -34,23 +37,47 @@ public class IMManager extends BaseManager {
} }
public void getLoginStatus(MethodCall methodCall, MethodChannel.Result result) { public void getLoginStatus(MethodCall methodCall, MethodChannel.Result result) {
CommonUtil.runMainThreadReturn(result, Open_im_sdk.getLoginStatus()); CommonUtil.runMainThreadReturn(result, Open_im_sdk.getLoginStatus(value(methodCall, "operationID")));
} }
public void wakeUp(MethodCall methodCall, MethodChannel.Result result) { public void uploadFile(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.wakeUp( Open_im_sdk.uploadFile(
new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
jsonValue(methodCall),
new OnUploadFileListener(result, methodCall)
);
}
public void updateFcmToken(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.updateFcmToken(
new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
value(methodCall, "fcmToken")
);
}
public void setAppBackgroundStatus(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.setAppBackgroundStatus(
new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
value(methodCall, "isBackground")
);
}
public void networkStatusChanged(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.networkStatusChanged(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID") value(methodCall, "operationID")
); );
} }
public void uploadImage(MethodCall methodCall, MethodChannel.Result result) { // public void setListenerForService(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.uploadImage( // Open_im_sdk.setListenerForService(new OnListenerForService());
new OnBaseListener(result, methodCall), //
value(methodCall, "operationID"), // result.success(null);
value(methodCall, "path"), // }
value(methodCall, "token"),
value(methodCall, "obj")
);
}
} }

View File

@@ -4,6 +4,8 @@ import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel; import io.flutter.plugin.common.MethodChannel;
import io.openim.flutter_openim_sdk.listener.OnAdvancedMsgListener; import io.openim.flutter_openim_sdk.listener.OnAdvancedMsgListener;
import io.openim.flutter_openim_sdk.listener.OnBaseListener; import io.openim.flutter_openim_sdk.listener.OnBaseListener;
import io.openim.flutter_openim_sdk.listener.OnCustomBusinessListener;
import io.openim.flutter_openim_sdk.listener.OnMessageKvInfoListener;
import io.openim.flutter_openim_sdk.listener.OnMsgSendListener; import io.openim.flutter_openim_sdk.listener.OnMsgSendListener;
import io.openim.flutter_openim_sdk.util.CommonUtil; import io.openim.flutter_openim_sdk.util.CommonUtil;
import open_im_sdk.Open_im_sdk; import open_im_sdk.Open_im_sdk;
@@ -11,6 +13,7 @@ import open_im_sdk.Open_im_sdk;
public class MessageManager extends BaseManager { public class MessageManager extends BaseManager {
private final static String KEY_ID = "id"; private final static String KEY_ID = "id";
// private final static Map<String, OnAdvancedMsgListener> listeners = new HashMap<>(); // private final static Map<String, OnAdvancedMsgListener> listeners = new HashMap<>();
/* private static boolean initializedListener = false; /* private static boolean initializedListener = false;
private final static Map<String, AdvancedMsgListener> listeners = new ConcurrentHashMap<>(); private final static Map<String, AdvancedMsgListener> listeners = new ConcurrentHashMap<>();
@@ -82,6 +85,8 @@ public class MessageManager extends BaseManager {
public void setAdvancedMsgListener(MethodCall methodCall, MethodChannel.Result result) { public void setAdvancedMsgListener(MethodCall methodCall, MethodChannel.Result result) {
String key = methodCall.argument(KEY_ID); String key = methodCall.argument(KEY_ID);
Open_im_sdk.setAdvancedMsgListener(new OnAdvancedMsgListener(key)); Open_im_sdk.setAdvancedMsgListener(new OnAdvancedMsgListener(key));
result.success(null);
} }
public void sendMessage(MethodCall methodCall, MethodChannel.Result result) { public void sendMessage(MethodCall methodCall, MethodChannel.Result result) {
@@ -95,19 +100,12 @@ public class MessageManager extends BaseManager {
); );
} }
public void getHistoryMessageList(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.getHistoryMessageList(
new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
jsonValue(methodCall)
);
}
public void revokeMessage(MethodCall methodCall, MethodChannel.Result result) { public void revokeMessage(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.revokeMessage( Open_im_sdk.revokeMessage(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
jsonValue(methodCall) value(methodCall, "conversationID"),
value(methodCall, "clientMsgID")
); );
} }
@@ -115,13 +113,33 @@ public class MessageManager extends BaseManager {
Open_im_sdk.deleteMessageFromLocalStorage( Open_im_sdk.deleteMessageFromLocalStorage(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
jsonValue(methodCall) value(methodCall, "conversationID"),
value(methodCall, "clientMsgID")
); );
} }
// public void deleteMessages(MethodCall methodCall, MethodChannel.Result result) { public void deleteMessageFromLocalAndSvr(MethodCall methodCall, MethodChannel.Result result) {
// Open_im_sdk.deleteMessages(new OnBaseListener(result, methodCall), CommonUtil.getSDKJsonParam(methodCall)); Open_im_sdk.deleteMessage(
// } new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
value(methodCall, "conversationID"),
value(methodCall, "clientMsgID")
);
}
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) { public void insertSingleMessageToLocalStorage(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.insertSingleMessageToLocalStorage( Open_im_sdk.insertSingleMessageToLocalStorage(
@@ -143,20 +161,11 @@ public class MessageManager extends BaseManager {
); );
} }
public void markC2CMessageAsRead(MethodCall methodCall, MethodChannel.Result result) { public void markMessagesAsReadByMsgID(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.markC2CMessageAsRead( Open_im_sdk.markMessagesAsReadByMsgID(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
value(methodCall, "userID"), value(methodCall, "conversationID"),
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"),
jsonValue(methodCall, "messageIDList") jsonValue(methodCall, "messageIDList")
); );
} }
@@ -201,6 +210,7 @@ public class MessageManager extends BaseManager {
value(methodCall, "operationID"), value(methodCall, "operationID"),
value(methodCall, "imagePath"))); value(methodCall, "imagePath")));
} }
public void createSoundMessage(MethodCall methodCall, MethodChannel.Result result) { public void createSoundMessage(MethodCall methodCall, MethodChannel.Result result) {
CommonUtil.runMainThreadReturn(result, CommonUtil.runMainThreadReturn(result,
Open_im_sdk.createSoundMessage( Open_im_sdk.createSoundMessage(
@@ -311,20 +321,23 @@ public class MessageManager extends BaseManager {
)); ));
} }
public void clearC2CHistoryMessage(MethodCall methodCall, MethodChannel.Result result) { public void createAdvancedTextMessage(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.clearC2CHistoryMessage( CommonUtil.runMainThreadReturn(result,
new OnBaseListener(result, methodCall), Open_im_sdk.createAdvancedTextMessage(
value(methodCall, "operationID"), value(methodCall, "operationID"),
value(methodCall, "userID") value(methodCall, "text"),
); jsonValue(methodCall, "richMessageInfoList")
));
} }
public void clearGroupHistoryMessage(MethodCall methodCall, MethodChannel.Result result) { public void createAdvancedQuoteMessage(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.clearGroupHistoryMessage( CommonUtil.runMainThreadReturn(result,
new OnBaseListener(result, methodCall), Open_im_sdk.createAdvancedQuoteMessage(
value(methodCall, "operationID"), value(methodCall, "operationID"),
value(methodCall, "groupID") value(methodCall, "quoteText"),
); jsonValue(methodCall, "quoteMessage"),
jsonValue(methodCall, "richMessageInfoList")
));
} }
public void searchLocalMessages(MethodCall methodCall, MethodChannel.Result result) { public void searchLocalMessages(MethodCall methodCall, MethodChannel.Result result) {
@@ -335,58 +348,135 @@ public class MessageManager extends BaseManager {
); );
} }
public void deleteMessageFromLocalAndSvr(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.deleteMessageFromLocalAndSvr( public void clearConversationAndDeleteAllMsg(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.clearConversationAndDeleteAllMsg(
new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
value(methodCall, "conversationID")
);
}
public void getAdvancedHistoryMessageList(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.getAdvancedHistoryMessageList(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
jsonValue(methodCall) jsonValue(methodCall)
); );
} }
public void deleteAllMsgFromLocal(MethodCall methodCall, MethodChannel.Result result) { public void getAdvancedHistoryMessageListReverse(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.deleteAllMsgFromLocal( Open_im_sdk.getAdvancedHistoryMessageListReverse(
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(
new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
value(methodCall, "conversationID"),
jsonValue(methodCall, "messageIDList")
);
}
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), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
jsonValue(methodCall) jsonValue(methodCall)
); );
} }
public void findMessageList(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.findMessageList(
new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
jsonValue(methodCall, "searchParams")
);
}
public void sendMessageNotOss(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.sendMessageNotOss(
new OnMsgSendListener(result, methodCall),
value(methodCall, "operationID"),
jsonValue(methodCall, "message"),
value(methodCall, "userID"),
value(methodCall, "groupID"),
jsonValue(methodCall, "offlinePushInfo")
);
}
public void createImageMessageByURL(MethodCall methodCall, MethodChannel.Result result) {
CommonUtil.runMainThreadReturn(result,
Open_im_sdk.createImageMessageByURL(
value(methodCall, "operationID"),
jsonValue(methodCall, "sourcePicture"),
jsonValue(methodCall, "bigPicture"),
jsonValue(methodCall, "snapshotPicture")));
}
public void createSoundMessageByURL(MethodCall methodCall, MethodChannel.Result result) {
CommonUtil.runMainThreadReturn(result,
Open_im_sdk.createSoundMessageByURL(
value(methodCall, "operationID"),
jsonValue(methodCall, "soundElem")));
}
public void createVideoMessageByURL(MethodCall methodCall, MethodChannel.Result result) {
CommonUtil.runMainThreadReturn(result,
Open_im_sdk.createVideoMessageByURL(
value(methodCall, "operationID"),
jsonValue(methodCall, "videoElem")));
}
public void createFileMessageByURL(MethodCall methodCall, MethodChannel.Result result) {
CommonUtil.runMainThreadReturn(result,
Open_im_sdk.createFileMessageByURL(
value(methodCall, "operationID"),
jsonValue(methodCall, "fileElem")));
}
public void setCustomBusinessListener(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.setCustomBusinessListener(new OnCustomBusinessListener());
result.success(null);
}
public void setMessageKvInfoListener(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.setMessageKvInfoListener(new OnMessageKvInfoListener());
result.success(null);
}
// public void setMessageReactionExtensions(MethodCall methodCall, MethodChannel.Result result) {
// Open_im_sdk.setMessageReactionExtensions(
// new OnBaseListener(result, methodCall),
// value(methodCall, "operationID"),
// jsonValue(methodCall, "message"),
// jsonValue(methodCall, "list")
// );
// }
//
// public void deleteMessageReactionExtensions(MethodCall methodCall, MethodChannel.Result result) {
// Open_im_sdk.deleteMessageReactionExtensions(
// new OnBaseListener(result, methodCall),
// value(methodCall, "operationID"),
// jsonValue(methodCall, "message"),
// jsonValue(methodCall, "list")
// );
// }
//
// public void getMessageListReactionExtensions(MethodCall methodCall, MethodChannel.Result result) {
// Open_im_sdk.getMessageListReactionExtensions(
// new OnBaseListener(result, methodCall),
// value(methodCall, "operationID"),
// jsonValue(methodCall, "messageList")
// );
// }
//
// public void addMessageReactionExtensions(MethodCall methodCall, MethodChannel.Result result) {
// Open_im_sdk.addMessageReactionExtensions(
// new OnBaseListener(result, methodCall),
// value(methodCall, "operationID"),
// jsonValue(methodCall, "message"),
// jsonValue(methodCall, "list")
// );
// }
//
// public void getMessageListSomeReactionExtensions(MethodCall methodCall, MethodChannel.Result result) {
// Open_im_sdk.getMessageListSomeReactionExtensions(
// new OnBaseListener(result, methodCall),
// value(methodCall, "operationID"),
// jsonValue(methodCall, "messageList"),
// jsonValue(methodCall, "list")
// );
// }
} }

View File

@@ -1,68 +0,0 @@
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());
}
public void getSubDepartment(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.getSubDepartment(
new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
value(methodCall, "departmentID"),
int2long(methodCall, "offset"),
int2long(methodCall, "count")
);
}
public void getDepartmentMember(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.getDepartmentMember(
new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
value(methodCall, "departmentID"),
int2long(methodCall, "offset"),
int2long(methodCall, "count")
);
}
public void getUserInDepartment(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.getUserInDepartment(
new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
value(methodCall, "userID")
);
}
public void getDepartmentMemberAndSubDepartment(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.getDepartmentMemberAndSubDepartment(
new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
value(methodCall, "departmentID")
);
}
public void getDepartmentInfo(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.getDepartmentInfo(
new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
value(methodCall, "departmentID")
);
}
public void searchOrganization(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.searchOrganization(
new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
jsonValue(methodCall, "searchParams"),
int2long(methodCall, "offset"),
int2long(methodCall, "count")
);
}
}

View File

@@ -10,6 +10,8 @@ public class SignalingManager extends BaseManager {
public void setSignalingListener(MethodCall methodCall, MethodChannel.Result result) { public void setSignalingListener(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.setSignalingListener(new OnSignalingListener()); Open_im_sdk.setSignalingListener(new OnSignalingListener());
result.success(null);
} }
public void signalingInvite(MethodCall methodCall, MethodChannel.Result result) { public void signalingInvite(MethodCall methodCall, MethodChannel.Result result) {
@@ -53,4 +55,77 @@ public class SignalingManager extends BaseManager {
value(methodCall, "operationID"), value(methodCall, "operationID"),
jsonValue(methodCall, "signalingInfo")); 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),
value(methodCall, "operationID"),
jsonValue(methodCall, "info"));
}
public void signalingCreateMeeting(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.signalingCreateMeeting(
new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
jsonValue(methodCall, "info"));
}
public void signalingJoinMeeting(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.signalingJoinMeeting(
new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
jsonValue(methodCall, "info"));
}
public void signalingOperateStream(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.signalingOperateStream(
new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
value(methodCall, "streamType"),
value(methodCall, "roomID"),
value(methodCall, "userID"),
value(methodCall, "mute"),
value(methodCall, "muteAll"));
}
public void signalingGetMeetings(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.signalingGetMeetings(
new OnBaseListener(result, methodCall),
value(methodCall, "operationID"));
}
public void signalingCloseRoom(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.signalingCloseRoom(
new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
value(methodCall, "roomID"));
}
public void signalingSendCustomSignal(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.signalingSendCustomSignal(
new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
value(methodCall, "customInfo"),
value(methodCall, "roomID"));
}
public void getSignalingInvitationInfoStartApp(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.getSignalingInvitationInfoStartApp(
new OnBaseListener(result, methodCall),
value(methodCall, "operationID"));
}
} }

View File

@@ -10,13 +10,15 @@ public class UserManager extends BaseManager {
public void setUserListener(MethodCall methodCall, MethodChannel.Result result) { public void setUserListener(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.setUserListener(new OnUserListener()); Open_im_sdk.setUserListener(new OnUserListener());
result.success(null);
} }
public void getUsersInfo(MethodCall methodCall, MethodChannel.Result result) { public void getUsersInfo(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.getUsersInfo( Open_im_sdk.getUsersInfo(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
jsonValue(methodCall, "uidList")); jsonValue(methodCall, "userIDList"));
} }
public void setSelfInfo(MethodCall methodCall, MethodChannel.Result result) { public void setSelfInfo(MethodCall methodCall, MethodChannel.Result result) {

View File

@@ -1,31 +0,0 @@
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());
}
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"));
}
}

View File

@@ -33,6 +33,7 @@ public class CommonUtil {
} }
public synchronized static <T> void emitEvent(String method, String type, Object errCode, String errMsg, T data) { public synchronized static <T> void emitEvent(String method, String type, Object errCode, String errMsg, T data) {
String threadName = Thread.currentThread().getName();
runMainThread(() -> { runMainThread(() -> {
Map<String, Object> res = new ArrayMap<>(); Map<String, Object> res = new ArrayMap<>();
if (null != type) { if (null != type) {
@@ -47,7 +48,7 @@ public class CommonUtil {
if (null != errMsg) { if (null != errMsg) {
res.put("errMsg", errMsg); res.put("errMsg", errMsg);
} }
Log.i("F-OpenIMSDK(native call flutter)", "{ method:" + method + ", type:" + type + " }"); Log.i("F-OpenIMSDK(native call flutter)", "thread: " + threadName + " { method:" + method + ", type:" + type + " }");
FlutterOpenimSdkPlugin.channel.invokeMethod(method, res); FlutterOpenimSdkPlugin.channel.invokeMethod(method, res);
}); });
} }

View File

@@ -21,6 +21,6 @@
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1.0</string> <string>1.0</string>
<key>MinimumOSVersion</key> <key>MinimumOSVersion</key>
<string>9.0</string> <string>11.0</string>
</dict> </dict>
</plist> </plist>

View File

@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project # Uncomment this line to define a global platform for your project
# platform :ios, '9.0' platform :ios, '11.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency. # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true' ENV['COCOAPODS_DISABLE_STATS'] = 'true'

29
example/ios/Podfile.lock Normal file
View File

@@ -0,0 +1,29 @@
PODS:
- Flutter (1.0.0)
- flutter_openim_sdk (0.0.1):
- Flutter
- OpenIMSDKCore (= 3.0.0-e)
- OpenIMSDKCore (3.0.0-e)
DEPENDENCIES:
- Flutter (from `Flutter`)
- flutter_openim_sdk (from `.symlinks/plugins/flutter_openim_sdk/ios`)
SPEC REPOS:
trunk:
- OpenIMSDKCore
EXTERNAL SOURCES:
Flutter:
:path: Flutter
flutter_openim_sdk:
:path: ".symlinks/plugins/flutter_openim_sdk/ios"
SPEC CHECKSUMS:
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
flutter_openim_sdk: 9b4a8c3f8bc581249d074c4090b32d743adee0e0
OpenIMSDKCore: b6b5620eb31da76b9c0142e703dff2924341871a
PODFILE CHECKSUM: 7368163408c647b7eb699d0d788ba6718e18fb8d
COCOAPODS: 1.11.2

View File

@@ -3,14 +3,14 @@
archiveVersion = 1; archiveVersion = 1;
classes = { classes = {
}; };
objectVersion = 51; objectVersion = 54;
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
6F7F8B794B6D663E7A65A104 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1971A63CCEC4B744C25980F8 /* Pods_Runner.framework */; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
79CF11091A38454F94DA1EB4 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2F48A41A58786A29BEEBCFE3 /* Pods_Runner.framework */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
@@ -30,16 +30,16 @@
/* End PBXCopyFilesBuildPhase section */ /* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
076751BE520B721535096B75 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; }; 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
1971A63CCEC4B744C25980F8 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 2F48A41A58786A29BEEBCFE3 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
3A6AB9CCD90A2F5C2CE719D0 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
3F8F3496860058CED33C418C /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
564E6205C72C7CB32AC49601 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
7CF14C3CACE83F04F858C9EC /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; }; 85A1617DD2AFC45DFFDD8B11 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -54,17 +54,17 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
6F7F8B794B6D663E7A65A104 /* Pods_Runner.framework in Frameworks */, 79CF11091A38454F94DA1EB4 /* Pods_Runner.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
/* End PBXFrameworksBuildPhase section */ /* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */ /* Begin PBXGroup section */
4B877210D623EE0FDE18A08F /* Frameworks */ = { 0EDFEBEB76AE7FAFA44EF2AF /* Frameworks */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
1971A63CCEC4B744C25980F8 /* Pods_Runner.framework */, 2F48A41A58786A29BEEBCFE3 /* Pods_Runner.framework */,
); );
name = Frameworks; name = Frameworks;
sourceTree = "<group>"; sourceTree = "<group>";
@@ -87,7 +87,7 @@
97C146F01CF9000F007C117D /* Runner */, 97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */, 97C146EF1CF9000F007C117D /* Products */,
E653626F5A38799455FF26C4 /* Pods */, E653626F5A38799455FF26C4 /* Pods */,
4B877210D623EE0FDE18A08F /* Frameworks */, 0EDFEBEB76AE7FAFA44EF2AF /* Frameworks */,
); );
sourceTree = "<group>"; sourceTree = "<group>";
}; };
@@ -117,9 +117,9 @@
E653626F5A38799455FF26C4 /* Pods */ = { E653626F5A38799455FF26C4 /* Pods */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
7CF14C3CACE83F04F858C9EC /* Pods-Runner.debug.xcconfig */, 85A1617DD2AFC45DFFDD8B11 /* Pods-Runner.debug.xcconfig */,
3A6AB9CCD90A2F5C2CE719D0 /* Pods-Runner.release.xcconfig */, 3F8F3496860058CED33C418C /* Pods-Runner.release.xcconfig */,
076751BE520B721535096B75 /* Pods-Runner.profile.xcconfig */, 564E6205C72C7CB32AC49601 /* Pods-Runner.profile.xcconfig */,
); );
path = Pods; path = Pods;
sourceTree = "<group>"; sourceTree = "<group>";
@@ -131,7 +131,7 @@
isa = PBXNativeTarget; isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = ( buildPhases = (
FA9CAD2EF743D14467F7D993 /* [CP] Check Pods Manifest.lock */, DFE84742E2B41158E8703A14 /* [CP] Check Pods Manifest.lock */,
9740EEB61CF901F6004384FC /* Run Script */, 9740EEB61CF901F6004384FC /* Run Script */,
97C146EA1CF9000F007C117D /* Sources */, 97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */, 97C146EB1CF9000F007C117D /* Frameworks */,
@@ -198,6 +198,7 @@
/* Begin PBXShellScriptBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
); );
@@ -212,6 +213,7 @@
}; };
9740EEB61CF901F6004384FC /* Run Script */ = { 9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
); );
@@ -224,7 +226,7 @@
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
}; };
FA9CAD2EF743D14467F7D993 /* [CP] Check Pods Manifest.lock */ = { DFE84742E2B41158E8703A14 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
@@ -322,7 +324,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0; IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos; SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos; SUPPORTED_PLATFORMS = iphoneos;
@@ -346,7 +348,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
PRODUCT_BUNDLE_IDENTIFIER = io.openim.flutterOpenimSdkExample; PRODUCT_BUNDLE_IDENTIFIER = cn.rentsoft.uni;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
@@ -402,7 +404,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0; IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = YES; MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos; SDKROOT = iphoneos;
@@ -452,7 +454,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0; IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos; SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos; SUPPORTED_PLATFORMS = iphoneos;
@@ -478,7 +480,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
PRODUCT_BUNDLE_IDENTIFIER = io.openim.flutterOpenimSdkExample; PRODUCT_BUNDLE_IDENTIFIER = cn.rentsoft.uni;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
@@ -502,7 +504,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
PRODUCT_BUNDLE_IDENTIFIER = io.openim.flutterOpenimSdkExample; PRODUCT_BUNDLE_IDENTIFIER = cn.rentsoft.uni;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;

View File

@@ -1,122 +1,103 @@
{ {
"images" : [ "images" : [
{ {
"size" : "20x20",
"idiom" : "iphone", "idiom" : "iphone",
"filename" : "Icon-App-20x20@2x.png", "scale" : "2x",
"scale" : "2x" "size" : "20x20"
}, },
{ {
"size" : "20x20",
"idiom" : "iphone", "idiom" : "iphone",
"filename" : "Icon-App-20x20@3x.png", "scale" : "3x",
"scale" : "3x" "size" : "20x20"
}, },
{ {
"size" : "29x29",
"idiom" : "iphone", "idiom" : "iphone",
"filename" : "Icon-App-29x29@1x.png", "scale" : "1x",
"scale" : "1x" "size" : "29x29"
}, },
{ {
"size" : "29x29",
"idiom" : "iphone", "idiom" : "iphone",
"filename" : "Icon-App-29x29@2x.png", "scale" : "2x",
"scale" : "2x" "size" : "29x29"
}, },
{ {
"size" : "29x29",
"idiom" : "iphone", "idiom" : "iphone",
"filename" : "Icon-App-29x29@3x.png", "scale" : "3x",
"scale" : "3x" "size" : "29x29"
}, },
{ {
"size" : "40x40",
"idiom" : "iphone", "idiom" : "iphone",
"filename" : "Icon-App-40x40@2x.png", "scale" : "2x",
"scale" : "2x" "size" : "40x40"
}, },
{ {
"size" : "40x40",
"idiom" : "iphone", "idiom" : "iphone",
"filename" : "Icon-App-40x40@3x.png", "scale" : "3x",
"scale" : "3x" "size" : "40x40"
}, },
{ {
"size" : "60x60",
"idiom" : "iphone", "idiom" : "iphone",
"filename" : "Icon-App-60x60@2x.png", "scale" : "2x",
"scale" : "2x" "size" : "60x60"
}, },
{ {
"size" : "60x60",
"idiom" : "iphone", "idiom" : "iphone",
"filename" : "Icon-App-60x60@3x.png", "scale" : "3x",
"scale" : "3x" "size" : "60x60"
}, },
{ {
"size" : "20x20",
"idiom" : "ipad", "idiom" : "ipad",
"filename" : "Icon-App-20x20@1x.png", "scale" : "1x",
"scale" : "1x" "size" : "20x20"
}, },
{ {
"size" : "20x20",
"idiom" : "ipad", "idiom" : "ipad",
"filename" : "Icon-App-20x20@2x.png", "scale" : "2x",
"scale" : "2x" "size" : "20x20"
}, },
{ {
"size" : "29x29",
"idiom" : "ipad", "idiom" : "ipad",
"filename" : "Icon-App-29x29@1x.png", "scale" : "1x",
"scale" : "1x" "size" : "29x29"
}, },
{ {
"size" : "29x29",
"idiom" : "ipad", "idiom" : "ipad",
"filename" : "Icon-App-29x29@2x.png", "scale" : "2x",
"scale" : "2x" "size" : "29x29"
}, },
{ {
"size" : "40x40",
"idiom" : "ipad", "idiom" : "ipad",
"filename" : "Icon-App-40x40@1x.png", "scale" : "1x",
"scale" : "1x" "size" : "40x40"
}, },
{ {
"size" : "40x40",
"idiom" : "ipad", "idiom" : "ipad",
"filename" : "Icon-App-40x40@2x.png", "scale" : "2x",
"scale" : "2x" "size" : "40x40"
}, },
{ {
"size" : "76x76",
"idiom" : "ipad", "idiom" : "ipad",
"filename" : "Icon-App-76x76@1x.png", "scale" : "1x",
"scale" : "1x" "size" : "76x76"
}, },
{ {
"size" : "76x76",
"idiom" : "ipad", "idiom" : "ipad",
"filename" : "Icon-App-76x76@2x.png", "scale" : "2x",
"scale" : "2x" "size" : "76x76"
}, },
{ {
"size" : "83.5x83.5",
"idiom" : "ipad", "idiom" : "ipad",
"filename" : "Icon-App-83.5x83.5@2x.png", "scale" : "2x",
"scale" : "2x" "size" : "83.5x83.5"
}, },
{ {
"size" : "1024x1024",
"idiom" : "ios-marketing", "idiom" : "ios-marketing",
"filename" : "Icon-App-1024x1024@1x.png", "scale" : "1x",
"scale" : "1x" "size" : "1024x1024"
} }
], ],
"info" : { "info" : {
"version" : 1, "author" : "xcode",
"author" : "xcode" "version" : 1
} }
} }

View File

@@ -2,22 +2,19 @@
"images" : [ "images" : [
{ {
"idiom" : "universal", "idiom" : "universal",
"filename" : "LaunchImage.png",
"scale" : "1x" "scale" : "1x"
}, },
{ {
"idiom" : "universal", "idiom" : "universal",
"filename" : "LaunchImage@2x.png",
"scale" : "2x" "scale" : "2x"
}, },
{ {
"idiom" : "universal", "idiom" : "universal",
"filename" : "LaunchImage@3x.png",
"scale" : "3x" "scale" : "3x"
} }
], ],
"info" : { "info" : {
"version" : 1, "author" : "xcode",
"author" : "xcode" "version" : 1
} }
} }

View File

@@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string> <string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
@@ -22,6 +24,8 @@
<string>$(FLUTTER_BUILD_NUMBER)</string> <string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
<true/> <true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UILaunchStoryboardName</key> <key>UILaunchStoryboardName</key>
<string>LaunchScreen</string> <string>LaunchScreen</string>
<key>UIMainStoryboardFile</key> <key>UIMainStoryboardFile</key>

View File

@@ -1,5 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
void main() { void main() {
runApp(MyApp()); runApp(MyApp());
@@ -14,6 +14,13 @@ class _MyAppState extends State<MyApp> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
OpenIM.iMManager.initSDK(
platformID: 1,
apiAddr: '',
wsAddr: '',
dataDir: '/',
objectStorage: 'minio',
listener: OnConnectListener());
} }
@override @override

View File

@@ -5,58 +5,58 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: async name: async
sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.8.2" version: "2.10.0"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
name: boolean_selector name: boolean_selector
sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.0" version: "2.1.1"
characters: characters:
dependency: transitive dependency: transitive
description: description:
name: characters name: characters
sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.2.0" version: "1.2.1"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.1"
clock: clock:
dependency: transitive dependency: transitive
description: description:
name: clock name: clock
sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.0" version: "1.1.1"
collection: collection:
dependency: transitive dependency: transitive
description: description:
name: collection name: collection
sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.16.0" version: "1.17.0"
cupertino_icons: cupertino_icons:
dependency: "direct main" dependency: "direct main"
description: description:
name: cupertino_icons name: cupertino_icons
sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.3" version: "1.0.5"
fake_async: fake_async:
dependency: transitive dependency: transitive
description: description:
name: fake_async name: fake_async
sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78"
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.3.0" version: "1.3.1"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
@@ -68,40 +68,52 @@ packages:
path: ".." path: ".."
relative: true relative: true
source: path source: path
version: "2.1.0+1" version: "3.0.0"
flutter_test: flutter_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
js:
dependency: transitive
description:
name: js
sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7"
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.6.5"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
name: matcher name: matcher
sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72"
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.12.11" version: "0.12.13"
material_color_utilities: material_color_utilities:
dependency: transitive dependency: transitive
description: description:
name: material_color_utilities name: material_color_utilities
sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.1.4" version: "0.2.0"
meta: meta:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42"
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.7.0" version: "1.8.0"
path: path:
dependency: transitive dependency: transitive
description: description:
name: path name: path
sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.8.1" version: "1.8.2"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter
@@ -111,51 +123,58 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: source_span name: source_span
sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.8.2" version: "1.9.1"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
name: stack_trace name: stack_trace
sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.10.0" version: "1.11.0"
stream_channel: stream_channel:
dependency: transitive dependency: transitive
description: description:
name: stream_channel name: stream_channel
sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8"
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.0" version: "2.1.1"
string_scanner: string_scanner:
dependency: transitive dependency: transitive
description: description:
name: string_scanner name: string_scanner
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.0" version: "1.2.0"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
description: description:
name: term_glyph name: term_glyph
sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.2.0" version: "1.2.1"
test_api: test_api:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.4.9" version: "0.4.16"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
name: vector_math name: vector_math
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.2" version: "2.1.4"
sdks: sdks:
dart: ">=2.17.0-0 <3.0.0" dart: ">=2.18.0 <3.0.0"
flutter: ">=1.20.0" flutter: ">=1.20.0"

View File

@@ -10,21 +10,22 @@ public class ConversationManager: BaseServiceManager {
self["getConversationListSplit"] = getConversationListSplit self["getConversationListSplit"] = getConversationListSplit
self["getOneConversation"] = getOneConversation self["getOneConversation"] = getOneConversation
self["getMultipleConversation"] = getMultipleConversation self["getMultipleConversation"] = getMultipleConversation
self["deleteConversation"] = deleteConversation
self["setConversationDraft"] = setConversationDraft self["setConversationDraft"] = setConversationDraft
self["pinConversation"] = pinConversation self["pinConversation"] = pinConversation
// self["markSingleMessageHasRead"] = markSingleMessageHasRead self["hideConversation"] = hideConversation
self["markGroupMessageHasRead"] = markGroupMessageHasRead self["markConversationMessageAsRead"] = markConversationMessageAsRead
self["getTotalUnreadMsgCount"] = getTotalUnreadMsgCount self["getTotalUnreadMsgCount"] = getTotalUnreadMsgCount
self["getConversationIDBySessionType"] = getConversationIDBySessionType self["getConversationIDBySessionType"] = getConversationIDBySessionType
self["setConversationRecvMessageOpt"] = setConversationRecvMessageOpt self["setConversationRecvMessageOpt"] = setConversationRecvMessageOpt
self["getConversationRecvMessageOpt"] = getConversationRecvMessageOpt self["getConversationRecvMessageOpt"] = getConversationRecvMessageOpt
self["setOneConversationPrivateChat"] = setOneConversationPrivateChat self["setConversationPrivateChat"] = setConversationPrivateChat
self["deleteConversationFromLocalAndSvr"] = deleteConversationFromLocalAndSvr self["clearConversationAndDeleteAllMsg"] = clearConversationAndDeleteAllMsg
self["deleteConversationAndDeleteAllMsg"] = deleteConversationAndDeleteAllMsg
self["deleteAllConversationFromLocal"] = deleteAllConversationFromLocal self["deleteAllConversationFromLocal"] = deleteAllConversationFromLocal
self["resetConversationGroupAtType"] = resetConversationGroupAtType self["resetConversationGroupAtType"] = resetConversationGroupAtType
self["getAtAllTag"] = getAtAllTag self["getAtAllTag"] = getAtAllTag
self["setGlobalRecvMessageOpt"] = setGlobalRecvMessageOpt self["setGlobalRecvMessageOpt"] = setGlobalRecvMessageOpt
self["setConversationBurnDuration"] = setConversationBurnDuration
} }
func setConversationListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func setConversationListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
@@ -41,17 +42,13 @@ public class ConversationManager: BaseServiceManager {
} }
func getOneConversation(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ 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){ func getMultipleConversation(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetMultipleConversation(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "conversationIDList"]) 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){ func setConversationDraft(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkSetConversationDraft(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"], methodCall[string: "draftText"]) Open_im_sdkSetConversationDraft(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"], methodCall[string: "draftText"])
} }
@@ -60,12 +57,12 @@ public class ConversationManager: BaseServiceManager {
Open_im_sdkPinConversation(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"], methodCall[bool: "isPinned"]) Open_im_sdkPinConversation(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"], methodCall[bool: "isPinned"])
} }
// func markSingleMessageHasRead(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func hideConversation(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
// Open_im_sdkMarkSingleMessageHasRead(BaseCallback(result: result), methodCall[string: "userID"]) Open_im_sdkHideConversation(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"])
// } }
func markGroupMessageHasRead(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func markConversationMessageAsRead(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkMarkGroupMessageHasRead(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"]) Open_im_sdkMarkConversationMessageAsRead(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"])
} }
func getTotalUnreadMsgCount(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func getTotalUnreadMsgCount(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
@@ -73,24 +70,28 @@ public class ConversationManager: BaseServiceManager {
} }
func getConversationIDBySessionType(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ 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) callBack(result, conversationID)
} }
func setConversationRecvMessageOpt(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ 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){ func getConversationRecvMessageOpt(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetConversationRecvMessageOpt(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "conversationIDList"]) Open_im_sdkGetConversationRecvMessageOpt(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "conversationIDList"])
} }
func setOneConversationPrivateChat(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func setConversationPrivateChat(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkSetOneConversationPrivateChat(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"],methodCall[bool: "isPrivate"]) Open_im_sdkSetConversationPrivateChat(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"],methodCall[bool: "isPrivate"])
} }
func deleteConversationFromLocalAndSvr(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func clearConversationAndDeleteAllMsg(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkDeleteConversationFromLocalAndSvr(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"]) Open_im_sdkClearConversationAndDeleteAllMsg(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){ func deleteAllConversationFromLocal(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
@@ -102,12 +103,16 @@ public class ConversationManager: BaseServiceManager {
} }
func getAtAllTag(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ 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){ func setGlobalRecvMessageOpt(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkSetGlobalRecvMessageOpt(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[int: "status"]) Open_im_sdkSetGlobalRecvMessageOpt(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[int: "status"])
} }
func setConversationBurnDuration(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkSetConversationBurnDuration(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"], methodCall[int32: "burnDuration"])
}
} }

View File

@@ -8,8 +8,8 @@ public class FriendshipManager: BaseServiceManager {
self["setFriendListener"] = setFriendListener self["setFriendListener"] = setFriendListener
self["getFriendsInfo"] = getFriendsInfo self["getFriendsInfo"] = getFriendsInfo
self["addFriend"] = addFriend self["addFriend"] = addFriend
self["getRecvFriendApplicationList"] = getRecvFriendApplicationList self["getFriendApplicationListAsRecipient"] = getFriendApplicationListAsRecipient
self["getSendFriendApplicationList"] = getSendFriendApplicationList self["getFriendApplicationListAsApplicant"] = getFriendApplicationListAsApplicant
self["getFriendList"] = getFriendList self["getFriendList"] = getFriendList
self["setFriendRemark"] = setFriendRemark self["setFriendRemark"] = setFriendRemark
self["addBlacklist"] = addBlacklist self["addBlacklist"] = addBlacklist
@@ -20,9 +20,6 @@ public class FriendshipManager: BaseServiceManager {
self["acceptFriendApplication"] = acceptFriendApplication self["acceptFriendApplication"] = acceptFriendApplication
self["refuseFriendApplication"] = refuseFriendApplication self["refuseFriendApplication"] = refuseFriendApplication
self["searchFriends"] = searchFriends self["searchFriends"] = searchFriends
// self["forceSyncFriendApplication"] = forceSyncFriendApplication
// self["forceSyncFriend"] = forceSyncFriend
// self["forceSyncBlackList"] = forceSyncBlackList
} }
func setFriendListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func setFriendListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
@@ -31,19 +28,19 @@ public class FriendshipManager: BaseServiceManager {
} }
func getFriendsInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ 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){ func addFriend(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkAddFriend(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString()) Open_im_sdkAddFriend(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString())
} }
func getRecvFriendApplicationList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func getFriendApplicationListAsRecipient(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetRecvFriendApplicationList(BaseCallback(result: result), methodCall[string: "operationID"]) Open_im_sdkGetFriendApplicationListAsRecipient(BaseCallback(result: result), methodCall[string: "operationID"])
} }
func getSendFriendApplicationList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func getFriendApplicationListAsApplicant(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetSendFriendApplicationList(BaseCallback(result: result), methodCall[string: "operationID"]) Open_im_sdkGetFriendApplicationListAsApplicant(BaseCallback(result: result), methodCall[string: "operationID"])
} }
func getFriendList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func getFriendList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
@@ -55,7 +52,7 @@ public class FriendshipManager: BaseServiceManager {
} }
func addBlacklist(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ 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){ func getBlacklist(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
@@ -63,15 +60,15 @@ public class FriendshipManager: BaseServiceManager {
} }
func removeBlacklist(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ 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){ 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){ 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){ func acceptFriendApplication(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
@@ -85,20 +82,6 @@ public class FriendshipManager: BaseServiceManager {
func searchFriends(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func searchFriends(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkSearchFriends(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "searchParam"]) 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 { 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?) { 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?) { 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?) { 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) 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?) { public func onFriendDeleted(_ friendInfo: String?) {
CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onFriendDeleted", errCode: nil, errMsg: nil, data: friendInfo) 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)
}
} }

View File

@@ -17,8 +17,8 @@ public class GroupManager: BaseServiceManager {
self["joinGroup"] = joinGroup self["joinGroup"] = joinGroup
self["quitGroup"] = quitGroup self["quitGroup"] = quitGroup
self["transferGroupOwner"] = transferGroupOwner self["transferGroupOwner"] = transferGroupOwner
self["getRecvGroupApplicationList"] = getRecvGroupApplicationList self["getGroupApplicationListAsRecipient"] = getGroupApplicationListAsRecipient
self["getSendGroupApplicationList"] = getSendGroupApplicationList self["getGroupApplicationListAsApplicant"] = getGroupApplicationListAsApplicant
self["acceptGroupApplication"] = acceptGroupApplication self["acceptGroupApplication"] = acceptGroupApplication
self["refuseGroupApplication"] = refuseGroupApplication self["refuseGroupApplication"] = refuseGroupApplication
self["dismissGroup"] = dismissGroup self["dismissGroup"] = dismissGroup
@@ -29,6 +29,12 @@ public class GroupManager: BaseServiceManager {
self["setGroupMemberRoleLevel"] = setGroupMemberRoleLevel self["setGroupMemberRoleLevel"] = setGroupMemberRoleLevel
self["getGroupMemberListByJoinTimeFilter"] = getGroupMemberListByJoinTimeFilter self["getGroupMemberListByJoinTimeFilter"] = getGroupMemberListByJoinTimeFilter
self["setGroupVerification"] = setGroupVerification self["setGroupVerification"] = setGroupVerification
self["setGroupLookMemberInfo"] = setGroupLookMemberInfo
self["setGroupApplyMemberFriend"] = setGroupApplyMemberFriend
self["getGroupMemberOwnerAndAdmin"] = getGroupMemberOwnerAndAdmin
self["searchGroupMembers"] = searchGroupMembers
self["setGroupMemberInfo"] = setGroupMemberInfo
self["isJoinGroup"] = isJoinGroup
} }
func setGroupListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func setGroupListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
@@ -37,21 +43,21 @@ public class GroupManager: BaseServiceManager {
} }
func inviteUserToGroup(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func inviteUserToGroup(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkInviteUserToGroup(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "gid"], methodCall[string: "reason"], Open_im_sdkInviteUserToGroup(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[string: "reason"],
methodCall[jsonString: "uidList"]) methodCall[jsonString: "userIDList"])
} }
func kickGroupMember(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func kickGroupMember(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkKickGroupMember(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "gid"], methodCall[string: "reason"], Open_im_sdkKickGroupMember(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[string: "reason"],
methodCall[jsonString: "uidList"]) methodCall[jsonString: "userIDList"])
} }
func getGroupMembersInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ 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){ 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"]) methodCall[int32: "offset"], methodCall[int32: "count"])
} }
@@ -60,59 +66,59 @@ public class GroupManager: BaseServiceManager {
} }
func createGroup(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ 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){ 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){ 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){ func joinGroup(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkJoinGroup(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "gid"], methodCall[string: "reason"]) 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){ 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){ 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){ func getGroupApplicationListAsRecipient(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetRecvGroupApplicationList(BaseCallback(result: result), methodCall[string: "operationID"]) Open_im_sdkGetGroupApplicationListAsRecipient(BaseCallback(result: result), methodCall[string: "operationID"])
} }
func getSendGroupApplicationList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func getGroupApplicationListAsApplicant(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetSendGroupApplicationList(BaseCallback(result: result), methodCall[string: "operationID"]) Open_im_sdkGetGroupApplicationListAsApplicant(BaseCallback(result: result), methodCall[string: "operationID"])
} }
func acceptGroupApplication(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ 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){ 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){ 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){ 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){ 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){ 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){ func searchGroups(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
@@ -130,6 +136,30 @@ public class GroupManager: BaseServiceManager {
func setGroupVerification(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func setGroupVerification(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkSetGroupVerification(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[int32:"needVerification"]) Open_im_sdkSetGroupVerification(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[int32:"needVerification"])
} }
func setGroupLookMemberInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkSetGroupLookMemberInfo(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[int32:"status"])
}
func setGroupApplyMemberFriend(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkSetGroupApplyMemberFriend(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[int32:"status"])
}
func getGroupMemberOwnerAndAdmin(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetGroupMemberOwnerAndAdmin(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"])
}
func searchGroupMembers(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkSearchGroupMembers(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "searchParam"])
}
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 { public class GroupListener: NSObject, Open_im_sdk_callbackOnGroupListenerProtocol {
@@ -156,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) 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?) { public func onGroupInfoChanged(_ s: String?) {
CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onGroupInfoChanged", errCode: nil, errMsg: nil, data: s) CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onGroupInfoChanged", errCode: nil, errMsg: nil, data: s)
} }

View File

@@ -3,21 +3,68 @@ import OpenIMCore
public class IMMananger: BaseServiceManager { public class IMMananger: BaseServiceManager {
let reachability = try? Reachability()
public override func registerHandlers() { public override func registerHandlers() {
super.registerHandlers() super.registerHandlers()
self["initSDK"] = initSDK self["initSDK"] = initSDK
self["login"] = login self["login"] = login
self["logout"] = logout self["logout"] = logout
self["getLoginStatus"] = getLoginStatus self["getLoginStatus"] = getLoginStatus
self["wakeUp"] = wakeUp self["uploadFile"] = uploadFile
self["updateFcmToken"] = updateFcmToken
self["setAppBackgroundStatus"] = setAppBackgroundStatus
self["networkStatusChanged"] = networkStatusChanged
}
fileprivate func addObservers() {
NotificationCenter.default.addObserver(self,
selector: #selector(applicationWillEnterForeground),
name: UIApplication.willEnterForegroundNotification,
object: nil)
NotificationCenter.default.addObserver(self,
selector: #selector(applicationDidEnterBackground),
name: UIApplication.didEnterBackgroundNotification,
object: nil)
if let reachability {
do {
try reachability.startNotifier()
} catch (let e) {
print("reachability: \(e)")
}
reachability.whenReachable = { _ in
Open_im_sdkNetworkStatusChanged(BaseCallback(result: { _ in
}), UUID().uuidString)
}
reachability.whenUnreachable = { _ in
Open_im_sdkNetworkStatusChanged(BaseCallback(result: { _ in
}), UUID().uuidString)
}
}
}
@objc
fileprivate func applicationDidEnterBackground() {
Open_im_sdkSetAppBackgroundStatus(BaseCallback(result: { _ in
}), UUID().uuidString, true)
}
@objc
fileprivate func applicationWillEnterForeground() {
Open_im_sdkSetAppBackgroundStatus(BaseCallback(result: { _ in
}), UUID().uuidString, false)
} }
func initSDK(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func initSDK(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
callBack(result,Open_im_sdkInitSDK(ConnListener(channel: self.channel), methodCall[string: "operationID"], methodCall.toJsonString())) callBack(result,Open_im_sdkInitSDK(ConnListener(channel: self.channel), methodCall[string: "operationID"], methodCall.toJsonString()))
addObservers()
} }
func login(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { 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) { func logout(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
@@ -25,15 +72,23 @@ public class IMMananger: BaseServiceManager {
} }
func getLoginStatus(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { func getLoginStatus(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
callBack(result, Open_im_sdkGetLoginStatus()) callBack(result, Open_im_sdkGetLoginStatus(methodCall[string: "operationID"]))
} }
func wakeUp(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { func uploadFile(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkWakeUp(BaseCallback(result: result), methodCall[string: "operationID"]) Open_im_sdkUploadFile(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString(), UploadFileListener(channel: self.channel,id: methodCall[string: "id"]))
} }
func uploadImage(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { func updateFcmToken(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkUploadImage(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "path"], methodCall[string: "token"], methodCall[string: "obj"]) Open_im_sdkUpdateFcmToken(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "fcmToken"])
}
func setAppBackgroundStatus(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkSetAppBackgroundStatus(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[bool: "isBackground"])
}
func networkStatusChanged(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkNetworkStatusChanged(BaseCallback(result: result), methodCall[string: "operationID"])
} }
} }
@@ -64,3 +119,79 @@ public class ConnListener: NSObject, Open_im_sdk_callbackOnConnListenerProtocol
CommonUtil.emitEvent(channel: self.channel, method: "connectListener", type: "onUserTokenExpired", errCode: nil, errMsg: nil, data: nil) CommonUtil.emitEvent(channel: self.channel, method: "connectListener", type: "onUserTokenExpired", errCode: nil, errMsg: nil, data: nil)
} }
} }
public class UploadFileListener: NSObject, Open_im_sdk_callbackUploadFileCallbackProtocol {
private let channel:FlutterMethodChannel
private let id: String
init(channel:FlutterMethodChannel, id: String) {
self.channel = channel
self.id = id
}
public func complete(_ size: Int64, url: String?, typ: Int) {
var values: [String: Any] = [:]
values["id"] = id
values["size"] = size
values["url"] = url
values["type"] = typ
CommonUtil.emitEvent(channel: channel, method: "uploadFileListener", type: "complete", errCode: nil, errMsg: nil, data: values)
}
public func hashPartComplete(_ partsHash: String?, fileHash: String?) {
var values: [String: Any] = [:]
values["id"] = id
values["partHash"] = partsHash
values["fileHash"] = fileHash
CommonUtil.emitEvent(channel: channel, method: "uploadFileListener", type: "hashPartComplete", errCode: nil, errMsg: nil, data: values)
}
public func hashPartProgress(_ index: Int, size: Int64, partHash: String?) {
var values: [String: Any] = [:]
values["id"] = id
values["index"] = index
values["size"] = size
values["partHash"] = partHash
CommonUtil.emitEvent(channel: channel, method: "uploadFileListener", type: "hashPartProgress", errCode: nil, errMsg: nil, data: values)
}
public func open(_ size: Int64) {
var values: [String: Any] = [:]
values["id"] = id
values["size"] = size
CommonUtil.emitEvent(channel: channel, method: "uploadFileListener", type: "open", errCode: nil, errMsg: nil, data: values)
}
public func partSize(_ partSize: Int64, num: Int) {
var values: [String: Any] = [:]
values["id"] = id
values["partSize"] = partSize
values["num"] = num
CommonUtil.emitEvent(channel: channel, method: "uploadFileListener", type: "partSize", errCode: nil, errMsg: nil, data: values)
}
public func uploadComplete(_ fileSize: Int64, streamSize: Int64, storageSize: Int64) {
var values: [String: Any] = [:]
values["id"] = id
values["fileSize"] = fileSize
values["streamSize"] = streamSize
values["storageSize"] = storageSize
CommonUtil.emitEvent(channel: channel, method: "uploadFileListener", type: "uploadProgress", errCode: nil, errMsg: nil, data: values)
}
public func uploadID(_ uploadID: String?) {
var values: [String: Any] = [:]
values["id"] = id
values["uploadID"] = uploadID
CommonUtil.emitEvent(channel: channel, method: "uploadFileListener", type: "uploadID", errCode: nil, errMsg: nil, data: values)
}
public func uploadPartComplete(_ index: Int, partSize: Int64, partHash: String?) {
var values: [String: Any] = [:]
values["id"] = id
values["index"] = index
values["partSize"] = partSize
values["partHash"] = partHash
CommonUtil.emitEvent(channel: channel, method: "uploadFileListener", type: "uploadPartComplete", errCode: nil, errMsg: nil, data: values)
}
}

View File

@@ -9,13 +9,14 @@ public class MessageManager: BaseServiceManager {
super.registerHandlers() super.registerHandlers()
self["setAdvancedMsgListener"] = setAdvancedMsgListener self["setAdvancedMsgListener"] = setAdvancedMsgListener
self["sendMessage"] = sendMessage self["sendMessage"] = sendMessage
self["getHistoryMessageList"] = getHistoryMessageList
self["revokeMessage"] = revokeMessage self["revokeMessage"] = revokeMessage
self["deleteMessageFromLocalStorage"] = deleteMessageFromLocalStorage self["deleteMessageFromLocalStorage"] = deleteMessageFromLocalStorage
self["deleteMessageFromLocalAndSvr"] = deleteMessageFromLocalAndSvr
self["deleteAllMsgFromLocal"] = deleteAllMsgFromLocal
self["deleteAllMsgFromLocalAndSvr"] = deleteAllMsgFromLocalAndSvr
self["insertSingleMessageToLocalStorage"] = insertSingleMessageToLocalStorage self["insertSingleMessageToLocalStorage"] = insertSingleMessageToLocalStorage
self["insertGroupMessageToLocalStorage"] = insertGroupMessageToLocalStorage self["insertGroupMessageToLocalStorage"] = insertGroupMessageToLocalStorage
self["markC2CMessageAsRead"] = markC2CMessageAsRead self["markMessagesAsReadByMsgID"] = markMessagesAsReadByMsgID
self["markGroupMessageAsRead"] = markGroupMessageAsRead
self["typingStatusUpdate"] = typingStatusUpdate self["typingStatusUpdate"] = typingStatusUpdate
self["createTextMessage"] = createTextMessage self["createTextMessage"] = createTextMessage
self["createTextAtMessage"] = createTextAtMessage self["createTextAtMessage"] = createTextAtMessage
@@ -34,16 +35,25 @@ public class MessageManager: BaseServiceManager {
self["createQuoteMessage"] = createQuoteMessage self["createQuoteMessage"] = createQuoteMessage
self["createCardMessage"] = createCardMessage self["createCardMessage"] = createCardMessage
self["createFaceMessage"] = createFaceMessage self["createFaceMessage"] = createFaceMessage
self["clearC2CHistoryMessage"] = clearC2CHistoryMessage self["createAdvancedTextMessage"] = createAdvancedTextMessage
self["clearGroupHistoryMessage"] = clearGroupHistoryMessage self["createAdvancedQuoteMessage"] = createAdvancedQuoteMessage
self["searchLocalMessages"] = searchLocalMessages self["searchLocalMessages"] = searchLocalMessages
self["deleteMessageFromLocalAndSvr"] = deleteMessageFromLocalAndSvr self["clearConversationAndDeleteAllMsg"] = clearConversationAndDeleteAllMsg
self["deleteAllMsgFromLocal"] = deleteAllMsgFromLocal
self["deleteAllMsgFromLocalAndSvr"] = deleteAllMsgFromLocalAndSvr self["getAdvancedHistoryMessageList"] = getAdvancedHistoryMessageList
self["markMessageAsReadByConID"] = markMessageAsReadByConID self["getAdvancedHistoryMessageListReverse"] = getAdvancedHistoryMessageListReverse
self["clearC2CHistoryMessageFromLocalAndSvr"] = clearC2CHistoryMessageFromLocalAndSvr
self["clearGroupHistoryMessageFromLocalAndSvr"] = clearGroupHistoryMessageFromLocalAndSvr self["findMessageList"] = findMessageList
self["getHistoryMessageListReverse"] = getHistoryMessageListReverse
self["sendMessageNotOss"] = sendMessageNotOss
self["createImageMessageByURL"] = createImageMessageByURL
self["createSoundMessageByURL"] = createSoundMessageByURL
self["createVideoMessageByURL"] = createVideoMessageByURL
self["createFileMessageByURL"] = createFileMessageByURL
self["setCustomBusinessListener"] = setCustomBusinessListener
self["setMessageKvInfoListener"] = setMessageKvInfoListener
} }
func setAdvancedMsgListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func setAdvancedMsgListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
@@ -59,18 +69,25 @@ public class MessageManager: BaseServiceManager {
methodCall[string: "groupID"], methodCall[jsonString: "offlinePushInfo"]) 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){ 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){ 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){ func insertSingleMessageToLocalStorage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkInsertSingleMessageToLocalStorage(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "message"], Open_im_sdkInsertSingleMessageToLocalStorage(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "message"],
@@ -82,12 +99,8 @@ public class MessageManager: BaseServiceManager {
methodCall[string: "groupID"], methodCall[string: "senderID"]) methodCall[string: "groupID"], methodCall[string: "senderID"])
} }
func markC2CMessageAsRead(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func markMessagesAsReadByMsgID(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkMarkC2CMessageAsRead(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "userID"], methodCall[jsonString: "messageIDList"]) Open_im_sdkMarkMessagesAsReadByMsgID(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"], 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 typingStatusUpdate(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func typingStatusUpdate(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
@@ -174,44 +187,68 @@ public class MessageManager: BaseServiceManager {
callBack(result, Open_im_sdkCreateFaceMessage(methodCall[string: "operationID"], methodCall[int: "index"], methodCall[string: "data"])) callBack(result, Open_im_sdkCreateFaceMessage(methodCall[string: "operationID"], methodCall[int: "index"], methodCall[string: "data"]))
} }
func clearC2CHistoryMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func createAdvancedTextMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkClearC2CHistoryMessage(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "userID"]) let prama = Open_im_sdkCreateAdvancedTextMessage(methodCall[string: "operationID"], methodCall[string: "text"], methodCall[jsonString: "richMessageInfoList"])
callBack(result, prama)
} }
func clearGroupHistoryMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func createAdvancedQuoteMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkClearGroupHistoryMessage(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"]) let prama = Open_im_sdkCreateAdvancedQuoteMessage(methodCall[string: "operationID"], methodCall[string: "quoteText"], methodCall[jsonString: "quoteMessage"], methodCall[jsonString: "richMessageInfoList"])
callBack(result, prama)
} }
func searchLocalMessages(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func searchLocalMessages(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkSearchLocalMessages(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "filter"]) Open_im_sdkSearchLocalMessages(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "filter"])
} }
func deleteMessageFromLocalAndSvr(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { func clearConversationAndDeleteAllMsg(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkDeleteMessageFromLocalAndSvr(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString()) Open_im_sdkClearConversationAndDeleteAllMsg(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"])
} }
func deleteAllMsgFromLocal(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { func getAdvancedHistoryMessageList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkDeleteAllMsgFromLocal(BaseCallback(result: result), methodCall[string: "operationID"]) Open_im_sdkGetAdvancedHistoryMessageList(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString())
} }
func deleteAllMsgFromLocalAndSvr(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { func getAdvancedHistoryMessageListReverse(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkDeleteAllMsgFromLocalAndSvr(BaseCallback(result: result), methodCall[string: "operationID"]) Open_im_sdkGetAdvancedHistoryMessageListReverse(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString())
} }
func markMessageAsReadByConID(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkMarkMessageAsReadByConID(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"], methodCall[jsonString: "messageIDList"]) func findMessageList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkFindMessageList(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "searchParams"])
} }
func clearC2CHistoryMessageFromLocalAndSvr(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func sendMessageNotOss(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkClearC2CHistoryMessageFromLocalAndSvr(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "userID"]) let sendMsgProgressListener: SendMsgProgressListener = SendMsgProgressListener(channel: channel,result: result,methodCall: methodCall)
Open_im_sdkSendMessageNotOss(sendMsgProgressListener, methodCall[string: "operationID"], methodCall[jsonString: "message"], methodCall[string: "userID"],
methodCall[string: "groupID"], methodCall[jsonString: "offlinePushInfo"])
} }
func clearGroupHistoryMessageFromLocalAndSvr(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func createImageMessageByURL(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkClearGroupHistoryMessageFromLocalAndSvr(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"]) callBack(result, Open_im_sdkCreateImageMessageByURL(methodCall[string: "operationID"], methodCall[jsonString: "sourcePicture"], methodCall[jsonString: "bigPicture"], methodCall[jsonString: "snapshotPicture"]))
} }
func getHistoryMessageListReverse(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func createSoundMessageByURL(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetHistoryMessageListReverse(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString()) callBack(result, Open_im_sdkCreateSoundMessageByURL(methodCall[string: "operationID"], methodCall[jsonString: "soundElem"]))
}
func createVideoMessageByURL(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
callBack(result, Open_im_sdkCreateVideoMessageByURL(methodCall[string: "operationID"], methodCall[jsonString: "videoElem"]))
}
func createFileMessageByURL(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
callBack(result, Open_im_sdkCreateFileMessageByURL(methodCall[string: "operationID"], methodCall[jsonString: "fileElem"]))
}
func setCustomBusinessListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkSetCustomBusinessListener(CustomBusinessListener(channel: channel))
callBack(result)
}
func setMessageKvInfoListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkSetMessageKvInfoListener(MessageKvInfoListener(channel: channel))
callBack(result)
}
} }
public class SendMsgProgressListener: NSObject, Open_im_sdk_callbackSendMsgCallBackProtocol { public class SendMsgProgressListener: NSObject, Open_im_sdk_callbackSendMsgCallBackProtocol {
@@ -252,32 +289,99 @@ public class MessageManager: BaseServiceManager {
self.id = id self.id = id
} }
public func onMsgDeleted(_ message: String?) {
var values: [String: Any] = [:]
values["id"] = id
values["message"] = message
CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onMsgDeleted", errCode: nil, errMsg: nil, data: values);
}
public func onNewRecvMessageRevoked(_ messageRevoked: String?) {
var values: [String: Any] = [:]
values["id"] = id
values["messageRevoked"] = messageRevoked
CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onNewRecvMessageRevoked", errCode: nil, errMsg: nil, data: values)
}
public func onRecvC2CReadReceipt(_ msgReceiptList: String?) { public func onRecvC2CReadReceipt(_ msgReceiptList: String?) {
var values: [String: Any] = [:] var values: [String: Any] = [:]
values["id"] = id values["id"] = id
values["c2cMessageReadReceipt"] = msgReceiptList values["msgReceiptList"] = msgReceiptList
CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onRecvC2CReadReceipt", errCode: nil, errMsg: nil, data: values) CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onRecvC2CReadReceipt", errCode: nil, errMsg: nil, data: values)
} }
public func onRecvGroupReadReceipt(_ groupMsgReceiptList: String?) { public func onRecvGroupReadReceipt(_ groupMsgReceiptList: String?) {
var values: [String: Any] = [:] var values: [String: Any] = [:]
values["id"] = id values["id"] = id
values["groupMessageReadReceipt"] = groupMsgReceiptList values["groupMsgReceiptList"] = groupMsgReceiptList
CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onRecvGroupReadReceipt", errCode: nil, errMsg: nil, data: values) CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onRecvGroupReadReceipt", errCode: nil, errMsg: nil, data: values)
} }
public func onRecvMessageRevoked(_ msgId: String?) { public func onRecvMessageExtensionsAdded(_ msgID: String?, reactionExtensionList: String?) {
var values: [String: Any] = [:] var values: [String: Any] = [:]
values["id"] = id values["id"] = id
values["revokedMessage"] = msgId values["msgID"] = msgID
CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onRecvMessageRevoked", errCode: nil, errMsg: nil, data: values) 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["reactionExtensionList"] = reactionExtensionList
CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onRecvMessageExtensionsChanged", errCode: nil, errMsg: nil, data: values)
}
public func onRecvMessageExtensionsDeleted(_ msgID: String?, reactionExtensionKeyList: String?) {
var values: [String: Any] = [:]
values["id"] = id
values["msgID"] = msgID
values["reactionExtensionKeyList"] = reactionExtensionKeyList
CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onRecvMessageExtensionsDeleted", errCode: nil, errMsg: nil, data: values)
} }
public func onRecvNewMessage(_ message: String?) { public func onRecvNewMessage(_ message: String?) {
var values: [String: Any] = [:] var values: [String: Any] = [:]
values["id"] = id values["id"] = id
values["newMessage"] = message values["message"] = message
CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onRecvNewMessage", errCode: nil, errMsg: nil, data: values) CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onRecvNewMessage", errCode: nil, errMsg: nil, data: values)
} }
public func onRecvOfflineNewMessage(_ message: String?) {
var values: [String: Any] = [:]
values["id"] = id
values["message"] = message
CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onRecvOfflineNewMessage", errCode: nil, errMsg: nil, data: values);
}
}
public class CustomBusinessListener: NSObject, Open_im_sdk_callbackOnCustomBusinessListenerProtocol {
private let channel: FlutterMethodChannel
init(channel: FlutterMethodChannel) {
self.channel = channel
}
public func onRecvCustomBusinessMessage(_ s: String?) {
CommonUtil.emitEvent(channel: channel, method: "customBusinessListener", type: "onRecvCustomBusinessMessage", errCode: nil, errMsg: nil, data: s)
} }
} }
public class MessageKvInfoListener: NSObject, Open_im_sdk_callbackOnMessageKvInfoListenerProtocol {
private let channel: FlutterMethodChannel
init(channel: FlutterMethodChannel) {
self.channel = channel
}
public func onMessageKvInfoChanged(_ s: String?) {
CommonUtil.emitEvent(channel: channel, method: "messageKvInfoListener", type: "onMessageKvInfoChanged", errCode: nil, errMsg: nil, data: s)
}
}

View File

@@ -1,59 +1,59 @@
import Foundation //import Foundation
import OpenIMCore //import OpenIMCore
//
public class OrganizationManager: BaseServiceManager { //public class OrganizationManager: BaseServiceManager {
//
public override func registerHandlers() { // public override func registerHandlers() {
super.registerHandlers() // super.registerHandlers()
self["setOrganizationListener"] = setOrganizationListener // self["setOrganizationListener"] = setOrganizationListener
self["getSubDepartment"] = getSubDepartment // self["getSubDepartment"] = getSubDepartment
self["getDepartmentMember"] = getDepartmentMember // self["getDepartmentMember"] = getDepartmentMember
self["getUserInDepartment"] = getUserInDepartment // self["getUserInDepartment"] = getUserInDepartment
self["getDepartmentMemberAndSubDepartment"] = getDepartmentMemberAndSubDepartment // self["getDepartmentMemberAndSubDepartment"] = getDepartmentMemberAndSubDepartment
self["getDepartmentInfo"] = getDepartmentInfo // self["getDepartmentInfo"] = getDepartmentInfo
self["searchOrganization"] = searchOrganization // self["searchOrganization"] = searchOrganization
} // }
//
func setOrganizationListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ // func setOrganizationListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkSetOrganizationListener(OrganizationListener(channel: channel)) // Open_im_sdkSetOrganizationListener(OrganizationListener(channel: channel))
callBack(result) // callBack(result)
} // }
//
func getSubDepartment(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { // 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"]) // 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) { // 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"]) // 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) { // func getUserInDepartment(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkGetUserInDepartment(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "userID"]) // Open_im_sdkGetUserInDepartment(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "userID"])
} // }
//
func getDepartmentMemberAndSubDepartment(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { // func getDepartmentMemberAndSubDepartment(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkGetDepartmentMemberAndSubDepartment(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "departmentID"]) // Open_im_sdkGetDepartmentMemberAndSubDepartment(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "departmentID"])
} // }
//
func getDepartmentInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { // func getDepartmentInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkGetDepartmentInfo(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "departmentID"]) // Open_im_sdkGetDepartmentInfo(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "departmentID"])
} // }
//
func searchOrganization(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { // func searchOrganization(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkSearchOrganization(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "searchParams"], methodCall[int: "offset"], methodCall[int: "count"]) // 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 { //public class OrganizationListener: NSObject, Open_im_sdk_callbackOnOrganizationListenerProtocol {
//
private let channel:FlutterMethodChannel // private let channel:FlutterMethodChannel
//
init(channel:FlutterMethodChannel) { // init(channel:FlutterMethodChannel) {
self.channel = channel // self.channel = channel
} // }
//
public func onOrganizationUpdated() { // public func onOrganizationUpdated() {
CommonUtil.emitEvent(channel: self.channel, method: "organizationListener", type: "onOrganizationUpdated", errCode: nil, errMsg: nil, data: nil) // CommonUtil.emitEvent(channel: self.channel, method: "organizationListener", type: "onOrganizationUpdated", errCode: nil, errMsg: nil, data: nil)
} // }
//
} //}

View File

@@ -12,6 +12,15 @@ public class SignalingManager: BaseServiceManager {
self["signalingReject"] = signalingReject self["signalingReject"] = signalingReject
self["signalingCancel"] = signalingCancel self["signalingCancel"] = signalingCancel
self["signalingHungUp"] = signalingHungUp 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){ func setSignalingListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
@@ -42,9 +51,47 @@ public class SignalingManager: BaseServiceManager {
func signalingHungUp(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func signalingHungUp(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkSignalingHungUp(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "signalingInfo"]) 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 { public class SignalingListener: NSObject, Open_im_sdk_callbackOnSignalingListenerProtocol {
private let channel:FlutterMethodChannel private let channel:FlutterMethodChannel
init(channel:FlutterMethodChannel) { init(channel:FlutterMethodChannel) {
@@ -83,4 +130,20 @@ public class SignalingListener: NSObject, Open_im_sdk_callbackOnSignalingListene
CommonUtil.emitEvent(channel: channel, method: "signalingListener", type: "onHangUp", errCode: nil, errMsg: nil, data: s) 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)
}
} }

View File

@@ -17,7 +17,7 @@ public class UserManager: BaseServiceManager {
} }
func getUsersInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { 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) { func setSelfInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {

View File

@@ -1,44 +1,44 @@
import Foundation //import Foundation
import OpenIMCore //import OpenIMCore
//
public class WorkMomentsManager: BaseServiceManager { //public class WorkMomentsManager: BaseServiceManager {
//
public override func registerHandlers() { // public override func registerHandlers() {
super.registerHandlers() // super.registerHandlers()
self["setWorkMomentsListener"] = setWorkMomentsListener // self["setWorkMomentsListener"] = setWorkMomentsListener
self["getWorkMomentsUnReadCount"] = getWorkMomentsUnReadCount // self["getWorkMomentsUnReadCount"] = getWorkMomentsUnReadCount
self["getWorkMomentsNotification"] = getWorkMomentsNotification // self["getWorkMomentsNotification"] = getWorkMomentsNotification
self["clearWorkMomentsNotification"] = clearWorkMomentsNotification // self["clearWorkMomentsNotification"] = clearWorkMomentsNotification
} // }
//
func setWorkMomentsListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ // func setWorkMomentsListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkSetWorkMomentsListener(WorkMomentsListener(channel: channel)) // Open_im_sdkSetWorkMomentsListener(WorkMomentsListener(channel: channel))
callBack(result) // callBack(result)
} // }
//
func getWorkMomentsUnReadCount(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { // func getWorkMomentsUnReadCount(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkGetWorkMomentsUnReadCount(BaseCallback(result: result), methodCall[string: "operationID"]) // Open_im_sdkGetWorkMomentsUnReadCount(BaseCallback(result: result), methodCall[string: "operationID"])
} // }
//
func getWorkMomentsNotification(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { // func getWorkMomentsNotification(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkGetWorkMomentsNotification(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[int: "offset"], methodCall[int: "count"]) // Open_im_sdkGetWorkMomentsNotification(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[int: "offset"], methodCall[int: "count"])
} // }
//
func clearWorkMomentsNotification(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { // func clearWorkMomentsNotification(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkClearWorkMomentsNotification(BaseCallback(result: result), methodCall[string: "operationID"]) // Open_im_sdkClearWorkMomentsNotification(BaseCallback(result: result), methodCall[string: "operationID"])
} // }
} //}
//
public class WorkMomentsListener: NSObject, Open_im_sdk_callbackOnWorkMomentsListenerProtocol { //public class WorkMomentsListener: NSObject, Open_im_sdk_callbackOnWorkMomentsListenerProtocol {
//
private let channel:FlutterMethodChannel // private let channel:FlutterMethodChannel
//
init(channel:FlutterMethodChannel) { // init(channel:FlutterMethodChannel) {
self.channel = channel // self.channel = channel
} // }
//
public func onRecvNewNotification() { // public func onRecvNewNotification() {
CommonUtil.emitEvent(channel: self.channel, method: "workMomentsListener", type: "OnRecvNewNotification", errCode: nil, errMsg: nil, data: nil) // CommonUtil.emitEvent(channel: self.channel, method: "workMomentsListener", type: "OnRecvNewNotification", errCode: nil, errMsg: nil, data: nil)
} // }
//
} //}

View File

@@ -0,0 +1,405 @@
/*
Copyright (c) 2014, Ashley Mills
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
import SystemConfiguration
import Foundation
public enum ReachabilityError: Error {
case failedToCreateWithAddress(sockaddr, Int32)
case failedToCreateWithHostname(String, Int32)
case unableToSetCallback(Int32)
case unableToSetDispatchQueue(Int32)
case unableToGetFlags(Int32)
}
@available(*, unavailable, renamed: "Notification.Name.reachabilityChanged")
public let ReachabilityChangedNotification = NSNotification.Name("ReachabilityChangedNotification")
public extension Notification.Name {
static let reachabilityChanged = Notification.Name("reachabilityChanged")
}
public class Reachability {
public typealias NetworkReachable = (Reachability) -> ()
public typealias NetworkUnreachable = (Reachability) -> ()
@available(*, unavailable, renamed: "Connection")
public enum NetworkStatus: CustomStringConvertible {
case notReachable, reachableViaWiFi, reachableViaWWAN
public var description: String {
switch self {
case .reachableViaWWAN: return "Cellular"
case .reachableViaWiFi: return "WiFi"
case .notReachable: return "No Connection"
}
}
}
public enum Connection: CustomStringConvertible {
case unavailable, wifi, cellular
public var description: String {
switch self {
case .cellular: return "Cellular"
case .wifi: return "WiFi"
case .unavailable: return "No Connection"
}
}
@available(*, deprecated, renamed: "unavailable")
public static let none: Connection = .unavailable
}
public var whenReachable: NetworkReachable?
public var whenUnreachable: NetworkUnreachable?
@available(*, deprecated, renamed: "allowsCellularConnection")
public let reachableOnWWAN: Bool = true
/// Set to `false` to force Reachability.connection to .none when on cellular connection (default value `true`)
public var allowsCellularConnection: Bool
// The notification center on which "reachability changed" events are being posted
public var notificationCenter: NotificationCenter = NotificationCenter.default
@available(*, deprecated, renamed: "connection.description")
public var currentReachabilityString: String {
return "\(connection)"
}
@available(*, unavailable, renamed: "connection")
public var currentReachabilityStatus: Connection {
return connection
}
public var connection: Connection {
if flags == nil {
try? setReachabilityFlags()
}
switch flags?.connection {
case .unavailable?, nil: return .unavailable
case .cellular?: return allowsCellularConnection ? .cellular : .unavailable
case .wifi?: return .wifi
}
}
fileprivate var isRunningOnDevice: Bool = {
#if targetEnvironment(simulator)
return false
#else
return true
#endif
}()
fileprivate(set) var notifierRunning = false
fileprivate let reachabilityRef: SCNetworkReachability
fileprivate let reachabilitySerialQueue: DispatchQueue
fileprivate let notificationQueue: DispatchQueue?
fileprivate(set) var flags: SCNetworkReachabilityFlags? {
didSet {
guard flags != oldValue else { return }
notifyReachabilityChanged()
}
}
required public init(reachabilityRef: SCNetworkReachability,
queueQoS: DispatchQoS = .default,
targetQueue: DispatchQueue? = nil,
notificationQueue: DispatchQueue? = .main) {
self.allowsCellularConnection = true
self.reachabilityRef = reachabilityRef
self.reachabilitySerialQueue = DispatchQueue(label: "uk.co.ashleymills.reachability", qos: queueQoS, target: targetQueue)
self.notificationQueue = notificationQueue
}
public convenience init(hostname: String,
queueQoS: DispatchQoS = .default,
targetQueue: DispatchQueue? = nil,
notificationQueue: DispatchQueue? = .main) throws {
guard let ref = SCNetworkReachabilityCreateWithName(nil, hostname) else {
throw ReachabilityError.failedToCreateWithHostname(hostname, SCError())
}
self.init(reachabilityRef: ref, queueQoS: queueQoS, targetQueue: targetQueue, notificationQueue: notificationQueue)
}
public convenience init(queueQoS: DispatchQoS = .default,
targetQueue: DispatchQueue? = nil,
notificationQueue: DispatchQueue? = .main) throws {
var zeroAddress = sockaddr()
zeroAddress.sa_len = UInt8(MemoryLayout<sockaddr>.size)
zeroAddress.sa_family = sa_family_t(AF_INET)
guard let ref = SCNetworkReachabilityCreateWithAddress(nil, &zeroAddress) else {
throw ReachabilityError.failedToCreateWithAddress(zeroAddress, SCError())
}
self.init(reachabilityRef: ref, queueQoS: queueQoS, targetQueue: targetQueue, notificationQueue: notificationQueue)
}
deinit {
stopNotifier()
}
}
public extension Reachability {
// MARK: - *** Notifier methods ***
func startNotifier() throws {
guard !notifierRunning else { return }
let callback: SCNetworkReachabilityCallBack = { (reachability, flags, info) in
guard let info = info else { return }
// `weakifiedReachability` is guaranteed to exist by virtue of our
// retain/release callbacks which we provided to the `SCNetworkReachabilityContext`.
let weakifiedReachability = Unmanaged<ReachabilityWeakifier>.fromOpaque(info).takeUnretainedValue()
// The weak `reachability` _may_ no longer exist if the `Reachability`
// object has since been deallocated but a callback was already in flight.
weakifiedReachability.reachability?.flags = flags
}
let weakifiedReachability = ReachabilityWeakifier(reachability: self)
let opaqueWeakifiedReachability = Unmanaged<ReachabilityWeakifier>.passUnretained(weakifiedReachability).toOpaque()
var context = SCNetworkReachabilityContext(
version: 0,
info: UnsafeMutableRawPointer(opaqueWeakifiedReachability),
retain: { (info: UnsafeRawPointer) -> UnsafeRawPointer in
let unmanagedWeakifiedReachability = Unmanaged<ReachabilityWeakifier>.fromOpaque(info)
_ = unmanagedWeakifiedReachability.retain()
return UnsafeRawPointer(unmanagedWeakifiedReachability.toOpaque())
},
release: { (info: UnsafeRawPointer) -> Void in
let unmanagedWeakifiedReachability = Unmanaged<ReachabilityWeakifier>.fromOpaque(info)
unmanagedWeakifiedReachability.release()
},
copyDescription: { (info: UnsafeRawPointer) -> Unmanaged<CFString> in
let unmanagedWeakifiedReachability = Unmanaged<ReachabilityWeakifier>.fromOpaque(info)
let weakifiedReachability = unmanagedWeakifiedReachability.takeUnretainedValue()
let description = weakifiedReachability.reachability?.description ?? "nil"
return Unmanaged.passRetained(description as CFString)
}
)
if !SCNetworkReachabilitySetCallback(reachabilityRef, callback, &context) {
stopNotifier()
throw ReachabilityError.unableToSetCallback(SCError())
}
if !SCNetworkReachabilitySetDispatchQueue(reachabilityRef, reachabilitySerialQueue) {
stopNotifier()
throw ReachabilityError.unableToSetDispatchQueue(SCError())
}
// Perform an initial check
try setReachabilityFlags()
notifierRunning = true
}
func stopNotifier() {
defer { notifierRunning = false }
SCNetworkReachabilitySetCallback(reachabilityRef, nil, nil)
SCNetworkReachabilitySetDispatchQueue(reachabilityRef, nil)
}
// MARK: - *** Connection test methods ***
@available(*, deprecated, message: "Please use `connection != .none`")
var isReachable: Bool {
return connection != .unavailable
}
@available(*, deprecated, message: "Please use `connection == .cellular`")
var isReachableViaWWAN: Bool {
// Check we're not on the simulator, we're REACHABLE and check we're on WWAN
return connection == .cellular
}
@available(*, deprecated, message: "Please use `connection == .wifi`")
var isReachableViaWiFi: Bool {
return connection == .wifi
}
var description: String {
return flags?.description ?? "unavailable flags"
}
}
fileprivate extension Reachability {
func setReachabilityFlags() throws {
try reachabilitySerialQueue.sync { [unowned self] in
var flags = SCNetworkReachabilityFlags()
if !SCNetworkReachabilityGetFlags(self.reachabilityRef, &flags) {
self.stopNotifier()
throw ReachabilityError.unableToGetFlags(SCError())
}
self.flags = flags
}
}
func notifyReachabilityChanged() {
let notify = { [weak self] in
guard let self = self else { return }
self.connection != .unavailable ? self.whenReachable?(self) : self.whenUnreachable?(self)
self.notificationCenter.post(name: .reachabilityChanged, object: self)
}
// notify on the configured `notificationQueue`, or the caller's (i.e. `reachabilitySerialQueue`)
notificationQueue?.async(execute: notify) ?? notify()
}
}
extension SCNetworkReachabilityFlags {
typealias Connection = Reachability.Connection
var connection: Connection {
guard isReachableFlagSet else { return .unavailable }
// If we're reachable, but not on an iOS device (i.e. simulator), we must be on WiFi
#if targetEnvironment(simulator)
return .wifi
#else
var connection = Connection.unavailable
if !isConnectionRequiredFlagSet {
connection = .wifi
}
if isConnectionOnTrafficOrDemandFlagSet {
if !isInterventionRequiredFlagSet {
connection = .wifi
}
}
if isOnWWANFlagSet {
connection = .cellular
}
return connection
#endif
}
var isOnWWANFlagSet: Bool {
#if os(iOS)
return contains(.isWWAN)
#else
return false
#endif
}
var isReachableFlagSet: Bool {
return contains(.reachable)
}
var isConnectionRequiredFlagSet: Bool {
return contains(.connectionRequired)
}
var isInterventionRequiredFlagSet: Bool {
return contains(.interventionRequired)
}
var isConnectionOnTrafficFlagSet: Bool {
return contains(.connectionOnTraffic)
}
var isConnectionOnDemandFlagSet: Bool {
return contains(.connectionOnDemand)
}
var isConnectionOnTrafficOrDemandFlagSet: Bool {
return !intersection([.connectionOnTraffic, .connectionOnDemand]).isEmpty
}
var isTransientConnectionFlagSet: Bool {
return contains(.transientConnection)
}
var isLocalAddressFlagSet: Bool {
return contains(.isLocalAddress)
}
var isDirectFlagSet: Bool {
return contains(.isDirect)
}
var isConnectionRequiredAndTransientFlagSet: Bool {
return intersection([.connectionRequired, .transientConnection]) == [.connectionRequired, .transientConnection]
}
var description: String {
let W = isOnWWANFlagSet ? "W" : "-"
let R = isReachableFlagSet ? "R" : "-"
let c = isConnectionRequiredFlagSet ? "c" : "-"
let t = isTransientConnectionFlagSet ? "t" : "-"
let i = isInterventionRequiredFlagSet ? "i" : "-"
let C = isConnectionOnTrafficFlagSet ? "C" : "-"
let D = isConnectionOnDemandFlagSet ? "D" : "-"
let l = isLocalAddressFlagSet ? "l" : "-"
let d = isDirectFlagSet ? "d" : "-"
return "\(W)\(R) \(c)\(t)\(i)\(C)\(D)\(l)\(d)"
}
}
/**
`ReachabilityWeakifier` weakly wraps the `Reachability` class
in order to break retain cycles when interacting with CoreFoundation.
CoreFoundation callbacks expect a pair of retain/release whenever an
opaque `info` parameter is provided. These callbacks exist to guard
against memory management race conditions when invoking the callbacks.
#### Race Condition
If we passed `SCNetworkReachabilitySetCallback` a direct reference to our
`Reachability` class without also providing corresponding retain/release
callbacks, then a race condition can lead to crashes when:
- `Reachability` is deallocated on thread X
- A `SCNetworkReachability` callback(s) is already in flight on thread Y
#### Retain Cycle
If we pass `Reachability` to CoreFoundtion while also providing retain/
release callbacks, we would create a retain cycle once CoreFoundation
retains our `Reachability` class. This fixes the crashes and his how
CoreFoundation expects the API to be used, but doesn't play nicely with
Swift/ARC. This cycle would only be broken after manually calling
`stopNotifier()` `deinit` would never be called.
#### ReachabilityWeakifier
By providing both retain/release callbacks and wrapping `Reachability` in
a weak wrapper, we:
- interact correctly with CoreFoundation, thereby avoiding a crash.
See "Memory Management Programming Guide for Core Foundation".
- don't alter the public API of `Reachability.swift` in any way
- still allow for automatic stopping of the notifier on `deinit`.
*/
private class ReachabilityWeakifier {
weak var reachability: Reachability?
init(reachability: Reachability) {
self.reachability = reachability
}
}

View File

@@ -9,8 +9,8 @@ public class SwiftFlutterOpenimSdkPlugin: NSObject, FlutterPlugin {
let groupManager: GroupManager let groupManager: GroupManager
let userManger: UserManager let userManger: UserManager
let signalingManager: SignalingManager let signalingManager: SignalingManager
let workMomentsManager: WorkMomentsManager // let workMomentsManager: WorkMomentsManager
let organizationManager: OrganizationManager // let organizationManager: OrganizationManager
init(channel: FlutterMethodChannel) { init(channel: FlutterMethodChannel) {
self.imManager = IMMananger(channel: channel) self.imManager = IMMananger(channel: channel)
@@ -20,8 +20,8 @@ public class SwiftFlutterOpenimSdkPlugin: NSObject, FlutterPlugin {
self.groupManager = GroupManager(channel: channel) self.groupManager = GroupManager(channel: channel)
self.userManger = UserManager(channel: channel) self.userManger = UserManager(channel: channel)
self.signalingManager = SignalingManager(channel: channel) self.signalingManager = SignalingManager(channel: channel)
self.workMomentsManager = WorkMomentsManager(channel: channel) // self.workMomentsManager = WorkMomentsManager(channel: channel)
self.organizationManager = OrganizationManager(channel: channel) // self.organizationManager = OrganizationManager(channel: channel)
} }
public static func register(with registrar: FlutterPluginRegistrar) { public static func register(with registrar: FlutterPluginRegistrar) {
@@ -47,10 +47,10 @@ public class SwiftFlutterOpenimSdkPlugin: NSObject, FlutterPlugin {
userManger.handleMethod(call: call, result: result) userManger.handleMethod(call: call, result: result)
case "signalingManager": case "signalingManager":
signalingManager.handleMethod(call: call, result: result) signalingManager.handleMethod(call: call, result: result)
case "workMomentsManager": // case "workMomentsManager":
workMomentsManager.handleMethod(call: call, result: result) // workMomentsManager.handleMethod(call: call, result: result)
case "organizationManager": // case "organizationManager":
organizationManager.handleMethod(call: call, result: result) // organizationManager.handleMethod(call: call, result: result)
default: default:
print("Handle ManagerName Error: \(managerName) not found") print("Handle ManagerName Error: \(managerName) not found")
} }

View File

@@ -15,9 +15,9 @@ A new Flutter project.
s.source = { :path => '.' } s.source = { :path => '.' }
s.source_files = 'Classes/**/*' s.source_files = 'Classes/**/*'
s.dependency 'Flutter' s.dependency 'Flutter'
s.platform = :ios, '8.0' s.platform = :ios, '11.0'
s.dependency 'OpenIMSDKCore','2.1.0' s.dependency 'OpenIMSDKCore','3.0.1-e'
s.static_framework = true s.static_framework = true
# s.vendored_frameworks = 'Framework/*.framework' # s.vendored_frameworks = 'Framework/*.framework'
# Flutter.framework does not contain a i386 slice. # Flutter.framework does not contain a i386 slice.

View File

@@ -3,39 +3,41 @@ library flutter_openim_sdk;
export 'src/enum/conversation_type.dart'; export 'src/enum/conversation_type.dart';
export 'src/enum/group_at_type.dart'; export 'src/enum/group_at_type.dart';
export 'src/enum/group_role_level.dart'; export 'src/enum/group_role_level.dart';
export 'src/enum/group_type.dart';
export 'src/enum/group_verification.dart'; export 'src/enum/group_verification.dart';
export 'src/enum/im_platform.dart'; export 'src/enum/im_platform.dart';
export 'src/enum/listener_type.dart'; export 'src/enum/listener_type.dart';
export 'src/enum/login_status.dart';
export 'src/enum/message_status.dart'; export 'src/enum/message_status.dart';
export 'src/enum/message_type.dart'; export 'src/enum/message_type.dart';
export 'src/enum/sdk_error_code.dart';
export 'src/listener/advanced_msg_listener.dart'; export 'src/listener/advanced_msg_listener.dart';
export 'src/listener/connect_listener.dart'; export 'src/listener/connect_listener.dart';
export 'src/listener/conversation_listener.dart'; export 'src/listener/conversation_listener.dart';
export 'src/listener/custom_business_listener.dart';
export 'src/listener/friendship_listener.dart'; export 'src/listener/friendship_listener.dart';
export 'src/listener/group_listener.dart'; export 'src/listener/group_listener.dart';
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/msg_send_progress_listener.dart';
export 'src/listener/organization_listener.dart'; export 'src/listener/upload_file_listener.dart';
export 'src/listener/signaling_listener.dart'; export 'src/listener/signaling_listener.dart';
export 'src/listener/user_listener.dart'; export 'src/listener/user_listener.dart';
export 'src/listener/workmoments_listener.dart';
export 'src/manager/im_conversation_manager.dart'; export 'src/manager/im_conversation_manager.dart';
export 'src/manager/im_friendship_manager.dart'; export 'src/manager/im_friendship_manager.dart';
export 'src/manager/im_group_manager.dart'; export 'src/manager/im_group_manager.dart';
export 'src/manager/im_manager.dart'; export 'src/manager/im_manager.dart';
export 'src/manager/im_message_manager.dart'; export 'src/manager/im_message_manager.dart';
export 'src/manager/im_offline_push_manager.dart';
export 'src/manager/im_organization_manager.dart';
export 'src/manager/im_signaling_manager.dart'; export 'src/manager/im_signaling_manager.dart';
export 'src/manager/im_user_manager.dart'; export 'src/manager/im_user_manager.dart';
export 'src/manager/im_workmoments_manager.dart';
export 'src/models/conversation_info.dart'; export 'src/models/conversation_info.dart';
export 'src/models/group_info.dart'; export 'src/models/group_info.dart';
export 'src/models/meeting_info.dart';
export 'src/models/message.dart'; export 'src/models/message.dart';
export 'src/models/notification_info.dart'; export 'src/models/notification_info.dart';
export 'src/models/organization_info.dart'; export 'src/models/organization_info.dart';
export 'src/models/search_info.dart'; export 'src/models/search_info.dart';
export 'src/models/signaling_info.dart'; export 'src/models/signaling_info.dart';
export 'src/models/user_info.dart'; export 'src/models/user_info.dart';
export 'src/models/workmoments_info.dart';
export 'src/openim.dart'; export 'src/openim.dart';
export 'src/utils.dart'; export 'src/utils.dart';

View File

@@ -3,9 +3,12 @@ class ConversationType {
/// 单聊 /// 单聊
static const single = 1; static const single = 1;
/// 群 /// 群
static const group = 2; static const group = 2;
/// 大群
static const superGroup = 3;
/// 通知 /// 通知
static const notification = 4; static const notification = 4;
} }

View File

@@ -1,11 +1,11 @@
/// 群成员角色 /// 群成员角色
class GroupRoleLevel { 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;
} }

View File

@@ -0,0 +1,8 @@
/// 组类型
class GroupType {
/// 普通群
static const int general = 0;
/// 工作群
static const int work = 2;
}

View File

@@ -10,4 +10,6 @@ class IMPlatform {
static const web = 5; static const web = 5;
static const mini_web = 6; static const mini_web = 6;
static const linux = 7; static const linux = 7;
static const android_pad = 8;
static const ipad = 9;
} }

View File

@@ -1,14 +1,18 @@
/// callback类型 /// callback类型
class ListenerType { class ListenerType {
static final simpleMsgListener = 'simpleMsgListener'; static const simpleMsgListener = 'simpleMsgListener';
static final connectListener = 'connectListener'; static const connectListener = 'connectListener';
static final userListener = 'userListener'; static const userListener = 'userListener';
static final groupListener = 'groupListener'; static const groupListener = 'groupListener';
static final advancedMsgListener = 'advancedMsgListener'; static const advancedMsgListener = 'advancedMsgListener';
static final conversationListener = 'conversationListener'; static const conversationListener = 'conversationListener';
static final friendListener = 'friendListener'; static const friendListener = 'friendListener';
static final signalingListener = 'signalingListener'; static const signalingListener = 'signalingListener';
static final msgSendProgressListener = "msgSendProgressListener"; static const msgSendProgressListener = "msgSendProgressListener";
static final workMomentsListener = "workMomentsListener"; static const workMomentsListener = "workMomentsListener";
static final organizationListener = "organizationListener"; static const organizationListener = "organizationListener";
static const customBusinessListener = "customBusinessListener";
static const messageKvInfoListener = "messageKvInfoListener";
static const listenerForService = "listenerForService";
static const uploadFileListener = "uploadFileListener";
} }

View File

@@ -0,0 +1,5 @@
class LoginStatus {
static const logout = 1;
static const logging = 2;
static const logged = 3;
}

View File

@@ -30,9 +30,6 @@ class MessageType {
/// 自定义 /// 自定义
static const custom = 110; static const custom = 110;
/// 撤回
static const revoke = 111;
/// 已读回执 /// 已读回执
static const has_read_receipt = 112; static const has_read_receipt = 112;
@@ -45,6 +42,16 @@ class MessageType {
/// 自定义表情 /// 自定义表情
static const custom_face = 115; static const custom_face = 115;
/// 群消息已读回执
static const groupHasReadReceipt = 116;
/// 富文本消息
static const advancedText = 117;
static const customMsgNotTriggerConversation = 119;
static const customMsgOnlineOnly = 120;
/// 通知类型 /// 通知类型
static const notificationBegin = 1000; static const notificationBegin = 1000;
@@ -141,6 +148,12 @@ class MessageType {
/// 群成员信息改变 /// 群成员信息改变
static const groupMemberInfoChangedNotification = 1516; static const groupMemberInfoChangedNotification = 1516;
/// 群公告修改
static const groupNoticeChangedNotification = 1519;
/// 群名字修改
static const groupNameChangedNotification = 1520;
static const signalingNotificationBegin = 1600; static const signalingNotificationBegin = 1600;
/// 信令 /// 信令
@@ -152,4 +165,7 @@ class MessageType {
static const burnAfterReadingNotification = 1701; static const burnAfterReadingNotification = 1701;
static const notificationEnd = 2000; static const notificationEnd = 2000;
/// 撤回消息
static const revokeMessageNotification = 2101;
} }

View File

@@ -0,0 +1,172 @@
// /// 消息发送失败
// class MessageFailedCode {
// /// 被对方拉黑
// static const int blockedByFriend = 1302;
//
// /// 被对方删除
// static const int deletedByFriend = 1303;
//
// /// 已被移除群聊/群已解散
// static const int notInGroup = 1204;
// }
//
// /// 添加好友失败
// class AddFriendFailedCode {
// /// 该用户已设置不可添加
// static const int refuseToAddFriends = 10013;
// }
class SDKErrorCode {
/// 网络请求错误
static const int networkRequestError = 10000;
/// 网络等待超时错误
static const int networkWaitTimeoutError = 10001;
/// 参数错误
static const int parameterError = 10002;
/// 上下文超时错误,通常为用户已经退出
static const int contextTimeoutError = 10003;
/// 资源未加载完毕,通常为未初始化,或者登录接口还未成功返回
static const int resourceNotLoaded = 10004;
/// 未知错误,需要根据 errmsg 确认原因
static const int unknownError = 10005;
/// sdk 内部错误,需要根据 errmsg 确认原因
static const int sdkInternalError = 10006;
/// 该用户已设置不可添加
static const int refuseToAddFriends = 10013;
/// 用户不存在或未注册
static const int userNotExistOrNotRegistered = 10100;
/// 用户已经退出登录
static const int userHasLoggedOut = 10101;
/// 用户重复登录,可以通过 getloginstatus 确认登录状态,避免重复登录
static const int repeatLogin = 10102;
/// 需要上传的文件不存在
static const int uploadFileNotExist = 10200;
/// 消息解压失败
static const int messageDecompressionFailed = 10201;
/// 消息解码失败
static const int messageDecodingFailed = 10202;
/// 不支持的长连接二进制协议
static const int unsupportedLongConnection = 10203;
/// 消息重复发送
static const int messageRepeated = 10204;
/// 消息内容类型不支持
static const int messageContentTypeNotSupported = 10205;
/// 不支持的会话操作
static const int unsupportedSessionOperation = 10301;
/// 群 ID 不存在
static const int groupIDNotExist = 10400;
/// 群组类型错误
static const int wrongGroupType = 10401;
/// 服务器内部错误,通常为内部网络错误,需要检查服务器各节点运行是否正常
static const int serverInternalError = 500;
/// 参数错误,需要检查 body 参数以及 header 参数是否正确
static const int serverParameterError = 1001;
/// 权限不足,一般为 header 参数中携带 token 不正确,或者权限越级操作
static const int insufficientPermissions = 1002;
/// 数据库主键重复
static const int duplicateDatabasePrimaryKey = 1003;
/// 数据库记录未找到
static const int databaseRecordNotFound = 1004;
/// 用户 ID 不存在
static const int userIDNotExist = 1101;
/// 用户已经注册
static const int userAlreadyRegistered = 1102;
/// 群不存在
static const int groupNotExis = 1201;
/// 群已存在
static const int groupAlreadyExists = 1202;
/// 用户不在群组中
static const int userIsNotInGroup = 1203;
/// 群组已解散
static const int groupDisbanded = 1204;
/// 群申请已经被处理,不需要重复处理
static const int groupApplicationHasBeenProcessed = 1206;
/// 不能添加自己为好友
static const int notAddMyselfAsAFriend = 1301;
/// 已被对方拉黑
static const int hasBeenBlocked = 1302;
/// 对方不是自己的好友
static const int notFriend = 1303;
/// 已经是好友关系,不需要重复申请
static const int alreadyAFriendRelationship = 1304;
/// 消息已读功能被关闭
static const int messageReadFunctionIsTurnedOff = 1401;
/// 你已被禁言,不能在群里发言
static const int youHaveBeenBanned = 1402;
/// 群已被禁言,不能发言
static const int groupHasBeenBanned = 1403;
/// 该消息已被撤回
static const int messageHasBeenRetracted = 1404;
/// 授权过期
static const int licenseExpired = 1405;
/// token 已经过期
static const int tokenHasExpired = 1501;
/// token 无效
static const int tokenInvalid = 1502;
/// token 格式错误
static const int tokenFormatError = 1503;
/// token 还未生效
static const int tokenHasNotYetTakenEffect = 1504;
/// 未知 token 错误
static const int unknownTokenError = 1505;
/// 被踢出的 token无效
static const int thekickedOutTokenIsInvalid = 1506;
/// token 不存在
static const int tokenNotExist = 1507;
/// 连接数超过网关最大限制
static const int connectionsExceedsMaximumLimit = 1601;
/// 连接握手参数错误
static const int handshakeParameterError = 1602;
/// 文件上传过期
static const int fileUploadExpired = 1701;
}

View File

@@ -2,38 +2,72 @@ import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
/// 消息监听 /// 消息监听
class OnAdvancedMsgListener { class OnAdvancedMsgListener {
Function(List<ReadReceiptInfo> list)? onRecvC2CMessageReadReceipt; Function(Message msg)? onMsgDeleted;
Function(List<ReadReceiptInfo> list)? onRecvGroupMessageReadReceipt; Function(RevokedInfo info)? onNewRecvMessageRevoked;
Function(String msgId)? onRecvMessageRevoked; Function(List<ReadReceiptInfo> list)? onRecvC2CReadReceipt;
Function(List<ReadReceiptInfo> list)? onRecvGroupReadReceipt;
Function(String msgID, List<KeyValue> list)? onRecvMessageExtensionsAdded;
Function(String msgID, List<KeyValue> list)? onRecvMessageExtensionsChanged;
Function(String msgID, List<String> list)? onRecvMessageExtensionsDeleted;
Function(Message msg)? onRecvNewMessage; Function(Message msg)? onRecvNewMessage;
Function(Message msg)? onRecvOfflineNewMessage;
/// Uniquely identifies /// Uniquely identifies
String id; String id;
OnAdvancedMsgListener({ OnAdvancedMsgListener({
this.onRecvC2CMessageReadReceipt, this.onMsgDeleted,
this.onRecvGroupMessageReadReceipt, this.onNewRecvMessageRevoked,
this.onRecvMessageRevoked, this.onRecvC2CReadReceipt,
this.onRecvGroupReadReceipt,
this.onRecvMessageExtensionsAdded,
this.onRecvMessageExtensionsChanged,
this.onRecvMessageExtensionsDeleted,
this.onRecvNewMessage, this.onRecvNewMessage,
this.onRecvOfflineNewMessage,
}) : id = "id_${DateTime.now().microsecondsSinceEpoch}"; }) : id = "id_${DateTime.now().microsecondsSinceEpoch}";
/// C2C消息已读回执 void msgDeleted(Message msg) {
void recvC2CMessageReadReceipt(List<ReadReceiptInfo> list) { onMsgDeleted?.call(msg);
onRecvC2CMessageReadReceipt?.call(list);
}
/// 群消息已读回执
void recvGroupMessageReadReceipt(List<ReadReceiptInfo> list) {
onRecvGroupMessageReadReceipt?.call(list);
} }
/// 消息被撤回 /// 消息被撤回
void recvMessageRevoked(String msgId) { void newRecvMessageRevoked(RevokedInfo info) {
onRecvMessageRevoked?.call(msgId); onNewRecvMessageRevoked?.call(info);
}
/// C2C消息已读回执
void recvC2CReadReceipt(List<ReadReceiptInfo> list) {
onRecvC2CReadReceipt?.call(list);
}
/// 群消息已读回执
void recvGroupReadReceipt(List<ReadReceiptInfo> list) {
onRecvGroupReadReceipt?.call(list);
}
/// 收到拓展消息kv新增
void recvMessageExtensionsAdded(String msgID, List<KeyValue> list) {
onRecvMessageExtensionsAdded?.call(msgID, list);
}
/// 收到拓展消息kv改变
void recvMessageExtensionsChanged(String msgID, List<KeyValue> list) {
onRecvMessageExtensionsChanged?.call(msgID, list);
}
/// 收到扩展消息被删除
/// [list] 被删除的TypeKey
void recvMessageExtensionsDeleted(String msgID, List<String> list) {
onRecvMessageExtensionsDeleted?.call(msgID, list);
} }
/// 收到了一条新消息 /// 收到了一条新消息
void recvNewMessage(Message msg) { void recvNewMessage(Message msg) {
onRecvNewMessage?.call(msg); onRecvNewMessage?.call(msg);
} }
void recvOfflineNewMessage(Message msg) {
onRecvOfflineNewMessage?.call(msg);
}
} }

View File

@@ -4,38 +4,38 @@ class OnConnectListener {
Function()? onConnectSuccess; Function()? onConnectSuccess;
Function()? onConnecting; Function()? onConnecting;
Function()? onKickedOffline; Function()? onKickedOffline;
Function()? onUserSigExpired; Function()? onUserTokenExpired;
OnConnectListener({ OnConnectListener({
this.onConnectFailed, this.onConnectFailed,
this.onConnectSuccess, this.onConnectSuccess,
this.onConnecting, this.onConnecting,
this.onKickedOffline, this.onKickedOffline,
this.onUserSigExpired, this.onUserTokenExpired,
}); });
/// SDK连接服务器失败 /// SDK连接服务器失败
void connectFailed(int? code, String? errorMsg) { void connectFailed(int? code, String? errorMsg) {
if (null != onConnectFailed) onConnectFailed!(code, errorMsg); onConnectFailed?.call(code, errorMsg);
} }
/// SDK连接服务器成功 /// SDK连接服务器成功
void connectSuccess() { void connectSuccess() {
if (null != onConnectSuccess) onConnectSuccess!(); onConnectSuccess?.call();
} }
/// SDK正在连接服务器 /// SDK正在连接服务器
void connecting() { void connecting() {
if (null != onConnecting) onConnecting!.call(); onConnecting?.call();
} }
/// 账号已在其他地方登录,当前设备被踢下线 /// 账号已在其他地方登录,当前设备被踢下线
void kickedOffline() { void kickedOffline() {
if (null != onKickedOffline) onKickedOffline!(); onKickedOffline?.call();
} }
/// 登录凭证过期,需要重新登录 /// 登录凭证过期,需要重新登录
void userSigExpired() { void userTokenExpired() {
if (null != onUserSigExpired) onUserSigExpired!(); onUserTokenExpired?.call();
} }
} }

View File

@@ -20,29 +20,28 @@ class OnConversationListener {
/// 会话发生改变 /// 会话发生改变
void conversationChanged(List<ConversationInfo> list) { void conversationChanged(List<ConversationInfo> list) {
if (onConversationChanged != null) onConversationChanged!(list); onConversationChanged?.call(list);
} }
/// 有新会话产生 /// 有新会话产生
void newConversation(List<ConversationInfo> list) { void newConversation(List<ConversationInfo> list) {
if (onNewConversation != null) onNewConversation!(list); onNewConversation?.call(list);
} }
/// 未读消息总数发送改变 /// 未读消息总数发送改变
void totalUnreadMessageCountChanged(int i) { void totalUnreadMessageCountChanged(int i) {
if (onTotalUnreadMessageCountChanged != null) onTotalUnreadMessageCountChanged?.call(i);
onTotalUnreadMessageCountChanged!(i);
} }
void syncServerFailed() { void syncServerFailed() {
if (onSyncServerFailed != null) onSyncServerFailed!(); onSyncServerFailed?.call();
} }
void syncServerFinish() { void syncServerFinish() {
if (onSyncServerFinish != null) onSyncServerFinish!(); onSyncServerFinish?.call();
} }
void syncServerStart() { void syncServerStart() {
if (onSyncServerStart != null) onSyncServerStart!(); onSyncServerStart?.call();
} }
} }

View File

@@ -0,0 +1,9 @@
class OnCustomBusinessListener {
Function(String s)? onRecvCustomBusinessMessage;
OnCustomBusinessListener({this.onRecvCustomBusinessMessage});
void recvCustomBusinessMessage(String s) {
onRecvCustomBusinessMessage?.call(s);
}
}

View File

@@ -2,19 +2,19 @@ import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
/// 好友关系监听 /// 好友关系监听
class OnFriendshipListener { 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)? onFriendApplicationAdded;
Function(FriendApplicationInfo i)? onFriendApplicationDeleted; Function(FriendApplicationInfo i)? onFriendApplicationDeleted;
Function(FriendApplicationInfo i)? onFriendApplicationAccepted;
Function(FriendApplicationInfo i)? onFriendApplicationRejected; Function(FriendApplicationInfo i)? onFriendApplicationRejected;
Function(FriendInfo i)? onFriendAdded;
Function(FriendInfo i)? onFriendDeleted; Function(FriendInfo i)? onFriendDeleted;
Function(FriendInfo i)? onFriendInfoChanged; Function(FriendInfo i)? onFriendInfoChanged;
Function(BlacklistInfo i)? onBlacklistAdded;
Function(BlacklistInfo i)? onBlacklistDeleted;
OnFriendshipListener({ OnFriendshipListener({
this.onBlacklistAdded, this.onBlackAdded,
this.onBlacklistDeleted, this.onBlackDeleted,
this.onFriendAdded, this.onFriendAdded,
this.onFriendApplicationAccepted, this.onFriendApplicationAccepted,
this.onFriendApplicationAdded, this.onFriendApplicationAdded,
@@ -25,13 +25,13 @@ class OnFriendshipListener {
}); });
/// 已被加入黑名单 /// 已被加入黑名单
void blacklistAdded(BlacklistInfo u) { void blackAdded(BlacklistInfo u) {
onBlacklistAdded?.call(u); onBlackAdded?.call(u);
} }
/// 已从黑名单移除 /// 已从黑名单移除
void blacklistDeleted(BlacklistInfo u) { void blackDeleted(BlacklistInfo u) {
onBlacklistDeleted?.call(u); onBlackDeleted?.call(u);
} }
/// 好友已添加 /// 好友已添加

View File

@@ -6,6 +6,7 @@ class OnGroupListener {
Function(GroupApplicationInfo info)? onGroupApplicationAdded; Function(GroupApplicationInfo info)? onGroupApplicationAdded;
Function(GroupApplicationInfo info)? onGroupApplicationDeleted; Function(GroupApplicationInfo info)? onGroupApplicationDeleted;
Function(GroupApplicationInfo info)? onGroupApplicationRejected; Function(GroupApplicationInfo info)? onGroupApplicationRejected;
Function(GroupInfo info)? onGroupDismissed;
Function(GroupInfo info)? onGroupInfoChanged; Function(GroupInfo info)? onGroupInfoChanged;
Function(GroupMembersInfo info)? onGroupMemberAdded; Function(GroupMembersInfo info)? onGroupMemberAdded;
Function(GroupMembersInfo info)? onGroupMemberDeleted; Function(GroupMembersInfo info)? onGroupMemberDeleted;
@@ -18,6 +19,7 @@ class OnGroupListener {
this.onGroupApplicationAdded, this.onGroupApplicationAdded,
this.onGroupApplicationDeleted, this.onGroupApplicationDeleted,
this.onGroupApplicationRejected, this.onGroupApplicationRejected,
this.onGroupDismissed,
this.onGroupInfoChanged, this.onGroupInfoChanged,
this.onGroupMemberAdded, this.onGroupMemberAdded,
this.onGroupMemberDeleted, this.onGroupMemberDeleted,
@@ -46,6 +48,10 @@ class OnGroupListener {
onGroupApplicationRejected?.call(info); onGroupApplicationRejected?.call(info);
} }
void groupDismissed(GroupInfo info) {
onGroupDismissed?.call(info);
}
/// 群资料发生改变 /// 群资料发生改变
void groupInfoChanged(GroupInfo info) { void groupInfoChanged(GroupInfo info) {
onGroupInfoChanged?.call(info); onGroupInfoChanged?.call(info);

View File

@@ -0,0 +1,38 @@
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
/// 好友关系监听
class OnListenerForService {
Function(FriendApplicationInfo i)? onFriendApplicationAdded;
Function(FriendApplicationInfo i)? onFriendApplicationAccepted;
Function(GroupApplicationInfo info)? onGroupApplicationAccepted;
Function(GroupApplicationInfo info)? onGroupApplicationAdded;
Function(Message msg)? onRecvNewMessage;
OnListenerForService({
this.onFriendApplicationAdded,
this.onFriendApplicationAccepted,
this.onGroupApplicationAccepted,
this.onGroupApplicationAdded,
this.onRecvNewMessage,
});
void friendApplicationAccepted(FriendApplicationInfo u) {
onFriendApplicationAccepted?.call(u);
}
void friendApplicationAdded(FriendApplicationInfo u) {
onFriendApplicationAdded?.call(u);
}
void groupApplicationAccepted(GroupApplicationInfo info) {
onGroupApplicationAccepted?.call(info);
}
void groupApplicationAdded(GroupApplicationInfo info) {
onGroupApplicationAdded?.call(info);
}
void recvNewMessage(Message msg) {
onRecvNewMessage?.call(msg);
}
}

View File

@@ -0,0 +1,11 @@
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
class OnMessageKvInfoListener {
Function(List<MessageKv> list)? onMessageKvInfoChanged;
OnMessageKvInfoListener({this.onMessageKvInfoChanged});
void messageKvInfoChanged(List<MessageKv> list) {
onMessageKvInfoChanged?.call(list);
}
}

View File

@@ -6,6 +6,6 @@ class OnMsgSendProgressListener {
/// 消息发送进度 /// 消息发送进度
void progress(String clientMsgID, int progress) { void progress(String clientMsgID, int progress) {
if (null != onProgress) onProgress!(clientMsgID, progress); onProgress?.call(clientMsgID, progress);
} }
} }

View File

@@ -1,11 +0,0 @@
/// 组织架构监听
class OnOrganizationListener {
Function()? onOrganizationUpdated;
OnOrganizationListener({this.onOrganizationUpdated});
/// 组织架构有更新
void organizationUpdated() {
onOrganizationUpdated?.call();
}
}

View File

@@ -1,4 +1,4 @@
import 'package:flutter_openim_sdk/src/models/signaling_info.dart'; import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
/// 信令监听 /// 信令监听
class OnSignalingListener { class OnSignalingListener {
@@ -10,6 +10,10 @@ class OnSignalingListener {
final Function(SignalingInfo info)? onInviteeRejectedByOtherDevice; final Function(SignalingInfo info)? onInviteeRejectedByOtherDevice;
final Function(SignalingInfo info)? onInviteeAcceptedByOtherDevice; final Function(SignalingInfo info)? onInviteeAcceptedByOtherDevice;
final Function(SignalingInfo info)? onHangup; final Function(SignalingInfo info)? onHangup;
final Function(RoomCallingInfo info)? onRoomParticipantConnected;
final Function(RoomCallingInfo info)? onRoomParticipantDisconnected;
final Function(MeetingStreamEvent event)? onMeetingStreamChanged;
final Function(CustomSignaling info)? onReceiveCustomSignal;
OnSignalingListener({ OnSignalingListener({
this.onInvitationCancelled, this.onInvitationCancelled,
@@ -20,6 +24,10 @@ class OnSignalingListener {
this.onInviteeAcceptedByOtherDevice, this.onInviteeAcceptedByOtherDevice,
this.onInviteeRejectedByOtherDevice, this.onInviteeRejectedByOtherDevice,
this.onHangup, this.onHangup,
this.onRoomParticipantConnected,
this.onRoomParticipantDisconnected,
this.onMeetingStreamChanged,
this.onReceiveCustomSignal,
}); });
/// 被邀请者收到:邀请者取消音视频通话 /// 被邀请者收到:邀请者取消音视频通话
@@ -61,4 +69,20 @@ class OnSignalingListener {
void hangup(SignalingInfo info) { void hangup(SignalingInfo info) {
onHangup?.call(info); onHangup?.call(info);
} }
void roomParticipantConnected(RoomCallingInfo info) {
onRoomParticipantConnected?.call(info);
}
void roomParticipantDisconnected(RoomCallingInfo info) {
onRoomParticipantDisconnected?.call(info);
}
void streamChangedEvent(MeetingStreamEvent event) {
onMeetingStreamChanged?.call(event);
}
void receiveCustomSignal(CustomSignaling info) {
onReceiveCustomSignal?.call(info);
}
} }

View File

@@ -0,0 +1,45 @@
class OnUploadFileListener {
Function(String id, int size, String url, int type)? onComplete;
Function(String id, String partHash, String fileHash)? onHashPartComplete;
Function(String id, int index, int size, String partHash)? onHashPartProgress;
Function(String id, int size)? onOpen;
Function(String id, int partSize, int num)? onPartSize;
Function(String id, int fileSize, int streamSize, int storageSize)?
onUploadProgress;
Function(String id, String uploadID)? onUploadID;
Function(String id, int index, int partSize, String partHash)?
onUploadPartComplete;
void complete(String id, int size, String url, int type) {
onComplete?.call(id, size, url, type);
}
void hashPartComplete(String id, String partHash, String fileHash) {
onHashPartComplete?.call(id, partHash, fileHash);
}
void hashPartProgress(String id, int index, int size, String partHash) {
onHashPartProgress?.call(id, index, size, partHash);
}
void open(String id, int size) {
onOpen?.call(id, size);
}
void partSize(String id, int partSize, int num) {
onPartSize?.call(id, partSize, num);
}
void uploadProgress(
String id, int fileSize, int streamSize, int storageSize) {
onUploadProgress?.call(id, fileSize, streamSize, storageSize);
}
void uploadID(String id, String uploadID) {
onUploadID?.call(id, uploadID);
}
void uploadPartComplete(String id, int index, int partSize, String partHash) {
onUploadPartComplete?.call(id, index, partSize, partHash);
}
}

View File

@@ -1,11 +0,0 @@
/// 朋友圈监听
class OnWorkMomentsListener {
Function()? onRecvNewNotification;
OnWorkMomentsListener({this.onRecvNewNotification});
/// 朋友圈信息发送改变
void recvNewNotification() {
onRecvNewNotification?.call();
}
}

9
lib/src/logger.dart Normal file
View File

@@ -0,0 +1,9 @@
import 'dart:developer';
/// print full log
class Logger {
// Sample of abstract logging function
static void print(String text) {
log('** $text', name: 'flutter_openim_sdk');
}
}

View File

@@ -1,3 +1,5 @@
import 'dart:developer';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
@@ -46,7 +48,7 @@ class ConversationManager {
/// 查询会话,如果会话不存在会自动生成一个 /// 查询会话,如果会话不存在会自动生成一个
/// [sourceID] 如果是单聊会话传userID如果是群聊会话传GroupID /// [sourceID] 如果是单聊会话传userID如果是群聊会话传GroupID
/// [sessionType] 如果是单聊会话传1如果是群聊会话传2 /// [sessionType] 参考[ConversationType]
Future<ConversationInfo> getOneConversation({ Future<ConversationInfo> getOneConversation({
required String sourceID, required String sourceID,
required int sessionType, required int sessionType,
@@ -79,19 +81,6 @@ class ConversationManager {
.then((value) => .then((value) =>
Utils.toList(value, (map) => ConversationInfo.fromJson(map))); Utils.toList(value, (map) => ConversationInfo.fromJson(map)));
/// 通过会话id删除指定会话
/// [conversationID] 被删除的会话的id
Future deleteConversation({
required String conversationID,
String? operationID,
}) =>
_channel.invokeMethod(
'deleteConversation',
_buildParam({
"conversationID": conversationID,
"operationID": Utils.checkOperationID(operationID),
}));
/// 设置会话草稿 /// 设置会话草稿
/// [conversationID] 会话id /// [conversationID] 会话id
/// [draftText] 草稿 /// [draftText] 草稿
@@ -124,20 +113,21 @@ class ConversationManager {
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})); }));
/// 标记群聊会话已读 /// 置顶会话
/// [groupID] id /// [conversationID] 会话id
Future<dynamic> markGroupMessageHasRead({ Future hideConversation({
required String groupID, required String conversationID,
String? operationID, String? operationID,
}) => }) =>
_channel.invokeMethod( _channel.invokeMethod(
'markGroupMessageHasRead', 'hideConversation',
_buildParam({ _buildParam({
'groupID': groupID, "conversationID": conversationID,
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})); }));
/// 获取未读消息总数 /// 获取未读消息总数
/// int.tryParse(count) ?? 0;
Future<dynamic> getTotalUnreadMsgCount({ Future<dynamic> getTotalUnreadMsgCount({
String? operationID, String? operationID,
}) => }) =>
@@ -149,30 +139,30 @@ class ConversationManager {
/// 查询会话id /// 查询会话id
/// [sourceID] 如果是单聊值传用户ID如果是群聊值传组ID /// [sourceID] 如果是单聊值传用户ID如果是群聊值传组ID
/// [sessionType] 如果是单聊值传1如果是群聊值传2 /// [sessionType] 参考[ConversationType]
Future<dynamic> getConversationIDBySessionType({ // Future<dynamic> getConversationIDBySessionType({
required String sourceID, // required String sourceID,
required int sessionType, // required int sessionType,
}) => // }) =>
_channel.invokeMethod( // _channel.invokeMethod(
'getConversationIDBySessionType', // 'getConversationIDBySessionType',
_buildParam({ // _buildParam({
"sourceID": sourceID, // "sourceID": sourceID,
"sessionType": sessionType, // "sessionType": sessionType,
})); // }));
/// 消息免打扰设置 /// 消息免打扰设置
/// [conversationIDList] 会话id列表 /// [conversationID] 会话id
/// [status] 0正常1不接受消息2接受在线消息不接受离线消息 /// [status] 0正常1不接受消息2接受在线消息不接受离线消息
Future<dynamic> setConversationRecvMessageOpt({ Future<dynamic> setConversationRecvMessageOpt({
required List<String> conversationIDList, required String conversationID,
required int status, required int status,
String? operationID, String? operationID,
}) => }) =>
_channel.invokeMethod( _channel.invokeMethod(
'setConversationRecvMessageOpt', 'setConversationRecvMessageOpt',
_buildParam({ _buildParam({
"conversationIDList": conversationIDList, "conversationID": conversationID,
"status": status, "status": status,
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})); }));
@@ -196,13 +186,13 @@ class ConversationManager {
/// 阅后即焚 /// 阅后即焚
/// [conversationID] 会话id /// [conversationID] 会话id
/// [isPrivate] true开启false关闭 /// [isPrivate] true开启false关闭
Future<dynamic> setOneConversationPrivateChat({ Future<dynamic> setConversationPrivateChat({
required String conversationID, required String conversationID,
required bool isPrivate, required bool isPrivate,
String? operationID, String? operationID,
}) => }) =>
_channel.invokeMethod( _channel.invokeMethod(
'setOneConversationPrivateChat', 'setConversationPrivateChat',
_buildParam({ _buildParam({
"conversationID": conversationID, "conversationID": conversationID,
"isPrivate": isPrivate, "isPrivate": isPrivate,
@@ -211,12 +201,25 @@ class ConversationManager {
/// 删除本地以及服务器的会话 /// 删除本地以及服务器的会话
/// [conversationID] 会话ID /// [conversationID] 会话ID
Future<dynamic> deleteConversationFromLocalAndSvr({ Future<dynamic> deleteConversationAndDeleteAllMsg({
required String conversationID, required String conversationID,
String? operationID, String? operationID,
}) => }) =>
_channel.invokeMethod( _channel.invokeMethod(
'deleteConversationFromLocalAndSvr', 'deleteConversationAndDeleteAllMsg',
_buildParam({
"conversationID": conversationID,
"operationID": Utils.checkOperationID(operationID),
}));
/// 清空会话里的消息
/// [conversationID] 会话ID
Future<dynamic> clearConversationAndDeleteAllMsg({
required String conversationID,
String? operationID,
}) =>
_channel.invokeMethod(
'clearConversationAndDeleteAllMsg',
_buildParam({ _buildParam({
"conversationID": conversationID, "conversationID": conversationID,
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
@@ -246,8 +249,17 @@ class ConversationManager {
})); }));
/// 查询@所有人标识 /// 查询@所有人标识
Future<dynamic> getAtAllTag() => Future<dynamic> getAtAllTag({
_channel.invokeMethod('getAtAllTag', _buildParam({})); String? operationID,
}) =>
_channel.invokeMethod(
'getAtAllTag',
_buildParam({
"operationID": Utils.checkOperationID(operationID),
}));
/// 查询@所有人标识
String get atAllTag => 'AtAllTag';
/// 全局免打扰 /// 全局免打扰
/// [status] 0正常1不接受消息2接受在线消息不接受离线消息 /// [status] 0正常1不接受消息2接受在线消息不接受离线消息
@@ -262,6 +274,66 @@ class ConversationManager {
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})); }));
/// 设置阅后即焚时长
/// [conversationID] 会话id
/// [burnDuration] 时长s默认30s
Future<dynamic> setConversationBurnDuration({
required String conversationID,
int burnDuration = 30,
String? operationID,
}) =>
_channel.invokeMethod(
'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),
}));
/// 开启定期删除
/// [isMsgDestruct] true 开启
Future<dynamic> setConversationIsMsgDestruct({
required String conversationID,
bool isMsgDestruct = true,
String? operationID,
}) =>
_channel.invokeMethod(
'setConversationIsMsgDestruct',
_buildParam({
"conversationID": conversationID,
"isMsgDestruct": isMsgDestruct,
"operationID": Utils.checkOperationID(operationID),
}));
/// 定期删除聊天记录
/// [duration] 秒
Future<dynamic> setConversationMsgDestructTime({
required String conversationID,
int duration = 1 * 24 * 60 * 60,
String? operationID,
}) =>
_channel.invokeMethod(
'setConversationMsgDestructTime',
_buildParam({
"conversationID": conversationID,
"duration": duration,
"operationID": Utils.checkOperationID(operationID),
}));
/// 会话列表自定义排序规则。 /// 会话列表自定义排序规则。
List<ConversationInfo> simpleSort(List<ConversationInfo> list) => list List<ConversationInfo> simpleSort(List<ConversationInfo> list) => list
..sort((a, b) { ..sort((a, b) {
@@ -289,6 +361,7 @@ class ConversationManager {
static Map _buildParam(Map param) { static Map _buildParam(Map param) {
param["ManagerName"] = "conversationManager"; param["ManagerName"] = "conversationManager";
log('param: $param');
return param; return param;
} }
} }

View File

@@ -14,42 +14,42 @@ class FriendshipManager {
} }
/// 查询好友信息 /// 查询好友信息
/// [uidList] userID集合 /// [userIDList] userID集合
Future<List<UserInfo>> getFriendsInfo({ Future<List<UserInfo>> getFriendsInfo({
required List<String> uidList, required List<String> userIDList,
String? operationID, String? operationID,
}) => }) =>
_channel _channel
.invokeMethod( .invokeMethod(
'getFriendsInfo', 'getFriendsInfo',
_buildParam({ _buildParam({
"uidList": uidList, "userIDList": userIDList,
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})) }))
.then((value) => Utils.toList(value, (v) => UserInfo.fromJson(v))); .then((value) => Utils.toList(value, (v) => UserInfo.fromJson(v)));
/// 发送一个好友请求,需要对方调用同意申请才能成为好友。 /// 发送一个好友请求,需要对方调用同意申请才能成为好友。
/// [uid] 被邀请的用户ID /// [userID] 被邀请的用户ID
/// [reason] 备注说明 /// [reason] 备注说明
Future<dynamic> addFriend({ Future<dynamic> addFriend({
required String uid, required String userID,
String? reason, String? reason,
String? operationID, String? operationID,
}) => }) =>
_channel.invokeMethod( _channel.invokeMethod(
'addFriend', 'addFriend',
_buildParam({ _buildParam({
"toUserID": uid, "toUserID": userID,
"reqMsg": reason, "reqMsg": reason,
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})); }));
/// 获取别人加我为好友的申请 /// 获取别人加我为好友的申请
Future<List<FriendApplicationInfo>> getRecvFriendApplicationList( Future<List<FriendApplicationInfo>> getFriendApplicationListAsRecipient(
{String? operationID}) => {String? operationID}) =>
_channel _channel
.invokeMethod( .invokeMethod(
'getRecvFriendApplicationList', 'getFriendApplicationListAsRecipient',
_buildParam({ _buildParam({
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})) }))
@@ -57,11 +57,11 @@ class FriendshipManager {
Utils.toList(value, (v) => FriendApplicationInfo.fromJson(v))); Utils.toList(value, (v) => FriendApplicationInfo.fromJson(v)));
/// 获取我发出的好友申请 /// 获取我发出的好友申请
Future<List<FriendApplicationInfo>> getSendFriendApplicationList( Future<List<FriendApplicationInfo>> getFriendApplicationListAsApplicant(
{String? operationID}) => {String? operationID}) =>
_channel _channel
.invokeMethod( .invokeMethod(
'getSendFriendApplicationList', 'getFriendApplicationListAsApplicant',
_buildParam({ _buildParam({
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})) }))
@@ -87,31 +87,31 @@ class FriendshipManager {
.then((value) => Utils.toListMap(value)); .then((value) => Utils.toListMap(value));
/// 设置好友备注 /// 设置好友备注
/// [uid] 好友的userID /// [userID] 好友的userID
/// [remark] 好友的备注 /// [remark] 好友的备注
Future<dynamic> setFriendRemark({ Future<dynamic> setFriendRemark({
required String uid, required String userID,
required String remark, required String remark,
String? operationID, String? operationID,
}) => }) =>
_channel.invokeMethod( _channel.invokeMethod(
'setFriendRemark', 'setFriendRemark',
_buildParam({ _buildParam({
'toUserID': uid, 'toUserID': userID,
'remark': remark, 'remark': remark,
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})); }));
/// 加入黑名单 /// 加入黑名单
/// [uid] 被加入黑名单的好友ID /// [userID] 被加入黑名单的好友ID
Future<dynamic> addBlacklist({ Future<dynamic> addBlacklist({
required String uid, required String userID,
String? operationID, String? operationID,
}) => }) =>
_channel.invokeMethod( _channel.invokeMethod(
'addBlacklist', 'addBlacklist',
_buildParam({ _buildParam({
"uid": uid, "userID": userID,
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})); }));
@@ -125,75 +125,75 @@ class FriendshipManager {
.then((value) => Utils.toList(value, (v) => UserInfo.fromJson(v))); .then((value) => Utils.toList(value, (v) => UserInfo.fromJson(v)));
/// 从黑名单移除 /// 从黑名单移除
/// [uid] 用户ID /// [userID] 用户ID
Future<dynamic> removeBlacklist({ Future<dynamic> removeBlacklist({
required String uid, required String userID,
String? operationID, String? operationID,
}) => }) =>
_channel.invokeMethod( _channel.invokeMethod(
'removeBlacklist', 'removeBlacklist',
_buildParam({ _buildParam({
"uid": uid, "userID": userID,
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})); }));
/// 检查友好关系 /// 检查友好关系
/// [uidList] userID列表 /// [userIDList] userID列表
Future<List<FriendshipInfo>> checkFriend({ Future<List<FriendshipInfo>> checkFriend({
required List<String> uidList, required List<String> userIDList,
String? operationID, String? operationID,
}) => }) =>
_channel _channel
.invokeMethod( .invokeMethod(
'checkFriend', 'checkFriend',
_buildParam({ _buildParam({
'uidList': uidList, 'userIDList': userIDList,
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})) }))
.then((value) => .then((value) =>
Utils.toList(value, (v) => FriendshipInfo.fromJson(v))); Utils.toList(value, (v) => FriendshipInfo.fromJson(v)));
/// 删除好友 /// 删除好友
/// [uid] 用户ID /// [userID] 用户ID
Future<dynamic> deleteFriend({ Future<dynamic> deleteFriend({
required String uid, required String userID,
String? operationID, String? operationID,
}) => }) =>
_channel.invokeMethod( _channel.invokeMethod(
'deleteFriend', 'deleteFriend',
_buildParam({ _buildParam({
"uid": uid, "userID": userID,
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})); }));
/// 接受好友请求 /// 接受好友请求
/// [uid] 用户ID /// [userID] 用户ID
/// [handleMsg]备注说明 /// [handleMsg]备注说明
Future<dynamic> acceptFriendApplication({ Future<dynamic> acceptFriendApplication({
required String uid, required String userID,
String? handleMsg, String? handleMsg,
String? operationID, String? operationID,
}) => }) =>
_channel.invokeMethod( _channel.invokeMethod(
'acceptFriendApplication', 'acceptFriendApplication',
_buildParam({ _buildParam({
"toUserID": uid, "toUserID": userID,
"handleMsg": handleMsg, "handleMsg": handleMsg,
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})); }));
/// 拒绝好友请求 /// 拒绝好友请求
/// [uid] 用户ID /// [userID] 用户ID
/// [handleMsg]备注说明 /// [handleMsg]备注说明
Future<dynamic> refuseFriendApplication({ Future<dynamic> refuseFriendApplication({
required String uid, required String userID,
String? handleMsg, String? handleMsg,
String? operationID, String? operationID,
}) => }) =>
_channel.invokeMethod( _channel.invokeMethod(
'refuseFriendApplication', 'refuseFriendApplication',
_buildParam({ _buildParam({
"toUserID": uid, "toUserID": userID,
"handleMsg": handleMsg, "handleMsg": handleMsg,
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})); }));

View File

@@ -1,3 +1,5 @@
import 'dart:developer';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
@@ -14,11 +16,11 @@ class GroupManager {
} }
/// 邀请进组,直接进组无需同意。 /// 邀请进组,直接进组无需同意。
/// [groupId] 组ID /// [groupID] 组ID
/// [uidList] 用户ID列表 /// [userIDList] 用户ID列表
Future<List<GroupInviteResult>> inviteUserToGroup({ Future<List<GroupInviteResult>> inviteUserToGroup({
required String groupId, required String groupID,
required List<String> uidList, required List<String> userIDList,
String? reason, String? reason,
String? operationID, String? operationID,
}) => }) =>
@@ -26,21 +28,21 @@ class GroupManager {
.invokeMethod( .invokeMethod(
'inviteUserToGroup', 'inviteUserToGroup',
_buildParam({ _buildParam({
'gid': groupId, 'groupID': groupID,
'userIDList': userIDList,
'reason': reason, 'reason': reason,
'uidList': uidList,
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})) }))
.then((value) => .then((value) =>
Utils.toList(value, (map) => GroupInviteResult.fromJson(map))); Utils.toList(value, (map) => GroupInviteResult.fromJson(map)));
/// 移除组成员 /// 移除组成员
/// [groupId] 组ID /// [groupID] 组ID
/// [uidList] 用户ID列表 /// [userIDList] 用户ID列表
/// [reason] 备注说明 /// [reason] 备注说明
Future<List<GroupInviteResult>> kickGroupMember({ Future<List<GroupInviteResult>> kickGroupMember({
required String groupId, required String groupID,
required List<String> uidList, required List<String> userIDList,
String? reason, String? reason,
String? operationID, String? operationID,
}) => }) =>
@@ -48,40 +50,40 @@ class GroupManager {
.invokeMethod( .invokeMethod(
'kickGroupMember', 'kickGroupMember',
_buildParam({ _buildParam({
'gid': groupId, 'groupID': groupID,
'userIDList': userIDList,
'reason': reason, 'reason': reason,
'uidList': uidList,
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})) }))
.then((value) => .then((value) =>
Utils.toList(value, (map) => GroupInviteResult.fromJson(map))); Utils.toList(value, (map) => GroupInviteResult.fromJson(map)));
/// 查询组成员资料 /// 查询组成员资料
/// [groupId] 组ID /// [groupID] 组ID
/// [uidList] 用户ID列表 /// [userIDList] 用户ID列表
Future<List<GroupMembersInfo>> getGroupMembersInfo({ Future<List<GroupMembersInfo>> getGroupMembersInfo({
required String groupId, required String groupID,
required List<String> uidList, required List<String> userIDList,
String? operationID, String? operationID,
}) => }) =>
_channel _channel
.invokeMethod( .invokeMethod(
'getGroupMembersInfo', 'getGroupMembersInfo',
_buildParam({ _buildParam({
'gid': groupId, 'groupID': groupID,
'uidList': uidList, 'userIDList': userIDList,
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})) }))
.then((value) => .then((value) =>
Utils.toList(value, (map) => GroupMembersInfo.fromJson(map))); Utils.toList(value, (map) => GroupMembersInfo.fromJson(map)));
/// 分页获取组成员列表 /// 分页获取组成员列表
/// [groupId] 群ID /// [groupID] 群ID
/// [filter] 过滤成员 1普通成员, 2群主3管理员0 所有 /// [filter] 过滤成员 0所有1群主 , 2管理员3普通成员4管理员+普通成员 5,群主+管理员
/// [offset] 开始下标 /// [offset] 开始下标
/// [count] 总数 /// [count] 总数
Future<List<GroupMembersInfo>> getGroupMemberList({ Future<List<GroupMembersInfo>> getGroupMemberList({
required String groupId, required String groupID,
int filter = 0, int filter = 0,
int offset = 0, int offset = 0,
int count = 0, int count = 0,
@@ -91,7 +93,7 @@ class GroupManager {
.invokeMethod( .invokeMethod(
'getGroupMemberList', 'getGroupMemberList',
_buildParam({ _buildParam({
'gid': groupId, 'groupID': groupID,
'filter': filter, 'filter': filter,
'offset': offset, 'offset': offset,
'count': count, 'count': count,
@@ -101,12 +103,12 @@ class GroupManager {
Utils.toList(value, (map) => GroupMembersInfo.fromJson(map))); Utils.toList(value, (map) => GroupMembersInfo.fromJson(map)));
/// 分页获取组成员列表 /// 分页获取组成员列表
/// [groupId] 群ID /// [groupID] 群ID
/// [filter] 过滤成员 1普通成员, 2群主3管理员0所有 /// [filter] 过滤成员 0所有1群主 , 2管理员3普通成员4管理员+普通成员 5,群主+管理员
/// [offset] 开始下标 /// [offset] 开始下标
/// [count] 总数 /// [count] 总数
Future<List<dynamic>> getGroupMemberListMap({ Future<List<dynamic>> getGroupMemberListMap({
required String groupId, required String groupID,
int filter = 0, int filter = 0,
int offset = 0, int offset = 0,
int count = 0, int count = 0,
@@ -116,7 +118,7 @@ class GroupManager {
.invokeMethod( .invokeMethod(
'getGroupMemberList', 'getGroupMemberList',
_buildParam({ _buildParam({
'gid': groupId, 'groupID': groupID,
'filter': filter, 'filter': filter,
'offset': offset, 'offset': offset,
'count': count, 'count': count,
@@ -143,46 +145,43 @@ class GroupManager {
.then((value) => Utils.toListMap(value)); .then((value) => Utils.toListMap(value));
/// 检查是否已加入组 /// 检查是否已加入组
/// [gid] 组ID /// [groupID] 组ID
Future<bool> isJoinedGroup({ Future<bool> isJoinedGroup({
required String gid, required String groupID,
String? operationID, String? operationID,
}) => }) =>
getJoinedGroupList( _channel
operationID: Utils.checkOperationID(operationID), .invokeMethod(
).then((list) => list.where((e) => e.groupID == gid).length > 0); 'isJoinGroup',
_buildParam({
'groupID': groupID,
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) => value == 'true' ? true : false);
/// 创建一个组 /// 创建一个组
/// [groupName] 群名 /// [groupName] 群名
/// [notification] 公告 /// [notification] 公告
/// [introduction] 群介绍 /// [introduction] 群介绍
/// [faceUrl] 群头像 /// [faceUrl] 群头像
/// [groupType] 组类型 /// [groupType] 组类型 [GroupType]
/// [ex] 额外信息 /// [ex] 额外信息
/// [list] 初创群成员以及其角色列表,角色参考[GroupRoleLevel]类 /// [list] 初创群成员以及其角色列表[GroupMemberRole]
Future<GroupInfo> createGroup({ Future<GroupInfo> createGroup({
String? groupName, required GroupInfo groupInfo,
String? notification, List<String> memberUserIDs = const [],
String? introduction, List<String> adminUserIDs = const [],
String? faceUrl, String? ownerUserID,
int? groupType,
String? ex,
required List<GroupMemberRole> list,
String? operationID, String? operationID,
}) => }) =>
_channel _channel
.invokeMethod( .invokeMethod(
'createGroup', 'createGroup',
_buildParam({ _buildParam({
'gInfo': { 'groupInfo': groupInfo.toJson(),
"groupName": groupName, 'memberUserIDs': memberUserIDs,
"notification": notification, 'adminUserIDs': adminUserIDs,
"introduction": introduction, 'ownerUserID': ownerUserID,
"faceURL": faceUrl,
"groupType": groupType,
"ex": ex,
},
'memberList': list.map((e) => e.toJson()).toList(),
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})) }))
.then( .then(
@@ -193,96 +192,104 @@ class GroupManager {
/// [groupName] 新的群名 /// [groupName] 新的群名
/// [notification] 新的公告 /// [notification] 新的公告
/// [introduction] 新的群介绍 /// [introduction] 新的群介绍
/// [faceUrl] 新的群头像 /// [faceURL] 新的群头像
/// [ex] 新的额外信息 /// [ex] 新的额外信息
Future<dynamic> setGroupInfo({ Future<dynamic> setGroupInfo({
required String groupID, required String groupID,
String? groupName, String? groupName,
String? notification, String? notification,
String? introduction, String? introduction,
String? faceUrl, String? faceURL,
String? ex, String? ex,
int? needVerification,
int? lookMemberInfo,
int? applyMemberFriend,
String? operationID, String? operationID,
}) => }) =>
_channel.invokeMethod( _channel.invokeMethod(
'setGroupInfo', 'setGroupInfo',
_buildParam({ _buildParam({
"gid": groupID, 'groupInfo': {
'gInfo': { "groupID": groupID,
// "groupID": groupID,
"groupName": groupName, "groupName": groupName,
"notification": notification, "notification": notification,
"introduction": introduction, "introduction": introduction,
"faceURL": faceUrl, "faceURL": faceURL,
"ex": ex, "ex": ex,
'needVerification': needVerification,
'lookMemberInfo': lookMemberInfo,
'applyMemberFriend': applyMemberFriend,
}, },
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})); }));
/// 查询组信息 /// 查询组信息
/// [gidList] 组ID列表 /// [groupIDList] 组ID列表
Future<List<GroupInfo>> getGroupsInfo({ Future<List<GroupInfo>> getGroupsInfo({
required List<String> gidList, required List<String> groupIDList,
String? operationID, String? operationID,
}) => }) =>
_channel _channel
.invokeMethod( .invokeMethod(
'getGroupsInfo', 'getGroupsInfo',
_buildParam({ _buildParam({
'gidList': gidList, 'groupIDList': groupIDList,
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})) }))
.then( .then(
(value) => Utils.toList(value, (map) => GroupInfo.fromJson(map))); (value) => Utils.toList(value, (map) => GroupInfo.fromJson(map)));
/// 申请加入组,需要通过管理员/群组同意。 /// 申请加入组,需要通过管理员/群组同意。
/// [joinSource] 2通过邀请 3通过搜索 4通过二维码
Future<dynamic> joinGroup({ Future<dynamic> joinGroup({
required String gid, required String groupID,
String? reason, String? reason,
String? operationID, String? operationID,
int joinSource = 3,
}) => }) =>
_channel.invokeMethod( _channel.invokeMethod(
'joinGroup', 'joinGroup',
_buildParam({ _buildParam({
'gid': gid, 'groupID': groupID,
'reason': reason, 'reason': reason,
'joinSource': joinSource,
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})); }));
/// 退出组 /// 退出组
Future<dynamic> quitGroup({ Future<dynamic> quitGroup({
required String gid, required String groupID,
String? operationID, String? operationID,
}) => }) =>
_channel.invokeMethod( _channel.invokeMethod(
'quitGroup', 'quitGroup',
_buildParam({ _buildParam({
'gid': gid, 'groupID': groupID,
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})); }));
/// 转移组拥有者权限 /// 转移组拥有者权限
/// [gid] 组ID /// [groupID] 组ID
/// [uid] 新拥有者ID /// [userID] 新拥有者ID
Future<dynamic> transferGroupOwner({ Future<dynamic> transferGroupOwner({
required String gid, required String groupID,
required String uid, required String userID,
String? operationID, String? operationID,
}) => }) =>
_channel.invokeMethod( _channel.invokeMethod(
'transferGroupOwner', 'transferGroupOwner',
_buildParam({ _buildParam({
'gid': gid, 'groupID': groupID,
'uid': uid, 'userID': userID,
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})); }));
/// 作为群主或者管理员,收到的群成员入群申请 /// 作为群主或者管理员,收到的群成员入群申请
Future<List<GroupApplicationInfo>> getRecvGroupApplicationList( Future<List<GroupApplicationInfo>> getGroupApplicationListAsRecipient(
{String? operationID}) => {String? operationID}) =>
_channel _channel
.invokeMethod( .invokeMethod(
'getRecvGroupApplicationList', 'getGroupApplicationListAsRecipient',
_buildParam({ _buildParam({
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})) }))
@@ -290,11 +297,11 @@ class GroupManager {
Utils.toList(value, (map) => GroupApplicationInfo.fromJson(map))); Utils.toList(value, (map) => GroupApplicationInfo.fromJson(map)));
/// 获取自己发出的入群申请记录 /// 获取自己发出的入群申请记录
Future<List<GroupApplicationInfo>> getSendGroupApplicationList( Future<List<GroupApplicationInfo>> getGroupApplicationListAsApplicant(
{String? operationID}) => {String? operationID}) =>
_channel _channel
.invokeMethod( .invokeMethod(
'getSendGroupApplicationList', 'getGroupApplicationListAsApplicant',
_buildParam({ _buildParam({
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})) }))
@@ -303,39 +310,39 @@ class GroupManager {
/// 管理员或者群主同意某人进入某群 /// 管理员或者群主同意某人进入某群
/// 注:主动申请入群需要通过管理员/群组处理,被别人拉入群不需要管理员/群组处理 /// 注:主动申请入群需要通过管理员/群组处理,被别人拉入群不需要管理员/群组处理
/// [gid] 组id /// [groupID] 组id
/// [uid] 申请者用户ID /// [userID] 申请者用户ID
Future<dynamic> acceptGroupApplication({ Future<dynamic> acceptGroupApplication({
required String gid, required String groupID,
required String uid, required String userID,
String? handleMsg, String? handleMsg,
String? operationID, String? operationID,
}) => }) =>
_channel.invokeMethod( _channel.invokeMethod(
'acceptGroupApplication', 'acceptGroupApplication',
_buildParam({ _buildParam({
'gid': gid, 'groupID': groupID,
'uid': uid, 'userID': userID,
'handleMsg': handleMsg, 'handleMsg': handleMsg,
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})); }));
/// 管理员或者群主拒绝某人进入某群 /// 管理员或者群主拒绝某人进入某群
/// 注:主动申请入群需要通过管理员/群组处理,被别人拉入群不需要管理员/群组处理 /// 注:主动申请入群需要通过管理员/群组处理,被别人拉入群不需要管理员/群组处理
/// [gid] 组id /// [groupID] 组id
/// [uid] 申请者用户ID /// [userID] 申请者用户ID
/// [handleMsg] 说明 /// [handleMsg] 说明
Future<dynamic> refuseGroupApplication({ Future<dynamic> refuseGroupApplication({
required String gid, required String groupID,
required String uid, required String userID,
String? handleMsg, String? handleMsg,
String? operationID, String? operationID,
}) => }) =>
_channel.invokeMethod( _channel.invokeMethod(
'refuseGroupApplication', 'refuseGroupApplication',
_buildParam({ _buildParam({
'gid': gid, 'groupID': groupID,
'uid': uid, 'userID': userID,
'handleMsg': handleMsg, 'handleMsg': handleMsg,
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})); }));
@@ -349,7 +356,7 @@ class GroupManager {
_channel.invokeMethod( _channel.invokeMethod(
'dismissGroup', 'dismissGroup',
_buildParam({ _buildParam({
'gid': groupID, 'groupID': groupID,
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})); }));
@@ -364,7 +371,7 @@ class GroupManager {
_channel.invokeMethod( _channel.invokeMethod(
'changeGroupMute', 'changeGroupMute',
_buildParam({ _buildParam({
'gid': groupID, 'groupID': groupID,
'mute': mute, 'mute': mute,
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})); }));
@@ -382,8 +389,8 @@ class GroupManager {
_channel.invokeMethod( _channel.invokeMethod(
'changeGroupMemberMute', 'changeGroupMemberMute',
_buildParam({ _buildParam({
'gid': groupID, 'groupID': groupID,
'uid': userID, 'userID': userID,
'seconds': seconds, 'seconds': seconds,
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})); }));
@@ -401,8 +408,8 @@ class GroupManager {
_channel.invokeMethod( _channel.invokeMethod(
'setGroupMemberNickname', 'setGroupMemberNickname',
_buildParam({ _buildParam({
'gid': groupID, 'groupID': groupID,
'uid': userID, 'userID': userID,
'groupNickname': groupNickname ?? '', 'groupNickname': groupNickname ?? '',
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})); }));
@@ -481,7 +488,7 @@ class GroupManager {
.then((value) => .then((value) =>
Utils.toList(value, (map) => GroupMembersInfo.fromJson(map))); Utils.toList(value, (map) => GroupMembersInfo.fromJson(map)));
/// 设置群成员权限 /// 进群验证设置
/// [groupID] 群ID /// [groupID] 群ID
/// [needVerification] 进群设置,参考[GroupVerification]类 /// [needVerification] 进群设置,参考[GroupVerification]类
Future<dynamic> setGroupVerification({ Future<dynamic> setGroupVerification({
@@ -497,8 +504,140 @@ class GroupManager {
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})); }));
/// 不允许通过群获取成员资料
/// [groupID] 群ID
/// [status] 0关闭1打开
Future<dynamic> setGroupLookMemberInfo({
required String groupID,
required int status,
String? operationID,
}) =>
_channel.invokeMethod(
'setGroupLookMemberInfo',
_buildParam({
'groupID': groupID,
'status': status,
'operationID': Utils.checkOperationID(operationID),
}));
/// 不允许通过群添加好友
/// [groupID] 群ID
/// [status] 0关闭1打开
Future<dynamic> setGroupApplyMemberFriend({
required String groupID,
required int status,
String? operationID,
}) =>
_channel.invokeMethod(
'setGroupApplyMemberFriend',
_buildParam({
'groupID': groupID,
'status': status,
'operationID': Utils.checkOperationID(operationID),
}));
/// 获取群拥有者,管理员
/// [groupId] 群ID
Future<List<GroupMembersInfo>> getGroupOwnerAndAdmin({
required String groupID,
String? operationID,
}) =>
_channel
.invokeMethod(
'getGroupMemberOwnerAndAdmin',
_buildParam({
'groupID': groupID,
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) =>
Utils.toList(value, (map) => GroupMembersInfo.fromJson(map)));
/// 查询群
/// [groupID] 群id
/// [keywordList] 搜索关键词,目前仅支持一个关键词搜索,不能为空
/// [isSearchUserID] 是否以关键词搜成员id
/// [isSearchMemberNickname] 是否以关键词搜索成员昵称
/// [offset] 开始index
/// [count] 每次获取的总数
Future<List<GroupMembersInfo>> searchGroupMembers({
required String groupID,
List<String> keywordList = const [],
bool isSearchUserID = false,
bool isSearchMemberNickname = false,
int offset = 0,
int count = 40,
String? operationID,
}) =>
_channel
.invokeMethod(
'searchGroupMembers',
_buildParam({
'searchParam': {
'groupID': groupID,
'keywordList': keywordList,
'isSearchUserID': isSearchUserID,
'isSearchMemberNickname': isSearchMemberNickname,
'offset': offset,
'count': count,
},
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) =>
Utils.toList(value, (map) => GroupMembersInfo.fromJson(map)));
/// 查询群
/// [groupID] 群id
/// [keywordList] 搜索关键词,目前仅支持一个关键词搜索,不能为空
/// [isSearchUserID] 是否以关键词搜成员id
/// [isSearchMemberNickname] 是否以关键词搜索成员昵称
/// [offset] 开始index
/// [count] 每次获取的总数
Future<List<dynamic>> searchGroupMembersListMap({
required String groupID,
List<String> keywordList = const [],
bool isSearchUserID = false,
bool isSearchMemberNickname = false,
int offset = 0,
int count = 40,
String? operationID,
}) =>
_channel
.invokeMethod(
'searchGroupMembers',
_buildParam({
'searchParam': {
'groupID': groupID,
'keywordList': keywordList,
'isSearchUserID': isSearchUserID,
'isSearchMemberNickname': isSearchMemberNickname,
'offset': offset,
'count': count,
},
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toListMap(value));
/// 修改GroupMemberInfo ex字段
Future<dynamic> setGroupMemberInfo({
required String groupID,
required String userID,
String? ex,
String? operationID,
}) =>
_channel.invokeMethod(
'setGroupMemberInfo',
_buildParam({
'info': {
'groupID': groupID,
'userID': userID,
'ex': ex,
},
'operationID': Utils.checkOperationID(operationID),
}));
static Map _buildParam(Map param) { static Map _buildParam(Map param) {
param["ManagerName"] = "groupManager"; param["ManagerName"] = "groupManager";
log('param: $param');
return param; return param;
} }
} }

View File

@@ -1,7 +1,9 @@
import 'dart:developer'; import 'dart:developer';
import 'dart:io';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
import 'package:flutter_openim_sdk/src/logger.dart';
class IMManager { class IMManager {
MethodChannel _channel; MethodChannel _channel;
@@ -10,15 +12,13 @@ class IMManager {
late MessageManager messageManager; late MessageManager messageManager;
late GroupManager groupManager; late GroupManager groupManager;
late UserManager userManager; late UserManager userManager;
// late OfflinePushManager offlinePushManager;
late SignalingManager signalingManager; late SignalingManager signalingManager;
late WorkMomentsManager workMomentsManager;
late OrganizationManager organizationManager;
late OnConnectListener _connectListener; late OnConnectListener _connectListener;
late String uid; OnListenerForService? _listenerForService;
late UserInfo uInfo; OnUploadFileListener? _uploadFileListener;
late String userID;
late UserInfo userInfo;
bool isLogined = false; bool isLogined = false;
String? token; String? token;
String? _objectStorage; String? _objectStorage;
@@ -29,17 +29,14 @@ class IMManager {
messageManager = MessageManager(_channel); messageManager = MessageManager(_channel);
groupManager = GroupManager(_channel); groupManager = GroupManager(_channel);
userManager = UserManager(_channel); userManager = UserManager(_channel);
// offlinePushManager = OfflinePushManager(_channel);
signalingManager = SignalingManager(_channel); signalingManager = SignalingManager(_channel);
workMomentsManager = WorkMomentsManager(_channel);
organizationManager = OrganizationManager(_channel);
_addNativeCallback(_channel); _addNativeCallback(_channel);
} }
void _addNativeCallback(MethodChannel _channel) { void _addNativeCallback(MethodChannel _channel) {
_channel.setMethodCallHandler((call) { _channel.setMethodCallHandler((call) {
try { try {
log('Flutter : $call'); Logger.print('Flutter : $call');
if (call.method == ListenerType.connectListener) { if (call.method == ListenerType.connectListener) {
String type = call.arguments['type']; String type = call.arguments['type'];
switch (type) { switch (type) {
@@ -57,8 +54,8 @@ class IMManager {
case 'onKickedOffline': case 'onKickedOffline':
_connectListener.kickedOffline(); _connectListener.kickedOffline();
break; break;
case 'onUserSigExpired': case 'onUserTokenExpired':
_connectListener.userSigExpired(); _connectListener.userTokenExpired();
break; break;
} }
} else if (call.method == ListenerType.userListener) { } else if (call.method == ListenerType.userListener) {
@@ -66,8 +63,8 @@ class IMManager {
dynamic data = call.arguments['data']; dynamic data = call.arguments['data'];
switch (type) { switch (type) {
case 'onSelfInfoUpdated': case 'onSelfInfoUpdated':
uInfo = Utils.toObj(data, (map) => UserInfo.fromJson(map)); userInfo = Utils.toObj(data, (map) => UserInfo.fromJson(map));
userManager.listener.selfInfoUpdated(uInfo); userManager.listener.selfInfoUpdated(userInfo);
break; break;
} }
} else if (call.method == ListenerType.groupListener) { } else if (call.method == ListenerType.groupListener) {
@@ -94,6 +91,10 @@ class IMManager {
data, (map) => GroupApplicationInfo.fromJson(map)); data, (map) => GroupApplicationInfo.fromJson(map));
groupManager.listener.groupApplicationRejected(i); groupManager.listener.groupApplicationRejected(i);
break; break;
case 'onGroupDismissed':
final i = Utils.toObj(data, (map) => GroupInfo.fromJson(map));
groupManager.listener.groupDismissed(i);
break;
case 'onGroupInfoChanged': case 'onGroupInfoChanged':
final i = Utils.toObj(data, (map) => GroupInfo.fromJson(map)); final i = Utils.toObj(data, (map) => GroupInfo.fromJson(map));
groupManager.listener.groupInfoChanged(i); groupManager.listener.groupInfoChanged(i);
@@ -126,26 +127,59 @@ class IMManager {
var type = call.arguments['type']; var type = call.arguments['type'];
// var id = call.arguments['data']['id']; // var id = call.arguments['data']['id'];
switch (type) { switch (type) {
case 'onMsgDeleted':
var value = call.arguments['data']['message'];
final msg = Utils.toObj(value, (map) => Message.fromJson(map));
messageManager.msgListener.msgDeleted(msg);
break;
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']['msgReceiptList'];
var list =
Utils.toList(value, (map) => ReadReceiptInfo.fromJson(map));
messageManager.msgListener.recvC2CReadReceipt(list);
break;
case 'onRecvGroupReadReceipt':
var value = call.arguments['data']['groupMsgReceiptList'];
var list =
Utils.toList(value, (map) => ReadReceiptInfo.fromJson(map));
messageManager.msgListener.recvGroupReadReceipt(list);
break;
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']['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']['reactionExtensionKeyList'];
var list = Utils.toList(value, (map) => '$map');
messageManager.msgListener
.recvMessageExtensionsDeleted(msgID, list);
break;
case 'onRecvNewMessage': case 'onRecvNewMessage':
var value = call.arguments['data']['newMessage']; var value = call.arguments['data']['message'];
final msg = Utils.toObj(value, (map) => Message.fromJson(map)); final msg = Utils.toObj(value, (map) => Message.fromJson(map));
messageManager.msgListener.recvNewMessage(msg); messageManager.msgListener.recvNewMessage(msg);
break; break;
case 'onRecvMessageRevoked': case 'onRecvOfflineNewMessage':
var msgID = call.arguments['data']['revokedMessage']; var value = call.arguments['data']['message'];
messageManager.msgListener.recvMessageRevoked(msgID); final msg = Utils.toObj(value, (map) => Message.fromJson(map));
break; messageManager.msgListener.recvOfflineNewMessage(msg);
case 'onRecvC2CReadReceipt':
var value = call.arguments['data']['c2cMessageReadReceipt'];
var list =
Utils.toList(value, (map) => ReadReceiptInfo.fromJson(map));
messageManager.msgListener.recvC2CMessageReadReceipt(list);
break;
case 'onRecvGroupReadReceipt':
var value = call.arguments['data']['groupMessageReadReceipt'];
var list =
Utils.toList(value, (map) => ReadReceiptInfo.fromJson(map));
messageManager.msgListener.recvGroupMessageReadReceipt(list);
break; break;
} }
} else if (call.method == ListenerType.msgSendProgressListener) { } else if (call.method == ListenerType.msgSendProgressListener) {
@@ -195,13 +229,17 @@ class IMManager {
dynamic data = call.arguments['data']; dynamic data = call.arguments['data'];
switch (type) { switch (type) {
case 'onBlacklistAdded': case 'onBlackAdded':
final u = Utils.toObj(data, (map) => BlacklistInfo.fromJson(map)); final u = Utils.toObj(data, (map) => BlacklistInfo.fromJson(map));
friendshipManager.listener.blacklistAdded(u); friendshipManager.listener.blackAdded(u);
break; break;
case 'onBlacklistDeleted': case 'onBlackDeleted':
final u = Utils.toObj(data, (map) => BlacklistInfo.fromJson(map)); 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; break;
case 'onFriendApplicationAccepted': case 'onFriendApplicationAccepted':
final u = Utils.toObj( final u = Utils.toObj(
@@ -223,67 +261,182 @@ class IMManager {
data, (map) => FriendApplicationInfo.fromJson(map)); data, (map) => FriendApplicationInfo.fromJson(map));
friendshipManager.listener.friendApplicationRejected(u); friendshipManager.listener.friendApplicationRejected(u);
break; 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': case 'onFriendDeleted':
final u = Utils.toObj(data, (map) => FriendInfo.fromJson(map)); final u = Utils.toObj(data, (map) => FriendInfo.fromJson(map));
friendshipManager.listener.friendDeleted(u); friendshipManager.listener.friendDeleted(u);
break; break;
case 'onFriendInfoChanged':
final u = Utils.toObj(data, (map) => FriendInfo.fromJson(map));
friendshipManager.listener.friendInfoChanged(u);
break;
} }
} else if (call.method == ListenerType.signalingListener) { } else if (call.method == ListenerType.signalingListener) {
String type = call.arguments['type']; String type = call.arguments['type'];
dynamic data = call.arguments['data']; dynamic data = call.arguments['data'];
final u = Utils.toObj(data, (map) => SignalingInfo.fromJson(map)); dynamic info;
switch (type) {
case 'onRoomParticipantConnected':
case 'onRoomParticipantDisconnected':
info = Utils.toObj(data, (map) => RoomCallingInfo.fromJson(map));
break;
case 'onStreamChange':
info =
Utils.toObj(data, (map) => MeetingStreamEvent.fromJson(map));
break;
case 'onReceiveCustomSignal':
info = Utils.toObj(data, (map) => CustomSignaling.fromJson(map));
break;
default:
info = Utils.toObj(data, (map) => SignalingInfo.fromJson(map));
break;
}
switch (type) { switch (type) {
case 'onInvitationCancelled': case 'onInvitationCancelled':
signalingManager.listener.invitationCancelled(u); signalingManager.listener.invitationCancelled(info);
break; break;
case 'onInvitationTimeout': case 'onInvitationTimeout':
signalingManager.listener.invitationTimeout(u); signalingManager.listener.invitationTimeout(info);
break; break;
case 'onInviteeAccepted': case 'onInviteeAccepted':
signalingManager.listener.inviteeAccepted(u); signalingManager.listener.inviteeAccepted(info);
break; break;
case 'onInviteeRejected': case 'onInviteeRejected':
signalingManager.listener.inviteeRejected(u); signalingManager.listener.inviteeRejected(info);
break; break;
case 'onReceiveNewInvitation': case 'onReceiveNewInvitation':
signalingManager.listener.receiveNewInvitation(u); signalingManager.listener.receiveNewInvitation(info);
break; break;
case 'onInviteeAcceptedByOtherDevice': case 'onInviteeAcceptedByOtherDevice':
signalingManager.listener.inviteeAcceptedByOtherDevice(u); signalingManager.listener.inviteeAcceptedByOtherDevice(info);
break; break;
case 'onInviteeRejectedByOtherDevice': case 'onInviteeRejectedByOtherDevice':
signalingManager.listener.inviteeRejectedByOtherDevice(u); signalingManager.listener.inviteeRejectedByOtherDevice(info);
break; break;
case 'onHangUp': case 'onHangUp':
signalingManager.listener.hangup(u); signalingManager.listener.hangup(info);
break;
case 'onRoomParticipantConnected':
signalingManager.listener.roomParticipantConnected(info);
break;
case 'onRoomParticipantDisconnected':
signalingManager.listener.roomParticipantDisconnected(info);
break;
case 'onStreamChange':
signalingManager.listener.streamChangedEvent(info);
break;
case 'onReceiveCustomSignal':
signalingManager.listener.receiveCustomSignal(info);
break; break;
} }
} else if (call.method == ListenerType.workMomentsListener) { } else if (call.method == ListenerType.customBusinessListener) {
String type = call.arguments['type']; String type = call.arguments['type'];
String data = call.arguments['data'];
switch (type) { switch (type) {
case 'OnRecvNewNotification': case 'onRecvCustomBusinessMessage':
workMomentsManager.listener.recvNewNotification(); messageManager.customBusinessListener
?.recvCustomBusinessMessage(data);
break; break;
} }
} else if (call.method == ListenerType.organizationListener) { } else if (call.method == ListenerType.messageKvInfoListener) {
String type = call.arguments['type']; String type = call.arguments['type'];
String data = call.arguments['data'];
switch (type) { switch (type) {
case 'onOrganizationUpdated': case 'onMessageKvInfoChanged':
organizationManager.listener.organizationUpdated(); final list =
Utils.toList(data, (map) => MessageKv.fromJson(map)).toList();
messageManager.messageKvInfoListener?.messageKvInfoChanged(list);
break;
}
} else if (call.method == ListenerType.listenerForService) {
String type = call.arguments['type'];
String data = call.arguments['data'];
switch (type) {
case 'onFriendApplicationAccepted':
final u = Utils.toObj(
data, (map) => FriendApplicationInfo.fromJson(map));
_listenerForService?.friendApplicationAccepted(u);
break;
case 'onFriendApplicationAdded':
final u = Utils.toObj(
data, (map) => FriendApplicationInfo.fromJson(map));
_listenerForService?.friendApplicationAdded(u);
break;
case 'onGroupApplicationAccepted':
final i = Utils.toObj(
data, (map) => GroupApplicationInfo.fromJson(map));
_listenerForService?.groupApplicationAccepted(i);
break;
case 'onGroupApplicationAdded':
final i = Utils.toObj(
data, (map) => GroupApplicationInfo.fromJson(map));
_listenerForService?.groupApplicationAdded(i);
break;
case 'onRecvNewMessage':
final msg = Utils.toObj(data, (map) => Message.fromJson(map));
_listenerForService?.recvNewMessage(msg);
break;
}
} else if (call.method == ListenerType.uploadFileListener) {
String type = call.arguments['type'];
dynamic data = call.arguments['data'];
switch (type) {
case 'complete':
String id = data['id'];
int size = data['size'];
String url = data['url'];
int type = data['type'];
_uploadFileListener?.complete(id, size, url, type);
break;
case 'hashPartComplete':
String id = data['id'];
String partHash = data['partHash'];
String fileHash = data['fileHash'];
_uploadFileListener?.hashPartComplete(id, partHash, fileHash);
break;
case 'hashPartProgress':
String id = data['id'];
int index = data['index'];
int size = data['size'];
String partHash = data['partHash'];
_uploadFileListener?.hashPartProgress(id, index, size, partHash);
break;
case 'open':
String id = data['id'];
int size = data['size'];
_uploadFileListener?.open(id, size);
break;
case 'partSize':
String id = data['id'];
int partSize = data['partSize'];
int num = data['num'];
_uploadFileListener?.partSize(id, partSize, num);
break;
case 'uploadProgress':
String id = data['id'];
int fileSize = data['fileSize'];
int streamSize = data['streamSize'];
int storageSize = data['storageSize'];
_uploadFileListener?.uploadProgress(
id, fileSize, streamSize, storageSize);
break;
case 'uploadID':
String id = data['id'];
String uploadID = data['uploadID'];
_uploadFileListener?.uploadID(id, uploadID);
break;
case 'uploadPartComplete':
String id = data['id'];
int index = data['index'];
int partSize = data['partSize'];
String partHash = data['partHash'];
_uploadFileListener?.uploadPartComplete(
id, index, partSize, partHash);
break; break;
} }
} }
} catch (err) { } catch (error, stackTrace) {
print( Logger.print(
"回调失败了。$err ${call.method} ${call.arguments['type']} ${call.arguments['data']}"); "回调失败了。${call.method} ${call.arguments['type']} ${call.arguments['data']} $error $stackTrace");
} }
return Future.value(null); return Future.value(null);
}); });
@@ -296,14 +449,22 @@ class IMManager {
/// [dataDir] SDK数据库存储目录 /// [dataDir] SDK数据库存储目录
/// [objectStorage] 存储对象 cos/minio /// [objectStorage] 存储对象 cos/minio
/// [logLevel] 日志 1不打印 /// [logLevel] 日志 1不打印
/// [enabledEncryption] true加密
/// [enabledCompression] true压缩
Future<dynamic> initSDK({ Future<dynamic> initSDK({
required int platform, required int platformID,
required String apiAddr, required String apiAddr,
required String wsAddr, required String wsAddr,
required String dataDir, required String dataDir,
required OnConnectListener listener, required OnConnectListener listener,
int logLevel = 6, int logLevel = 6,
String objectStorage = 'cos', String objectStorage = 'cos',
String? encryptionKey,
bool isNeedEncryption = false,
bool isCompression = false,
bool isExternalExtensions = false,
bool isLogStandardOutput = true,
String? logFilePath,
String? operationID, String? operationID,
}) { }) {
this._connectListener = listener; this._connectListener = listener;
@@ -312,43 +473,62 @@ class IMManager {
'initSDK', 'initSDK',
_buildParam( _buildParam(
{ {
"platform": platform, "platformID": platformID,
"api_addr": apiAddr, "apiAddr": apiAddr,
"ws_addr": wsAddr, "wsAddr": wsAddr,
"data_dir": dataDir, "dataDir": dataDir,
"log_level": logLevel, "logLevel": logLevel,
"object_storage": objectStorage, "objectStorage": objectStorage,
"encryptionKey": encryptionKey,
"isNeedEncryption": isNeedEncryption,
"isCompression": isCompression,
"isExternalExtensions": isExternalExtensions,
"isLogStandardOutput": isLogStandardOutput,
"logFilePath": logFilePath,
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
}, },
)); ));
} }
/// 反初始化SDK
Future<dynamic> unInitSDK() {
return _channel.invokeMethod('unInitSDK', _buildParam({}));
}
/// 登录 /// 登录
/// [uid] 用户id /// [userID] 用户id
/// [token] 登录token从业务服务器上获取 /// [token] 登录token从业务服务器上获取
/// [defaultValue] 获取失败后使用的默认值
Future<UserInfo> login({ Future<UserInfo> login({
required String uid, required String userID,
required String token, required String token,
String? operationID, String? operationID,
Future<UserInfo> Function()? defaultValue,
bool checkLoginStatus = true,
}) async { }) async {
int? status;
if (checkLoginStatus) {
// 1: logout 2: logging 3:logged
status = await getLoginStatus();
}
if (status != LoginStatus.logging && status != LoginStatus.logged) {
await _channel.invokeMethod( await _channel.invokeMethod(
'login', 'login',
_buildParam({ _buildParam({
'uid': uid, 'userID': userID,
'token': token, 'token': token,
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
}), }),
); );
}
this.isLogined = true; this.isLogined = true;
this.uid = uid; this.userID = userID;
this.token = token; this.token = token;
this.uInfo = await userManager.getSelfUserInfo(); try {
return uInfo; return this.userInfo = await userManager.getSelfUserInfo();
} catch (error, stackTrace) {
log('login e: $error s: $stackTrace');
if (null != defaultValue) {
return this.userInfo = await (defaultValue.call());
}
return Future.error(error, stackTrace);
}
// return uInfo;
} }
/// 登出 /// 登出
@@ -364,41 +544,93 @@ class IMManager {
} }
/// 获取登录状态 /// 获取登录状态
Future<int?> getLoginStatus() => /// 1: logout 2: logging 3:logged
_channel.invokeMethod<int>('getLoginStatus', _buildParam({})); Future<int?> getLoginStatus({
String? operationID,
/// 获取当前登录用户id }) =>
Future<String> getLoginUserID() async => uid; _channel.invokeMethod<int>(
'getLoginStatus',
/// 获取当前登录用户信息
Future<UserInfo> getLoginUserInfo() async => uInfo;
/// 从后台回到前台立刻唤醒
Future wakeUp({String? operationID}) => _channel.invokeMethod(
'wakeUp',
_buildParam({ _buildParam({
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})); }));
/// 上传图片到服务器 /// 获取当前登录用户id
/// [path] 图片路径 Future<String> getLoginUserID() async => userID;
/// [token] im token
/// [objectStorage] 存储对象 cos/minio /// 获取当前登录用户信息
Future uploadImage({ Future<UserInfo> getLoginUserInfo() async => userInfo;
required String path,
String? token, ///[id] 跟 [OnUploadFileListener] id一致区分是哪个文件的回调
String? objectStorage, Future uploadFile({
required String id,
required String filePath,
required String fileName,
String? contentType,
String? cause,
String? operationID, String? operationID,
}) => }) =>
_channel.invokeMethod( _channel.invokeMethod(
'uploadImage', 'uploadFile',
_buildParam({ _buildParam({
'path': path, 'id': id,
'token': token ?? this.token, 'filePath': filePath,
'obj': objectStorage ?? this._objectStorage, 'name': fileName,
'contentType': contentType,
'cause': cause,
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})); }));
/// 更新firebase客户端注册token
/// [fcmToken] firebase token
Future updateFcmToken({
required String fcmToken,
String? operationID,
}) =>
_channel.invokeMethod(
'updateFcmToken',
_buildParam({
'fcmToken': fcmToken,
'operationID': Utils.checkOperationID(operationID),
}));
/// 标记app处于后台
// Future setAppBackgroundStatus({
// required bool isBackground,
// String? operationID,
// }) =>
// _channel.invokeMethod(
// 'setAppBackgroundStatus',
// _buildParam({
// 'isBackground': isBackground,
// 'operationID': Utils.checkOperationID(operationID),
// }));
/// 网络改变
// Future networkStatusChanged({
// String? operationID,
// }) =>
// _channel.invokeMethod(
// 'networkStatusChanged',
// _buildParam({
// 'operationID': Utils.checkOperationID(operationID),
// }));
void setUploadFileListener(OnUploadFileListener listener) {
_uploadFileListener = listener;
}
///
Future setListenerForService(OnListenerForService listener) {
if (Platform.isAndroid) {
this._listenerForService = listener;
return _channel.invokeMethod('setListenerForService', _buildParam({}));
} else {
throw UnsupportedError("only supprot android platform");
}
}
MethodChannel get channel => _channel;
static Map _buildParam(Map param) { static Map _buildParam(Map param) {
param["ManagerName"] = "imManager"; param["ManagerName"] = "imManager";
return param; return param;

View File

@@ -7,6 +7,8 @@ class MessageManager {
// List<AdvancedMsgListener> advancedMsgListeners = List.empty(growable: true); // List<AdvancedMsgListener> advancedMsgListeners = List.empty(growable: true);
OnMsgSendProgressListener? msgSendProgressListener; OnMsgSendProgressListener? msgSendProgressListener;
late OnAdvancedMsgListener msgListener; late OnAdvancedMsgListener msgListener;
OnCustomBusinessListener? customBusinessListener;
OnMessageKvInfoListener? messageKvInfoListener;
MessageManager(this._channel); MessageManager(this._channel);
@@ -50,58 +52,56 @@ class MessageManager {
})) }))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); .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<List<Message>> getHistoryMessageList({
String? userID,
String? groupID,
String? conversationID,
Message? startMsg,
int? count,
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)));
/// 撤回消息
/// [message] 被撤回的消息体
Future revokeMessage({
required Message message,
String? operationID,
}) =>
_channel.invokeMethod(
'revokeMessage',
_buildParam(message.toJson()
..addAll({
"operationID": Utils.checkOperationID(operationID),
})));
/// 删除本地消息 /// 删除本地消息
/// [message] 被删除的消息体 /// [message] 被删除的消息体
Future deleteMessageFromLocalStorage({ Future deleteMessageFromLocalStorage({
required Message message, required String conversationID,
required String clientMsgID,
String? operationID, String? operationID,
}) => }) =>
_channel.invokeMethod( _channel.invokeMethod(
'deleteMessageFromLocalStorage', 'deleteMessageFromLocalStorage',
_buildParam(message.toJson() _buildParam({
..addAll({ "conversationID": conversationID,
"clientMsgID": clientMsgID,
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
}))); }));
/// core-sdk: DeleteMessage
/// 删除本地跟服务器的指定的消息
/// [message] 被删除的消息
Future<dynamic> deleteMessageFromLocalAndSvr({
required String conversationID,
required String clientMsgID,
String? operationID,
}) =>
_channel.invokeMethod(
'deleteMessageFromLocalAndSvr',
_buildParam({
"conversationID": conversationID,
"clientMsgID": clientMsgID,
"operationID": Utils.checkOperationID(operationID),
}));
/// 删除本地所有聊天记录
Future<dynamic> deleteAllMsgFromLocal({
String? operationID,
}) =>
_channel.invokeMethod(
'deleteAllMsgFromLocal',
_buildParam({
"operationID": Utils.checkOperationID(operationID),
}));
/// 删除本地跟服务器所有聊天记录
Future<dynamic> deleteAllMsgFromLocalAndSvr({
String? operationID,
}) =>
_channel.invokeMethod(
'deleteAllMsgFromLocalAndSvr',
_buildParam({
"operationID": Utils.checkOperationID(operationID),
}));
/// 插入单聊消息到本地 /// 插入单聊消息到本地
/// [receiverID] 接收者id /// [receiverID] 接收者id
@@ -145,38 +145,6 @@ class MessageManager {
})) }))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); .then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 标记c2c单条消息已读
/// [userID] 消息来源的userID
/// [messageIDList] 消息clientMsgID集合
Future markC2CMessageAsRead({
required String userID,
required List<String> 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<String> messageIDList,
String? operationID,
}) =>
_channel.invokeMethod(
'markGroupMessageAsRead',
_buildParam({
"messageIDList": messageIDList,
"groupID": groupID,
"operationID": Utils.checkOperationID(operationID),
}));
/// 正在输入提示 /// 正在输入提示
/// [msgTip] 自定义内容 /// [msgTip] 自定义内容
Future typingStatusUpdate({ Future typingStatusUpdate({
@@ -486,14 +454,22 @@ class MessageManager {
/// 创建卡片消息 /// 创建卡片消息
/// [data] 自定义数据 /// [data] 自定义数据
Future<Message> createCardMessage({ Future<Message> createCardMessage({
required Map<String, dynamic> data, required String userID,
required String nickname,
String? faceURL,
String? ex,
String? operationID, String? operationID,
}) => }) =>
_channel _channel
.invokeMethod( .invokeMethod(
'createCardMessage', 'createCardMessage',
_buildParam({ _buildParam({
'cardMessage': data, 'cardMessage': {
'userID': userID,
'nickname': nickname,
'faceURL': faceURL,
'ex': ex,
},
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})) }))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); .then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
@@ -516,32 +492,6 @@ class MessageManager {
})) }))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); .then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 清空单聊消息记录
/// [uid] 单聊对象id
Future<dynamic> clearC2CHistoryMessage({
required String uid,
String? operationID,
}) =>
_channel.invokeMethod(
'clearC2CHistoryMessage',
_buildParam({
"userID": uid,
"operationID": Utils.checkOperationID(operationID),
}));
/// 清空组消息记录
/// [gid] 组id
Future<dynamic> clearGroupHistoryMessage({
required String gid,
String? operationID,
}) =>
_channel.invokeMethod(
'clearGroupHistoryMessage',
_buildParam({
"groupID": gid,
"operationID": Utils.checkOperationID(operationID),
}));
/// 搜索消息 /// 搜索消息
/// [conversationID] 根据会话查询如果是全局搜索传null /// [conversationID] 根据会话查询如果是全局搜索传null
/// [keywordList] 搜索关键词列表,目前仅支持一个关键词搜索 /// [keywordList] 搜索关键词列表,目前仅支持一个关键词搜索
@@ -584,107 +534,318 @@ class MessageManager {
.then((value) => .then((value) =>
Utils.toObj(value, (map) => SearchResult.fromJson(map))); Utils.toObj(value, (map) => SearchResult.fromJson(map)));
/// 删除本地跟服务器的指定的消息 /// 撤回消息
/// [message] 被删除的消息 /// [message] 被撤回的消息
Future<dynamic> deleteMessageFromLocalAndSvr({ Future revokeMessage({
required Message message, required String conversationID,
required String clientMsgID,
String? operationID, String? operationID,
}) => }) =>
_channel.invokeMethod( _channel.invokeMethod(
'deleteMessageFromLocalAndSvr', 'revokeMessage',
_buildParam(message.toJson()
..addAll({
"operationID": Utils.checkOperationID(operationID),
})));
/// 删除本地所有聊天记录
Future<dynamic> deleteAllMsgFromLocal({
String? operationID,
}) =>
_channel.invokeMethod(
'deleteAllMsgFromLocal',
_buildParam({
"operationID": Utils.checkOperationID(operationID),
}));
/// 删除本地跟服务器所有聊天记录
Future<dynamic> deleteAllMsgFromLocalAndSvr({
String? operationID,
}) =>
_channel.invokeMethod(
'deleteAllMsgFromLocalAndSvr',
_buildParam({ _buildParam({
'conversationID': conversationID,
'clientMsgID': clientMsgID,
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})); }));
/// 标记消息已读 /// 标记消息已读
/// [conversationID] 会话ID /// [conversationID] 会话ID
/// [messageIDList] 被标记的消息clientMsgID /// [messageIDList] 被标记的消息clientMsgID
Future markMessageAsReadByConID({ Future markMessagesAsReadByMsgID({
required String conversationID, required String conversationID,
required List<String> messageIDList, required List<String> messageIDList,
String? operationID, String? operationID,
}) => }) =>
_channel.invokeMethod( _channel.invokeMethod(
'markMessageAsReadByConID', 'markMessagesAsReadByMsgID',
_buildParam({ _buildParam({
"messageIDList": messageIDList,
"conversationID": conversationID, "conversationID": conversationID,
"messageIDList": messageIDList,
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})); }));
/// 删除本地跟服务器的单聊聊天记录 /// 获取聊天记录(以startMsg为节点以前的聊天记录)
/// [uid] 聊天对象的userID
Future<dynamic> clearC2CHistoryMessageFromLocalAndSvr({
required String uid,
String? operationID,
}) =>
_channel.invokeMethod(
'clearC2CHistoryMessageFromLocalAndSvr',
_buildParam({
"userID": uid,
"operationID": Utils.checkOperationID(operationID),
}));
/// 删除本地跟服务器的群聊天记录
/// [gid] 组id
Future<dynamic> clearGroupHistoryMessageFromLocalAndSvr({
required String gid,
String? operationID,
}) =>
_channel.invokeMethod(
'clearGroupHistoryMessageFromLocalAndSvr',
_buildParam({
"groupID": gid,
"operationID": Utils.checkOperationID(operationID),
}));
/// 获取聊天记录(以startMsg为节点新收到的聊天记录),用在全局搜索定位某一条消息,然后此条消息后新增的消息
/// [userID] 接收消息的用户id
/// [conversationID] 会话id查询通知时可用 /// [conversationID] 会话id查询通知时可用
/// [groupID] 接收消息的组id /// [startMsg] 从这条消息开始查询[count]条获取的列表index==length-1为最新消息所以获取下一页历史记录startMsg=list.first
/// [startMsg] 从这条消息开始查询[count]条获取的列表index==length-1为最新消息所以获取下一页历史记录startMsg=list.last
/// [count] 一次拉取的总数 /// [count] 一次拉取的总数
Future<List<Message>> getHistoryMessageListReverse({ /// [lastMinSeq] 第一页消息不用传,获取第二页开始必传 跟[startMsg]一样
String? userID, Future<AdvancedMessage> getAdvancedHistoryMessageList({
String? groupID,
String? conversationID, String? conversationID,
Message? startMsg, Message? startMsg,
int? lastMinSeq,
int? count, int? count,
String? operationID, String? operationID,
}) => }) =>
_channel _channel
.invokeMethod( .invokeMethod(
'getHistoryMessageListReverse', 'getAdvancedHistoryMessageList',
_buildParam({ _buildParam({
'userID': userID ?? '',
'groupID': groupID ?? '',
'conversationID': conversationID ?? '', 'conversationID': conversationID ?? '',
'startClientMsgID': startMsg?.clientMsgID ?? '', 'startClientMsgID': startMsg?.clientMsgID ?? '',
'count': count ?? 10, 'count': count ?? 40,
'lastMinSeq': lastMinSeq ?? 0,
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})) }))
.then((value) => Utils.toList(value, (map) => Message.fromJson(map))); .then((value) =>
Utils.toObj(value, (map) => AdvancedMessage.fromJson(map)));
/// 获取聊天记录(以startMsg为节点新收到的聊天记录),用在全局搜索定位某一条消息,然后此条消息后新增的消息
/// [conversationID] 会话id查询通知时可用
/// [startMsg] 从这条消息开始查询[count]条获取的列表index==length-1为最新消息所以获取下一页历史记录startMsg=list.last
/// [count] 一次拉取的总数
Future<AdvancedMessage> getAdvancedHistoryMessageListReverse({
String? conversationID,
Message? startMsg,
int? lastMinSeq,
int? count,
String? operationID,
}) =>
_channel
.invokeMethod(
'getAdvancedHistoryMessageListReverse',
_buildParam({
'conversationID': conversationID ?? '',
'startClientMsgID': startMsg?.clientMsgID ?? '',
'count': count ?? 40,
'lastMinSeq': lastMinSeq ?? 0,
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) =>
Utils.toObj(value, (map) => AdvancedMessage.fromJson(map)));
/// 查找消息详细
/// [conversationID] 会话id
/// [clientMsgIDList] 消息id列表
Future<SearchResult> findMessageList({
required List<SearchParams> searchParams,
String? operationID,
}) =>
_channel
.invokeMethod(
'findMessageList',
_buildParam({
'searchParams': searchParams.map((e) => e.toJson()).toList(),
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) =>
Utils.toObj(value, (map) => SearchResult.fromJson(map)));
/// 富文本消息
/// [text] 输入内容
/// [list] 富文本消息具体详细
Future<Message> createAdvancedTextMessage({
required String text,
List<RichMessageInfo> list = const [],
String? operationID,
}) =>
_channel
.invokeMethod(
'createAdvancedTextMessage',
_buildParam({
'text': text,
'richMessageInfoList': list.map((e) => e.toJson()).toList(),
"operationID": Utils.checkOperationID(operationID),
}),
)
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 富文本消息
/// [text] 回复的内容
/// [quoteMsg] 被回复的消息
/// [list] 富文本消息具体详细
Future<Message> createAdvancedQuoteMessage({
required String text,
required Message quoteMsg,
List<RichMessageInfo> list = const [],
String? operationID,
}) =>
_channel
.invokeMethod(
'createAdvancedQuoteMessage',
_buildParam({
'quoteText': text,
'quoteMessage': quoteMsg.toJson(),
'richMessageInfoList': list.map((e) => e.toJson()).toList(),
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 发送消息
/// [message] 消息体 [createImageMessageByURL],[createSoundMessageByURL],[createVideoMessageByURL],[createFileMessageByURL]
/// [userID] 接收消息的用户id
/// [groupID] 接收消息的组id
/// [offlinePushInfo] 离线消息显示内容
Future<Message> sendMessageNotOss({
required Message message,
required OfflinePushInfo offlinePushInfo,
String? userID,
String? groupID,
String? operationID,
}) =>
_channel
.invokeMethod(
'sendMessageNotOss',
_buildParam({
'message': message.toJson(),
'offlinePushInfo': offlinePushInfo.toJson(),
'userID': userID ?? '',
'groupID': groupID ?? '',
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建图片消息
Future<Message> createImageMessageByURL({
required PictureInfo sourcePicture,
required PictureInfo bigPicture,
required PictureInfo snapshotPicture,
String? operationID,
}) =>
_channel
.invokeMethod(
'createImageMessageByURL',
_buildParam({
'sourcePicture': sourcePicture.toJson(),
'bigPicture': bigPicture.toJson(),
'snapshotPicture': snapshotPicture.toJson(),
"operationID": Utils.checkOperationID(operationID),
}),
)
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建语音消息
Future<Message> createSoundMessageByURL({
required SoundElem soundElem,
String? operationID,
}) =>
_channel
.invokeMethod(
'createSoundMessageByURL',
_buildParam({
'soundElem': soundElem.toJson(),
"operationID": Utils.checkOperationID(operationID),
}),
)
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建视频消息
Future<Message> createVideoMessageByURL({
required VideoElem videoElem,
String? operationID,
}) =>
_channel
.invokeMethod(
'createVideoMessageByURL',
_buildParam({
'videoElem': videoElem.toJson(),
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建视频消息
Future<Message> createFileMessageByURL({
required FileElem fileElem,
String? operationID,
}) =>
_channel
.invokeMethod(
'createFileMessageByURL',
_buildParam({
'fileElem': fileElem.toJson(),
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
///
Future setCustomBusinessListener(OnCustomBusinessListener listener) {
this.customBusinessListener = listener;
return _channel.invokeMethod('setCustomBusinessListener', _buildParam({}));
}
///
Future setMessageKvInfoListener(OnMessageKvInfoListener listener) {
this.messageKvInfoListener = listener;
return _channel.invokeMethod('setMessageKvInfoListener', _buildParam({}));
}
Future<List<TypeKeySetResult>> setMessageReactionExtensions({
required Message message,
List<KeyValue> list = const [],
String? operationID,
}) =>
_channel
.invokeMethod(
'setMessageReactionExtensions',
_buildParam({
'message': message.toJson(),
'list': list.map((e) => e.toJson()).toList(),
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) =>
Utils.toList(value, (map) => TypeKeySetResult.fromJson(map)));
Future<List<TypeKeySetResult>> deleteMessageReactionExtensions({
required Message message,
List<String> list = const [],
String? operationID,
}) =>
_channel
.invokeMethod(
'deleteMessageReactionExtensions',
_buildParam({
'message': message.toJson(),
'list': list,
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) =>
Utils.toList(value, (map) => TypeKeySetResult.fromJson(map)));
Future<List<MessageTypeKeyMapping>> getMessageListReactionExtensions({
List<Message> messageList = const [],
String? operationID,
}) =>
_channel
.invokeMethod(
'getMessageListReactionExtensions',
_buildParam({
'messageList': messageList.map((e) => e.toJson()).toList(),
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(
value, (map) => MessageTypeKeyMapping.fromJson(map)));
Future<List<TypeKeySetResult>> addMessageReactionExtensions({
required Message message,
List<KeyValue> list = const [],
String? operationID,
}) =>
_channel
.invokeMethod(
'addMessageReactionExtensions',
_buildParam({
'message': message.toJson(),
'list': list.map((e) => e.toJson()).toList(),
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) =>
Utils.toList(value, (map) => TypeKeySetResult.fromJson(map)));
Future<List<MessageTypeKeyMapping>> getMessageListSomeReactionExtensions({
List<Message> messageList = const [],
List<KeyValue> kvList = const [],
String? operationID,
}) =>
_channel
.invokeMethod(
'getMessageListSomeReactionExtensions',
_buildParam({
'messageList': messageList.map((e) => e.toJson()).toList(),
'list': kvList.map((e) => e.toJson()).toList(),
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(
value, (map) => MessageTypeKeyMapping.fromJson(map)));
static Map _buildParam(Map param) { static Map _buildParam(Map param) {
param["ManagerName"] = "messageManager"; param["ManagerName"] = "messageManager";

View File

@@ -1,7 +0,0 @@
// import 'package:flutter/services.dart';
//
// class OfflinePushManager{
// MethodChannel _channel;
//
// OfflinePushManager(this._channel);
// }

Some files were not shown because too many files have changed in this diff Show More