Allow null header, body, applogo, and image on notification builder

This commit is contained in:
LAGonauta 2021-03-23 20:19:04 -03:00
parent e6a521ada9
commit 878bf9ac43
2 changed files with 12 additions and 16 deletions

View file

@ -41,31 +41,31 @@ namespace Dino.Plugins.WindowsNotification {
return this;
}
public ToastNotificationBuilder SetHeader(string header) {
public ToastNotificationBuilder SetHeader(string? header) {
_header = header;
return this;
}
public ToastNotificationBuilder SetBody(string body) {
public ToastNotificationBuilder SetBody(string? body) {
_body = body;
return this;
}
public ToastNotificationBuilder SetAppLogo(string applogo_path) {
public ToastNotificationBuilder SetAppLogo(string? applogo_path) {
_appLogo = applogo_path;
return this;
}
public ToastNotificationBuilder SetInlineImage(string? image_path) {
_inlineImage = image_path;
return this;
}
public ToastNotificationBuilder SetScenario(Scenario scenario) {
_scenario = scenario;
return this;
}
public ToastNotificationBuilder SetInlineImage(string image_path) {
_inlineImage = image_path;
return this;
}
public async ToastNotification Build() {
if (!_supportsModernFeatures) {
return yield BuildFromLegacyTemplate();

View file

@ -206,16 +206,12 @@ namespace Dino.Plugins.WindowsNotification {
}
var image_path = get_avatar(conversation);
var builder = new ToastNotificationBuilder()
var notification = yield new ToastNotificationBuilder()
.SetHeader(conversation_display_name)
.SetBody(body)
.SetAppLogo(image_path);
if (inlineImagePath != null) {
builder.SetInlineImage(inlineImagePath);
}
var notification = yield builder.Build();
.SetAppLogo(image_path)
.SetInlineImage(inlineImagePath)
.Build();
var notification_id = generate_id();
notification.Activated((argument, user_input) => {