|
|
|
@ -76,15 +76,15 @@ func NewPusher(config *config.GlobalConfig, discov discoveryregistry.SvcDiscover
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func NewOfflinePusher(config *config.GlobalConfig, cache cache.MsgModel) offlinepush.OfflinePusher {
|
|
|
|
|
func NewOfflinePusher(pushConf *config.Push, iOSPushConf *config.IOSPush, cache cache.MsgModel) offlinepush.OfflinePusher {
|
|
|
|
|
var offlinePusher offlinepush.OfflinePusher
|
|
|
|
|
switch config.Push.Enable {
|
|
|
|
|
switch pushConf.Enable {
|
|
|
|
|
case "getui":
|
|
|
|
|
offlinePusher = getui.NewClient(config, cache)
|
|
|
|
|
offlinePusher = getui.NewClient(pushConf, cache)
|
|
|
|
|
case "fcm":
|
|
|
|
|
offlinePusher = fcm.NewClient(config, cache)
|
|
|
|
|
offlinePusher = fcm.NewClient(pushConf, cache)
|
|
|
|
|
case "jpush":
|
|
|
|
|
offlinePusher = jpush.NewClient(config)
|
|
|
|
|
offlinePusher = jpush.NewClient(pushConf, iOSPushConf)
|
|
|
|
|
default:
|
|
|
|
|
offlinePusher = dummy.NewClient()
|
|
|
|
|
}
|
|
|
|
@ -102,7 +102,7 @@ func (p *Pusher) DeleteMemberAndSetConversationSeq(ctx context.Context, groupID
|
|
|
|
|
|
|
|
|
|
func (p *Pusher) Push2User(ctx context.Context, userIDs []string, msg *sdkws.MsgData) error {
|
|
|
|
|
log.ZDebug(ctx, "Get msg from msg_transfer And push msg", "userIDs", userIDs, "msg", msg.String())
|
|
|
|
|
if err := callbackOnlinePush(ctx, p.config, userIDs, msg); err != nil {
|
|
|
|
|
if err := callbackOnlinePush(ctx, &p.config.Callback, userIDs, msg); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
// push
|
|
|
|
@ -130,7 +130,7 @@ func (p *Pusher) Push2User(ctx context.Context, userIDs []string, msg *sdkws.Msg
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
if len(offlinePushUserIDList) > 0 {
|
|
|
|
|
if err = callbackOfflinePush(ctx, p.config, offlinePushUserIDList, msg, &[]string{}); err != nil {
|
|
|
|
|
if err = callbackOfflinePush(ctx, &p.config.Callback, offlinePushUserIDList, msg, &[]string{}); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
err = p.offlinePushMsg(ctx, msg.SendID, msg, offlinePushUserIDList)
|
|
|
|
@ -163,7 +163,7 @@ func (p *Pusher) k8sOfflinePush2SuperGroup(ctx context.Context, groupID string,
|
|
|
|
|
}
|
|
|
|
|
if len(needOfflinePushUserIDs) > 0 {
|
|
|
|
|
var offlinePushUserIDs []string
|
|
|
|
|
err := callbackOfflinePush(ctx, p.config, needOfflinePushUserIDs, msg, &offlinePushUserIDs)
|
|
|
|
|
err := callbackOfflinePush(ctx, &p.config.Callback, needOfflinePushUserIDs, msg, &offlinePushUserIDs)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
@ -194,7 +194,7 @@ func (p *Pusher) k8sOfflinePush2SuperGroup(ctx context.Context, groupID string,
|
|
|
|
|
func (p *Pusher) Push2SuperGroup(ctx context.Context, groupID string, msg *sdkws.MsgData) (err error) {
|
|
|
|
|
log.ZDebug(ctx, "Get super group msg from msg_transfer and push msg", "msg", msg.String(), "groupID", groupID)
|
|
|
|
|
var pushToUserIDs []string
|
|
|
|
|
if err = callbackBeforeSuperGroupOnlinePush(ctx, p.config, groupID, msg, &pushToUserIDs); err != nil {
|
|
|
|
|
if err = callbackBeforeSuperGroupOnlinePush(ctx, &p.config.Callback, groupID, msg, &pushToUserIDs); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -299,7 +299,7 @@ func (p *Pusher) Push2SuperGroup(ctx context.Context, groupID string, msg *sdkws
|
|
|
|
|
// Use offline push messaging
|
|
|
|
|
if len(needOfflinePushUserIDs) > 0 {
|
|
|
|
|
var offlinePushUserIDs []string
|
|
|
|
|
err = callbackOfflinePush(ctx, p.config, needOfflinePushUserIDs, msg, &offlinePushUserIDs)
|
|
|
|
|
err = callbackOfflinePush(ctx, &p.config.Callback, needOfflinePushUserIDs, msg, &offlinePushUserIDs)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|