Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow to override notification service. #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions AspNetCoreHero.ToastNotification/Notyf/NotyfService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,48 +13,48 @@ public NotyfService(IMessageContainerFactory messageContainerFactory)
{
MessageContainer = messageContainerFactory.Create<Models.NotyfNotification>();
}
public void Custom(string message, int? durationInSeconds = null, string backgroundColor = "black", string iconClassName = "home")
public virtual void Custom(string message, int? durationInSeconds = null, string backgroundColor = "black", string iconClassName = "home")
{
var toastMessage = new Models.NotyfNotification(ToastNotificationType.Custom, message, durationInSeconds);
toastMessage.Icon = iconClassName;
toastMessage.BackgroundColor = backgroundColor;
MessageContainer.Add(toastMessage);
}

public void Error(string message, int? durationInSeconds = null)
public virtual void Error(string message, int? durationInSeconds = null)
{
var toastMessage = new Models.NotyfNotification(ToastNotificationType.Error, message, durationInSeconds);
MessageContainer.Add(toastMessage);
}

public IEnumerable<Models.NotyfNotification> GetNotifications()
public virtual IEnumerable<Models.NotyfNotification> GetNotifications()
{
return MessageContainer.GetAll();
}

public void Information(string message, int? durationInSeconds = null)
public virtual void Information(string message, int? durationInSeconds = null)
{
var toastMessage = new Models.NotyfNotification(ToastNotificationType.Information, message, durationInSeconds);
MessageContainer.Add(toastMessage);
}

public IEnumerable<Models.NotyfNotification> ReadAllNotifications()
public virtual IEnumerable<Models.NotyfNotification> ReadAllNotifications()
{
return MessageContainer.ReadAll();
}

public void RemoveAll()
public virtual void RemoveAll()
{
MessageContainer.RemoveAll();
}

public void Success(string message, int? durationInSeconds = null)
public virtual void Success(string message, int? durationInSeconds = null)
{
var toastMessage = new Models.NotyfNotification(ToastNotificationType.Success, message, durationInSeconds);
MessageContainer.Add(toastMessage);
}

public void Warning(string message, int? durationInSeconds = null)
public virtual void Warning(string message, int? durationInSeconds = null)
{
var toastMessage = new Models.NotyfNotification(ToastNotificationType.Warning, message, durationInSeconds);
MessageContainer.Add(toastMessage);
Expand Down