Archived
1
0

Fixed xml escape symbols in notifications title

Fixed ChannelCard
Added "Share" button to VideoCard
This commit is contained in:
Michael Gordeev
2019-04-13 19:25:54 +03:00
parent 853a219456
commit b0ecac7c02
9 changed files with 40 additions and 20 deletions
+12 -5
View File
@@ -11,7 +11,6 @@ using System.Xml;
using Windows.ApplicationModel.Background; using Windows.ApplicationModel.Background;
using Windows.Storage; using Windows.Storage;
using Windows.UI.Notifications; using Windows.UI.Notifications;
using YoutubeExplode.Models;
namespace FoxTube.Background namespace FoxTube.Background
{ {
@@ -78,13 +77,13 @@ namespace FoxTube.Background
if(i.Snippet.LiveBroadcastContent == "live") if(i.Snippet.LiveBroadcastContent == "live")
ToastNotificationManager.CreateToastNotifier().Show( 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") else if(i.Snippet.LiveBroadcastContent == "upcoming")
ToastNotificationManager.CreateToastNotifier().Show( 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 else
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, 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.EnableNotificationQueue(true);
updater.Clear(); updater.Clear();
for (int i = 0; i < 5 && i < results.Count; i++) 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 { } catch { }
} }
@@ -119,4 +118,12 @@ namespace FoxTube.Background
catch { } catch { }
} }
} }
public static class Ext
{
public static string ConvertEscapeSymbols(this string str)
{
return str.Replace("&quot;", "\"").Replace("&apos;", "'").Replace("&lt;", "<").Replace("&gt;", ">").Replace("&amp;", "&");
}
}
} }
+1 -2
View File
@@ -1,8 +1,7 @@
<Application <Application
x:Class="FoxTube.App" x:Class="FoxTube.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
xmlns:local="using:FoxTube">
<Application.Resources> <Application.Resources>
<ResourceDictionary> <ResourceDictionary>
+2
View File
@@ -13,6 +13,7 @@
- Added adverts - Added adverts
- Fixed header titles - Fixed header titles
- Some items were moved from menu to header - Some items were moved from menu to header
- Added "Share" button to video cards
</en-US> </en-US>
<ru-RU>### Что нового: <ru-RU>### Что нового:
- Оптимизация приложения - Оптимизация приложения
@@ -25,6 +26,7 @@
- Добавлена реклама - Добавлена реклама
- Исправлено изменение заголовков - Исправлено изменение заголовков
- Некоторые пункты меню перемещены в заголовок - Некоторые пункты меню перемещены в заголовок
- Добавлена кнопка "Поделиться" к видео карточкам
</ru-RU> </ru-RU>
</content> </content>
</item> </item>
-1
View File
@@ -110,7 +110,6 @@ namespace FoxTube
/// </summary> /// </summary>
public static void Initialize() public static void Initialize()
{ {
// TODO: Reactivate addons initialization
CheckAddons(); CheckAddons();
CheckAuthorization(); CheckAuthorization();
} }
+2 -3
View File
@@ -4,7 +4,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 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" mc:Ignorable="d"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalAlignment="Top" VerticalAlignment="Top"
@@ -21,10 +20,10 @@
<DoubleAnimation Storyboard.TargetName="card" Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="{StaticResource CardOpacityDuration}"/> <DoubleAnimation Storyboard.TargetName="card" Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard> </Storyboard>
<Storyboard x:Name="showThumb"> <Storyboard x:Name="showThumb">
<DoubleAnimation Storyboard.TargetName="thumbnail" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="{StaticResource CardOpacityDuration}"/> <DoubleAnimation Storyboard.TargetName="cover" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard> </Storyboard>
<Storyboard x:Name="hideThumb"> <Storyboard x:Name="hideThumb">
<DoubleAnimation Storyboard.TargetName="thumbnail" Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="{StaticResource CardOpacityDuration}"/> <DoubleAnimation Storyboard.TargetName="cover" Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard> </Storyboard>
</UserControl.Resources> </UserControl.Resources>
+7 -6
View File
@@ -79,17 +79,18 @@
</MenuFlyoutItem.Icon> </MenuFlyoutItem.Icon>
</MenuFlyoutItem> </MenuFlyoutItem>
<MenuFlyoutItem x:Uid="/Cards/channel" Icon="Contact" Text="View channel" Name="viewChannel" Click="ViewChannel_Click"/> <MenuFlyoutItem x:Uid="/Cards/channel" Icon="Contact" Text="View channel" Name="viewChannel" Click="ViewChannel_Click"/>
<MenuFlyoutSeparator/>
<MenuFlyoutItem x:Uid="/Cards/getLink" Icon="Link" Text="Copy link" Name="getLink" Click="GetLink_Click"/>
<MenuFlyoutItem x:Uid="/Cards/openWeb" Icon="Globe" Text="Open in browser" Name="inBrowser" Click="InBrowser_Click"/>
<MenuFlyoutItem x:Uid="/Cards/share" Icon="Share" Text="Share" Name="share" Click="share_Click"/>
<MenuFlyoutSeparator/>
<MenuFlyoutSubItem Icon="Download" Text="Download" Name="download"/>
<MenuFlyoutSubItem Icon="Add" Text="Add to" Name="addTo"> <MenuFlyoutSubItem Icon="Add" Text="Add to" Name="addTo">
<MenuFlyoutItem Text="New playlist" Name="newPlaylist" Click="NewPlaylist_Click" Icon="Add"/> <MenuFlyoutItem Text="New playlist" Name="newPlaylist" Click="NewPlaylist_Click" Icon="Add"/>
<ToggleMenuFlyoutItem Text="Watch later" Name="wl" Click="Wl_Click" Icon="Clock"/> <ToggleMenuFlyoutItem Text="Watch later" Name="wl" Click="Wl_Click" Icon="Clock"/>
<MenuFlyoutSeparator/> <MenuFlyoutSeparator/>
</MenuFlyoutSubItem> </MenuFlyoutSubItem>
<MenuFlyoutSeparator/> <MenuFlyoutItem Text="Remove from playlist" Icon="Delete" Visibility="Collapsed"/>
<MenuFlyoutItem x:Uid="/Cards/getLink" Icon="Link" Text="Copy link" Name="getLink" Click="GetLink_Click"/>
<MenuFlyoutItem x:Uid="/Cards/openWeb" Icon="Globe" Text="Open in browser" Name="inBrowser" Click="InBrowser_Click"/>
<MenuFlyoutItem x:Uid="/Cards/share" Icon="Share" Text="Share" Name="share" Visibility="Collapsed"/>
<MenuFlyoutSeparator Visibility="{x:Bind download.Visibility}"/>
<MenuFlyoutSubItem Icon="Download" Text="Download" Visibility="Visible" Name="download"/>
</MenuFlyout> </MenuFlyout>
</UserControl.ContextFlyout> </UserControl.ContextFlyout>
</UserControl> </UserControl>
+16
View File
@@ -12,6 +12,7 @@ using System.Collections.Generic;
using YoutubeExplode; using YoutubeExplode;
using Windows.UI.Popups; using Windows.UI.Popups;
using YoutubeExplode.Models.MediaStreams; using YoutubeExplode.Models.MediaStreams;
using Windows.Foundation;
namespace FoxTube.Controls namespace FoxTube.Controls
{ {
@@ -233,6 +234,21 @@ namespace FoxTube.Controls
Methods.MainPage.GoToVideo(videoId, playlistId); 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<DataTransferManager, DataRequestedEventArgs>(Share);
DataTransferManager.ShowShareUI();
}
private void ViewChannel_Click(object sender, RoutedEventArgs e) private void ViewChannel_Click(object sender, RoutedEventArgs e)
{ {
Methods.MainPage.GoToChannel(item.Snippet.ChannelId); Methods.MainPage.GoToChannel(item.Snippet.ChannelId);
-1
View File
@@ -5,7 +5,6 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="using:FoxTube.Controls" xmlns:controls="using:FoxTube.Controls"
xmlns:adverts="using:FoxTube.Controls.Adverts"
mc:Ignorable="d" mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
-2
View File
@@ -6,8 +6,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Globalization; using System.Globalization;
using System.Linq;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Windows.ApplicationModel.DataTransfer; using Windows.ApplicationModel.DataTransfer;
using Windows.ApplicationModel.Resources; using Windows.ApplicationModel.Resources;