🐛 Fix notification push issue
This commit is contained in:
parent
07dbdd80ec
commit
0e89e325d4
7
.idea/workspace.xml
generated
7
.idea/workspace.xml
generated
@ -4,8 +4,9 @@
|
|||||||
<option name="autoReloadType" value="ALL" />
|
<option name="autoReloadType" value="ALL" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":bug: Bug fixes on E2EE">
|
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":bug: Fix key exchange cause echo">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/pkg/services/notifications.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/services/notifications.go" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@ -138,7 +139,6 @@
|
|||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="VcsManagerConfiguration">
|
<component name="VcsManagerConfiguration">
|
||||||
<MESSAGE value=":sparkles: New ticket ways" />
|
|
||||||
<MESSAGE value=":sparkles: Sign up & Sign in" />
|
<MESSAGE value=":sparkles: Sign up & Sign in" />
|
||||||
<MESSAGE value=":sparkles: An entire complete sign in user flow" />
|
<MESSAGE value=":sparkles: An entire complete sign in user flow" />
|
||||||
<MESSAGE value=":sparkles: User center page" />
|
<MESSAGE value=":sparkles: User center page" />
|
||||||
@ -163,7 +163,8 @@
|
|||||||
<MESSAGE value=":recycle: Improved the notification subscriber API" />
|
<MESSAGE value=":recycle: Improved the notification subscriber API" />
|
||||||
<MESSAGE value=":sparkles: E2EE Key Exchange" />
|
<MESSAGE value=":sparkles: E2EE Key Exchange" />
|
||||||
<MESSAGE value=":bug: Bug fixes on E2EE" />
|
<MESSAGE value=":bug: Bug fixes on E2EE" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value=":bug: Bug fixes on E2EE" />
|
<MESSAGE value=":bug: Fix key exchange cause echo" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value=":bug: Fix key exchange cause echo" />
|
||||||
</component>
|
</component>
|
||||||
<component name="VgoProject">
|
<component name="VgoProject">
|
||||||
<settings-migrated>true</settings-migrated>
|
<settings-migrated>true</settings-migrated>
|
||||||
|
@ -2,7 +2,6 @@ package services
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
jsoniter "github.com/json-iterator/go"
|
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"firebase.google.com/go/messaging"
|
"firebase.google.com/go/messaging"
|
||||||
@ -58,11 +57,10 @@ func NewNotification(notification models.Notification) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func PushNotification(notification models.Notification) error {
|
func PushNotification(notification models.Notification) error {
|
||||||
raw, _ := jsoniter.Marshal(notification)
|
|
||||||
for conn := range wsConn[notification.RecipientID] {
|
for conn := range wsConn[notification.RecipientID] {
|
||||||
_ = conn.WriteMessage(1, models.UnifiedCommand{
|
_ = conn.WriteMessage(1, models.UnifiedCommand{
|
||||||
Action: "notifications.new",
|
Action: "notifications.new",
|
||||||
Payload: raw,
|
Payload: notification,
|
||||||
}.Marshal())
|
}.Marshal())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user