🐛 Fix push notification didn't contains custom category identifier
This commit is contained in:
@@ -14,7 +14,7 @@ public class Notification : ModelBase
|
|||||||
[MaxLength(1024)] public string? Title { get; set; }
|
[MaxLength(1024)] public string? Title { get; set; }
|
||||||
[MaxLength(2048)] public string? Subtitle { get; set; }
|
[MaxLength(2048)] public string? Subtitle { get; set; }
|
||||||
[MaxLength(4096)] public string? Content { get; set; }
|
[MaxLength(4096)] public string? Content { get; set; }
|
||||||
[Column(TypeName = "jsonb")] public Dictionary<string, object>? Meta { get; set; }
|
[Column(TypeName = "jsonb")] public Dictionary<string, object?> Meta { get; set; }
|
||||||
public int Priority { get; set; } = 10;
|
public int Priority { get; set; } = 10;
|
||||||
public Instant? ViewedAt { get; set; }
|
public Instant? ViewedAt { get; set; }
|
||||||
|
|
||||||
|
@@ -238,7 +238,7 @@ public class PushService
|
|||||||
{
|
{
|
||||||
["id"] = notification.Id,
|
["id"] = notification.Id,
|
||||||
["topic"] = notification.Topic,
|
["topic"] = notification.Topic,
|
||||||
["meta"] = notification.Meta ?? new Dictionary<string, object>()
|
["meta"] = notification.Meta
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -259,13 +259,14 @@ public class PushService
|
|||||||
var payload = new Dictionary<string, object?>
|
var payload = new Dictionary<string, object?>
|
||||||
{
|
{
|
||||||
["topic"] = _apnsTopic,
|
["topic"] = _apnsTopic,
|
||||||
|
["type"] = notification.Topic,
|
||||||
["aps"] = new Dictionary<string, object?>
|
["aps"] = new Dictionary<string, object?>
|
||||||
{
|
{
|
||||||
["alert"] = alertDict,
|
["alert"] = alertDict,
|
||||||
["sound"] = notification.Priority >= 5 ? "default" : null,
|
["sound"] = notification.Priority >= 5 ? "default" : null,
|
||||||
["mutable-content"] = 1
|
["mutable-content"] = 1
|
||||||
},
|
},
|
||||||
["meta"] = notification.Meta ?? new Dictionary<string, object>()
|
["meta"] = notification.Meta
|
||||||
};
|
};
|
||||||
|
|
||||||
await _apns.SendAsync(
|
await _apns.SendAsync(
|
||||||
|
@@ -107,7 +107,7 @@ public class PusherServiceGrpc(
|
|||||||
Topic = request.Notification.Topic,
|
Topic = request.Notification.Topic,
|
||||||
Title = request.Notification.Title,
|
Title = request.Notification.Title,
|
||||||
Subtitle = request.Notification.Subtitle, Content = request.Notification.Body,
|
Subtitle = request.Notification.Subtitle, Content = request.Notification.Body,
|
||||||
Meta = GrpcTypeHelper.ConvertFromValueMap(request.Notification.Meta),
|
Meta = GrpcTypeHelper.ConvertFromValueMap(request.Notification.Meta)
|
||||||
};
|
};
|
||||||
if (request.Notification.ActionUri is not null)
|
if (request.Notification.ActionUri is not null)
|
||||||
notification.Meta["action_uri"] = request.Notification.ActionUri;
|
notification.Meta["action_uri"] = request.Notification.ActionUri;
|
||||||
|
@@ -220,7 +220,6 @@ public partial class ChatService(
|
|||||||
["images"] = message.Attachments
|
["images"] = message.Attachments
|
||||||
.Where(a => a.MimeType != null && a.MimeType.StartsWith("image"))
|
.Where(a => a.MimeType != null && a.MimeType.StartsWith("image"))
|
||||||
.Select(a => a.Id).ToList(),
|
.Select(a => a.Id).ToList(),
|
||||||
["action_uri"] = $"/chat/{room.Id}"
|
|
||||||
};
|
};
|
||||||
if (sender.Account.Profile is not { Picture: null })
|
if (sender.Account.Profile is not { Picture: null })
|
||||||
metaDict["pfp"] = sender.Account.Profile.Picture.Id;
|
metaDict["pfp"] = sender.Account.Profile.Picture.Id;
|
||||||
@@ -234,7 +233,8 @@ public partial class ChatService(
|
|||||||
Body = !string.IsNullOrEmpty(message.Content)
|
Body = !string.IsNullOrEmpty(message.Content)
|
||||||
? message.Content[..Math.Min(message.Content.Length, 100)]
|
? message.Content[..Math.Min(message.Content.Length, 100)]
|
||||||
: "<no content>",
|
: "<no content>",
|
||||||
IsSavable = false
|
ActionUri = $"/chat/{room.Id}",
|
||||||
|
IsSavable = false,
|
||||||
};
|
};
|
||||||
notification.Meta.Add(GrpcTypeHelper.ConvertToValueMap(metaDict));
|
notification.Meta.Add(GrpcTypeHelper.ConvertToValueMap(metaDict));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user