🐛 Trying to fix bugs...
This commit is contained in:
@@ -84,6 +84,7 @@ public class AccountContact : ModelBase
|
||||
public Instant? VerifiedAt { get; set; }
|
||||
[MaxLength(1024)] public string Content { get; set; } = string.Empty;
|
||||
|
||||
public Guid AccountId { get; set; }
|
||||
[JsonIgnore] public Account Account { get; set; } = null!;
|
||||
}
|
||||
|
||||
@@ -100,6 +101,7 @@ public class AccountAuthFactor : ModelBase
|
||||
public AccountAuthFactorType Type { get; set; }
|
||||
[MaxLength(8196)] public string? Secret { get; set; } = null;
|
||||
|
||||
public Guid AccountId { get; set; }
|
||||
[JsonIgnore] public Account Account { get; set; } = null!;
|
||||
|
||||
public AccountAuthFactor HashSecret(int cost = 12)
|
||||
|
@@ -264,22 +264,29 @@ public class NotificationService
|
||||
if (_apns == null)
|
||||
throw new InvalidOperationException("The apple notification push service is not initialized.");
|
||||
|
||||
await _apns.SendAsync(new Dictionary<string, object>
|
||||
var alertDict = new Dictionary<string, object>();
|
||||
|
||||
if (!string.IsNullOrEmpty(notification.Title))
|
||||
alertDict["title"] = notification.Title;
|
||||
if (!string.IsNullOrEmpty(notification.Subtitle))
|
||||
alertDict["subtitle"] = notification.Subtitle;
|
||||
if (!string.IsNullOrEmpty(notification.Content))
|
||||
alertDict["body"] = notification.Content;
|
||||
|
||||
var payload = new Dictionary<string, object>
|
||||
{
|
||||
["topic"] = notification.Topic,
|
||||
["aps"] = new Dictionary<string, object>
|
||||
{
|
||||
["topic"] = notification.Topic,
|
||||
["aps"] = new Dictionary<string, object>
|
||||
{
|
||||
["alert"] = new Dictionary<string, object>
|
||||
{
|
||||
["title"] = notification.Title ?? string.Empty,
|
||||
["subtitle"] = notification.Subtitle ?? string.Empty,
|
||||
["body"] = notification.Content ?? string.Empty
|
||||
}
|
||||
},
|
||||
["sound"] = (notification.Priority > 0 ? "default" : null) ?? string.Empty,
|
||||
["mutable-content"] = 1,
|
||||
["meta"] = notification.Meta ?? new Dictionary<string, object>()
|
||||
["alert"] = alertDict
|
||||
},
|
||||
["sound"] = (notification.Priority > 0 ? "default" : null) ?? string.Empty,
|
||||
["mutable-content"] = 1,
|
||||
["meta"] = notification.Meta ?? new Dictionary<string, object>()
|
||||
};
|
||||
|
||||
await _apns.SendAsync(
|
||||
payload,
|
||||
deviceToken: subscription.DeviceToken,
|
||||
apnsId: notification.Id.ToString(),
|
||||
apnsPriority: notification.Priority,
|
||||
|
Reference in New Issue
Block a user