Archived
1
0

Notification system development 2

This commit is contained in:
Michael Gordeev
2018-10-24 22:00:47 +03:00
parent 1a93ea4801
commit df6d9c4aab
5 changed files with 18 additions and 21 deletions
+3 -3
View File
@@ -9,7 +9,7 @@ namespace FoxTube.Background
{ {
XmlDocument template = new XmlDocument(); XmlDocument template = new XmlDocument();
template.LoadXml($@"<toast activationType='foreground' launch='changelog|{version.Replace(".", "-")}'> template.LoadXml($@"<toast activationType='foreground' launch='changelog|{version}'>
<visual> <visual>
<binding template='ToastGeneric'> <binding template='ToastGeneric'>
<image placement='hero' src='http://foxgame.hol.es/FoxTubeAssets/WhatsNewThumb.png'/> <image placement='hero' src='http://foxgame.hol.es/FoxTubeAssets/WhatsNewThumb.png'/>
@@ -38,8 +38,8 @@ namespace FoxTube.Background
</visual> </visual>
<actions> <actions>
<action content='Add to Watch later' activationType='background' arguments='later-{id}'/> <action content='Add to Watch later' activationType='background' arguments='later|{id}'/>
<action content='Go to channel' activationType='foreground' arguments='channel-{channelId}'/> <action content='Go to channel' activationType='foreground' arguments='channel|{channelId}'/>
</actions> </actions>
</toast>"); </toast>");
+4 -6
View File
@@ -9,8 +9,7 @@ namespace FoxTube.Classes
{ {
public InboxItemType Type { get; set; } = InboxItemType.Default; public InboxItemType Type { get; set; } = InboxItemType.Default;
public DateTime TimeStamp { get; set; } public DateTime TimeStamp { get; set; }
public string PatchVersion { get; set; }
public string Subject { get; set; } public string Subject { get; set; }
public string Content { get; set; } public string Content { get; set; }
public string Id { get; set; } public string Id { get; set; }
@@ -41,20 +40,19 @@ namespace FoxTube.Classes
get get
{ {
if (Type == InboxItemType.PatchNote) if (Type == InboxItemType.PatchNote)
return $"What's new in v{PatchVersion}"; return $"What's new in v{Id}";
else else
return Subject; return Subject;
} }
} }
public InboxItem(string version, string content, string timeStamp, string id) public InboxItem(string version, string content, string timeStamp)
{ {
Type = InboxItemType.PatchNote; Type = InboxItemType.PatchNote;
PatchVersion = version;
Content = content; Content = content;
TimeStamp = DateTime.Parse(timeStamp); TimeStamp = DateTime.Parse(timeStamp);
Id = id; Id = version;
} }
public InboxItem(string title, string content, DateTime timeStamp, string id) public InboxItem(string title, string content, DateTime timeStamp, string id)
+1 -1
View File
@@ -74,7 +74,7 @@ namespace FoxTube
if (settings.Values["ver"] == null) if (settings.Values["ver"] == null)
settings.Values.Add("ver", $"{ver.Major}.{ver.Minor}"); settings.Values.Add("ver", $"{ver.Major}.{ver.Minor}");
if((string)settings.Values["ver"] == $"{ver.Major}.{ver.Minor}") //Replace for '!=' !!! //if((string)settings.Values["ver"] != $"{ver.Major}.{ver.Minor}")
{ {
try try
{ {
+7 -7
View File
@@ -38,21 +38,21 @@ namespace FoxTube
base.OnNavigatedTo(e); base.OnNavigatedTo(e);
if(!string.IsNullOrWhiteSpace(e.Parameter as string)) if(!string.IsNullOrWhiteSpace(e.Parameter as string))
{ {
if ((e.Parameter as string).Contains("inbox")) if ((e.Parameter as string).Contains("inbox") || (e.Parameter as string).Contains("changelog"))
{ {
pivot.SelectedIndex = 3; pivot.SelectedIndex = 2;
if ((string)e.Parameter != "inbox") if ((string)e.Parameter != "inbox" && (string)e.Parameter != "changelog")
((pivot.SelectedItem as PivotItem).Content as Inbox).Open((e.Parameter as string).Split('&')[1]); ((pivot.SelectedItem as PivotItem).Content as Inbox).Open(e.Parameter as string);
} }
else else
switch(e.Parameter as string) switch(e.Parameter as string)
{ {
case "about": case "about":
pivot.SelectedIndex = 2; pivot.SelectedIndex = 1;
break; break;
case "translate": /*case "translate":
pivot.SelectedIndex = 3; pivot.SelectedIndex = 3;
break; break;*/
} }
} }
} }
+3 -4
View File
@@ -45,9 +45,7 @@ namespace FoxTube.Pages.SettingsPages
items.Add(new InboxItem( items.Add(new InboxItem(
e.GetAttribute("version"), e.GetAttribute("version"),
e["content"].InnerText, e["content"].InnerText,
e.GetAttribute("time"), e.GetAttribute("time")));
e.GetAttribute("id")
));
doc.Load("http://foxgame.hol.es/foxtube-messages.xml"); doc.Load("http://foxgame.hol.es/foxtube-messages.xml");
foreach (XmlElement e in doc["posts"].ChildNodes) foreach (XmlElement e in doc["posts"].ChildNodes)
@@ -141,8 +139,9 @@ namespace FoxTube.Pages.SettingsPages
} }
} }
public void Open(string id) public void Open(string arg)
{ {
string id = arg.Split('&')[1];
InboxItem item = items.Find(x => x.Id == id); InboxItem item = items.Find(x => x.Id == id);
if(item != null) if(item != null)
list.SelectedIndex = items.IndexOf(item); list.SelectedIndex = items.IndexOf(item);