diff --git a/FoxTube.Background/BackgroundProcessor.cs b/FoxTube.Background/BackgroundProcessor.cs index 51ca404..97ca597 100644 --- a/FoxTube.Background/BackgroundProcessor.cs +++ b/FoxTube.Background/BackgroundProcessor.cs @@ -4,6 +4,7 @@ using Google.Apis.YouTube.v3.Data; using Newtonsoft.Json; using System; using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; using System.Xml; using Windows.ApplicationModel.Background; @@ -57,6 +58,9 @@ namespace FoxTube.Background try { Dictionary subscriptions = JsonConvert.DeserializeObject>(await FileIO.ReadTextAsync(await ApplicationData.Current.RoamingFolder.GetFileAsync("background.json"))); + + List results = new List(); + foreach (var s in subscriptions) { SearchResource.ListRequest request = Service.Search.List("snippet"); @@ -67,9 +71,21 @@ namespace FoxTube.Background SearchListResponse response = await request.ExecuteAsync(); foreach (SearchResult i in response.Items) + { + results.Add(i); + ToastNotificationManager.CreateToastNotifier().Show( Notification.GetVideoToast(i.Id.VideoId, i.Snippet.ChannelId, i.Snippet.Title, i.Snippet.ChannelTitle, i.Snippet.Thumbnails.Medium.Url, s.Value)); + } } + + results.OrderBy(i => i.Snippet.PublishedAt); + + TileUpdater updater = TileUpdateManager.CreateTileUpdaterForApplication(); + updater.EnableNotificationQueue(true); + updater.Clear(); + for (int i = 0; i < 5; i++) + updater.Update(Tiles.GetTileLayout(results[i].Snippet.Title, results[i].Snippet.ChannelTitle, results[i].Snippet.Thumbnails.Medium.Url, subscriptions[results[i].Snippet.ChannelId])); } catch { } } diff --git a/FoxTube.Background/FoxTube.Background.csproj b/FoxTube.Background/FoxTube.Background.csproj index fee00da..41111b2 100644 --- a/FoxTube.Background/FoxTube.Background.csproj +++ b/FoxTube.Background/FoxTube.Background.csproj @@ -108,7 +108,7 @@ - + diff --git a/FoxTube.Background/Notification.cs b/FoxTube.Background/ResourceCreators.cs similarity index 57% rename from FoxTube.Background/Notification.cs rename to FoxTube.Background/ResourceCreators.cs index 4071a4b..0fd4c6f 100644 --- a/FoxTube.Background/Notification.cs +++ b/FoxTube.Background/ResourceCreators.cs @@ -1,67 +1,115 @@ -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($@" - - - - - Changelog - See what's new in version {version} - - - "); - - 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($@" - - - - - {title} - {channel} uploaded a new video - - - - - - - - "); - - return new ToastNotification(template); - } - - public static ToastNotification GetInternalToast(string id, string header, string content, string thumbnail, string avatar) - { - XmlDocument template = new XmlDocument(); - - template.LoadXml($@" - - - - - {header} - {content} - - - "); - - return new ToastNotification(template); - } - } -} +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($@" + + + + + Changelog + See what's new in version {version} + + + "); + + 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($@" + + + + + {title} + {channel} uploaded a new video + + + + + + + + "); + + return new ToastNotification(template); + } + + public static ToastNotification GetInternalToast(string id, string header, string content, string thumbnail, string avatar) + { + XmlDocument template = new XmlDocument(); + + template.LoadXml($@" + + + + + {header} + {content} + + + "); + + return new ToastNotification(template); + } + } + + public static class Tiles + { + public static TileNotification GetTileLayout(string title, string channel, string thumbnail, string avatar) + { + XmlDocument doc = new XmlDocument(); + + doc.LoadXml($@" + + + + + + {channel} + {title} + + + + + + + + + + {channel} + {title} + + + + + + + + + + + + {channel} + {title} + + + + + "); + + return new TileNotification(doc); + } + } +} diff --git a/FoxTube/Assets/StoreLogo.scale-100.png b/FoxTube/Assets/StoreLogo.scale-100.png index 9d3b85f..3ab11f5 100644 Binary files a/FoxTube/Assets/StoreLogo.scale-100.png and b/FoxTube/Assets/StoreLogo.scale-100.png differ diff --git a/FoxTube/Assets/StoreLogo.scale-125.png b/FoxTube/Assets/StoreLogo.scale-125.png index c3c5610..cb504c8 100644 Binary files a/FoxTube/Assets/StoreLogo.scale-125.png and b/FoxTube/Assets/StoreLogo.scale-125.png differ diff --git a/FoxTube/Assets/StoreLogo.scale-150.png b/FoxTube/Assets/StoreLogo.scale-150.png index a541ede..8b8b63b 100644 Binary files a/FoxTube/Assets/StoreLogo.scale-150.png and b/FoxTube/Assets/StoreLogo.scale-150.png differ diff --git a/FoxTube/Assets/StoreLogo.scale-200.png b/FoxTube/Assets/StoreLogo.scale-200.png index 2fe564e..4e8cf47 100644 Binary files a/FoxTube/Assets/StoreLogo.scale-200.png and b/FoxTube/Assets/StoreLogo.scale-200.png differ diff --git a/FoxTube/Assets/StoreLogo.scale-400.png b/FoxTube/Assets/StoreLogo.scale-400.png index 428e767..67f49b5 100644 Binary files a/FoxTube/Assets/StoreLogo.scale-400.png and b/FoxTube/Assets/StoreLogo.scale-400.png differ diff --git a/FoxTube/Package.appxmanifest b/FoxTube/Package.appxmanifest index 3a8f43c..6223f4b 100644 --- a/FoxTube/Package.appxmanifest +++ b/FoxTube/Package.appxmanifest @@ -15,7 +15,7 @@ - + diff --git a/Src/FoxTubeLogoPadding.png b/Src/FoxTubeLogoPadding.png new file mode 100644 index 0000000..5a80f21 Binary files /dev/null and b/Src/FoxTubeLogoPadding.png differ