Skip to content

Commit

Permalink
fix: add notifications for some notifications. (#1609)
Browse files Browse the repository at this point in the history
  • Loading branch information
FGadvancer committed Dec 27, 2023
1 parent cff90a3 commit 53a3f47
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
13 changes: 1 addition & 12 deletions pkg/msgprocessor/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ func NewOptions(opts ...OptionsOpt) Options {
options[constant.IsOfflinePush] = false
options[constant.IsUnreadCount] = false
options[constant.IsConversationUpdate] = false
options[constant.IsSenderSync] = false
options[constant.IsSenderSync] = true
options[constant.IsNotPrivate] = false
options[constant.IsSenderConversationUpdate] = false
options[constant.IsSenderNotificationPush] = false
options[constant.IsReactionFromCache] = false
for _, opt := range opts {
opt(options)
Expand Down Expand Up @@ -114,12 +113,6 @@ func WithSenderConversationUpdate() OptionsOpt {
}
}

func WithSenderNotificationPush() OptionsOpt {
return func(options Options) {
options[constant.IsSenderNotificationPush] = true
}
}

func WithReactionFromCache() OptionsOpt {
return func(options Options) {
options[constant.IsReactionFromCache] = true
Expand Down Expand Up @@ -174,10 +167,6 @@ func (o Options) IsSenderConversationUpdate() bool {
return o.Is(constant.IsSenderConversationUpdate)
}

func (o Options) IsSenderNotificationPush() bool {
return o.Is(constant.IsSenderNotificationPush)
}

func (o Options) IsReactionFromCache() bool {
return o.Is(constant.IsReactionFromCache)
}
9 changes: 9 additions & 0 deletions pkg/rpcclient/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ func (s *NotificationSender) NotificationWithSesstionType(ctx context.Context, s
optionsConfig.ReliabilityLevel = constant.UnreliableNotification
}
options := config.GetOptionsByNotification(optionsConfig)
s.SetOptionsByContentType(ctx, options, contentType)
msg.Options = options
offlineInfo.Title = title
offlineInfo.Desc = desc
Expand All @@ -274,3 +275,11 @@ func (s *NotificationSender) NotificationWithSesstionType(ctx context.Context, s
func (s *NotificationSender) Notification(ctx context.Context, sendID, recvID string, contentType int32, m proto.Message, opts ...NotificationOptions) error {
return s.NotificationWithSesstionType(ctx, sendID, recvID, contentType, s.sessionTypeConf[contentType], m, opts...)
}

func (s *NotificationSender) SetOptionsByContentType(_ context.Context, options map[string]bool, contentType int32) {
switch contentType {
case constant.UserStatusChangeNotification:
options[constant.IsSenderSync] = false
default:
}
}

0 comments on commit 53a3f47

Please sign in to comment.