@@ -4,6 +4,7 @@ using Google.Apis.YouTube.v3.Data;
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using Windows.ApplicationModel.Background;
|
using Windows.ApplicationModel.Background;
|
||||||
@@ -57,6 +58,9 @@ namespace FoxTube.Background
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
Dictionary<string, string> subscriptions = JsonConvert.DeserializeObject<Dictionary<string, string>>(await FileIO.ReadTextAsync(await ApplicationData.Current.RoamingFolder.GetFileAsync("background.json")));
|
Dictionary<string, string> subscriptions = JsonConvert.DeserializeObject<Dictionary<string, string>>(await FileIO.ReadTextAsync(await ApplicationData.Current.RoamingFolder.GetFileAsync("background.json")));
|
||||||
|
|
||||||
|
List<SearchResult> results = new List<SearchResult>();
|
||||||
|
|
||||||
foreach (var s in subscriptions)
|
foreach (var s in subscriptions)
|
||||||
{
|
{
|
||||||
SearchResource.ListRequest request = Service.Search.List("snippet");
|
SearchResource.ListRequest request = Service.Search.List("snippet");
|
||||||
@@ -67,9 +71,21 @@ namespace FoxTube.Background
|
|||||||
SearchListResponse response = await request.ExecuteAsync();
|
SearchListResponse response = await request.ExecuteAsync();
|
||||||
|
|
||||||
foreach (SearchResult i in response.Items)
|
foreach (SearchResult i in response.Items)
|
||||||
|
{
|
||||||
|
results.Add(i);
|
||||||
|
|
||||||
ToastNotificationManager.CreateToastNotifier().Show(
|
ToastNotificationManager.CreateToastNotifier().Show(
|
||||||
Notification.GetVideoToast(i.Id.VideoId, i.Snippet.ChannelId, i.Snippet.Title, i.Snippet.ChannelTitle, i.Snippet.Thumbnails.Medium.Url, s.Value));
|
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 { }
|
catch { }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,7 +108,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="BackgroundProcessor.cs" />
|
<Compile Include="BackgroundProcessor.cs" />
|
||||||
<Compile Include="Notification.cs" />
|
<Compile Include="ResourceCreators.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -1,67 +1,115 @@
|
|||||||
using Windows.Data.Xml.Dom;
|
using Windows.Data.Xml.Dom;
|
||||||
using Windows.UI.Notifications;
|
using Windows.UI.Notifications;
|
||||||
|
|
||||||
namespace FoxTube.Background
|
namespace FoxTube.Background
|
||||||
{
|
{
|
||||||
public static class Notification
|
public static class Notification
|
||||||
{
|
{
|
||||||
public static ToastNotification GetChangelogToast(string version)
|
public static ToastNotification GetChangelogToast(string version)
|
||||||
{
|
{
|
||||||
XmlDocument template = new XmlDocument();
|
XmlDocument template = new XmlDocument();
|
||||||
|
|
||||||
template.LoadXml($@"<toast activationType='foreground' launch='changelog|{version}'>
|
template.LoadXml($@"<toast activationType='foreground' launch='changelog|{version}'>
|
||||||
<visual>
|
<visual>
|
||||||
<binding template='ToastGeneric'>
|
<binding template='ToastGeneric'>
|
||||||
<image placement='hero' src='http://foxgame-studio.000webhostapp.com/FoxTubeAssets/WhatsNewThumb.png'/>
|
<image placement='hero' src='http://foxgame-studio.000webhostapp.com/FoxTubeAssets/WhatsNewThumb.png'/>
|
||||||
<image placement='appLogoOverride' hint-crop='circle' src='http://foxgame-studio.000webhostapp.com/FoxTubeAssets/NewsAvatar.png'/>
|
<image placement='appLogoOverride' hint-crop='circle' src='http://foxgame-studio.000webhostapp.com/FoxTubeAssets/NewsAvatar.png'/>
|
||||||
<text>Changelog</text>
|
<text>Changelog</text>
|
||||||
<text>See what's new in version {version}</text>
|
<text>See what's new in version {version}</text>
|
||||||
</binding>
|
</binding>
|
||||||
</visual>
|
</visual>
|
||||||
</toast>");
|
</toast>");
|
||||||
|
|
||||||
return new ToastNotification(template);
|
return new ToastNotification(template);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ToastNotification GetVideoToast(string id, string channelId, string title, string channel, string thumbnail, string avatar)
|
public static ToastNotification GetVideoToast(string id, string channelId, string title, string channel, string thumbnail, string avatar)
|
||||||
{
|
{
|
||||||
XmlDocument template = new XmlDocument();
|
XmlDocument template = new XmlDocument();
|
||||||
|
|
||||||
template.LoadXml($@"<toast activationType='foreground' launch='video|{id}'>
|
template.LoadXml($@"<toast activationType='foreground' launch='video|{id}'>
|
||||||
<visual>
|
<visual>
|
||||||
<binding template='ToastGeneric'>
|
<binding template='ToastGeneric'>
|
||||||
<image placement='hero' src='{thumbnail.Replace("&", "%26")}'/>
|
<image placement='hero' src='{thumbnail.Replace("&", "%26")}'/>
|
||||||
<image placement='appLogoOverride' hint-crop='circle' src='{avatar.Replace("&", "%26") ?? "http://foxgame-studio.000webhostapp.com/FoxTubeAssets/LogoAvatar.png"}'/>
|
<image placement='appLogoOverride' hint-crop='circle' src='{avatar.Replace("&", "%26") ?? "http://foxgame-studio.000webhostapp.com/FoxTubeAssets/LogoAvatar.png"}'/>
|
||||||
<text>{title}</text>
|
<text>{title}</text>
|
||||||
<text>{channel} uploaded a new video</text>
|
<text>{channel} uploaded a new video</text>
|
||||||
</binding>
|
</binding>
|
||||||
</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>");
|
||||||
|
|
||||||
return new ToastNotification(template);
|
return new ToastNotification(template);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ToastNotification GetInternalToast(string id, string header, string content, string thumbnail, string avatar)
|
public static ToastNotification GetInternalToast(string id, string header, string content, string thumbnail, string avatar)
|
||||||
{
|
{
|
||||||
XmlDocument template = new XmlDocument();
|
XmlDocument template = new XmlDocument();
|
||||||
|
|
||||||
template.LoadXml($@"<toast activationType='foreground' launch='inbox|{id}'>
|
template.LoadXml($@"<toast activationType='foreground' launch='inbox|{id}'>
|
||||||
<visual>
|
<visual>
|
||||||
<binding template='ToastGeneric'>
|
<binding template='ToastGeneric'>
|
||||||
<image placement='hero' src='{thumbnail ?? "http://foxgame-studio.000webhostapp.com/FoxTubeAssets/AnnouncementThumb.png"}'/>
|
<image placement='hero' src='{thumbnail ?? "http://foxgame-studio.000webhostapp.com/FoxTubeAssets/AnnouncementThumb.png"}'/>
|
||||||
<image placement='appLogoOverride' hint-crop='circle' src='{avatar ?? "http://foxgame-studio.000webhostapp.com/FoxTubeAssets/LogoAvatar.png"}'/>
|
<image placement='appLogoOverride' hint-crop='circle' src='{avatar ?? "http://foxgame-studio.000webhostapp.com/FoxTubeAssets/LogoAvatar.png"}'/>
|
||||||
<text>{header}</text>
|
<text>{header}</text>
|
||||||
<text hint-maxLines='5'>{content}</text>
|
<text hint-maxLines='5'>{content}</text>
|
||||||
</binding>
|
</binding>
|
||||||
</visual>
|
</visual>
|
||||||
</toast>");
|
</toast>");
|
||||||
|
|
||||||
return new ToastNotification(template);
|
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($@" <tile>
|
||||||
|
<visual>
|
||||||
|
|
||||||
|
<binding template='TileMedium' branding='none'>
|
||||||
|
<image placement='peek' src='{avatar?.Replace("&", "%26")}'/>
|
||||||
|
<image placement='background' src='{thumbnail?.Replace("&", "%26")}'/>
|
||||||
|
<text hint-style='base' hint-overlay='60'>{channel}</text>
|
||||||
|
<text hint-wrap='true' hint-style='captionSubtle'>{title}</text>
|
||||||
|
</binding>
|
||||||
|
|
||||||
|
<binding template='TileWide' Branding='nameAndLogo'>
|
||||||
|
<image placement='background' hint-overlay='60' src='{thumbnail?.Replace("&", "%26")}'/>
|
||||||
|
<group>
|
||||||
|
<subgroup hint-weight='33'>
|
||||||
|
<image src='{avatar?.Replace("&", "%26")}' hint-crop='circle' />
|
||||||
|
</subgroup>
|
||||||
|
<subgroup hint-textStacking='center'>
|
||||||
|
<text hint-style='base'>{channel}</text>
|
||||||
|
<text hint-wrap='true' hint-style='captionSubtle'>{title}</text>
|
||||||
|
</subgroup>
|
||||||
|
</group>
|
||||||
|
</binding>
|
||||||
|
|
||||||
|
<binding template='TileLarge' hint-textStacking='top' Branding='nameAndLogo'>
|
||||||
|
<image placement='background' hint-overlay='60' src='{thumbnail?.Replace("&", "%26")}'/>
|
||||||
|
<group>
|
||||||
|
<subgroup hint-weight='33'>
|
||||||
|
<image src='{avatar?.Replace("&", "%26")}' hint-crop='circle' />
|
||||||
|
</subgroup>
|
||||||
|
<subgroup hint-textStacking='center'>
|
||||||
|
<text hint-style='base'>{channel}</text>
|
||||||
|
<text hint-wrap='true' hint-style='captionSubtle'>{title}</text>
|
||||||
|
</subgroup>
|
||||||
|
</group>
|
||||||
|
</binding>
|
||||||
|
</visual>
|
||||||
|
</tile>");
|
||||||
|
|
||||||
|
return new TileNotification(doc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
@@ -15,7 +15,7 @@
|
|||||||
</Resources>
|
</Resources>
|
||||||
<Applications>
|
<Applications>
|
||||||
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="FoxTube.App" ResourceGroup="foxtube">
|
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="FoxTube.App" ResourceGroup="foxtube">
|
||||||
<uap:VisualElements DisplayName="FoxTube" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="YouTube Client" BackgroundColor="transparent">
|
<uap:VisualElements DisplayName="FoxTube" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="YouTube Client" BackgroundColor="red">
|
||||||
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png" ShortName="FoxTube" Square310x310Logo="Assets\LargeTile.png" Square71x71Logo="Assets\SmallTile.png">
|
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png" ShortName="FoxTube" Square310x310Logo="Assets\LargeTile.png" Square71x71Logo="Assets\SmallTile.png">
|
||||||
<uap:ShowNameOnTiles>
|
<uap:ShowNameOnTiles>
|
||||||
<uap:ShowOn Tile="square150x150Logo" />
|
<uap:ShowOn Tile="square150x150Logo" />
|
||||||
|
|||||||
|
After Width: | Height: | Size: 19 KiB |