Renaming to BaseNotification

This commit is contained in:
rockstardev
2020-06-14 23:48:58 -05:00
parent 0dab96f0a6
commit 113869bd08
4 changed files with 7 additions and 7 deletions

View File

@@ -5,6 +5,6 @@ namespace BTCPayServer.Events
internal class NotificationEvent internal class NotificationEvent
{ {
internal string[] ApplicationUserIds { get; set; } internal string[] ApplicationUserIds { get; set; }
internal NotificationBase Notification { get; set; } internal BaseNotification Notification { get; set; }
} }
} }

View File

@@ -29,11 +29,11 @@ namespace BTCPayServer.Models.NotificationViewModels
{ {
public static NotificationViewModel ViewModel(this NotificationData data) public static NotificationViewModel ViewModel(this NotificationData data)
{ {
var baseType = typeof(NotificationBase); var baseType = typeof(BaseNotification);
var fullTypeName = baseType.FullName.Replace(nameof(NotificationBase), data.NotificationType, StringComparison.OrdinalIgnoreCase); var fullTypeName = baseType.FullName.Replace(nameof(BaseNotification), data.NotificationType, StringComparison.OrdinalIgnoreCase);
var parsedType = baseType.Assembly.GetType(fullTypeName); var parsedType = baseType.Assembly.GetType(fullTypeName);
var instance = Activator.CreateInstance(parsedType) as NotificationBase; var instance = Activator.CreateInstance(parsedType) as BaseNotification;
var casted = JsonConvert.DeserializeObject(ZipUtils.Unzip(data.Blob), parsedType); var casted = JsonConvert.DeserializeObject(ZipUtils.Unzip(data.Blob), parsedType);
var obj = new NotificationViewModel var obj = new NotificationViewModel

View File

@@ -5,10 +5,10 @@ using Newtonsoft.Json;
namespace BTCPayServer.Services.Notifications.Blobs namespace BTCPayServer.Services.Notifications.Blobs
{ {
// Make sure to keep all NotificationEventBase classes in same namespace // Make sure to keep all Blob Notification classes in same namespace
// because of dependent initialization and parsing to view models logic // because of dependent initialization and parsing to view models logic
// IndexViewModel.cs#32 // IndexViewModel.cs#32
internal abstract class NotificationBase internal abstract class BaseNotification
{ {
internal virtual string NotificationType { get { return GetType().Name; } } internal virtual string NotificationType { get { return GetType().Name; } }

View File

@@ -4,7 +4,7 @@ using Newtonsoft.Json;
namespace BTCPayServer.Services.Notifications.Blobs namespace BTCPayServer.Services.Notifications.Blobs
{ {
internal class NewVersionNotification : NotificationBase internal class NewVersionNotification : BaseNotification
{ {
internal override string NotificationType => "NewVersionNotification"; internal override string NotificationType => "NewVersionNotification";