Allow null header, body, applogo, and image on notification builder
This commit is contained in:
parent
e6a521ada9
commit
878bf9ac43
|
@ -41,31 +41,31 @@ namespace Dino.Plugins.WindowsNotification {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ToastNotificationBuilder SetHeader(string header) {
|
public ToastNotificationBuilder SetHeader(string? header) {
|
||||||
_header = header;
|
_header = header;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ToastNotificationBuilder SetBody(string body) {
|
public ToastNotificationBuilder SetBody(string? body) {
|
||||||
_body = body;
|
_body = body;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ToastNotificationBuilder SetAppLogo(string applogo_path) {
|
public ToastNotificationBuilder SetAppLogo(string? applogo_path) {
|
||||||
_appLogo = applogo_path;
|
_appLogo = applogo_path;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ToastNotificationBuilder SetInlineImage(string? image_path) {
|
||||||
|
_inlineImage = image_path;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public ToastNotificationBuilder SetScenario(Scenario scenario) {
|
public ToastNotificationBuilder SetScenario(Scenario scenario) {
|
||||||
_scenario = scenario;
|
_scenario = scenario;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ToastNotificationBuilder SetInlineImage(string image_path) {
|
|
||||||
_inlineImage = image_path;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async ToastNotification Build() {
|
public async ToastNotification Build() {
|
||||||
if (!_supportsModernFeatures) {
|
if (!_supportsModernFeatures) {
|
||||||
return yield BuildFromLegacyTemplate();
|
return yield BuildFromLegacyTemplate();
|
||||||
|
|
|
@ -206,16 +206,12 @@ namespace Dino.Plugins.WindowsNotification {
|
||||||
}
|
}
|
||||||
|
|
||||||
var image_path = get_avatar(conversation);
|
var image_path = get_avatar(conversation);
|
||||||
var builder = new ToastNotificationBuilder()
|
var notification = yield new ToastNotificationBuilder()
|
||||||
.SetHeader(conversation_display_name)
|
.SetHeader(conversation_display_name)
|
||||||
.SetBody(body)
|
.SetBody(body)
|
||||||
.SetAppLogo(image_path);
|
.SetAppLogo(image_path)
|
||||||
|
.SetInlineImage(inlineImagePath)
|
||||||
if (inlineImagePath != null) {
|
.Build();
|
||||||
builder.SetInlineImage(inlineImagePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
var notification = yield builder.Build();
|
|
||||||
|
|
||||||
var notification_id = generate_id();
|
var notification_id = generate_id();
|
||||||
notification.Activated((argument, user_input) => {
|
notification.Activated((argument, user_input) => {
|
||||||
|
|
Loading…
Reference in a new issue