mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-10 23:07:30 +08:00
Simplify iOS background push gating (#3611)
This commit is contained in:
parent
7d6682ca4b
commit
d244060e59
@ -152,19 +152,16 @@ func (s *Server) pushToUser(ctx context.Context, userID string, msgData *sdkws.M
|
||||
userPlatform := &msggateway.SingleMsgToUserPlatform{
|
||||
RecvPlatFormID: int32(client.PlatformID),
|
||||
}
|
||||
if !client.IsBackground ||
|
||||
(client.IsBackground && client.PlatformID != constant.IOSPlatformID) {
|
||||
err := client.PushMessage(ctx, msgData)
|
||||
if err != nil {
|
||||
log.ZWarn(ctx, "online push msg failed", err, "userID", userID, "platformID", client.PlatformID)
|
||||
userPlatform.ResultCode = int64(servererrs.ErrPushMsgErr.Code())
|
||||
} else {
|
||||
if _, ok := s.pushTerminal[client.PlatformID]; ok {
|
||||
result.OnlinePush = true
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if client.IsBackground && client.PlatformID == constant.IOSPlatformID {
|
||||
userPlatform.ResultCode = int64(servererrs.ErrIOSBackgroundPushErr.Code())
|
||||
result.Resp = append(result.Resp, userPlatform)
|
||||
continue
|
||||
}
|
||||
if err := client.PushMessage(ctx, msgData); err != nil {
|
||||
log.ZWarn(ctx, "online push msg failed", err, "userID", userID, "platformID", client.PlatformID)
|
||||
userPlatform.ResultCode = int64(servererrs.ErrPushMsgErr.Code())
|
||||
} else if _, ok := s.pushTerminal[client.PlatformID]; ok {
|
||||
result.OnlinePush = true
|
||||
}
|
||||
result.Resp = append(result.Resp, userPlatform)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user