notification

This commit is contained in:
wangchuxiao
2023-05-16 18:37:14 +08:00
parent 5377f1501d
commit 4f6fb10006
7 changed files with 54 additions and 17 deletions
-1
View File
@@ -357,7 +357,6 @@ type Notification struct {
func GetOptionsByNotification(cfg NotificationConf) utils.Options {
opts := utils.NewOptions()
opts = utils.WithOptions(opts, utils.WithNotification(true))
if cfg.UnreadCount {
opts = utils.WithOptions(opts, utils.WithUnreadCount())
}
+1 -1
View File
@@ -142,7 +142,7 @@ const (
IsSenderConversationUpdate = "senderConversationUpdate"
IsSenderNotificationPush = "senderNotificationPush"
IsReactionFromCache = "reactionFromCache"
IsNotification = "isNotification"
IsNotNotification = "isNotification"
IsSendMsg = "isSendMsg"
//GroupStatus
+4 -4
View File
@@ -7,7 +7,7 @@ type OptionsOpt func(Options)
func NewOptions(opts ...OptionsOpt) Options {
options := make(map[string]bool, 11)
options[constant.IsNotification] = false
options[constant.IsNotNotification] = false
options[constant.IsSendMsg] = false
options[constant.IsHistory] = false
options[constant.IsPersistent] = false
@@ -32,9 +32,9 @@ func WithOptions(options Options, opts ...OptionsOpt) Options {
return options
}
func WithNotification(b bool) OptionsOpt {
func WithNotNotification(b bool) OptionsOpt {
return func(options Options) {
options[constant.IsNotification] = b
options[constant.IsNotNotification] = b
}
}
@@ -113,7 +113,7 @@ func (o Options) Is(notification string) bool {
}
func (o Options) IsNotNotification() bool {
return o.Is(constant.IsNotification)
return o.Is(constant.IsNotNotification)
}
func (o Options) IsSendMsg() bool {
+5
View File
@@ -170,6 +170,11 @@ func GetHashCode(s string) uint32 {
return crc32.ChecksumIEEE([]byte(s))
}
func MsgIsNotification(msg *sdkws.MsgData) bool {
options := Options(msg.Options)
return !options.IsNotNotification()
}
func GetConversationIDByMsg(msg *sdkws.MsgData) string {
options := Options(msg.Options)
switch msg.SessionType {