feat: incr sync version.
This commit is contained in:
158
go/chao-sdk-core/open_im_sdk_callback/callback_client.go
Normal file
158
go/chao-sdk-core/open_im_sdk_callback/callback_client.go
Normal file
@@ -0,0 +1,158 @@
|
||||
// Copyright © 2023 OpenIM SDK. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package open_im_sdk_callback
|
||||
|
||||
type Base interface {
|
||||
OnError(errCode int32, errMsg string)
|
||||
OnSuccess(data string)
|
||||
}
|
||||
type SendMsgCallBack interface {
|
||||
Base
|
||||
OnProgress(progress int)
|
||||
}
|
||||
|
||||
type OnConnListener interface {
|
||||
OnConnecting()
|
||||
OnConnectSuccess()
|
||||
OnConnectFailed(errCode int32, errMsg string)
|
||||
OnKickedOffline()
|
||||
OnUserTokenExpired()
|
||||
OnUserTokenInvalid(errMsg string)
|
||||
}
|
||||
|
||||
type OnGroupListener interface {
|
||||
OnJoinedGroupAdded(groupInfo string)
|
||||
OnJoinedGroupDeleted(groupInfo string)
|
||||
OnGroupMemberAdded(groupMemberInfo string)
|
||||
OnGroupMemberDeleted(groupMemberInfo string)
|
||||
OnGroupApplicationAdded(groupApplication string)
|
||||
OnGroupApplicationDeleted(groupApplication string)
|
||||
OnGroupInfoChanged(groupInfo string)
|
||||
OnGroupDismissed(groupInfo string)
|
||||
OnGroupMemberInfoChanged(groupMemberInfo string)
|
||||
OnGroupApplicationAccepted(groupApplication string)
|
||||
OnGroupApplicationRejected(groupApplication string)
|
||||
}
|
||||
type OnFriendshipListener interface {
|
||||
OnFriendApplicationAdded(friendApplication string)
|
||||
OnFriendApplicationDeleted(friendApplication string)
|
||||
OnFriendApplicationAccepted(friendApplication string)
|
||||
OnFriendApplicationRejected(friendApplication string)
|
||||
OnFriendAdded(friendInfo string)
|
||||
OnFriendDeleted(friendInfo string)
|
||||
OnFriendInfoChanged(friendInfo string)
|
||||
OnBlackAdded(blackInfo string)
|
||||
OnBlackDeleted(blackInfo string)
|
||||
}
|
||||
type OnConversationListener interface {
|
||||
OnSyncServerStart()
|
||||
OnSyncServerFinish()
|
||||
//OnSyncServerProgress(progress int)
|
||||
OnSyncServerFailed()
|
||||
OnNewConversation(conversationList string)
|
||||
OnConversationChanged(conversationList string)
|
||||
OnTotalUnreadMessageCountChanged(totalUnreadCount int32)
|
||||
OnConversationUserInputStatusChanged(change string)
|
||||
}
|
||||
|
||||
type OnAdvancedMsgListener interface {
|
||||
OnRecvNewMessage(message string)
|
||||
OnRecvC2CReadReceipt(msgReceiptList string)
|
||||
OnRecvGroupReadReceipt(groupMsgReceiptList string)
|
||||
|
||||
OnNewRecvMessageRevoked(messageRevoked string)
|
||||
OnRecvMessageExtensionsChanged(msgID string, reactionExtensionList string)
|
||||
OnRecvMessageExtensionsDeleted(msgID string, reactionExtensionKeyList string)
|
||||
OnRecvMessageExtensionsAdded(msgID string, reactionExtensionList string)
|
||||
OnRecvOfflineNewMessage(message string)
|
||||
OnMsgDeleted(message string)
|
||||
OnRecvOnlineOnlyMessage(message string)
|
||||
}
|
||||
|
||||
type OnBatchMsgListener interface {
|
||||
OnRecvNewMessages(messageList string)
|
||||
OnRecvOfflineNewMessages(messageList string)
|
||||
}
|
||||
|
||||
type OnUserListener interface {
|
||||
OnSelfInfoUpdated(userInfo string)
|
||||
OnUserStatusChanged(userOnlineStatus string)
|
||||
OnUserCommandAdd(userCommand string)
|
||||
OnUserCommandDelete(userCommand string)
|
||||
OnUserCommandUpdate(userCommand string)
|
||||
}
|
||||
|
||||
type OnCustomBusinessListener interface {
|
||||
OnRecvCustomBusinessMessage(businessMessage string)
|
||||
}
|
||||
type OnMessageKvInfoListener interface {
|
||||
OnMessageKvInfoChanged(messageChangedList string)
|
||||
}
|
||||
|
||||
type OnListenerForService interface {
|
||||
//有人申请进群
|
||||
OnGroupApplicationAdded(groupApplication string)
|
||||
//进群申请被同意
|
||||
OnGroupApplicationAccepted(groupApplication string)
|
||||
//有人申请添加你为好友
|
||||
OnFriendApplicationAdded(friendApplication string)
|
||||
//好友申请被同意
|
||||
OnFriendApplicationAccepted(groupApplication string)
|
||||
//收到新消息
|
||||
OnRecvNewMessage(message string)
|
||||
}
|
||||
|
||||
type OnSignalingListener interface {
|
||||
OnReceiveNewInvitation(receiveNewInvitationCallback string)
|
||||
|
||||
OnInviteeAccepted(inviteeAcceptedCallback string)
|
||||
|
||||
OnInviteeAcceptedByOtherDevice(inviteeAcceptedCallback string)
|
||||
|
||||
OnInviteeRejected(inviteeRejectedCallback string)
|
||||
|
||||
OnInviteeRejectedByOtherDevice(inviteeRejectedCallback string)
|
||||
//
|
||||
OnInvitationCancelled(invitationCancelledCallback string)
|
||||
//
|
||||
OnInvitationTimeout(invitationTimeoutCallback string)
|
||||
//
|
||||
OnHangUp(hangUpCallback string)
|
||||
|
||||
OnRoomParticipantConnected(onRoomParticipantConnectedCallback string)
|
||||
|
||||
OnRoomParticipantDisconnected(onRoomParticipantDisconnectedCallback string)
|
||||
}
|
||||
|
||||
type UploadFileCallback interface {
|
||||
Open(size int64) // 文件打开的大小
|
||||
PartSize(partSize int64, num int) // 分片大小,数量
|
||||
HashPartProgress(index int, size int64, partHash string) // 每块分片的hash值
|
||||
HashPartComplete(partsHash string, fileHash string) // 分块完成,服务端标记hash和文件最终hash
|
||||
UploadID(uploadID string) // 上传ID
|
||||
UploadPartComplete(index int, partSize int64, partHash string) // 上传分片进度
|
||||
UploadComplete(fileSize int64, streamSize int64, storageSize int64) // 整体进度
|
||||
Complete(size int64, url string, typ int) // 上传完成
|
||||
}
|
||||
|
||||
type UploadLogProgress interface {
|
||||
OnProgress(current int64, size int64)
|
||||
}
|
||||
|
||||
type AppDataSyncListener interface {
|
||||
OnAppDataSyncStart()
|
||||
OnAppDataSyncProgress(progress int)
|
||||
OnAppDataSyncFinish()
|
||||
}
|
||||
88
go/chao-sdk-core/open_im_sdk_callback/callback_go_sdk.go
Normal file
88
go/chao-sdk-core/open_im_sdk_callback/callback_go_sdk.go
Normal file
@@ -0,0 +1,88 @@
|
||||
// Copyright © 2023 OpenIM SDK. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package open_im_sdk_callback
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/openimsdk/openim-sdk-core/v3/pkg/db/model_struct"
|
||||
"github.com/openimsdk/openim-sdk-core/v3/pkg/utils"
|
||||
|
||||
"github.com/openimsdk/tools/log"
|
||||
)
|
||||
|
||||
type OnFriendshipListenerSdk interface {
|
||||
OnFriendApplicationAdded(friendApplication model_struct.LocalFriendRequest)
|
||||
OnFriendApplicationDeleted(friendApplication model_struct.LocalFriendRequest)
|
||||
OnFriendApplicationAccepted(friendApplication model_struct.LocalFriendRequest)
|
||||
OnFriendApplicationRejected(friendApplication model_struct.LocalFriendRequest)
|
||||
OnFriendAdded(friendInfo model_struct.LocalFriend)
|
||||
OnFriendDeleted(friendInfo model_struct.LocalFriend)
|
||||
OnFriendInfoChanged(friendInfo model_struct.LocalFriend)
|
||||
OnBlackAdded(blackInfo model_struct.LocalBlack)
|
||||
OnBlackDeleted(blackInfo model_struct.LocalBlack)
|
||||
}
|
||||
|
||||
type onFriendshipListener struct {
|
||||
onFriendshipListener func() OnFriendshipListener
|
||||
}
|
||||
|
||||
func NewOnFriendshipListenerSdk(listener func() OnFriendshipListener) OnFriendshipListenerSdk {
|
||||
return &onFriendshipListener{listener}
|
||||
}
|
||||
|
||||
func (o *onFriendshipListener) OnFriendApplicationAdded(friendApplication model_struct.LocalFriendRequest) {
|
||||
log.ZDebug(context.Background(), "OnFriendApplicationAdded", "friendApplication", friendApplication)
|
||||
o.onFriendshipListener().OnFriendApplicationAdded(utils.StructToJsonString(friendApplication))
|
||||
}
|
||||
|
||||
func (o *onFriendshipListener) OnFriendApplicationDeleted(friendApplication model_struct.LocalFriendRequest) {
|
||||
log.ZDebug(context.Background(), "OnFriendApplicationDeleted", "friendApplication", friendApplication)
|
||||
o.onFriendshipListener().OnFriendApplicationDeleted(utils.StructToJsonString(friendApplication))
|
||||
}
|
||||
|
||||
func (o *onFriendshipListener) OnFriendApplicationAccepted(friendApplication model_struct.LocalFriendRequest) {
|
||||
log.ZDebug(context.Background(), "OnFriendApplicationAccepted", "friendApplication", friendApplication)
|
||||
o.onFriendshipListener().OnFriendApplicationAccepted(utils.StructToJsonString(friendApplication))
|
||||
}
|
||||
|
||||
func (o *onFriendshipListener) OnFriendApplicationRejected(friendApplication model_struct.LocalFriendRequest) {
|
||||
log.ZDebug(context.Background(), "OnFriendApplicationRejected", "friendApplication", friendApplication)
|
||||
o.onFriendshipListener().OnFriendApplicationRejected(utils.StructToJsonString(friendApplication))
|
||||
}
|
||||
|
||||
func (o *onFriendshipListener) OnFriendAdded(friendInfo model_struct.LocalFriend) {
|
||||
log.ZDebug(context.Background(), "OnFriendAdded", "friendInfo", friendInfo)
|
||||
o.onFriendshipListener().OnFriendAdded(utils.StructToJsonString(friendInfo))
|
||||
}
|
||||
|
||||
func (o *onFriendshipListener) OnFriendDeleted(friendInfo model_struct.LocalFriend) {
|
||||
log.ZDebug(context.Background(), "OnFriendDeleted", "friendInfo", friendInfo)
|
||||
o.onFriendshipListener().OnFriendDeleted(utils.StructToJsonString(friendInfo))
|
||||
}
|
||||
|
||||
func (o *onFriendshipListener) OnFriendInfoChanged(friendInfo model_struct.LocalFriend) {
|
||||
log.ZDebug(context.Background(), "OnFriendInfoChanged", "friendInfo", friendInfo)
|
||||
o.onFriendshipListener().OnFriendInfoChanged(utils.StructToJsonString(friendInfo))
|
||||
}
|
||||
|
||||
func (o *onFriendshipListener) OnBlackAdded(blackInfo model_struct.LocalBlack) {
|
||||
log.ZDebug(context.Background(), "OnBlackAdded", "blackInfo", blackInfo)
|
||||
o.onFriendshipListener().OnBlackAdded(utils.StructToJsonString(blackInfo))
|
||||
}
|
||||
|
||||
func (o *onFriendshipListener) OnBlackDeleted(blackInfo model_struct.LocalBlack) {
|
||||
log.ZDebug(context.Background(), "OnBlackDeleted", "blackInfo", blackInfo)
|
||||
o.onFriendshipListener().OnBlackDeleted(utils.StructToJsonString(blackInfo))
|
||||
}
|
||||
Reference in New Issue
Block a user