68 lines
3.7 KiB
C#
68 lines
3.7 KiB
C#
using Windows.Data.Xml.Dom;
|
|
using Windows.UI.Notifications;
|
|
|
|
namespace FoxTube.Background
|
|
{
|
|
public static class Notification
|
|
{
|
|
public static ToastNotification GetChangelogToast(string version)
|
|
{
|
|
XmlDocument template = new XmlDocument();
|
|
|
|
template.LoadXml($@"<toast activationType='foreground' launch='changelog|{version}'>
|
|
<visual>
|
|
<binding template='ToastGeneric'>
|
|
<image placement='hero' src='http://foxgame-studio.000webhostapp.com/FoxTubeAssets/WhatsNewThumb.png'/>
|
|
<image placement='appLogoOverride' hint-crop='circle' src='http://foxgame-studio.000webhostapp.com/FoxTubeAssets/NewsAvatar.png'/>
|
|
<text>Changelog</text>
|
|
<text>See what's new in version {version}</text>
|
|
</binding>
|
|
</visual>
|
|
</toast>");
|
|
|
|
return new ToastNotification(template);
|
|
}
|
|
|
|
public static ToastNotification GetVideoToast(string id, string channelId, string title, string channel, string thumbnail, string avatar)
|
|
{
|
|
XmlDocument template = new XmlDocument();
|
|
|
|
template.LoadXml($@"<toast activationType='foreground' launch='video|{id}'>
|
|
<visual>
|
|
<binding template='ToastGeneric'>
|
|
<image placement='hero' src='{thumbnail.Replace("&", "%26")}'/>
|
|
<image placement='appLogoOverride' hint-crop='circle' src='{avatar.Replace("&", "%26") ?? "http://foxgame-studio.000webhostapp.com/FoxTubeAssets/LogoAvatar.png"}'/>
|
|
<text>{title}</text>
|
|
<text>{channel} uploaded a new video</text>
|
|
</binding>
|
|
</visual>
|
|
|
|
<actions>
|
|
<action content='Add to Watch later' activationType='background' arguments='later|{id}'/>
|
|
<action content='Go to channel' activationType='foreground' arguments='channel|{channelId}'/>
|
|
</actions>
|
|
</toast>");
|
|
|
|
return new ToastNotification(template);
|
|
}
|
|
|
|
public static ToastNotification GetInternalToast(string id, string header, string content, string thumbnail, string avatar)
|
|
{
|
|
XmlDocument template = new XmlDocument();
|
|
|
|
template.LoadXml($@"<toast activationType='foreground' launch='inbox|{id}'>
|
|
<visual>
|
|
<binding template='ToastGeneric'>
|
|
<image placement='hero' src='{thumbnail ?? "http://foxgame-studio.000webhostapp.com/FoxTubeAssets/AnnouncementThumb.png"}'/>
|
|
<image placement='appLogoOverride' hint-crop='circle' src='{avatar ?? "http://foxgame-studio.000webhostapp.com/FoxTubeAssets/LogoAvatar.png"}'/>
|
|
<text>{header}</text>
|
|
<text hint-maxLines='5'>{content}</text>
|
|
</binding>
|
|
</visual>
|
|
</toast>");
|
|
|
|
return new ToastNotification(template);
|
|
}
|
|
}
|
|
}
|