diff --git a/FoxTube.Background/BackgroundProcessor.cs b/FoxTube.Background/BackgroundProcessor.cs index 706209d..6e06785 100644 --- a/FoxTube.Background/BackgroundProcessor.cs +++ b/FoxTube.Background/BackgroundProcessor.cs @@ -11,7 +11,6 @@ using System.Xml; using Windows.ApplicationModel.Background; using Windows.Storage; using Windows.UI.Notifications; -using YoutubeExplode.Models; namespace FoxTube.Background { @@ -78,13 +77,13 @@ namespace FoxTube.Background if(i.Snippet.LiveBroadcastContent == "live") ToastNotificationManager.CreateToastNotifier().Show( - Notification.GetStreamToast(i.Id.VideoId, i.Snippet.ChannelId, i.Snippet.Title, i.Snippet.ChannelTitle, i.Snippet.Thumbnails.Medium.Url, i.Snippet.PublishedAt.Value, s.Value)); + Notification.GetStreamToast(i.Id.VideoId, i.Snippet.ChannelId, i.Snippet.Title.ConvertEscapeSymbols(), i.Snippet.ChannelTitle, i.Snippet.Thumbnails.Medium.Url, i.Snippet.PublishedAt.Value, s.Value)); else if(i.Snippet.LiveBroadcastContent == "upcoming") ToastNotificationManager.CreateToastNotifier().Show( - Notification.GetUpcomingToast(i.Id.VideoId, i.Snippet.ChannelId, i.Snippet.Title, i.Snippet.ChannelTitle, i.Snippet.Thumbnails.Medium.Url, i.Snippet.PublishedAt.Value, s.Value)); + Notification.GetUpcomingToast(i.Id.VideoId, i.Snippet.ChannelId, i.Snippet.Title.ConvertEscapeSymbols(), i.Snippet.ChannelTitle, i.Snippet.Thumbnails.Medium.Url, i.Snippet.PublishedAt.Value, s.Value)); else ToastNotificationManager.CreateToastNotifier().Show( - Notification.GetVideoToast(i.Id.VideoId, i.Snippet.ChannelId, i.Snippet.Title, i.Snippet.ChannelTitle, i.Snippet.Thumbnails.Medium.Url, i.Snippet.PublishedAt.Value, s.Value)); + Notification.GetVideoToast(i.Id.VideoId, i.Snippet.ChannelId, i.Snippet.Title.ConvertEscapeSymbols(), i.Snippet.ChannelTitle, i.Snippet.Thumbnails.Medium.Url, i.Snippet.PublishedAt.Value, s.Value)); } } @@ -94,7 +93,7 @@ namespace FoxTube.Background updater.EnableNotificationQueue(true); updater.Clear(); for (int i = 0; i < 5 && i < results.Count; i++) - updater.Update(Tiles.GetTileLayout(System.Security.SecurityElement.Escape(results[i].Snippet.Title), System.Security.SecurityElement.Escape(results[i].Snippet.ChannelTitle), results[i].Snippet.Thumbnails.Medium.Url.Replace("&", "%26"), subscriptions[results[i].Snippet.ChannelId])); + updater.Update(Tiles.GetTileLayout(System.Security.SecurityElement.Escape(results[i].Snippet.Title.ConvertEscapeSymbols()), System.Security.SecurityElement.Escape(results[i].Snippet.ChannelTitle), results[i].Snippet.Thumbnails.Medium.Url.Replace("&", "%26"), subscriptions[results[i].Snippet.ChannelId])); } catch { } } @@ -119,4 +118,12 @@ namespace FoxTube.Background catch { } } } + + public static class Ext + { + public static string ConvertEscapeSymbols(this string str) + { + return str.Replace(""", "\"").Replace("'", "'").Replace("<", "<").Replace(">", ">").Replace("&", "&"); + } + } } diff --git a/FoxTube/App.xaml b/FoxTube/App.xaml index 9629a35..3f5f37b 100644 --- a/FoxTube/App.xaml +++ b/FoxTube/App.xaml @@ -1,8 +1,7 @@  + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> diff --git a/FoxTube/Assets/Data/Patchnotes.xml b/FoxTube/Assets/Data/Patchnotes.xml index 81216eb..6b4d465 100644 --- a/FoxTube/Assets/Data/Patchnotes.xml +++ b/FoxTube/Assets/Data/Patchnotes.xml @@ -13,6 +13,7 @@ - Added adverts - Fixed header titles - Some items were moved from menu to header +- Added "Share" button to video cards ### Что нового: - Оптимизация приложения @@ -25,6 +26,7 @@ - Добавлена реклама - Исправлено изменение заголовков - Некоторые пункты меню перемещены в заголовок +- Добавлена кнопка "Поделиться" к видео карточкам diff --git a/FoxTube/Classes/SecretsVault.cs b/FoxTube/Classes/SecretsVault.cs index 307a658..affa15c 100644 --- a/FoxTube/Classes/SecretsVault.cs +++ b/FoxTube/Classes/SecretsVault.cs @@ -110,7 +110,6 @@ namespace FoxTube /// public static void Initialize() { - // TODO: Reactivate addons initialization CheckAddons(); CheckAuthorization(); } diff --git a/FoxTube/Controls/ChannelCard.xaml b/FoxTube/Controls/ChannelCard.xaml index 58c73ea..c19f69c 100644 --- a/FoxTube/Controls/ChannelCard.xaml +++ b/FoxTube/Controls/ChannelCard.xaml @@ -4,7 +4,6 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:Windows10version1809="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 7)" mc:Ignorable="d" HorizontalAlignment="Stretch" VerticalAlignment="Top" @@ -21,10 +20,10 @@ - + - + diff --git a/FoxTube/Controls/VideoCard.xaml b/FoxTube/Controls/VideoCard.xaml index c63f8dd..e72eebe 100644 --- a/FoxTube/Controls/VideoCard.xaml +++ b/FoxTube/Controls/VideoCard.xaml @@ -79,17 +79,18 @@ + + + + + + - - - - - - + diff --git a/FoxTube/Controls/VideoCard.xaml.cs b/FoxTube/Controls/VideoCard.xaml.cs index 557eb72..42f5874 100644 --- a/FoxTube/Controls/VideoCard.xaml.cs +++ b/FoxTube/Controls/VideoCard.xaml.cs @@ -12,6 +12,7 @@ using System.Collections.Generic; using YoutubeExplode; using Windows.UI.Popups; using YoutubeExplode.Models.MediaStreams; +using Windows.Foundation; namespace FoxTube.Controls { @@ -233,6 +234,21 @@ namespace FoxTube.Controls Methods.MainPage.GoToVideo(videoId, playlistId); } + private void Share(DataTransferManager sender, DataRequestedEventArgs args) + { + Methods.Share(args, + item.Snippet.Thumbnails.Medium.Url, + item.Snippet.Title, + $"https://www.youtube.com/watch?v={videoId}", + resources.GetString("/Cards/videoShare")); + } + + private void share_Click(object sender, RoutedEventArgs e) + { + DataTransferManager.GetForCurrentView().DataRequested += new TypedEventHandler(Share); + DataTransferManager.ShowShareUI(); + } + private void ViewChannel_Click(object sender, RoutedEventArgs e) { Methods.MainPage.GoToChannel(item.Snippet.ChannelId); diff --git a/FoxTube/Pages/CommentsPage.xaml b/FoxTube/Pages/CommentsPage.xaml index 65e3703..daf3362 100644 --- a/FoxTube/Pages/CommentsPage.xaml +++ b/FoxTube/Pages/CommentsPage.xaml @@ -5,7 +5,6 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:controls="using:FoxTube.Controls" - xmlns:adverts="using:FoxTube.Controls.Adverts" mc:Ignorable="d" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> diff --git a/FoxTube/Pages/VideoPage.xaml.cs b/FoxTube/Pages/VideoPage.xaml.cs index cb738e6..0645b1f 100644 --- a/FoxTube/Pages/VideoPage.xaml.cs +++ b/FoxTube/Pages/VideoPage.xaml.cs @@ -6,8 +6,6 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; -using System.Linq; -using System.Threading; using System.Threading.Tasks; using Windows.ApplicationModel.DataTransfer; using Windows.ApplicationModel.Resources;