btcpayserver/BTCPayServer/Services/Notifications/Blobs/NewVersionNotification.cs

42 lines
1.5 KiB
C#
Raw Normal View History

using BTCPayServer.Abstractions.Contracts;
using Microsoft.Extensions.Localization;
namespace BTCPayServer.Services.Notifications.Blobs
{
2021-12-31 16:59:02 +09:00
internal class NewVersionNotification : BaseNotification
{
private const string TYPE = "newversion";
internal class Handler(IStringLocalizer stringLocalizer) : NotificationHandler<NewVersionNotification>
2020-06-16 23:29:25 +09:00
{
private IStringLocalizer StringLocalizer { get; } = stringLocalizer;
public override string NotificationType => TYPE;
public override (string identifier, string name)[] Meta
{
get
{
return [(TYPE, StringLocalizer["New version"])];
}
}
2020-06-16 23:29:25 +09:00
protected override void FillViewModel(NewVersionNotification notification, NotificationViewModel vm)
{
vm.Identifier = notification.Identifier;
vm.Type = notification.NotificationType;
vm.Body = StringLocalizer["New version {0} released!", notification.Version];
2020-06-16 23:29:25 +09:00
vm.ActionLink = $"https://github.com/btcpayserver/btcpayserver/releases/tag/v{notification.Version}";
}
}
public NewVersionNotification()
{
}
public NewVersionNotification(string version)
{
Version = version;
}
public string Version { get; set; }
2021-12-31 16:59:02 +09:00
public override string Identifier => TYPE;
public override string NotificationType => TYPE;
}
}