diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 9c9d052..30172ca 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -7,12 +7,6 @@
-
-
-
-
-
-
diff --git a/pkg/grpc/notify.go b/pkg/grpc/notify.go
index 7279057..f1bc325 100644
--- a/pkg/grpc/notify.go
+++ b/pkg/grpc/notify.go
@@ -32,7 +32,7 @@ func (v *Server) NotifyUser(_ context.Context, in *proto.NotifyRequest) (*proto.
})
notification := models.Notification{
- Type: in.GetType(),
+ Type: lo.Ternary(len(in.GetType()) > 0, in.GetType(), "common"),
Subject: in.GetSubject(),
Content: in.GetContent(),
Metadata: metadata,
diff --git a/pkg/services/notifications.go b/pkg/services/notifications.go
index 947c4a0..ddfdd3e 100644
--- a/pkg/services/notifications.go
+++ b/pkg/services/notifications.go
@@ -118,13 +118,18 @@ func PushNotification(notification models.Notification) error {
}
payload := &apns2.Notification{
DeviceToken: subscriber.DeviceToken,
- Topic: "dev.solsynth.solian.UniversalNotification",
+ Topic: "dev.solsynth.solian",
Payload: data,
}
- _, err = ExtAPNS.Push(payload)
- if err != nil {
+ if resp, err := ExtAPNS.Push(payload); err != nil {
log.Warn().Err(err).Msg("An error occurred when notify subscriber via APNs...")
+ } else {
+ log.Debug().
+ Str("reason", resp.Reason).
+ Int("status", resp.StatusCode).
+ Int("subscriber", int(subscriber.ID)).
+ Msg("Notified subscriber via APNs.")
}
}
}