File tree Expand file tree Collapse file tree 2 files changed +5
-7
lines changed
Expand file tree Collapse file tree 2 files changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -33,9 +33,8 @@ func (p PushMessage) IsEmptyAlert() bool {
3333 return p .Title == "" && p .Body == "" && p .Subtitle == ""
3434}
3535
36- // Check if it's an encrypted push notification
37- func (p PushMessage ) IsEncrypted () bool {
38- return p .ExtParams ["ciphertext" ] != nil
36+ func (p PushMessage ) IsDelete () bool {
37+ return p .ExtParams ["delete" ] == "1"
3938}
4039
4140const (
@@ -107,8 +106,7 @@ func ReCreateAPNS(maxClientCount int) error {
107106func Push (msg * PushMessage ) error {
108107 pl := payload .NewPayload ().MutableContent ()
109108 pushType := apns2 .PushTypeAlert
110-
111- if msg .IsEmptyAlert () {
109+ if msg .IsDelete () {
112110 // Silent push notification
113111 pl = pl .ContentAvailable ()
114112 pushType = apns2 .PushTypeBackground
Original file line number Diff line number Diff line change @@ -251,9 +251,9 @@ func push(params map[string]interface{}) (int, error) {
251251 return 400 , fmt .Errorf ("device key is empty" )
252252 }
253253
254- if msg .IsEmptyAlert () && msg . IsEncrypted () {
254+ if msg .IsEmptyAlert () {
255255 // For encrypted push notifications, a Body is required; otherwise, APNs will discard the notification
256- msg .Body = "Encrypted Message"
256+ msg .Body = "Empty Message"
257257 }
258258
259259 deviceToken , err := db .DeviceTokenByKey (msg .DeviceKey )
You can’t perform that action at this time.
0 commit comments