Archived
1
0

Notificaions development 0

This commit is contained in:
Michael Gordeev
2018-10-24 16:46:22 +03:00
parent 4cb9bdd8cb
commit dc8afa2891
10 changed files with 165 additions and 335 deletions
+15
View File
@@ -0,0 +1,15 @@
<UserControl
x:Class="FoxTube.Controls.Advert"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:FoxTube.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="400">
<Grid>
</Grid>
</UserControl>
+27
View File
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
namespace FoxTube.Controls
{
public sealed partial class Advert : UserControl
{
public Advert()
{
this.InitializeComponent();
}
}
}
+7
View File
@@ -101,6 +101,9 @@
<Compile Include="Classes\InboxItem.cs" />
<Compile Include="Classes\Methods.cs" />
<Compile Include="Classes\ObjectEventArgs.cs" />
<Compile Include="Controls\Advert.xaml.cs">
<DependentUpon>Advert.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\ChannelCard.xaml.cs">
<DependentUpon>ChannelCard.xaml</DependentUpon>
</Compile>
@@ -277,6 +280,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="Controls\Advert.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\ChannelCard.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
+1 -1
View File
@@ -1 +1 @@
<toast launch="action=viewPhoto&amp;photoId=92187">
<toast launch="action=viewPhoto&amp;photoId=92187">
+3 -2
View File
@@ -1,6 +1,7 @@
<posts>
<post time="YYYY-MM-DDThh:mm:ss-03" image="http://foxtube.hol.es/foxtube/FILE_NAME.png Hero image (not implemented yet)" id="0">
<notificationHeader>Short headline for toast notifications</notificationHeader>
<post time="YYYY-MM-DDThh:mm:ss-03" id="0">
<thumbnail></thumbnail>
<avatar></avatar>
<header>Main headline for full post</header>
<content>Announcement body (beware of special characters)</content>
</post>
+4 -26
View File
@@ -53,8 +53,8 @@ namespace FoxTube
if (settings.Values["newVideoNotification"] == null)
settings.Values.Add("newVideoNotification", true);
if (settings.Values["newmessagesNotification"] == null)
settings.Values.Add("newmessagesNotification", true);
if (settings.Values["devNews"] == null)
settings.Values.Add("devNews", true);
if (settings.Values["moblieWarning"] == null)
settings.Values.Add("moblieWarning", false);
@@ -70,19 +70,11 @@ namespace FoxTube
if (settings.Values["safeSearch"] == null)
settings.Values.Add("safeSearch", 0);
if (settings.Values["notificationsHistory"] == null)
{
XmlDocument doc = new XmlDocument();
doc.AppendChild(doc.CreateXmlDeclaration("1.0", "utf-8", null));
doc.AppendChild(doc.CreateElement("history"));
settings.Values.Add("notificationsHistory", doc.InnerXml);
}
PackageVersion ver = Package.Current.Id.Version;
if (settings.Values["ver"] == null)
settings.Values.Add("ver", $"{ver.Major}.{ver.Minor}");
if((string)settings.Values["ver"] != $"{ver.Major}.{ver.Minor}")
if((string)settings.Values["ver"] == $"{ver.Major}.{ver.Minor}") //Replace for '!=' !!!
{
try
{
@@ -90,21 +82,7 @@ namespace FoxTube
changelog.Load("http://foxgame.hol.es/foxtube-changelog.xml");
XmlElement e = changelog["items"].ChildNodes[0] as XmlElement;
XmlDocument doc = new XmlDocument();
doc.LoadXml(settings.Values["notificationsHistory"] as string);
Background.Notification n = new Background.Notification("changelog",
$"changelog-{e.GetAttribute("version").Replace('.', '-')}",
"Changelog",
$"What&apos;s new in version {e.GetAttribute("version")}",
DateTime.Parse(e.GetAttribute("time")),
"http://foxgame.hol.es/FoxTubeAssets/WhatsNewThumb.png",
"http://foxgame.hol.es/FoxTubeAssets/NewsAvatar.png");
doc["history"].InnerXml += n.GetXml();
settings.Values["notificationsHistory"] = doc.InnerXml;
ToastNotificationManager.CreateToastNotifier().Show(n.GetToast());
ToastNotificationManager.CreateToastNotifier().Show(FoxTube.Background.Notification.GetChangelogToast(e.GetAttribute("version")));
settings.Values["ver"] = $"{ver.Major}.{ver.Minor}";
}
+1
View File
@@ -42,6 +42,7 @@
<TextBlock x:Uid="/General/notifications" Text="Notifications" FontSize="22"/>
<ToggleSwitch x:Uid="/General/newVideo" Name="newVideo" OnContent="Notify when someone of your subscriptions uploaded new video" OffContent="Notify when someone of your subscriptions uploaded new video" Toggled="notification_IsEnabledChanged"/>
<ToggleSwitch Name="devNews" OnContent="Recieve messages from developers" OffContent="Recieve messages from developers" Toggled="devNews_Toggled"/>
<TextBlock x:Uid="/General/color" Text="Color mode" FontSize="22"/>
<RadioButton x:Uid="/General/colorLight" Content="Light" Name="light" GroupName="color" Checked="RadioButton_Checked"/>
@@ -134,5 +134,10 @@ namespace FoxTube.Pages.SettingsPages
{
CoreApplication.Exit();
}
private void devNews_Toggled(object sender, RoutedEventArgs e)
{
settings.Values["devnews"] = devNews.IsOn;
}
}
}