|
|
|
@ -31,65 +31,65 @@ A flutter im plugin for android and ios. |
|
|
|
|
// Initialize SDK |
|
|
|
|
OpenIM.iMManager |
|
|
|
|
..initSDK( |
|
|
|
|
platform: IMPlatform.ios, |
|
|
|
|
ipApi: 'Api interface address', |
|
|
|
|
ipWs: 'WebSocket address', |
|
|
|
|
dbPath: 'Database directory', |
|
|
|
|
platform: Platform.isAndroid ? IMPlatform.android : IMPlatform.ios, |
|
|
|
|
ipApi: '', |
|
|
|
|
ipWs: '', |
|
|
|
|
dbPath: '', |
|
|
|
|
listener: OnInitSDKListener( |
|
|
|
|
connecting: () {}, |
|
|
|
|
connectFailed: (code, error) {}, |
|
|
|
|
connectSuccess: () {}, |
|
|
|
|
kickedOffline: () {}, |
|
|
|
|
userSigExpired: () {}, |
|
|
|
|
selfInfoUpdated: (user) {}, |
|
|
|
|
onConnecting: () {}, |
|
|
|
|
onConnectFailed: (code, error) {}, |
|
|
|
|
onConnectSuccess: () {}, |
|
|
|
|
onKickedOffline: () {}, |
|
|
|
|
onUserSigExpired: () {}, |
|
|
|
|
onSelfInfoUpdated: (user) {}, |
|
|
|
|
), |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
// Add message listener (remove when not in use) |
|
|
|
|
..messageManager.addAdvancedMsgListener(OnAdvancedMsgListener( |
|
|
|
|
recvMessageRevoked: (id) {}, |
|
|
|
|
recvC2CReadReceipt: (list) {}, |
|
|
|
|
recvNewMessage: (msg) {}, |
|
|
|
|
onRecvMessageRevoked: (msgId) {}, |
|
|
|
|
onRecvC2CReadReceipt: (list) {}, |
|
|
|
|
onRecvNewMessage: (msg) {}, |
|
|
|
|
)) |
|
|
|
|
|
|
|
|
|
// Set up message sending progress listener |
|
|
|
|
..messageManager.setMsgSendProgressListener(OnMsgSendProgressListener( |
|
|
|
|
progressCallback: (id, progress) {}, |
|
|
|
|
onProgress: (msgId, progress) {}, |
|
|
|
|
)) |
|
|
|
|
|
|
|
|
|
// Set up friend relationship listener |
|
|
|
|
..friendshipManager.setFriendshipListener(OnFriendshipListener( |
|
|
|
|
blackListAdd: (u) {}, |
|
|
|
|
blackListDeleted: (u) {}, |
|
|
|
|
friendApplicationListAccept: (u) {}, |
|
|
|
|
friendApplicationListAdded: (u) {}, |
|
|
|
|
friendApplicationListDeleted: (u) {}, |
|
|
|
|
friendApplicationListReject: (u) {}, |
|
|
|
|
friendInfoChanged: (u) {}, |
|
|
|
|
friendListAdded: (u) {}, |
|
|
|
|
friendListDeleted: (u) {}, |
|
|
|
|
onBlackListAdd: (u) {}, |
|
|
|
|
onBlackListDeleted: (u) {}, |
|
|
|
|
onFriendApplicationListAccept: (u) {}, |
|
|
|
|
onFriendApplicationListAdded: (u) {}, |
|
|
|
|
onFriendApplicationListDeleted: (u) {}, |
|
|
|
|
onFriendApplicationListReject: (u) {}, |
|
|
|
|
onFriendInfoChanged: (u) {}, |
|
|
|
|
onFriendListAdded: (u) {}, |
|
|
|
|
onFriendListDeleted: (u) {}, |
|
|
|
|
)) |
|
|
|
|
|
|
|
|
|
// Set up conversation listener |
|
|
|
|
..conversationManager.setConversationListener(OnConversationListener( |
|
|
|
|
conversationChanged: (list) {}, |
|
|
|
|
newConversation: (list) {}, |
|
|
|
|
totalUnreadMsgCountChanged: (count) {}, |
|
|
|
|
syncServerFailed: () {}, |
|
|
|
|
syncServerFinish: () {}, |
|
|
|
|
syncServerStart: () {}, |
|
|
|
|
onConversationChanged: (list) {}, |
|
|
|
|
onNewConversation: (list) {}, |
|
|
|
|
onTotalUnreadMessageCountChanged: (count) {}, |
|
|
|
|
onSyncServerFailed: () {}, |
|
|
|
|
onSyncServerFinish: () {}, |
|
|
|
|
onSyncServerStart: () {}, |
|
|
|
|
)) |
|
|
|
|
|
|
|
|
|
// Set up group listener |
|
|
|
|
..groupManager.setGroupListener(OnGroupListener( |
|
|
|
|
applicationProcessed: (groupId, opUser, agreeOrReject, opReason) {}, |
|
|
|
|
groupCreated: (groupId) {}, |
|
|
|
|
groupInfoChanged: (groupId, info) {}, |
|
|
|
|
memberEnter: (groupId, list) {}, |
|
|
|
|
memberInvited: (groupId, opUser, list) {}, |
|
|
|
|
memberKicked: (groupId, opUser, list) {}, |
|
|
|
|
memberLeave: (groupId, info) {}, |
|
|
|
|
receiveJoinApplication: (groupId, info, opReason) {}, |
|
|
|
|
onApplicationProcessed: (groupId, opUser, agreeOrReject, opReason) {}, |
|
|
|
|
onGroupCreated: (groupId) {}, |
|
|
|
|
onGroupInfoChanged: (groupId, info) {}, |
|
|
|
|
onMemberEnter: (groupId, list) {}, |
|
|
|
|
onMemberInvited: (groupId, opUser, list) {}, |
|
|
|
|
onMemberKicked: (groupId, opUser, list) {}, |
|
|
|
|
onMemberLeave: (groupId, info) {}, |
|
|
|
|
onReceiveJoinApplication: (groupId, info, opReason) {}, |
|
|
|
|
)); |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|