Archived
1
0

Feedback hub removed, Subscription page development, changelog notifications

This commit is contained in:
Michael Gordeev
2018-08-19 00:14:20 +03:00
parent 4c4f4ed967
commit bf4262426d
16 changed files with 306 additions and 385 deletions
+30 -82
View File
@@ -37,10 +37,25 @@ namespace FoxTube.Background
TimeStamp = date;
Id = id;
Type = TypeConversion(type);
Avatar = avatarUrl == null? "ms-appx:///Assets/Icons/Profile.png" : avatarUrl;
Avatar = avatarUrl ?? "ms-appx:///Assets/Icons/Profile.png";
Thumbnail = thumbnailUrl;
}
public Notification(string xmlSource)
{
System.Xml.XmlDocument d = new System.Xml.XmlDocument();
d.InnerXml = xmlSource;
System.Xml.XmlElement xml = d["item"];
Channel = xml["channelName"].InnerText;
Content = xml["content"].InnerText;
TimeStamp = DateTimeOffset.Parse(xml.GetAttribute("time"));
Id = xml.GetAttribute("id");
Type = TypeConversion(xml.GetAttribute("type"));
Avatar = xml["images"].GetAttribute("avatar");
Thumbnail = xml["images"].GetAttribute("thumbnail");
}
public string GetXml()
{
return $@"<item time='{TimeStamp.ToString("YYYY-MM-DDThh:mm:ss")}' type='{TypeConversion(Type)}' id='{Id}'>
@@ -57,33 +72,23 @@ namespace FoxTube.Background
//Channel
switch (Type)
{
case NotificationType.Comment:
stackPanel.Children.Add(new TextBlock()
{
FontSize = 14,
FontStyle = Windows.UI.Text.FontStyle.Italic,
Foreground = new SolidColorBrush(Colors.Gray),
Text = string.Format("{0} replied to your comment", Channel)
});
break;
case NotificationType.Internal:
stackPanel.Children.Add(new TextBlock()
{
FontSize = 14,
FontStyle = Windows.UI.Text.FontStyle.Italic,
Foreground = new SolidColorBrush(Colors.Gray),
Text = Channel
Text = "Developer's message"
});
break;
case NotificationType.Post:
case NotificationType.Changelog:
stackPanel.Children.Add(new TextBlock()
{
FontSize = 14,
FontStyle = Windows.UI.Text.FontStyle.Italic,
Foreground = new SolidColorBrush(Colors.Gray),
Text = string.Format("{0} published new post", Channel)
Text = "Changelog"
});
break;
@@ -93,7 +98,7 @@ namespace FoxTube.Background
FontSize = 14,
FontStyle = Windows.UI.Text.FontStyle.Italic,
Foreground = new SolidColorBrush(Colors.Gray),
Text = string.Format("{0} uploaded new video", Channel)
Text = $"{Channel} uploaded new video"
});
break;
}
@@ -142,36 +147,13 @@ namespace FoxTube.Background
XmlDocument template = new XmlDocument();
switch (Type)
{
case NotificationType.Comment:
template.LoadXml($@"<toast launch='comment&{Id}'>
<visual>
<binding template='ToastGeneric'>
<image placement='appLogoOverride' hint-crop='circle' src='{Avatar}'/>
<text>{Channel} posted a new comment</text>
<text>{Content}</text>
</binding>
</visual>
<actions>
<input id='textBox' type='text' placeHolderContent='Send a reply'/>
<action content='Send' imageUri='Assets/Icons/Send.png'
hint-inputId='textBox' activationType='background'
arguments='comment&{Id}&send'/>
<action content='Like'
arguments='comment&{Id}&like'/>
</actions>
</toast>");
break;
case NotificationType.Video:
template.LoadXml($@"<toast launch='video&{Id}'>
template.LoadXml($@"<toast launch='video={Id}'>
<visual>
<binding template='ToastGeneric'>
<image placement='appLogoOverride' hint-crop='circle' src='{Avatar}'/>
<text>{Channel} uploaded a new video</text>
<text>{Content}</text>
<text>{Channel} uploaded a new video</text>
<image src='{Thumbnail}'/>
</binding>
</visual>
@@ -187,62 +169,28 @@ namespace FoxTube.Background
break;
case NotificationType.Changelog:
template.LoadXml($@"<toast launch='changelog&{Id}'>
template.LoadXml($@"<toast launch='{Id}'>
<visual>
<binding template='ToastGeneric'>
<image placement='hero' src='Assets/WhatsNewThumb.png'/>
<image placement='appLogoOverride' hint-crop='circle' src='Assets/LogoAvatar.png'/>
<image placement='hero' src='http://foxgame.hol.es/FoxTubeAssets/WhatsNewThumb.png'/>
<image placement='appLogoOverride' hint-crop='circle' src='http://foxgame.hol.es/FoxTubeAssets/NewsAvatar.png'/>
<text>{Content}</text>
<text>Changelog</text>
<text>{Channel}</text>
</binding>
</visual>
</toast>");
break;
case NotificationType.Internal:
string thumb1 = string.IsNullOrWhiteSpace(Thumbnail) ? "Assets/AnnouncementThumb.png" : Thumbnail;
template.LoadXml($@"<toast launch='internal&{Id}'>
template.LoadXml($@"<toast launch='internal={Id}'>
<visual>
<binding template='ToastGeneric'>
<image placement='hero' src='{thumb1}'/>
<image placement='appLogoOverride' hint-crop='circle' src='Assets/LogoAvatar.png'/>
<text>{Channel}</text>
<text hint-maxLines='5'>{Content}</text>
</binding>
</visual>
<actions>
<action content='Watch full post'
arguments='internal&{Id}'/>
<action content='Manage notifications'
arguments='notifications'/>
</actions>
</toast>");
break;
case NotificationType.Post:
string thumb2 = string.IsNullOrWhiteSpace(Thumbnail) ? "" : $"<image placement='hero' src ='{Thumbnail}'/>";
template.LoadXml($@"<toast launch='action=openThread&amp;threadId=92187'>
<visual>
<binding template='ToastGeneric'>
{thumb2}
<image placement='hero' src='{Thumbnail}'/>
<image placement='appLogoOverride' hint-crop='circle' src='{Avatar}'/>
<text>{Channel}</text>
<text hint-maxLines='5'>{Content}</text>
<text>{Content}</text>
<text hint-maxLines='5'>{Channel}</text>
</binding>
</visual>
<actions>
<input id='textBox' type='text' placeHolderContent='Leave a comment'/>
<action content='Send'
imageUri='Assets/Icons/send.png'
hint-inputId='textBox'
activationType='background'
arguments='action=reply&amp;threadId=92187'/>
<action content='Like'
arguments='action=commentPhoto&amp;photoId=92187'/>
</actions>
</toast>");
break;
}