Notification system development 1
This commit is contained in:
@@ -15,7 +15,7 @@ namespace FoxTube.Background
|
||||
{
|
||||
public enum NotificationType
|
||||
{
|
||||
Video, Comment, Post, Internal
|
||||
Video, Comment, Post, Internal, Changelog
|
||||
}
|
||||
|
||||
public sealed class Notification
|
||||
@@ -35,6 +35,7 @@ namespace FoxTube.Background
|
||||
Channel = channelName;
|
||||
Content = content;
|
||||
TimeStamp = date;
|
||||
Id = id;
|
||||
Type = TypeConversion(type);
|
||||
Avatar = avatarUrl == null? "ms-appx:///Assets/Icons/Profile.png" : avatarUrl;
|
||||
Thumbnail = thumbnailUrl;
|
||||
@@ -136,13 +137,13 @@ namespace FoxTube.Background
|
||||
return item;
|
||||
}
|
||||
|
||||
public ToastNotification GetToast(int assignedId)
|
||||
public ToastNotification GetToast()
|
||||
{
|
||||
XmlDocument template = new XmlDocument();
|
||||
switch (Type)
|
||||
{
|
||||
case NotificationType.Comment:
|
||||
template.LoadXml($@"<toast launch='type=comment&action=open&id={assignedId}'>
|
||||
template.LoadXml($@"<toast launch='comment&{Id}'>
|
||||
<visual>
|
||||
<binding template='ToastGeneric'>
|
||||
<image placement='appLogoOverride' hint-crop='circle' src='{Avatar}'/>
|
||||
@@ -156,16 +157,16 @@ namespace FoxTube.Background
|
||||
|
||||
<action content='Send' imageUri='Assets/Icons/Send.png'
|
||||
hint-inputId='textBox' activationType='background'
|
||||
arguments='type=comment&action=sendReply&id={assignedId}'/>
|
||||
arguments='comment&{Id}&send'/>
|
||||
|
||||
<action content='Like'
|
||||
arguments='type=comment&action=like&id={assignedId}'/>
|
||||
arguments='comment&{Id}&like'/>
|
||||
</actions>
|
||||
</toast>");
|
||||
break;
|
||||
|
||||
case NotificationType.Video:
|
||||
template.LoadXml($@"<toast launch='action=viewPhoto&photoId=92187'>
|
||||
template.LoadXml($@"<toast launch='video&{Id}'>
|
||||
<visual>
|
||||
<binding template='ToastGeneric'>
|
||||
<image placement='appLogoOverride' hint-crop='circle' src='{Avatar}'/>
|
||||
@@ -178,16 +179,29 @@ namespace FoxTube.Background
|
||||
<actions>
|
||||
<action content='Watch later'
|
||||
activationType='background'
|
||||
arguments='likePhoto&photoId=92187'/>
|
||||
arguments='video&{Id}&later'/>
|
||||
<action content='Go to channel'
|
||||
arguments='action=commentPhoto&photoId=92187'/>
|
||||
arguments='video&{Id}&channel'/>
|
||||
</actions>
|
||||
</toast>");
|
||||
break;
|
||||
|
||||
case NotificationType.Changelog:
|
||||
template.LoadXml($@"<toast launch='changelog&{Id}'>
|
||||
<visual>
|
||||
<binding template='ToastGeneric'>
|
||||
<image placement='hero' src='Assets/WhatsNewThumb.png'/>
|
||||
<image placement='appLogoOverride' hint-crop='circle' src='Assets/LogoAvatar.png'/>
|
||||
<text>{Content}</text>
|
||||
<text>Changelog</text>
|
||||
</binding>
|
||||
</visual>
|
||||
</toast>");
|
||||
break;
|
||||
|
||||
case NotificationType.Internal:
|
||||
string thumb1 = string.IsNullOrWhiteSpace(Thumbnail) ? "Assets/AnnouncementThumb.png" : Thumbnail;
|
||||
template.LoadXml($@"<toast launch='action=openThread&threadId=92187'>
|
||||
template.LoadXml($@"<toast launch='internal&{Id}'>
|
||||
<visual>
|
||||
<binding template='ToastGeneric'>
|
||||
<image placement='hero' src='{thumb1}'/>
|
||||
@@ -199,9 +213,9 @@ namespace FoxTube.Background
|
||||
|
||||
<actions>
|
||||
<action content='Watch full post'
|
||||
arguments='action=commentPhoto&photoId=92187'/>
|
||||
arguments='internal&{Id}'/>
|
||||
<action content='Manage notifications'
|
||||
arguments='action=commentPhoto&photoId=92187'/>
|
||||
arguments='notifications'/>
|
||||
</actions>
|
||||
</toast>");
|
||||
break;
|
||||
@@ -246,6 +260,8 @@ namespace FoxTube.Background
|
||||
return "post";
|
||||
case NotificationType.Video:
|
||||
return "video";
|
||||
case NotificationType.Changelog:
|
||||
return "changelog";
|
||||
default:
|
||||
return "internal";
|
||||
}
|
||||
@@ -261,6 +277,8 @@ namespace FoxTube.Background
|
||||
return NotificationType.Post;
|
||||
case "video":
|
||||
return NotificationType.Video;
|
||||
case "changelog":
|
||||
return NotificationType.Changelog;
|
||||
default:
|
||||
return NotificationType.Internal;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user