mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-25 02:58:26 +08:00
Merge remote-tracking branch 'origin/v2.3.0release' into v2.3.0release
This commit is contained in:
commit
fdc1cd26e7
@ -368,7 +368,11 @@ func (ws *WServer) getUserAllCons(uid string) map[int]*UserConn {
|
|||||||
rwLock.RLock()
|
rwLock.RLock()
|
||||||
defer rwLock.RUnlock()
|
defer rwLock.RUnlock()
|
||||||
if connMap, ok := ws.wsUserToConn[uid]; ok {
|
if connMap, ok := ws.wsUserToConn[uid]; ok {
|
||||||
return connMap
|
newConnMap := make(map[int]*UserConn)
|
||||||
|
for k, v := range connMap {
|
||||||
|
newConnMap[k] = v
|
||||||
|
}
|
||||||
|
return newConnMap
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -7,11 +7,12 @@ import (
|
|||||||
"Open_IM/pkg/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/pkg/tools/splitter"
|
"Open_IM/pkg/tools/splitter"
|
||||||
"context"
|
"context"
|
||||||
|
"path/filepath"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
firebase "firebase.google.com/go"
|
firebase "firebase.google.com/go"
|
||||||
"firebase.google.com/go/messaging"
|
"firebase.google.com/go/messaging"
|
||||||
"google.golang.org/api/option"
|
"google.golang.org/api/option"
|
||||||
"path/filepath"
|
|
||||||
"strconv"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const SinglePushCountLimit = 400
|
const SinglePushCountLimit = 400
|
||||||
@ -67,6 +68,14 @@ func (f *Fcm) Push(accounts []string, alert, detailContent, operationID string,
|
|||||||
Msg.Notification = &messaging.Notification{}
|
Msg.Notification = &messaging.Notification{}
|
||||||
Msg.Notification.Body = detailContent
|
Msg.Notification.Body = detailContent
|
||||||
Msg.Notification.Title = alert
|
Msg.Notification.Title = alert
|
||||||
|
Msg.APNS = &messaging.APNSConfig{Payload: &messaging.APNSPayload{Aps: &messaging.Aps{}}}
|
||||||
|
if opts.IOSBadgeCount {
|
||||||
|
i := 1
|
||||||
|
Msg.APNS.Payload.Aps.Badge = &i
|
||||||
|
}
|
||||||
|
if opts.IOSPushSound != "" {
|
||||||
|
Msg.APNS.Payload.Aps.Sound = opts.IOSPushSound
|
||||||
|
}
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
for _, v := range result {
|
for _, v := range result {
|
||||||
Msg.Tokens = v.Item
|
Msg.Tokens = v.Item
|
||||||
|
@ -21,8 +21,9 @@ import (
|
|||||||
"Open_IM/pkg/utils"
|
"Open_IM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/golang/protobuf/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/golang/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
type OpenIMContent struct {
|
type OpenIMContent struct {
|
||||||
@ -323,8 +324,9 @@ func GetOfflinePushOpts(pushMsg *pbPush.PushMsgReq) (opts push.PushOpts, err err
|
|||||||
opts.Signal.ClientMsgID = pushMsg.MsgData.ClientMsgID
|
opts.Signal.ClientMsgID = pushMsg.MsgData.ClientMsgID
|
||||||
log.NewDebug(pushMsg.OperationID, opts)
|
log.NewDebug(pushMsg.OperationID, opts)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
opts.IOSBadgeCount = pushMsg.MsgData.OfflinePushInfo.IOSBadgeCount
|
||||||
|
opts.IOSPushSound = pushMsg.MsgData.OfflinePushInfo.IOSPushSound
|
||||||
return opts, nil
|
return opts, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@ type OfflinePusher interface {
|
|||||||
|
|
||||||
type PushOpts struct {
|
type PushOpts struct {
|
||||||
Signal Signal
|
Signal Signal
|
||||||
|
IOSPushSound string
|
||||||
|
IOSBadgeCount bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type Signal struct {
|
type Signal struct {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user