2020-11-17 13:46:23 +01:00
|
|
|
using BTCPayServer.Abstractions.Contracts;
|
2024-10-25 15:48:53 +02:00
|
|
|
using Microsoft.Extensions.Localization;
|
2020-05-27 18:41:00 -05:00
|
|
|
|
2020-06-14 23:47:11 -05:00
|
|
|
namespace BTCPayServer.Services.Notifications.Blobs
|
2020-05-27 18:41:00 -05:00
|
|
|
{
|
2021-12-31 16:59:02 +09:00
|
|
|
internal class NewVersionNotification : BaseNotification
|
2020-05-27 18:41:00 -05:00
|
|
|
{
|
2020-10-20 13:09:09 +02:00
|
|
|
private const string TYPE = "newversion";
|
2024-10-25 15:48:53 +02:00
|
|
|
internal class Handler(IStringLocalizer stringLocalizer) : NotificationHandler<NewVersionNotification>
|
2020-06-16 23:29:25 +09:00
|
|
|
{
|
2024-10-25 15:48:53 +02:00
|
|
|
private IStringLocalizer StringLocalizer { get; } = stringLocalizer;
|
2020-10-20 13:09:09 +02:00
|
|
|
public override string NotificationType => TYPE;
|
|
|
|
public override (string identifier, string name)[] Meta
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
2024-10-25 15:48:53 +02:00
|
|
|
return [(TYPE, StringLocalizer["New version"])];
|
2020-10-20 13:09:09 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-16 23:29:25 +09:00
|
|
|
protected override void FillViewModel(NewVersionNotification notification, NotificationViewModel vm)
|
|
|
|
{
|
2023-02-21 03:06:27 +01:00
|
|
|
vm.Identifier = notification.Identifier;
|
|
|
|
vm.Type = notification.NotificationType;
|
2024-10-25 15:48:53 +02:00
|
|
|
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}";
|
|
|
|
}
|
|
|
|
}
|
2020-06-15 16:45:29 +09:00
|
|
|
public NewVersionNotification()
|
|
|
|
{
|
2020-06-13 18:40:30 -05:00
|
|
|
|
2020-06-15 16:45:29 +09:00
|
|
|
}
|
|
|
|
public NewVersionNotification(string version)
|
|
|
|
{
|
|
|
|
Version = version;
|
|
|
|
}
|
2020-05-27 18:41:00 -05:00
|
|
|
public string Version { get; set; }
|
2021-12-31 16:59:02 +09:00
|
|
|
public override string Identifier => TYPE;
|
2020-10-20 13:09:09 +02:00
|
|
|
public override string NotificationType => TYPE;
|
2020-05-27 18:41:00 -05:00
|
|
|
}
|
|
|
|
}
|