From 3ba881f641bad5d2501c344c3ebc8f4aae6506f1 Mon Sep 17 00:00:00 2001 From: wenxu12345 <44203734@qq.com> Date: Mon, 20 Dec 2021 16:29:24 +0800 Subject: [PATCH] pb: open_im_sdk.OfflinePushInfo --- config/config.yaml | 31 +++++++++++++++++++++++++++++++ internal/rpc/chat/send_msg.go | 27 ++++++++++++++++++++++----- pkg/proto/sdk_ws/ws.proto | 2 ++ 3 files changed, 55 insertions(+), 5 deletions(-) diff --git a/config/config.yaml b/config/config.yaml index f5edcc8..ca754a5 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -171,6 +171,37 @@ messagecallback: stateChange: switch: false +iOSPush: + pushSound: "xxx" + badgeCount: 1 + +notification: + groupCreated: + conversation: + conversationChanged: 1 + unreadCount: 1 + offlinePush: + switch: true + title: "create group title" + desc: "create group desc" + ext: "create group ext" + defaultTips: + tips: "create the group" # xx create the group + + groupInfoChanged: + conversation: + conversationChanged: 1 + unreadCount: 1 + offlinePush: + switch: true + title: "group info changed title" + desc: "group info changed desc" + ext: "group info changed ext" + defaultTips: + tips: "group info changed by" # group info changed by xx + conversationChanged: 0 + + #---------------demo configuration---------------------# #The following configuration items are applied to openIM Demo configuration demoswitch: true diff --git a/internal/rpc/chat/send_msg.go b/internal/rpc/chat/send_msg.go index d237c25..640309c 100644 --- a/internal/rpc/chat/send_msg.go +++ b/internal/rpc/chat/send_msg.go @@ -6,6 +6,7 @@ import ( "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" "Open_IM/pkg/common/db" + "Open_IM/pkg/common/db/mysql_model/im_mysql_model" http2 "Open_IM/pkg/common/http" "Open_IM/pkg/common/log" "Open_IM/pkg/grpc-etcdv3/getcdv3" @@ -203,17 +204,33 @@ type WSToMsgSvrChatMsg struct { OperationID string `protobuf:"bytes,10,opt,name=OperationID" json:"OperationID,omitempty"` } -func CreateGroupNotification(SendID, RecvID string, tip open_im_sdk.CreateGroupTip) { +func CreateGroupNotification(sendID string, creator im_mysql_model.User, group im_mysql_model.Group, memberList []im_mysql_model.GroupMember) { var msg WSToMsgSvrChatMsg msg.OperationID = utils.OperationIDGenerator() - msg.SendID = SendID - msg.RecvID = RecvID + msg.SendID = sendID + msg.RecvID = group.GroupId msg.ContentType = constant.CreateGroupTip - msg.SessionType = constant.SysMsgType + msg.SessionType = constant.GroupChatType + msg.MsgFrom = constant.SysMsgType + var groupCreated open_im_sdk.GroupCreatedTips + groupCreated.Group = &open_im_sdk.GroupInfo{} + utils.CopyStructFields(groupCreated.Group, group) + groupCreated.Creator = &open_im_sdk.GroupMemberFullInfo{} + utils.CopyStructFields(groupCreated.Creator, creator) + for _, v := range memberList { + var groupMemberInfo open_im_sdk.GroupMemberFullInfo + utils.CopyStructFields(&groupMemberInfo, v) + groupCreated.MemberList = append(groupCreated.MemberList, &groupMemberInfo) + } + var tips open_im_sdk.TipsComm + tips.Detail = utils.StructToJsonString(groupCreated) + tips.DefaultTips = creator.Name + " " + config.Config.DefaultTips.GroupCreatedTips + msg.Content = utils.StructToJsonString(tips) + Notification(&msg, false) } -func Notification(m *WSToMsgSvrChatMsg, onlineUserOnly bool, offlineInfo open_im_sdk.OfflinePushInfo) { +func Notification(m *WSToMsgSvrChatMsg, onlineUserOnly bool) { } diff --git a/pkg/proto/sdk_ws/ws.proto b/pkg/proto/sdk_ws/ws.proto index 9b9d805..456195d 100644 --- a/pkg/proto/sdk_ws/ws.proto +++ b/pkg/proto/sdk_ws/ws.proto @@ -91,6 +91,8 @@ message OfflinePushInfo{ string Title = 1; string Desc = 2; string Ext = 3; + string PushSound = 4; + bool ISBadgeCount = 5; } message GroupInfoTip{ -- GitLab