Archived
1
0

Merged PR 24: [0.5] Submission #4

- StoreAssociation.xml added to git
- Changelogs toasts fixed
Inbox messages background is now transparent
- Added "Add to" button on video page
- Added "Add to" option to video cards context menu
Added "Download" option to video cards context menu
Updated changelog

Related Work Items: #192
- Deleted videos are now displayed
- Updated target version to 17134
Fixed headers
Added ads to VideoGrid

Related Work Items: #162, #188
- Added CommentAdvert
Activated pro version validation
Leave feedback and account buttons were moved to header
- Fixed extensions in Methods
Added chat ads
Optimized users's avatar
CardAdverts now appearing every 25 items
Added privacy url in CommentAdvert

Related Work Items: #162, #252
- Added ad to player
- Fixed xml escape symbols in notifications title
Fixed ChannelCard
Added "Share" button to VideoCard
- Added "Delete playlist item" to video cards on playlist page

Related Work Items: #192
- Channel cover resolution improves
- Updated localization
Titles are now localized
Updated ads (including default AdUintId)
- Mute button for hd resolutions fixed
Updated localization
- Fixed comment advert
Test ads are now on

Related work items: #161, #162, #164, #188, #192, #246, #247, #248, #252, #280, #289
This commit is contained in:
Michael Gordeev
2019-04-14 10:36:40 +00:00
48 changed files with 1893 additions and 316 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;", "&");
}
}
} }
+8 -11
View File
@@ -1,17 +1,14 @@
<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>
<Color x:Key="SystemAccentColor">Red</Color> <ResourceDictionary>
<Style TargetType="Button" BasedOn="{StaticResource ButtonRevealStyle}"/> <ResourceDictionary.MergedDictionaries>
<Style TargetType="ListViewItem" BasedOn="{StaticResource ListViewItemRevealStyle}"/> <ResourceDictionary Source="Themes/Resources.xml"/>
<Style TargetType="TextBlock"> <XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls"/>
<Setter Property="SelectionHighlightColor" Value="Red"/> </ResourceDictionary.MergedDictionaries>
</Style> </ResourceDictionary>
<Style TargetType="TextBox">
<Setter Property="SelectionHighlightColor" Value="Red"/>
</Style>
</Application.Resources> </Application.Resources>
</Application> </Application>
+38
View File
@@ -1,5 +1,43 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<items> <items>
<item time="2019-04-06" version="0.5">
<content>
<en-US>### What's new:
- App optimization
- Changelog notification now pops up after update at first launch
- Added ability to add videos to playlists on video page
- Added ability to add videos to playlists through card's context menu
- Added ability to download video through card's context menu
- Deleted videos are now also displayed
- Added support of April 2018 Update (Windows 10 build 17134)
- Added adverts (not real. Just for debugging)
- Fixed header titles
- Some items were moved from menu to header
- Added "Share" button to video cards
- Added "Delete video from playlist" button to video cards on playlist page\
- Improved channel cover quality
- If available, shows localized titles and descriptions (based on "Search relevance language" parameter set in settings)
- Updated russian localization
</en-US>
<ru-RU>### Что нового:
- Оптимизация приложения
- Добавлено уведомление со списком изменений при первом запуске после обновления
- Добавлена возможность добавлять видео в плейлисты на странице просмотра
- Добавлена возможность добавлять видео в плейлисты через контекстное меню карточки
- Добавлена возможность скачивать видео через контекстное меню карточки
- Удаленные видео теперь также отображаются
- Добавлена поддержка Апрельского Обновления 2018 (Windows 10 сборка 17134)
- Добавлена реклама (не настоящие. Только для отладки)
- Исправлено изменение заголовков
- Некоторые пункты меню перемещены в заголовок
- Добавлена кнопка "Поделиться" к видео карточкам
- Добавлена кнопка "Удалить видео из плейлиста" к видео карточкам на страницах плейлистов
- Улучшено качество обложки канала
- Показывает локализированные заголовки и описания если доступны (основан на параметре "Предпочитаемый язык поиска" установленного в настройках)
- Обновлена русская локализация
</ru-RU>
</content>
</item>
<item time="2019-04-05" version="0.4"> <item time="2019-04-05" version="0.4">
<content> <content>
<en-US>### What's new: <en-US>### What's new:
+12 -7
View File
@@ -1,27 +1,21 @@
using FoxTube.Pages; using FoxTube.Pages;
using Google.Apis.YouTube.v3;
using Newtonsoft.Json; using Newtonsoft.Json;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Web;
using System.Xml; using System.Xml;
using Windows.ApplicationModel.Core; using Windows.ApplicationModel.Core;
using Windows.ApplicationModel.DataTransfer; using Windows.ApplicationModel.DataTransfer;
using Windows.ApplicationModel.Resources; using Windows.ApplicationModel.Resources;
using Windows.ApplicationModel.Resources.Core;
using Windows.Storage; using Windows.Storage;
using Windows.Storage.Streams; using Windows.Storage.Streams;
using Windows.System; using Windows.System;
using Windows.UI;
using Windows.UI.Xaml; using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Documents; using Windows.UI.Xaml.Documents;
using Windows.UI.Xaml.Media;
using YoutubeExplode; using YoutubeExplode;
using YoutubeExplode.Models.MediaStreams; using YoutubeExplode.Models.MediaStreams;
@@ -48,7 +42,18 @@ namespace FoxTube
public static Uri ToUri(this string url) public static Uri ToUri(this string url)
{ {
return new Uri(url); if (string.IsNullOrWhiteSpace(url))
return null;
else
return new Uri(url);
}
public static string GuardFromNull(string str)
{
if (string.IsNullOrWhiteSpace(str))
return string.Empty;
else
return str;
} }
public static string GetChars(this string str, int count) public static string GetChars(this string str, int count)
+4 -4
View File
@@ -42,8 +42,9 @@ namespace FoxTube
}; };
public static YouTubeService Service => IsAuthorized ? new YouTubeService(Initializer) : NoAuthService; public static YouTubeService Service => IsAuthorized ? new YouTubeService(Initializer) : NoAuthService;
public static HttpClient HttpClient { get; } = new HttpClient(); public static HttpClient HttpClient { get; } = new HttpClient();
public static string AppId => true ? "d25517cb-12d4-4699-8bdc-52040c712cab" : "9ncqqxjtdlfh"; private static bool TestAds => true; //Change this bool
public static string AdUnitId => true ? "test" : "1100037769"; public static string AppId => TestAds ? "d25517cb-12d4-4699-8bdc-52040c712cab" : "9ncqqxjtdlfh";
public static string AdUnitId => TestAds ? "test" : "1100044398";
public static bool AdsDisabled { get; private set; } = true; public static bool AdsDisabled { get; private set; } = true;
//User info //User info
@@ -109,9 +110,8 @@ namespace FoxTube
/// </summary> /// </summary>
public static void Initialize() public static void Initialize()
{ {
CheckAddons();
CheckAuthorization(); CheckAuthorization();
// TODO: Reactivate addons initialization
//CheckAddons();
} }
/// <summary> /// <summary>
+1 -1
View File
@@ -161,7 +161,7 @@ namespace FoxTube
{ {
get get
{ {
if (storage.Values["ver"] == null) if (storage.Values["version"] == null)
{ {
PackageVersion ver = Package.Current.Id.Version; PackageVersion ver = Package.Current.Id.Version;
storage.Values["version"] = $"{ver.Major}.{ver.Minor}"; storage.Values["version"] = $"{ver.Major}.{ver.Minor}";
+20 -3
View File
@@ -9,7 +9,24 @@
VerticalAlignment="Top" VerticalAlignment="Top"
d:DesignHeight="290" d:DesignHeight="290"
d:DesignWidth="384" d:DesignWidth="384"
Visibility="Collapsed"> Visibility="Collapsed"
Opacity="0"
Name="card">
<UserControl.Resources>
<Storyboard x:Name="show">
<DoubleAnimation Storyboard.TargetName="card" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
<Storyboard x:Name="hide">
<DoubleAnimation Storyboard.TargetName="card" Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
<Storyboard x:Name="showThumb">
<DoubleAnimation Storyboard.TargetName="image" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
<Storyboard x:Name="hideThumb">
<DoubleAnimation Storyboard.TargetName="image" Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
</UserControl.Resources>
<Button Padding="0" Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}"> <Button Padding="0" Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}">
<Grid> <Grid>
@@ -20,10 +37,10 @@
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Image Source="/Assets/videoPlaceholder.png" Opacity=".0001" Stretch="Fill"/> <Image Source="/Assets/videoPlaceholder.png" Opacity=".0001" Stretch="Fill"/>
<Image Name="image" Source="/Assets/videoThumbSample.png" Stretch="Fill"/> <Image Name="image" Stretch="Fill" ImageOpened="Image_ImageOpened"/>
<StackPanel Margin="0,0,5,5" Background="Orange" VerticalAlignment="Bottom" BorderBrush="OrangeRed" BorderThickness="1" HorizontalAlignment="Right" Padding="5,2,5,3"> <StackPanel Margin="0,0,5,5" Background="Orange" VerticalAlignment="Bottom" BorderBrush="OrangeRed" BorderThickness="1" HorizontalAlignment="Right" Padding="5,2,5,3">
<TextBlock Name="info" Text="SPONSORED CONTENT" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Gray" FontSize="12"/> <TextBlock Name="info" Text="CALL TO ACTION TEXT" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Gray" FontSize="12"/>
</StackPanel> </StackPanel>
<Grid Grid.Row="1" Name="contentGrid"> <Grid Grid.Row="1" Name="contentGrid">
+32 -13
View File
@@ -13,13 +13,26 @@ namespace FoxTube.Controls.Adverts
{ {
NativeAdsManagerV2 manager = new NativeAdsManagerV2(SecretsVault.AppId, SecretsVault.AdUnitId); NativeAdsManagerV2 manager = new NativeAdsManagerV2(SecretsVault.AppId, SecretsVault.AdUnitId);
public NativeAdV2 advert; public NativeAdV2 advert;
public CardAdvert() public CardAdvert(bool isOnVideoPage = false)
{ {
InitializeComponent(); InitializeComponent();
if(!isOnVideoPage)
MainPage.VideoPageSizeChanged += Methods_VideoPageSizeChanged;
manager.AdReady += AdReady; manager.AdReady += AdReady;
manager.ErrorOccurred += ErrorOccurred;
manager.RequestAd(); manager.RequestAd();
} }
private void Methods_VideoPageSizeChanged(object sender = null, params object[] args)
{
Visibility = !(bool)args[0] && advert != null ? Visibility.Visible : Visibility.Collapsed;
}
private void ErrorOccurred(object sender, NativeAdErrorEventArgs e)
{
System.Diagnostics.Debug.WriteLine("Error has occured while loading ad");
}
private void AdReady(object sender, NativeAdReadyEventArgs e) private void AdReady(object sender, NativeAdReadyEventArgs e)
{ {
advert = e.NativeAd; advert = e.NativeAd;
@@ -29,27 +42,33 @@ namespace FoxTube.Controls.Adverts
public void Initialize() public void Initialize()
{ {
Visibility = Visibility.Visible;
title.Text = advert.Title; title.Text = advert.Title;
image.Source = new BitmapImage(advert.MainImages.First().Url.ToUri()); image.Source = new BitmapImage(advert.MainImages.First().Url.ToUri());
icon.ProfilePicture = advert.AdIcon.Source; icon.ProfilePicture = advert.AdIcon == null ? null : advert.AdIcon.Source;
if (string.IsNullOrWhiteSpace(advert.SponsoredBy)) sponsor.Text = Methods.GuardFromNull(advert.SponsoredBy);
sponsor.Visibility = Visibility.Collapsed;
if (string.IsNullOrWhiteSpace(advert.CallToActionText))
(info.Parent as FrameworkElement).Visibility = Visibility.Collapsed;
else else
sponsor.Text = advert.SponsoredBy; info.Text = advert.CallToActionText;
desc.Text = string.Empty;
if (!string.IsNullOrWhiteSpace(advert.Price))
desc.Text += advert.Price;
if (!string.IsNullOrWhiteSpace(advert.Rating)) if (!string.IsNullOrWhiteSpace(advert.Rating))
info.Text += $" {advert.Rating}"; desc.Text += " " + advert.Rating;
if (string.IsNullOrWhiteSpace(advert.CallToActionText) && string.IsNullOrWhiteSpace(advert.Price)) show.Begin();
desc.Visibility = Visibility.Collapsed; }
else if (!string.IsNullOrWhiteSpace(advert.CallToActionText))
desc.Text = advert.CallToActionText;
else
desc.Text = advert.Price;
Visibility = Visibility.Visible; private void Image_ImageOpened(object sender, RoutedEventArgs e)
{
showThumb.Begin();
} }
} }
} }
@@ -0,0 +1,29 @@
<UserControl
x:Class="FoxTube.Controls.Adverts.CommentAdvert"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
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"
mc:Ignorable="d"
d:DesignWidth="400"
Visibility="Collapsed">
<Grid Margin="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<PersonPicture Margin="5,30,5,5" Name="icon" Initials="&#xEC24;" FontFamily="Segoe MDL2 Assets" Height="50" VerticalAlignment="Top"/>
<StackPanel Grid.Column="1" Margin="5">
<Border HorizontalAlignment="Left" Background="Red" CornerRadius="5">
<TextBlock Text="Sponsored by" Foreground="White" TextWrapping="WrapWholeWords" FontSize="13" Margin="3,0,3,3"/>
</Border>
<TextBlock Name="meta" Text="" TextWrapping="WrapWholeWords" Foreground="Gray" FontSize="13"/>
<TextBlock Name="title" Text="Title" TextWrapping="WrapWholeWords" FontWeight="Bold"/>
<TextBlock Name="description" Text="Description" TextWrapping="WrapWholeWords"/>
<HyperlinkButton Name="privacy"/>
<Button Name="cta" Content="CALL TO ACTION TEXT" Margin="0,5"/>
</StackPanel>
</Grid>
</UserControl>
@@ -0,0 +1,59 @@
using Microsoft.Advertising.WinRT.UI;
using System.Collections.Generic;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace FoxTube.Controls.Adverts
{
/// <summary>
/// Advert which is looks similar to video comment
/// </summary>
public sealed partial class CommentAdvert : UserControl
{
NativeAdsManagerV2 manager = new NativeAdsManagerV2(SecretsVault.AppId, SecretsVault.AdUnitId);
public NativeAdV2 advert;
public CommentAdvert()
{
InitializeComponent();
manager.AdReady += AdReady;
manager.ErrorOccurred += ErrorOccurred;
manager.RequestAd();
}
private void ErrorOccurred(object sender, NativeAdErrorEventArgs e)
{
System.Diagnostics.Debug.WriteLine("Error has occured while loading ad");
}
private void AdReady(object sender, NativeAdReadyEventArgs e)
{
advert = e.NativeAd;
Initialize();
if(cta.Visibility == Visibility.Collapsed)
e.NativeAd.RegisterAdContainer(this);
else
e.NativeAd.RegisterAdContainer(this, new List<FrameworkElement> { cta });
}
private void Initialize()
{
title.Text = advert.Title;
description.Text = Methods.GuardFromNull(advert.Description);
icon.ProfilePicture = advert.AdIcon == null ? null : advert.AdIcon.Source;
privacy.NavigateUri = advert.PrivacyUrl.ToUri();
privacy.Content = advert.PrivacyUrl;
privacy.Visibility = string.IsNullOrWhiteSpace(advert.PrivacyUrl) ? Visibility.Collapsed : Visibility.Visible;
cta.Content = Methods.GuardFromNull(advert.CallToActionText);
cta.Visibility = string.IsNullOrWhiteSpace(advert.CallToActionText) ? Visibility.Collapsed : Visibility.Visible;
meta.Text += advert.Price;
meta.Text += " " + advert.Rating;
meta.Visibility = string.IsNullOrWhiteSpace(meta.Text) ? Visibility.Collapsed : Visibility.Visible;
Visibility = Visibility.Visible;
}
}
}
@@ -0,0 +1,98 @@
<UserControl
x:Class="FoxTube.Controls.Adverts.PlayerAdvert"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
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"
mc:Ignorable="d"
d:DesignHeight="53"
d:DesignWidth="1920"
Name="card"
Visibility="Collapsed"
Height="0"
Opacity="0">
<UserControl.Resources>
<Storyboard x:Name="show">
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="card">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
<DiscreteObjectKeyFrame KeyTime="0:0:0.1">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames EnableDependentAnimation="True" Storyboard.TargetName="card" Storyboard.TargetProperty="Height">
<EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="0" />
<EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="53" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames EnableDependentAnimation="True" Storyboard.TargetName="card" Storyboard.TargetProperty="Opacity">
<EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="0" />
<EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="1" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimation Storyboard.TargetName="countdown" Storyboard.TargetProperty="Value" EnableDependentAnimation="True" From="0" To="100" Duration="0:0:10"/>
</Storyboard>
<Storyboard x:Name="hide">
<DoubleAnimationUsingKeyFrames EnableDependentAnimation="True" Storyboard.TargetName="card" Storyboard.TargetProperty="Height">
<EasingDoubleKeyFrame KeyTime="0:0:0" Value="53" />
<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="0" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="card" Storyboard.TargetProperty="Opacity">
<EasingDoubleKeyFrame KeyTime="0:0:0" Value="1" />
<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="0" />
</DoubleAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="card">
<DiscreteObjectKeyFrame KeyTime="0:0:0.3">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
<DiscreteObjectKeyFrame KeyTime="0:0:0.4">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</UserControl.Resources>
<Grid Height="53" Background="{ThemeResource SystemChromeMediumColor}">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid Name="grid" HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="1" Padding="5">
<StackPanel Orientation="Horizontal">
<TextBlock Name="title" FontWeight="Bold" Text="Title"/>
<TextBlock Name="info" Foreground="Gray" VerticalAlignment="Center" Margin="10,0" Style="{StaticResource CaptionTextBlockStyle}" Text=""/>
</StackPanel>
<TextBlock Name="description" Text="Description" TextTrimming="CharacterEllipsis"/>
</StackPanel>
<Button Name="cta" Content="CALL TO ACTION" Grid.Column="2" Margin="10,0"/>
</Grid>
<Button Grid.Column="1" Width="50" Height="50" HorizontalAlignment="Right" FontFamily="Segoe MDL2 Assets" Content="&#xE106;" Background="Transparent" Click="Button_Click"/>
<ProgressBar Name="countdown" VerticalAlignment="Bottom" Grid.Row="1" Grid.ColumnSpan="2"/>
</Grid>
</UserControl>
@@ -0,0 +1,82 @@
using Microsoft.Advertising.WinRT.UI;
using System;
using System.Collections.Generic;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace FoxTube.Controls.Adverts
{
public sealed partial class PlayerAdvert : UserControl
{
NativeAdsManagerV2 manager = new NativeAdsManagerV2(SecretsVault.AppId, SecretsVault.AdUnitId);
NativeAdV2 advert;
DispatcherTimer timer = new DispatcherTimer()
{
Interval = TimeSpan.FromMilliseconds(10000)
};
public PlayerAdvert()
{
InitializeComponent();
manager.AdReady += AdReady;
manager.ErrorOccurred += ErrorOccurred;
timer.Tick += (s, e) =>
{
timer.Stop();
hide.Begin();
};
}
private void ErrorOccurred(object sender, NativeAdErrorEventArgs e)
{
System.Diagnostics.Debug.WriteLine("Error has occured while loading ad");
}
private void AdReady(object sender, NativeAdReadyEventArgs arg)
{
advert = arg.NativeAd;
title.Text = advert.Title;
description.Text = Methods.GuardFromNull(advert.Description);
if (advert.AdIcon != null)
{
grid.Children.Insert(0, advert.AdIcon);
advert.AdIcon.HorizontalAlignment = HorizontalAlignment.Left;
advert.AdIcon.Margin = new Thickness(4);
advert.AdIcon.Width = double.NaN;
advert.AdIcon.Height = double.NaN;
advert.AdIcon.SizeChanged += (s, e) => grid.ColumnDefinitions[0].Width = new GridLength(advert.AdIcon.ActualWidth + 8);
}
cta.Content = Methods.GuardFromNull(advert.CallToActionText);
cta.Visibility = string.IsNullOrWhiteSpace(advert.CallToActionText) ? Visibility.Collapsed : Visibility.Visible;
info.Text += advert.Price;
info.Text += " " + advert.Rating;
if (cta.Visibility == Visibility.Collapsed)
advert.RegisterAdContainer(grid);
else
advert.RegisterAdContainer(grid, new List<FrameworkElement> { cta });
timer.Start();
show.Begin();
}
public void PushAdvert()
{
manager.RequestAd();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
timer.Stop();
hide.Begin();
}
}
}
+18 -11
View File
@@ -4,17 +4,28 @@
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"
d:DesignHeight="290" d:DesignHeight="290"
d:DesignWidth="384" d:DesignWidth="384"
Opacity="0"> Opacity="0"
Name="card">
<Windows10version1809:UserControl.OpacityTransition> <UserControl.Resources>
<ScalarTransition Duration="0:0:0.5"/> <Storyboard x:Name="show">
</Windows10version1809:UserControl.OpacityTransition> <DoubleAnimation Storyboard.TargetName="card" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
<Storyboard x:Name="hide">
<DoubleAnimation Storyboard.TargetName="card" Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
<Storyboard x:Name="showThumb">
<DoubleAnimation Storyboard.TargetName="cover" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
<Storyboard x:Name="hideThumb">
<DoubleAnimation Storyboard.TargetName="cover" Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
</UserControl.Resources>
<Button Padding="0" Margin="1" Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}" Click="Button_Click"> <Button Padding="0" Margin="1" Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}" Click="Button_Click">
<Grid Name="grid"> <Grid Name="grid">
@@ -26,12 +37,8 @@
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Image Source="/Assets/ChannelCoverTemplate.png" Stretch="UniformToFill" Opacity=".0001"/> <Image Source="/Assets/ChannelCoverTemplate.png" Stretch="UniformToFill" Opacity=".0001"/>
<Image Name="cover" Source="/Assets/ChannelCoverTemplate.png" Stretch="UniformToFill" ImageOpened="Cover_ImageOpened" Opacity="0"> <Image Name="cover" Source="/Assets/ChannelCoverTemplate.png" Stretch="UniformToFill" ImageOpened="Cover_ImageOpened" Opacity="0"/>
<Windows10version1809:Image.OpacityTransition>
<ScalarTransition Duration="0:0:0.5"/>
</Windows10version1809:Image.OpacityTransition>
</Image>
<StackPanel Name="liveTag" Margin="5" Background="Red" BorderBrush="White" BorderThickness="1" VerticalAlignment="Bottom" HorizontalAlignment="Right" Padding="5,2,5,3" Orientation="Horizontal" Visibility="Collapsed"> <StackPanel Name="liveTag" Margin="5" Background="Red" BorderBrush="White" BorderThickness="1" VerticalAlignment="Bottom" HorizontalAlignment="Right" Padding="5,2,5,3" Orientation="Horizontal" Visibility="Collapsed">
<TextBlock Text="&#xEC44; " VerticalAlignment="Center" Foreground="White" FontSize="12" FontFamily="Segoe MDL2 Assets" FontWeight="Black"/> <TextBlock Text="&#xEC44; " VerticalAlignment="Center" Foreground="White" FontSize="12" FontFamily="Segoe MDL2 Assets" FontWeight="Black"/>
<TextBlock x:Uid="/Cards/live" Text="LIVE" VerticalAlignment="Center" Foreground="White" FontSize="12" FontWeight="Bold"/> <TextBlock x:Uid="/Cards/live" Text="LIVE" VerticalAlignment="Center" Foreground="White" FontSize="12" FontWeight="Bold"/>
+3 -3
View File
@@ -67,7 +67,7 @@ namespace FoxTube.Controls
try try
{ {
if (!item.BrandingSettings.Image.BannerImageUrl.Contains("default")) if (!item.BrandingSettings.Image.BannerImageUrl.Contains("default"))
cover.Source = new BitmapImage(item.BrandingSettings.Image.BannerImageUrl.ToUri()); cover.Source = new BitmapImage(item.BrandingSettings.Image.BannerMobileImageUrl.ToUri());
} }
catch { } catch { }
} }
@@ -82,7 +82,7 @@ namespace FoxTube.Controls
}); });
} }
Opacity = 1; show.Begin();
} }
public void Button_Click(object sender, RoutedEventArgs e) public void Button_Click(object sender, RoutedEventArgs e)
@@ -125,7 +125,7 @@ namespace FoxTube.Controls
private void Cover_ImageOpened(object sender, RoutedEventArgs e) private void Cover_ImageOpened(object sender, RoutedEventArgs e)
{ {
cover.Opacity = 1; showThumb.Begin();
} }
} }
} }
+8 -2
View File
@@ -4,6 +4,7 @@
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:controls="using:FoxTube.Controls"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="600" d:DesignHeight="600"
d:DesignWidth="400"> d:DesignWidth="400">
@@ -26,7 +27,7 @@
<ListView Name="list" Grid.Row="1" SelectionMode="None"> <ListView Name="list" Grid.Row="1" SelectionMode="None">
<ListView.ItemTemplate> <ListView.ItemTemplate>
<DataTemplate> <DataTemplate x:DataType="controls:ChatMessage">
<Border BorderBrush="Red" BorderThickness="{Binding Path=BorderThickness}" CornerRadius="5" HorizontalAlignment="Stretch" Background="{Binding Path=Background}" Margin="0,2"> <Border BorderBrush="Red" BorderThickness="{Binding Path=BorderThickness}" CornerRadius="5" HorizontalAlignment="Stretch" Background="{Binding Path=Background}" Margin="0,2">
<Grid Margin="0,5,5,0"> <Grid Margin="0,5,5,0">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
@@ -62,7 +63,12 @@
</FontIcon> </FontIcon>
</StackPanel> </StackPanel>
<StackPanel Orientation="Horizontal" Grid.Column="1" VerticalAlignment="Top" Margin="0,0,5,0"> <StackPanel Orientation="Horizontal" Grid.Column="1" VerticalAlignment="Top" Margin="0,0,5,0">
<HyperlinkButton Content="{Binding Path=Author}" Tag="{Binding Path=ChannelId}" Grid.Column="1" Margin="0,-6,0,0" FontWeight="Bold" Click="HyperlinkButton_Click"/> <HyperlinkButton Tag="{Binding Path=ChannelId}" Margin="0,-6,0,0" FontWeight="Bold" Click="HyperlinkButton_Click">
<ToolTipService.ToolTip>
<TextBlock Text="{Binding Path=Author}" Style="{StaticResource CaptionTextBlockStyle}"/>
</ToolTipService.ToolTip>
<TextBlock TextTrimming="CharacterEllipsis" MaxWidth="150" Text="{Binding Path=Author}"/>
</HyperlinkButton>
<TextBlock Text=":"/> <TextBlock Text=":"/>
</StackPanel> </StackPanel>
<GroupItem Content="{Binding Path=Message}" Grid.Column="2"/> <GroupItem Content="{Binding Path=Message}" Grid.Column="2"/>
+137 -1
View File
@@ -9,6 +9,9 @@ using Microsoft.AppCenter.Analytics;
using System.Collections.Generic; using System.Collections.Generic;
using Windows.UI.Popups; using Windows.UI.Popups;
using Windows.ApplicationModel.Resources; using Windows.ApplicationModel.Resources;
using Microsoft.Advertising.WinRT.UI;
using Windows.UI.Xaml.Media.Imaging;
using System.Linq;
namespace FoxTube.Controls namespace FoxTube.Controls
{ {
@@ -68,17 +71,24 @@ namespace FoxTube.Controls
public sealed partial class Chat : UserControl public sealed partial class Chat : UserControl
{ {
NativeAdsManagerV2 manager = new NativeAdsManagerV2(SecretsVault.AppId, SecretsVault.AdUnitId);
public NativeAdV2 advert;
string chatId; string chatId;
DateTime lastInsert; DateTime lastInsert;
LiveChatMessagesResource.ListRequest request; LiveChatMessagesResource.ListRequest request;
LiveChatMessageListResponse response; LiveChatMessageListResponse response;
DispatcherTimer timer = new DispatcherTimer() DispatcherTimer timer = new DispatcherTimer
{ {
Interval = TimeSpan.FromSeconds(1) Interval = TimeSpan.FromSeconds(1)
}; };
DispatcherTimer adTimer = new DispatcherTimer
{
Interval = TimeSpan.FromMinutes(5)
};
public Chat(string id) public Chat(string id)
{ {
InitializeComponent(); InitializeComponent();
@@ -90,6 +100,132 @@ namespace FoxTube.Controls
timer.Tick += Update; timer.Tick += Update;
timer.Start(); timer.Start();
if (SecretsVault.AdsDisabled)
return;
adTimer.Tick += (s, e) => manager.RequestAd();
adTimer.Start();
manager.AdReady += AdReady;
manager.ErrorOccurred += ErrorOccurred;
}
private void ErrorOccurred(object sender, NativeAdErrorEventArgs e)
{
System.Diagnostics.Debug.WriteLine("Error has occured while loading ad");
}
private void AdReady(object sender, NativeAdReadyEventArgs e)
{
advert = e.NativeAd;
Grid grid = new Grid
{
Margin = new Thickness(0, 5, 5, 5),
};
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Auto) });
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Auto) });
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });
StackPanel iconStack = new StackPanel
{
Orientation = Orientation.Horizontal,
VerticalAlignment = VerticalAlignment.Top,
Margin = new Thickness(5, 0, 5, 0)
};
iconStack.Children.Add(new PersonPicture
{
Height = 20,
ProfilePicture = advert.AdIcon == null ? null : advert.AdIcon.Source
});
FontIcon sponsor = new FontIcon
{
Glyph = "\xE735",
Margin = new Thickness(2, 0, 2, 0)
};
ToolTipService.SetToolTip(sponsor, ResourceLoader.GetForCurrentView("Chat").GetString("/Chat/sponsor/Text"));
iconStack.Children.Add(sponsor);
StackPanel nameStack = new StackPanel
{
Orientation = Orientation.Horizontal,
VerticalAlignment = VerticalAlignment.Top,
Margin = new Thickness(0, 0, 2, 0)
};
Grid.SetColumn(nameStack, 1);
HyperlinkButton sponsorName = new HyperlinkButton
{
Margin = new Thickness(0, -6, 0, 0),
FontWeight = Windows.UI.Text.FontWeights.Bold,
Content = new TextBlock
{
TextTrimming = TextTrimming.CharacterEllipsis,
MaxWidth = 150,
Text = Methods.GuardFromNull(advert.SponsoredBy)
}
};
ToolTipService.SetToolTip(sponsorName, Methods.GuardFromNull(advert.SponsoredBy));
nameStack.Children.Add(sponsorName);
nameStack.Children.Add(new TextBlock { Text = ":" });
StackPanel contentStack = new StackPanel
{
Padding = new Thickness(2, 0, 0, 0)
};
Grid.SetColumn(contentStack, 2);
contentStack.Children.Add(new TextBlock
{
VerticalAlignment = VerticalAlignment.Top,
TextWrapping = TextWrapping.WrapWholeWords,
FontWeight = Windows.UI.Text.FontWeights.Bold,
Text = advert.Title
});
if(!string.IsNullOrWhiteSpace(advert.Description))
contentStack.Children.Add(new TextBlock
{
VerticalAlignment = VerticalAlignment.Top,
TextWrapping = TextWrapping.WrapWholeWords,
Text = advert.Description
});
if (!string.IsNullOrWhiteSpace(advert.CallToActionText))
contentStack.Children.Add(new HyperlinkButton
{
VerticalAlignment = VerticalAlignment.Top,
Content = new TextBlock
{
TextWrapping = TextWrapping.WrapWholeWords,
Text = advert.CallToActionText
}
});
grid.Children.Add(iconStack);
grid.Children.Add(nameStack);
grid.Children.Add(contentStack);
ListViewItem item = new ListViewItem
{
Content = new Border
{
BorderBrush = new SolidColorBrush(Colors.Red),
BorderThickness = new Thickness(2),
CornerRadius = new CornerRadius(5),
HorizontalAlignment = HorizontalAlignment.Stretch,
Margin = new Thickness(0, 2, 0, 2),
Background = new SolidColorBrush(Colors.Red) { Opacity = .2 },
Child = grid
},
Padding = new Thickness(0,25,0,0)
};
list.Items.Insert(0, item);
if (contentStack.Children.Last() is HyperlinkButton)
advert.RegisterAdContainer(item, new List<FrameworkElement> { contentStack.Children.Last() as HyperlinkButton });
else
advert.RegisterAdContainer(item);
} }
public async void Update(object sender, object e) public async void Update(object sender, object e)
+12 -4
View File
@@ -258,21 +258,29 @@ namespace FoxTube.Controls
} }
cts.Cancel(); cts.Cancel();
DownloadAgent.Remove(this);
status.Text = resources.GetString("/Downloads/cancelling"); status.Text = resources.GetString("/Downloads/cancelling");
progressBar.IsIndeterminate = true; progressBar.IsIndeterminate = true;
} }
void SetMeta() void SetMeta()
{ {
thumbnail.Source = new BitmapImage(Container.Thumbnail) { DecodePixelHeight = (int)thumbnail.ActualHeight, DecodePixelWidth = (int)thumbnail.ActualWidth }; try
{
thumbnail.Source = new BitmapImage(Container.Thumbnail) { DecodePixelHeight = (int)thumbnail.ActualHeight, DecodePixelWidth = (int)thumbnail.ActualWidth };
title.Text = Container.Title; title.Text = Container.Title;
path.Text = File.Path; path.Text = File.Path;
meta.Text = $@"{resources.GetString("/Downloads/ext")}: {Container.Extension} meta.Text = $@"{resources.GetString("/Downloads/ext")}: {Container.Extension}
{resources.GetString("/Downloads/quality")}: {Container.Quality} {resources.GetString("/Downloads/quality")}: {Container.Quality}
{resources.GetString("/Downloads/duration")}: {Container.Duration} {resources.GetString("/Downloads/duration")}: {Container.Duration}
{resources.GetString("/Downloads/author")}: {Container.Channel}"; {resources.GetString("/Downloads/author")}: {Container.Channel}";
}
catch
{
DownloadAgent.Remove(this);
}
} }
private void Cancel_Click(object sender, RoutedEventArgs e) private void Cancel_Click(object sender, RoutedEventArgs e)
+14 -1
View File
@@ -1,4 +1,5 @@
using FoxTube.Controls; using FoxTube.Controls;
using FoxTube.Controls.Adverts;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
@@ -24,10 +25,12 @@ namespace FoxTube
public event RoutedEventHandler LiveRequested; public event RoutedEventHandler LiveRequested;
public event MinimodeChangedEventHandler MiniModeChanged; public event MinimodeChangedEventHandler MiniModeChanged;
public event RoutedEventHandler NextRequested; public event RoutedEventHandler NextRequested;
public event Event MuteClicked;
public event QualityChangedEventHandler QualityChanged; public event QualityChangedEventHandler QualityChanged;
public MediaElement Player; public MediaElement Player;
public PlayerAdvert Advert;
public IReadOnlyList<ClosedCaptionTrackInfo> ClosedCaptions { get; set; } public IReadOnlyList<ClosedCaptionTrackInfo> ClosedCaptions { get; set; }
public MediaStreamInfoSet MediaStreams { get; set; } public MediaStreamInfoSet MediaStreams { get; set; }
@@ -44,6 +47,8 @@ namespace FoxTube
{ {
isReady = true; isReady = true;
Advert = GetTemplateChild("ad") as PlayerAdvert;
(GetTemplateChild("close") as Button).Click += Close_Click; (GetTemplateChild("close") as Button).Click += Close_Click;
(GetTemplateChild("compactClose") as Button).Click += Close_Click; (GetTemplateChild("compactClose") as Button).Click += Close_Click;
@@ -103,6 +108,8 @@ namespace FoxTube
Volume_ValueChanged(this, null); Volume_ValueChanged(this, null);
else else
((GetTemplateChild("AudioMuteButton") as Button).Content as FontIcon).Glyph = ((GetTemplateChild("volume") as Button).Content as FontIcon).Glyph = "\xE74F"; ((GetTemplateChild("AudioMuteButton") as Button).Content as FontIcon).Glyph = ((GetTemplateChild("volume") as Button).Content as FontIcon).Glyph = "\xE74F";
MuteClicked?.Invoke();
} }
private void Volume_ValueChanged(object sender, RangeBaseValueChangedEventArgs e) private void Volume_ValueChanged(object sender, RangeBaseValueChangedEventArgs e)
@@ -139,7 +146,7 @@ namespace FoxTube
private void QualitySelector_SelectionChanged(object sender, SelectionChangedEventArgs e) private void QualitySelector_SelectionChanged(object sender, SelectionChangedEventArgs e)
{ {
SettingsStorage.RememberedQuality = e.AddedItems[0] as string; SettingsStorage.RememberedQuality = e.AddedItems[0] as string;
MediaStreamInfo item = MediaStreams.Muxed.Find(i => i.VideoQualityLabel == e.AddedItems[0] as string); MediaStreamInfo item = MediaStreams.Muxed.Find(i => i.VideoQualityLabel.Contains(e.AddedItems[0] as string));
if (item == null) if (item == null)
item = MediaStreams.Video.Find(i => i.VideoQualityLabel == e.AddedItems[0] as string); item = MediaStreams.Video.Find(i => i.VideoQualityLabel == e.AddedItems[0] as string);
@@ -200,6 +207,8 @@ namespace FoxTube
(GetTemplateChild("dragholder") as Button).Visibility = Visibility.Visible; (GetTemplateChild("dragholder") as Button).Visibility = Visibility.Visible;
(GetTemplateChild("captions") as LiveCaptions).Size = 15; (GetTemplateChild("captions") as LiveCaptions).Size = 15;
(GetTemplateChild("root") as Grid).RowDefinitions[1].Height = new GridLength(0);
} }
public void SetMinimized() public void SetMinimized()
@@ -225,6 +234,8 @@ namespace FoxTube
(GetTemplateChild("maximize") as Button).Visibility = Visibility.Visible; (GetTemplateChild("maximize") as Button).Visibility = Visibility.Visible;
(GetTemplateChild("captions") as LiveCaptions).Size = 15; (GetTemplateChild("captions") as LiveCaptions).Size = 15;
(GetTemplateChild("root") as Grid).RowDefinitions[1].Height = new GridLength(0);
} }
public void SetNormal() public void SetNormal()
@@ -249,6 +260,8 @@ namespace FoxTube
(GetTemplateChild("captions") as LiveCaptions).Size = 24; (GetTemplateChild("captions") as LiveCaptions).Size = 24;
(GetTemplateChild("dragholder") as Button).Visibility = Visibility.Collapsed; (GetTemplateChild("dragholder") as Button).Visibility = Visibility.Collapsed;
(GetTemplateChild("root") as Grid).RowDefinitions[1].Height = new GridLength(1, GridUnitType.Auto);
} }
public void SetMeta(string title, string channel) public void SetMeta(string title, string channel)
+1 -3
View File
@@ -4,8 +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:controls1="using:FoxTube.Controls"
xmlns:Windows10version1809="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 7)"
xmlns:foxtube="using:FoxTube" xmlns:foxtube="using:FoxTube"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="1080" d:DesignHeight="1080"
@@ -13,7 +11,7 @@
RequestedTheme="Dark"> RequestedTheme="Dark">
<Grid Background="White" Name="grid"> <Grid Background="White" Name="grid">
<MediaElement Name="videoSource" AreTransportControlsEnabled="True" PosterSource="ms-appx:///Assets/videoThumbSample.png" CurrentStateChanged="VideoSource_CurrentStateChanged" MediaOpened="VideoSource_MediaOpened" VolumeChanged="VideoSource_VolumeChanged"> <MediaElement Name="videoSource" MarkerReached="VideoSource_MarkerReached" AreTransportControlsEnabled="True" PosterSource="ms-appx:///Assets/videoThumbSample.png" CurrentStateChanged="VideoSource_CurrentStateChanged" MediaOpened="VideoSource_MediaOpened" VolumeChanged="VideoSource_VolumeChanged">
<MediaElement.TransportControls> <MediaElement.TransportControls>
<foxtube:PlayerControls IsCompactOverlayButtonVisible="True" IsCompactOverlayEnabled="True" <foxtube:PlayerControls IsCompactOverlayButtonVisible="True" IsCompactOverlayEnabled="True"
IsFullWindowButtonVisible="True" IsFullWindowEnabled="True" IsFullWindowButtonVisible="True" IsFullWindowEnabled="True"
+15 -1
View File
@@ -44,11 +44,13 @@ namespace FoxTube
avatar = channelAvatar; avatar = channelAvatar;
videoSource.PosterSource = new BitmapImage((meta.Snippet.Thumbnails.Maxres ?? meta.Snippet.Thumbnails.Medium).Url.ToUri()); videoSource.PosterSource = new BitmapImage((meta.Snippet.Thumbnails.Maxres ?? meta.Snippet.Thumbnails.Medium).Url.ToUri());
Controls.SetMeta(meta.Snippet.Title, meta.Snippet.ChannelTitle); Controls.SetMeta(meta.Snippet.Localized.Title, meta.Snippet.ChannelTitle);
if (item.Snippet.LiveBroadcastContent == "none") if (item.Snippet.LiveBroadcastContent == "none")
{ {
InitializeContols(); InitializeContols();
if (Methods.GetDuration(item.ContentDetails.Duration).TotalMinutes > 5)
videoSource.Markers.Add(new Windows.UI.Xaml.Media.TimelineMarker { Time = Methods.GetDuration(item.ContentDetails.Duration) - TimeSpan.FromMinutes(1) });
Controls.SetQualities(await new YoutubeClient().GetVideoMediaStreamInfosAsync(item.Id)); Controls.SetQualities(await new YoutubeClient().GetVideoMediaStreamInfosAsync(item.Id));
Controls.SetCaptions(await new YoutubeClient().GetVideoClosedCaptionTrackInfosAsync(item.Id)); Controls.SetCaptions(await new YoutubeClient().GetVideoClosedCaptionTrackInfosAsync(item.Id));
} }
@@ -89,6 +91,7 @@ namespace FoxTube
Controls.NextRequested += (s, e) => NextClicked?.Invoke(); Controls.NextRequested += (s, e) => NextClicked?.Invoke();
Controls.QualityChanged += Controls_QualityChanged; Controls.QualityChanged += Controls_QualityChanged;
Controls.MiniModeChanged += Controls_MiniModeChanged; Controls.MiniModeChanged += Controls_MiniModeChanged;
Controls.MuteClicked += Controls_MuteClicked;
Controls.Player = videoSource; Controls.Player = videoSource;
#region System Media Transport Controls #region System Media Transport Controls
@@ -108,6 +111,12 @@ namespace FoxTube
#endregion #endregion
} }
private void Controls_MuteClicked()
{
if (audioSource != null)
audioSource.IsMuted = videoSource.IsMuted;
}
public void Controls_MiniModeChanged(object sender, bool e) public void Controls_MiniModeChanged(object sender, bool e)
{ {
videoSource.IsFullWindow = false; videoSource.IsFullWindow = false;
@@ -230,5 +239,10 @@ namespace FoxTube
audioSource.Volume = videoSource.Volume; audioSource.Volume = videoSource.Volume;
SettingsStorage.Volume = videoSource.Volume; SettingsStorage.Volume = videoSource.Volume;
} }
private void VideoSource_MarkerReached(object sender, Windows.UI.Xaml.Media.TimelineMarkerRoutedEventArgs e)
{
Controls.Advert.PushAdvert();
}
} }
} }
+18 -10
View File
@@ -10,11 +10,23 @@
VerticalAlignment="Top" VerticalAlignment="Top"
d:DesignHeight="290" d:DesignHeight="290"
d:DesignWidth="384" d:DesignWidth="384"
Opacity="0"> Opacity="0"
Name="card">
<Windows10version1809:Page.OpacityTransition> <UserControl.Resources>
<ScalarTransition Duration="0:0:0.5"/> <Storyboard x:Name="show">
</Windows10version1809:Page.OpacityTransition> <DoubleAnimation Storyboard.TargetName="card" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
<Storyboard x:Name="hide">
<DoubleAnimation Storyboard.TargetName="card" Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
<Storyboard x:Name="showThumb">
<DoubleAnimation Storyboard.TargetName="thumbnail" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
<Storyboard x:Name="hideThumb">
<DoubleAnimation Storyboard.TargetName="thumbnail" Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
</UserControl.Resources>
<Button Padding="0" Margin="1" Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}" Click="Button_Click"> <Button Padding="0" Margin="1" Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}" Click="Button_Click">
<Grid> <Grid>
@@ -25,12 +37,8 @@
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Image Source="/Assets/videoPlaceholder.png" Opacity=".0001" Stretch="Fill"/> <Image Source="/Assets/videoPlaceholder.png" Opacity=".0001" Stretch="Fill"/>
<Image Name="thumbnail" Source="/Assets/videoThumbSample.png" Stretch="Fill" Opacity="0" ImageOpened="Thumbnail_ImageOpened"> <Image Name="thumbnail" Source="/Assets/videoThumbSample.png" Stretch="Fill" Opacity="0" ImageOpened="Thumbnail_ImageOpened"/>
<Windows10version1809:Image.OpacityTransition>
<ScalarTransition Duration="0:0:0.5"/>
</Windows10version1809:Image.OpacityTransition>
</Image>
<Grid HorizontalAlignment="Right" Width="100"> <Grid HorizontalAlignment="Right" Width="100">
<Grid.Background> <Grid.Background>
<AcrylicBrush TintColor="#7F000000" BackgroundSource="Backdrop" AlwaysUseFallback="False" TintOpacity="1" Opacity="0.97"/> <AcrylicBrush TintColor="#7F000000" BackgroundSource="Backdrop" AlwaysUseFallback="False" TintOpacity="1" Opacity="0.97"/>
+4 -3
View File
@@ -34,9 +34,10 @@ namespace FoxTube.Controls
playlistId = id; playlistId = id;
PlaylistsResource.ListRequest request = SecretsVault.Service.Playlists.List("snippet,contentDetails"); PlaylistsResource.ListRequest request = SecretsVault.Service.Playlists.List("snippet,contentDetails");
request.Id = playlistId; request.Id = playlistId;
request.Hl = SettingsStorage.RelevanceLanguage;
item = (await request.ExecuteAsync()).Items[0]; item = (await request.ExecuteAsync()).Items[0];
title.Text = item.Snippet.Title; title.Text = item.Snippet.Localized.Title;
channelName.Text = item.Snippet.ChannelTitle; channelName.Text = item.Snippet.ChannelTitle;
counter.Text = item.ContentDetails.ItemCount.ToString(); counter.Text = item.ContentDetails.ItemCount.ToString();
date.Text = Methods.GetAgo(item.Snippet.PublishedAt.Value); date.Text = Methods.GetAgo(item.Snippet.PublishedAt.Value);
@@ -49,7 +50,7 @@ namespace FoxTube.Controls
try { avatar.ProfilePicture = new BitmapImage(new Uri((await r.ExecuteAsync()).Items[0].Snippet.Thumbnails.Medium.Url)) { DecodePixelWidth = 46, DecodePixelHeight = 46 }; } try { avatar.ProfilePicture = new BitmapImage(new Uri((await r.ExecuteAsync()).Items[0].Snippet.Thumbnails.Medium.Url)) { DecodePixelWidth = 46, DecodePixelHeight = 46 }; }
catch { } catch { }
Opacity = 1; show.Begin();
} }
catch (Exception e) catch (Exception e)
{ {
@@ -87,7 +88,7 @@ namespace FoxTube.Controls
private void Thumbnail_ImageOpened(object sender, RoutedEventArgs e) private void Thumbnail_ImageOpened(object sender, RoutedEventArgs e)
{ {
thumbnail.Opacity = 1; showThumb.Begin();
} }
} }
} }
+27 -14
View File
@@ -4,17 +4,28 @@
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"
d:DesignHeight="290" d:DesignHeight="290"
d:DesignWidth="384" d:DesignWidth="384"
Opacity="0"> Opacity="0"
Name="card">
<Windows10version1809:UserControl.OpacityTransition> <UserControl.Resources>
<ScalarTransition Duration="0:0:0.5"/> <Storyboard x:Name="show">
</Windows10version1809:UserControl.OpacityTransition> <DoubleAnimation Storyboard.TargetName="card" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
<Storyboard x:Name="hide">
<DoubleAnimation Storyboard.TargetName="card" Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
<Storyboard x:Name="showThumb">
<DoubleAnimation Storyboard.TargetName="thumbnail" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
<Storyboard x:Name="hideThumb">
<DoubleAnimation Storyboard.TargetName="thumbnail" Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
</UserControl.Resources>
<Button Padding="0" Margin="1" Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}" Click="Button_Click"> <Button Padding="0" Margin="1" Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}" Click="Button_Click">
<Grid> <Grid>
@@ -25,12 +36,8 @@
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Image Source="/Assets/videoPlaceholder.png" Opacity=".0001" Stretch="Fill"/> <Image Source="/Assets/videoPlaceholder.png" Opacity=".0001" Stretch="Fill"/>
<Image Name="thumbnail" Source="/Assets/videoThumbSample.png" Stretch="Fill" ImageOpened="Thumbnail_ImageOpened" Opacity="0"> <Image Name="thumbnail" Source="/Assets/videoThumbSample.png" Stretch="Fill" ImageOpened="Thumbnail_ImageOpened" Opacity="0"/>
<Windows10version1809:Image.OpacityTransition>
<ScalarTransition Duration="0:0:0.5"/>
</Windows10version1809:Image.OpacityTransition>
</Image>
<Grid Background="#7F000000" Name="watched" Visibility="Collapsed"> <Grid Background="#7F000000" Name="watched" Visibility="Collapsed">
<StackPanel Margin="5" Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}" VerticalAlignment="Top" HorizontalAlignment="Left" Padding="5,2,5,2" BorderBrush="Gray" BorderThickness="1"> <StackPanel Margin="5" Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}" VerticalAlignment="Top" HorizontalAlignment="Left" Padding="5,2,5,2" BorderBrush="Gray" BorderThickness="1">
<TextBlock x:Uid="/Cards/watched" Text="Watched" Foreground="Gray" FontSize="12"/> <TextBlock x:Uid="/Cards/watched" Text="Watched" Foreground="Gray" FontSize="12"/>
@@ -74,9 +81,15 @@
<MenuFlyoutSeparator/> <MenuFlyoutSeparator/>
<MenuFlyoutItem x:Uid="/Cards/getLink" Icon="Link" Text="Copy link" Name="getLink" Click="GetLink_Click"/> <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/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"/> <MenuFlyoutItem x:Uid="/Cards/share" Icon="Share" Text="Share" Name="share" Click="share_Click"/>
<MenuFlyoutSeparator Visibility="Collapsed"/> <MenuFlyoutSeparator/>
<MenuFlyoutItem Icon="Download" Text="Download" Visibility="Collapsed"/> <MenuFlyoutSubItem x:Uid="/Cards/downloads" Icon="Download" Text="Download" Name="download"/>
<MenuFlyoutSubItem x:Uid="/Cards/addTo" Icon="Add" Text="Add to" Name="addTo">
<MenuFlyoutItem x:Uid="/VideoPage/newPlaylist" Text="New playlist" Name="newPlaylist" Click="NewPlaylist_Click" Icon="Add"/>
<ToggleMenuFlyoutItem x:Uid="/VideoPage/wl" Text="Watch later" Name="wl" Click="Wl_Click" Icon="Clock"/>
<MenuFlyoutSeparator/>
</MenuFlyoutSubItem>
<MenuFlyoutItem x:Uid="/Cards/delete" Text="Remove from playlist" Icon="Delete" Visibility="Collapsed" Name="delete" Click="Delete_Click"/>
</MenuFlyout> </MenuFlyout>
</UserControl.ContextFlyout> </UserControl.ContextFlyout>
</UserControl> </UserControl>
+267 -6
View File
@@ -11,6 +11,9 @@ using Microsoft.AppCenter.Analytics;
using System.Collections.Generic; using System.Collections.Generic;
using YoutubeExplode; using YoutubeExplode;
using Windows.UI.Popups; using Windows.UI.Popups;
using YoutubeExplode.Models.MediaStreams;
using Windows.Foundation;
using FoxTube.Pages;
namespace FoxTube.Controls namespace FoxTube.Controls
{ {
@@ -46,14 +49,24 @@ namespace FoxTube.Controls
videoId = id; videoId = id;
playlistId = playlist; playlistId = playlist;
delete.Visibility = string.IsNullOrWhiteSpace(playlistId) ? Visibility.Collapsed : Visibility.Visible;
VideosResource.ListRequest request = SecretsVault.Service.Videos.List("snippet,contentDetails,statistics,liveStreamingDetails"); VideosResource.ListRequest request = SecretsVault.Service.Videos.List("snippet,contentDetails,statistics,liveStreamingDetails");
request.Id = id; request.Id = id;
request.Hl = SettingsStorage.RelevanceLanguage;
item = (await request.ExecuteAsync()).Items[0]; item = (await request.ExecuteAsync()).Items[0];
title.Text = item.Snippet.Title; title.Text = item.Snippet.Localized.Title;
channelName.Text = item.Snippet.ChannelTitle; channelName.Text = item.Snippet.ChannelTitle;
if (item.Snippet.LiveBroadcastContent == "live") if (item.Snippet.Title == "Deleted video")
{
ContextFlyout = null;
show.Begin();
return;
}
if (item.Snippet.LiveBroadcastContent == "live")
{ {
views.Text = $"{item.LiveStreamingDetails.ConcurrentViewers:0,0} {resources.GetString("/Cards/viewers")}"; views.Text = $"{item.LiveStreamingDetails.ConcurrentViewers:0,0} {resources.GetString("/Cards/viewers")}";
if (item.LiveStreamingDetails.ScheduledStartTime.HasValue && item.LiveStreamingDetails.ScheduledEndTime.HasValue) if (item.LiveStreamingDetails.ScheduledStartTime.HasValue && item.LiveStreamingDetails.ScheduledEndTime.HasValue)
@@ -61,6 +74,7 @@ namespace FoxTube.Controls
else else
info.Text = Methods.GetAgo(item.LiveStreamingDetails.ActualStartTime.Value); info.Text = Methods.GetAgo(item.LiveStreamingDetails.ActualStartTime.Value);
liveTag.Visibility = Visibility.Visible; liveTag.Visibility = Visibility.Visible;
download.Visibility = Visibility.Collapsed;
} }
else if (item.Snippet.LiveBroadcastContent == "upcoming") else if (item.Snippet.LiveBroadcastContent == "upcoming")
{ {
@@ -74,12 +88,15 @@ namespace FoxTube.Controls
if (item.LiveStreamingDetails.ScheduledStartTime.HasValue) if (item.LiveStreamingDetails.ScheduledStartTime.HasValue)
liveContent.Text = resources.GetString("/Cards/goesLive") + (item.LiveStreamingDetails.ScheduledStartTime.Value > DateTime.Now ? " " : " -") + (item.LiveStreamingDetails.ScheduledStartTime.Value - DateTime.Now).ToString(@"hh\:mm\:ss"); liveContent.Text = resources.GetString("/Cards/goesLive") + (item.LiveStreamingDetails.ScheduledStartTime.Value > DateTime.Now ? " " : " -") + (item.LiveStreamingDetails.ScheduledStartTime.Value - DateTime.Now).ToString(@"hh\:mm\:ss");
else liveContent.Text = resources.GetString("/Cards/upcoming"); else liveContent.Text = resources.GetString("/Cards/upcoming");
download.Visibility = Visibility.Collapsed;
} }
else else
{ {
views.Text = $"{item.Statistics.ViewCount:0,0} {resources.GetString("/Cards/views")}"; views.Text = $"{item.Statistics.ViewCount:0,0} {resources.GetString("/Cards/views")}";
info.Text = $"{item.ContentDetails.Duration.GetDuration()} | {Methods.GetAgo(item.Snippet.PublishedAt.Value)}"; info.Text = $"{item.ContentDetails.Duration.GetDuration()} | {Methods.GetAgo(item.Snippet.PublishedAt.Value)}";
LoadDownloads();
} }
LoadAddTo();
try { thumbnail.Source = new BitmapImage(item.Snippet.Thumbnails.Medium.Url.ToUri()); } try { thumbnail.Source = new BitmapImage(item.Snippet.Thumbnails.Medium.Url.ToUri()); }
catch { } catch { }
@@ -89,7 +106,7 @@ namespace FoxTube.Controls
if(SecretsVault.History.Contains(videoId)) if(SecretsVault.History.Contains(videoId))
watched.Visibility = Visibility.Visible; watched.Visibility = Visibility.Visible;
Opacity = 1; show.Begin();
} }
catch (Exception e) catch (Exception e)
{ {
@@ -103,6 +120,41 @@ namespace FoxTube.Controls
} }
} }
async void LoadDownloads()
{
try
{
MediaStreamInfoSet infoSet = await new YoutubeClient().GetVideoMediaStreamInfosAsync(videoId);
foreach (MuxedStreamInfo i in infoSet.Muxed)
{
MenuFlyoutItem menuItem = new MenuFlyoutItem()
{
Text = i.VideoQualityLabel,
Tag = new object[] { i, i.VideoQualityLabel }
};
menuItem.Click += downloadItemSelected;
download.Items.Add(menuItem);
}
MenuFlyoutItem audioItem = new MenuFlyoutItem()
{
Text = resources.GetString("/VideoPage/audio"),
Tag = new object[] { infoSet.Audio[0], resources.GetString("/Cards/audioOnly") }
};
audioItem.Click += downloadItemSelected;
download.Items.Add(audioItem);
}
catch
{
download.Visibility = Visibility.Collapsed;
}
}
private void downloadItemSelected(object sender, RoutedEventArgs e)
{
DownloadAgent.Add(((sender as MenuFlyoutItem).Tag as object[])[0] as MediaStreamInfo, item, ((sender as MenuFlyoutItem).Tag as object[])[1] as string);
}
public async void LoadMeta() public async void LoadMeta()
{ {
videoId = item.Id; videoId = item.Id;
@@ -145,7 +197,7 @@ namespace FoxTube.Controls
if (SecretsVault.History.Contains(videoId)) if (SecretsVault.History.Contains(videoId))
watched.Visibility = Visibility.Visible; watched.Visibility = Visibility.Visible;
Opacity = 1; show.Begin();
} }
public async void Button_Click(object sender, RoutedEventArgs e) public async void Button_Click(object sender, RoutedEventArgs e)
@@ -185,6 +237,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);
@@ -204,7 +271,201 @@ namespace FoxTube.Controls
private void Thumbnail_ImageOpened(object sender, RoutedEventArgs e) private void Thumbnail_ImageOpened(object sender, RoutedEventArgs e)
{ {
thumbnail.Opacity = 1; showThumb.Begin();
}
private async void NewPlaylist_Click(object sender, RoutedEventArgs e)
{
StackPanel stack = new StackPanel();
stack.Children.Add(new TextBox
{
PlaceholderText = resources.GetString("/VideoPage/newPlaylistName/PlaceholderText")
});
ComboBox comboBox = new ComboBox
{
Header = resources.GetString("/VideoPage/privacy/Header"),
SelectedIndex = 0,
HorizontalAlignment = HorizontalAlignment.Stretch
};
comboBox.Items.Add(new ComboBoxItem { Content = resources.GetString("/VideoPage/public/Content") });
comboBox.Items.Add(new ComboBoxItem { Content = resources.GetString("/VideoPage/private/Content") });
comboBox.Items.Add(new ComboBoxItem { Content = resources.GetString("/VideoPage/direct/Content") });
stack.Children.Add(comboBox);
ContentDialog playlistDialog = new ContentDialog
{
PrimaryButtonText = resources.GetString("/VideoPage/dialog/PrimaryButtonText"),
CloseButtonText = resources.GetString("/VideoPage/dialog/CloseButtonText"),
DefaultButton = ContentDialogButton.Primary,
Title = resources.GetString("/VideoPage/dialog/Title"),
Content = stack
};
playlistDialog.PrimaryButtonClick += PlaylistDialog_PrimaryButtonClick;
await playlistDialog.ShowAsync();
}
private async void PlaylistDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
{
string privacy = "private";
switch (((sender.Content as StackPanel).Children[1] as ComboBox).SelectedIndex)
{
case 0:
privacy = "public";
break;
case 1:
privacy = "private";
break;
case 2:
privacy = "unlisted";
break;
}
Playlist newItem = new Playlist
{
Snippet = new PlaylistSnippet
{
Title = ((sender.Content as StackPanel).Children[0] as TextBox).Text
},
Status = new PlaylistStatus
{
PrivacyStatus = privacy,
}
};
Playlist i;
try { i = await SecretsVault.Service.Playlists.Insert(newItem, "snippet,status").ExecuteAsync(); }
catch
{
return;
}
ToggleMenuFlyoutItem menuItem = new ToggleMenuFlyoutItem
{
Text = i.Snippet.Title,
IsChecked = true,
Tag = i,
Icon = new FontIcon
{
Glyph = "\xE728"
}
};
menuItem.Click += Item_Click;
addTo.Items.Add(menuItem);
Item_Click(menuItem, null);
}
private void Wl_Click(object sender, RoutedEventArgs e)
{
}
async void LoadAddTo()
{
if (SecretsVault.UserChannel == null)
{
addTo.Visibility = Visibility.Collapsed;
return;
}
if (SecretsVault.WatchLater.Contains(item.Id))
(addTo.Items[1] as ToggleMenuFlyoutItem).IsChecked = true;
PlaylistsResource.ListRequest request = SecretsVault.Service.Playlists.List("snippet");
request.Mine = true;
request.MaxResults = 50;
PlaylistListResponse response = await request.ExecuteAsync();
PlaylistItemsResource.ListRequest itemRequest = SecretsVault.Service.PlaylistItems.List("snippet");
itemRequest.VideoId = item.Id;
foreach (Playlist i in response.Items)
{
itemRequest.PlaylistId = i.Id;
ToggleMenuFlyoutItem menuItem = new ToggleMenuFlyoutItem
{
Text = i.Snippet.Title,
IsChecked = (await itemRequest.ExecuteAsync()).Items.Count > 0,
Tag = i,
Icon = new FontIcon
{
Glyph = "\xE728"
}
};
menuItem.Click += Item_Click;
addTo.Items.Add(menuItem);
}
}
private async void Item_Click(object sender, RoutedEventArgs e)
{
if (((ToggleMenuFlyoutItem)sender).IsChecked)
{
try
{
PlaylistItem playlist = new PlaylistItem
{
Snippet = new PlaylistItemSnippet
{
PlaylistId = (((ToggleMenuFlyoutItem)sender).Tag as Playlist).Id,
ResourceId = new ResourceId
{
VideoId = item.Id,
Kind = "youtube#video"
}
}
};
PlaylistItemsResource.InsertRequest request = SecretsVault.Service.PlaylistItems.Insert(playlist, "snippet");
await request.ExecuteAsync();
}
catch
{
((ToggleMenuFlyoutItem)sender).IsChecked = false;
}
}
else
{
try
{
PlaylistItemsResource.ListRequest itemRequest = SecretsVault.Service.PlaylistItems.List("snippet");
itemRequest.VideoId = item.Id;
itemRequest.PlaylistId = ((Playlist)((ToggleMenuFlyoutItem)sender).Tag).Id;
PlaylistItemsResource.DeleteRequest request = SecretsVault.Service.PlaylistItems.Delete((await itemRequest.ExecuteAsync()).Items[0].Id);
await request.ExecuteAsync();
}
catch
{
((ToggleMenuFlyoutItem)sender).IsChecked = true;
}
}
}
private async void Delete_Click(object sender, RoutedEventArgs e)
{
try
{
PlaylistItemsResource.ListRequest request = SecretsVault.Service.PlaylistItems.List("snippet");
request.PlaylistId = playlistId;
request.VideoId = item.Id;
PlaylistItemListResponse response = await request.ExecuteAsync();
PlaylistItem playlistItem = response.Items.Find(i => i.Snippet.PlaylistId == playlistId);
await SecretsVault.Service.PlaylistItems.Delete(playlistItem.Id).ExecuteAsync();
(Methods.MainPage.PageContent as PlaylistPage).DeleteItem(this);
}
catch
{
}
} }
} }
} }
+22 -10
View File
@@ -11,7 +11,7 @@
<AssemblyName>FoxTube</AssemblyName> <AssemblyName>FoxTube</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage> <DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier> <TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.17763.0</TargetPlatformVersion> <TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.17134.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17134.0</TargetPlatformMinVersion> <TargetPlatformMinVersion>10.0.17134.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion> <MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
@@ -113,6 +113,12 @@
<Compile Include="Controls\Adverts\CardAdvert.xaml.cs"> <Compile Include="Controls\Adverts\CardAdvert.xaml.cs">
<DependentUpon>CardAdvert.xaml</DependentUpon> <DependentUpon>CardAdvert.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Controls\Adverts\CommentAdvert.xaml.cs">
<DependentUpon>CommentAdvert.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\Adverts\PlayerAdvert.xaml.cs">
<DependentUpon>PlayerAdvert.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\ChannelCard.xaml.cs"> <Compile Include="Controls\ChannelCard.xaml.cs">
<DependentUpon>ChannelCard.xaml</DependentUpon> <DependentUpon>ChannelCard.xaml</DependentUpon>
</Compile> </Compile>
@@ -282,6 +288,14 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="Controls\Adverts\CommentAdvert.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\Adverts\PlayerAdvert.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\ChannelCard.xaml"> <Page Include="Controls\ChannelCard.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
@@ -390,11 +404,12 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
<Page Include="Themes\Resources.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="AdaptiveCards.Rendering.Uwp">
<Version>1.1.2</Version>
</PackageReference>
<PackageReference Include="Google.Apis"> <PackageReference Include="Google.Apis">
<Version>1.30.0-beta02</Version> <Version>1.30.0-beta02</Version>
</PackageReference> </PackageReference>
@@ -414,7 +429,7 @@
<Version>10.1811.22001</Version> <Version>10.1811.22001</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.AppCenter.Analytics"> <PackageReference Include="Microsoft.AppCenter.Analytics">
<Version>1.13.2</Version> <Version>1.14.0</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform"> <PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.2.8</Version> <Version>6.2.8</Version>
@@ -429,16 +444,13 @@
<Version>5.1.1</Version> <Version>5.1.1</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.UI.Xaml"> <PackageReference Include="Microsoft.UI.Xaml">
<Version>2.0.181018004</Version> <Version>2.0.181011001</Version>
</PackageReference> </PackageReference>
<PackageReference Include="runtime.win10-arm64.runtime.native.System.IO.Compression"> <PackageReference Include="runtime.win10-arm64.runtime.native.System.IO.Compression">
<Version>4.3.2</Version> <Version>4.3.2</Version>
</PackageReference> </PackageReference>
<PackageReference Include="YoutubeExplode"> <PackageReference Include="YoutubeExplode">
<Version>4.6.7</Version> <Version>4.6.8</Version>
</PackageReference>
<PackageReference Include="YoutubeExtractor">
<Version>0.10.11</Version>
</PackageReference> </PackageReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
+371
View File
@@ -0,0 +1,371 @@
<?xml version="1.0" encoding="utf-8"?>
<StoreAssociation xmlns="http://schemas.microsoft.com/appx/2010/storeassociation">
<Publisher>CN=FD7A34DD-FE4D-4D7D-9D33-2DA9EBBE7725</Publisher>
<PublisherDisplayName>Michael "XFox" Gordeev</PublisherDisplayName>
<DeveloperAccountType>MSA</DeveloperAccountType>
<GeneratePackageHash>http://www.w3.org/2001/04/xmlenc#sha256</GeneratePackageHash>
<SupportedLocales>
<Language Code="af" InMinimumRequirementSet="true" />
<Language Code="af-za" InMinimumRequirementSet="true" />
<Language Code="am" InMinimumRequirementSet="true" />
<Language Code="am-et" InMinimumRequirementSet="true" />
<Language Code="ar" InMinimumRequirementSet="true" />
<Language Code="ar-ae" InMinimumRequirementSet="true" />
<Language Code="ar-bh" InMinimumRequirementSet="true" />
<Language Code="ar-dz" InMinimumRequirementSet="true" />
<Language Code="ar-eg" InMinimumRequirementSet="true" />
<Language Code="ar-iq" InMinimumRequirementSet="true" />
<Language Code="ar-jo" InMinimumRequirementSet="true" />
<Language Code="ar-kw" InMinimumRequirementSet="true" />
<Language Code="ar-lb" InMinimumRequirementSet="true" />
<Language Code="ar-ly" InMinimumRequirementSet="true" />
<Language Code="ar-ma" InMinimumRequirementSet="true" />
<Language Code="ar-om" InMinimumRequirementSet="true" />
<Language Code="ar-qa" InMinimumRequirementSet="true" />
<Language Code="ar-sa" InMinimumRequirementSet="true" />
<Language Code="ar-sy" InMinimumRequirementSet="true" />
<Language Code="ar-tn" InMinimumRequirementSet="true" />
<Language Code="ar-ye" InMinimumRequirementSet="true" />
<Language Code="as" InMinimumRequirementSet="true" />
<Language Code="as-in" InMinimumRequirementSet="true" />
<Language Code="az" InMinimumRequirementSet="true" />
<Language Code="az-arab" InMinimumRequirementSet="true" />
<Language Code="az-arab-az" InMinimumRequirementSet="true" />
<Language Code="az-cyrl" InMinimumRequirementSet="true" />
<Language Code="az-cyrl-az" InMinimumRequirementSet="true" />
<Language Code="az-latn" InMinimumRequirementSet="true" />
<Language Code="az-latn-az" InMinimumRequirementSet="true" />
<Language Code="be" InMinimumRequirementSet="true" />
<Language Code="be-by" InMinimumRequirementSet="true" />
<Language Code="bg" InMinimumRequirementSet="true" />
<Language Code="bg-bg" InMinimumRequirementSet="true" />
<Language Code="bn" InMinimumRequirementSet="true" />
<Language Code="bn-bd" InMinimumRequirementSet="true" />
<Language Code="bn-in" InMinimumRequirementSet="true" />
<Language Code="bs" InMinimumRequirementSet="true" />
<Language Code="bs-cyrl" InMinimumRequirementSet="true" />
<Language Code="bs-cyrl-ba" InMinimumRequirementSet="true" />
<Language Code="bs-latn" InMinimumRequirementSet="true" />
<Language Code="bs-latn-ba" InMinimumRequirementSet="true" />
<Language Code="ca" InMinimumRequirementSet="true" />
<Language Code="ca-es" InMinimumRequirementSet="true" />
<Language Code="ca-es-valencia" InMinimumRequirementSet="true" />
<Language Code="chr-cher" InMinimumRequirementSet="true" />
<Language Code="chr-cher-us" InMinimumRequirementSet="true" />
<Language Code="chr-latn" InMinimumRequirementSet="true" />
<Language Code="cs" InMinimumRequirementSet="true" />
<Language Code="cs-cz" InMinimumRequirementSet="true" />
<Language Code="cy" InMinimumRequirementSet="true" />
<Language Code="cy-gb" InMinimumRequirementSet="true" />
<Language Code="da" InMinimumRequirementSet="true" />
<Language Code="da-dk" InMinimumRequirementSet="true" />
<Language Code="de" InMinimumRequirementSet="true" />
<Language Code="de-at" InMinimumRequirementSet="true" />
<Language Code="de-ch" InMinimumRequirementSet="true" />
<Language Code="de-de" InMinimumRequirementSet="true" />
<Language Code="de-li" InMinimumRequirementSet="true" />
<Language Code="de-lu" InMinimumRequirementSet="true" />
<Language Code="el" InMinimumRequirementSet="true" />
<Language Code="el-gr" InMinimumRequirementSet="true" />
<Language Code="en" InMinimumRequirementSet="true" />
<Language Code="en-011" InMinimumRequirementSet="true" />
<Language Code="en-014" InMinimumRequirementSet="true" />
<Language Code="en-018" InMinimumRequirementSet="true" />
<Language Code="en-021" InMinimumRequirementSet="true" />
<Language Code="en-029" InMinimumRequirementSet="true" />
<Language Code="en-053" InMinimumRequirementSet="true" />
<Language Code="en-au" InMinimumRequirementSet="true" />
<Language Code="en-bz" InMinimumRequirementSet="true" />
<Language Code="en-ca" InMinimumRequirementSet="true" />
<Language Code="en-gb" InMinimumRequirementSet="true" />
<Language Code="en-hk" InMinimumRequirementSet="true" />
<Language Code="en-id" InMinimumRequirementSet="true" />
<Language Code="en-ie" InMinimumRequirementSet="true" />
<Language Code="en-in" InMinimumRequirementSet="true" />
<Language Code="en-jm" InMinimumRequirementSet="true" />
<Language Code="en-kz" InMinimumRequirementSet="true" />
<Language Code="en-mt" InMinimumRequirementSet="true" />
<Language Code="en-my" InMinimumRequirementSet="true" />
<Language Code="en-nz" InMinimumRequirementSet="true" />
<Language Code="en-ph" InMinimumRequirementSet="true" />
<Language Code="en-pk" InMinimumRequirementSet="true" />
<Language Code="en-sg" InMinimumRequirementSet="true" />
<Language Code="en-tt" InMinimumRequirementSet="true" />
<Language Code="en-us" InMinimumRequirementSet="true" />
<Language Code="en-vn" InMinimumRequirementSet="true" />
<Language Code="en-za" InMinimumRequirementSet="true" />
<Language Code="en-zw" InMinimumRequirementSet="true" />
<Language Code="es" InMinimumRequirementSet="true" />
<Language Code="es-019" InMinimumRequirementSet="true" />
<Language Code="es-419" InMinimumRequirementSet="true" />
<Language Code="es-ar" InMinimumRequirementSet="true" />
<Language Code="es-bo" InMinimumRequirementSet="true" />
<Language Code="es-cl" InMinimumRequirementSet="true" />
<Language Code="es-co" InMinimumRequirementSet="true" />
<Language Code="es-cr" InMinimumRequirementSet="true" />
<Language Code="es-do" InMinimumRequirementSet="true" />
<Language Code="es-ec" InMinimumRequirementSet="true" />
<Language Code="es-es" InMinimumRequirementSet="true" />
<Language Code="es-gt" InMinimumRequirementSet="true" />
<Language Code="es-hn" InMinimumRequirementSet="true" />
<Language Code="es-mx" InMinimumRequirementSet="true" />
<Language Code="es-ni" InMinimumRequirementSet="true" />
<Language Code="es-pa" InMinimumRequirementSet="true" />
<Language Code="es-pe" InMinimumRequirementSet="true" />
<Language Code="es-pr" InMinimumRequirementSet="true" />
<Language Code="es-py" InMinimumRequirementSet="true" />
<Language Code="es-sv" InMinimumRequirementSet="true" />
<Language Code="es-us" InMinimumRequirementSet="true" />
<Language Code="es-uy" InMinimumRequirementSet="true" />
<Language Code="es-ve" InMinimumRequirementSet="true" />
<Language Code="et" InMinimumRequirementSet="true" />
<Language Code="et-ee" InMinimumRequirementSet="true" />
<Language Code="eu" InMinimumRequirementSet="true" />
<Language Code="eu-es" InMinimumRequirementSet="true" />
<Language Code="fa" InMinimumRequirementSet="true" />
<Language Code="fa-ir" InMinimumRequirementSet="true" />
<Language Code="fi" InMinimumRequirementSet="true" />
<Language Code="fi-fi" InMinimumRequirementSet="true" />
<Language Code="fil" InMinimumRequirementSet="true" />
<Language Code="fil-latn" InMinimumRequirementSet="true" />
<Language Code="fil-ph" InMinimumRequirementSet="true" />
<Language Code="fr" InMinimumRequirementSet="true" />
<Language Code="fr-011" InMinimumRequirementSet="true" />
<Language Code="fr-015" InMinimumRequirementSet="true" />
<Language Code="fr-021" InMinimumRequirementSet="true" />
<Language Code="fr-029" InMinimumRequirementSet="true" />
<Language Code="fr-155" InMinimumRequirementSet="true" />
<Language Code="fr-be" InMinimumRequirementSet="true" />
<Language Code="fr-ca" InMinimumRequirementSet="true" />
<Language Code="fr-cd" InMinimumRequirementSet="true" />
<Language Code="fr-ch" InMinimumRequirementSet="true" />
<Language Code="fr-ci" InMinimumRequirementSet="true" />
<Language Code="fr-cm" InMinimumRequirementSet="true" />
<Language Code="fr-fr" InMinimumRequirementSet="true" />
<Language Code="fr-ht" InMinimumRequirementSet="true" />
<Language Code="fr-lu" InMinimumRequirementSet="true" />
<Language Code="fr-ma" InMinimumRequirementSet="true" />
<Language Code="fr-mc" InMinimumRequirementSet="true" />
<Language Code="fr-ml" InMinimumRequirementSet="true" />
<Language Code="fr-re" InMinimumRequirementSet="true" />
<Language Code="frc-latn" InMinimumRequirementSet="true" />
<Language Code="frp-latn" InMinimumRequirementSet="true" />
<Language Code="ga" InMinimumRequirementSet="true" />
<Language Code="ga-ie" InMinimumRequirementSet="true" />
<Language Code="gd-gb" InMinimumRequirementSet="true" />
<Language Code="gd-latn" InMinimumRequirementSet="true" />
<Language Code="gl" InMinimumRequirementSet="true" />
<Language Code="gl-es" InMinimumRequirementSet="true" />
<Language Code="gu" InMinimumRequirementSet="true" />
<Language Code="gu-in" InMinimumRequirementSet="true" />
<Language Code="ha" InMinimumRequirementSet="true" />
<Language Code="ha-latn" InMinimumRequirementSet="true" />
<Language Code="ha-latn-ng" InMinimumRequirementSet="true" />
<Language Code="he" InMinimumRequirementSet="true" />
<Language Code="he-il" InMinimumRequirementSet="true" />
<Language Code="hi" InMinimumRequirementSet="true" />
<Language Code="hi-in" InMinimumRequirementSet="true" />
<Language Code="hr" InMinimumRequirementSet="true" />
<Language Code="hr-ba" InMinimumRequirementSet="true" />
<Language Code="hr-hr" InMinimumRequirementSet="true" />
<Language Code="hu" InMinimumRequirementSet="true" />
<Language Code="hu-hu" InMinimumRequirementSet="true" />
<Language Code="hy" InMinimumRequirementSet="true" />
<Language Code="hy-am" InMinimumRequirementSet="true" />
<Language Code="id" InMinimumRequirementSet="true" />
<Language Code="id-id" InMinimumRequirementSet="true" />
<Language Code="ig-latn" InMinimumRequirementSet="true" />
<Language Code="ig-ng" InMinimumRequirementSet="true" />
<Language Code="is" InMinimumRequirementSet="true" />
<Language Code="is-is" InMinimumRequirementSet="true" />
<Language Code="it" InMinimumRequirementSet="true" />
<Language Code="it-ch" InMinimumRequirementSet="true" />
<Language Code="it-it" InMinimumRequirementSet="true" />
<Language Code="iu-cans" InMinimumRequirementSet="true" />
<Language Code="iu-latn" InMinimumRequirementSet="true" />
<Language Code="iu-latn-ca" InMinimumRequirementSet="true" />
<Language Code="ja" InMinimumRequirementSet="true" />
<Language Code="ja-jp" InMinimumRequirementSet="true" />
<Language Code="ka" InMinimumRequirementSet="true" />
<Language Code="ka-ge" InMinimumRequirementSet="true" />
<Language Code="kk" InMinimumRequirementSet="true" />
<Language Code="kk-kz" InMinimumRequirementSet="true" />
<Language Code="km" InMinimumRequirementSet="true" />
<Language Code="km-kh" InMinimumRequirementSet="true" />
<Language Code="kn" InMinimumRequirementSet="true" />
<Language Code="kn-in" InMinimumRequirementSet="true" />
<Language Code="ko" InMinimumRequirementSet="true" />
<Language Code="ko-kr" InMinimumRequirementSet="true" />
<Language Code="kok" InMinimumRequirementSet="true" />
<Language Code="kok-in" InMinimumRequirementSet="true" />
<Language Code="ku-arab" InMinimumRequirementSet="true" />
<Language Code="ku-arab-iq" InMinimumRequirementSet="true" />
<Language Code="ky-cyrl" InMinimumRequirementSet="true" />
<Language Code="ky-kg" InMinimumRequirementSet="true" />
<Language Code="lb" InMinimumRequirementSet="true" />
<Language Code="lb-lu" InMinimumRequirementSet="true" />
<Language Code="lo" InMinimumRequirementSet="true" />
<Language Code="lo-la" InMinimumRequirementSet="true" />
<Language Code="lt" InMinimumRequirementSet="true" />
<Language Code="lt-lt" InMinimumRequirementSet="true" />
<Language Code="lv" InMinimumRequirementSet="true" />
<Language Code="lv-lv" InMinimumRequirementSet="true" />
<Language Code="mi" InMinimumRequirementSet="true" />
<Language Code="mi-latn" InMinimumRequirementSet="true" />
<Language Code="mi-nz" InMinimumRequirementSet="true" />
<Language Code="mk" InMinimumRequirementSet="true" />
<Language Code="mk-mk" InMinimumRequirementSet="true" />
<Language Code="ml" InMinimumRequirementSet="true" />
<Language Code="ml-in" InMinimumRequirementSet="true" />
<Language Code="mn-cyrl" InMinimumRequirementSet="true" />
<Language Code="mn-mn" InMinimumRequirementSet="true" />
<Language Code="mn-mong" InMinimumRequirementSet="true" />
<Language Code="mn-phag" InMinimumRequirementSet="true" />
<Language Code="mr" InMinimumRequirementSet="true" />
<Language Code="mr-in" InMinimumRequirementSet="true" />
<Language Code="ms" InMinimumRequirementSet="true" />
<Language Code="ms-bn" InMinimumRequirementSet="true" />
<Language Code="ms-my" InMinimumRequirementSet="true" />
<Language Code="mt" InMinimumRequirementSet="true" />
<Language Code="mt-mt" InMinimumRequirementSet="true" />
<Language Code="nb" InMinimumRequirementSet="true" />
<Language Code="nb-no" InMinimumRequirementSet="true" />
<Language Code="ne" InMinimumRequirementSet="true" />
<Language Code="ne-np" InMinimumRequirementSet="true" />
<Language Code="nl" InMinimumRequirementSet="true" />
<Language Code="nl-be" InMinimumRequirementSet="true" />
<Language Code="nl-nl" InMinimumRequirementSet="true" />
<Language Code="nn" InMinimumRequirementSet="true" />
<Language Code="nn-no" InMinimumRequirementSet="true" />
<Language Code="no" InMinimumRequirementSet="true" />
<Language Code="no-no" InMinimumRequirementSet="true" />
<Language Code="nso" InMinimumRequirementSet="true" />
<Language Code="nso-za" InMinimumRequirementSet="true" />
<Language Code="or" InMinimumRequirementSet="true" />
<Language Code="or-in" InMinimumRequirementSet="true" />
<Language Code="pa" InMinimumRequirementSet="true" />
<Language Code="pa-arab" InMinimumRequirementSet="true" />
<Language Code="pa-arab-pk" InMinimumRequirementSet="true" />
<Language Code="pa-deva" InMinimumRequirementSet="true" />
<Language Code="pa-in" InMinimumRequirementSet="true" />
<Language Code="pl" InMinimumRequirementSet="true" />
<Language Code="pl-pl" InMinimumRequirementSet="true" />
<Language Code="prs" InMinimumRequirementSet="true" />
<Language Code="prs-af" InMinimumRequirementSet="true" />
<Language Code="prs-arab" InMinimumRequirementSet="true" />
<Language Code="pt" InMinimumRequirementSet="true" />
<Language Code="pt-br" InMinimumRequirementSet="true" />
<Language Code="pt-pt" InMinimumRequirementSet="true" />
<Language Code="quc-latn" InMinimumRequirementSet="true" />
<Language Code="qut-gt" InMinimumRequirementSet="true" />
<Language Code="qut-latn" InMinimumRequirementSet="true" />
<Language Code="quz" InMinimumRequirementSet="true" />
<Language Code="quz-bo" InMinimumRequirementSet="true" />
<Language Code="quz-ec" InMinimumRequirementSet="true" />
<Language Code="quz-pe" InMinimumRequirementSet="true" />
<Language Code="ro" InMinimumRequirementSet="true" />
<Language Code="ro-ro" InMinimumRequirementSet="true" />
<Language Code="ru" InMinimumRequirementSet="true" />
<Language Code="ru-ru" InMinimumRequirementSet="true" />
<Language Code="rw" InMinimumRequirementSet="true" />
<Language Code="rw-rw" InMinimumRequirementSet="true" />
<Language Code="sd-arab" InMinimumRequirementSet="true" />
<Language Code="sd-arab-pk" InMinimumRequirementSet="true" />
<Language Code="sd-deva" InMinimumRequirementSet="true" />
<Language Code="si" InMinimumRequirementSet="true" />
<Language Code="si-lk" InMinimumRequirementSet="true" />
<Language Code="sk" InMinimumRequirementSet="true" />
<Language Code="sk-sk" InMinimumRequirementSet="true" />
<Language Code="sl" InMinimumRequirementSet="true" />
<Language Code="sl-si" InMinimumRequirementSet="true" />
<Language Code="sq" InMinimumRequirementSet="true" />
<Language Code="sq-al" InMinimumRequirementSet="true" />
<Language Code="sr" InMinimumRequirementSet="true" />
<Language Code="sr-cyrl" InMinimumRequirementSet="true" />
<Language Code="sr-cyrl-ba" InMinimumRequirementSet="true" />
<Language Code="sr-cyrl-cs" InMinimumRequirementSet="true" />
<Language Code="sr-cyrl-me" InMinimumRequirementSet="true" />
<Language Code="sr-cyrl-rs" InMinimumRequirementSet="true" />
<Language Code="sr-latn" InMinimumRequirementSet="true" />
<Language Code="sr-latn-ba" InMinimumRequirementSet="true" />
<Language Code="sr-latn-cs" InMinimumRequirementSet="true" />
<Language Code="sr-latn-me" InMinimumRequirementSet="true" />
<Language Code="sr-latn-rs" InMinimumRequirementSet="true" />
<Language Code="sv" InMinimumRequirementSet="true" />
<Language Code="sv-fi" InMinimumRequirementSet="true" />
<Language Code="sv-se" InMinimumRequirementSet="true" />
<Language Code="sw" InMinimumRequirementSet="true" />
<Language Code="sw-ke" InMinimumRequirementSet="true" />
<Language Code="ta" InMinimumRequirementSet="true" />
<Language Code="ta-in" InMinimumRequirementSet="true" />
<Language Code="te" InMinimumRequirementSet="true" />
<Language Code="te-in" InMinimumRequirementSet="true" />
<Language Code="tg-arab" InMinimumRequirementSet="true" />
<Language Code="tg-cyrl" InMinimumRequirementSet="true" />
<Language Code="tg-cyrl-tj" InMinimumRequirementSet="true" />
<Language Code="tg-latn" InMinimumRequirementSet="true" />
<Language Code="th" InMinimumRequirementSet="true" />
<Language Code="th-th" InMinimumRequirementSet="true" />
<Language Code="ti" InMinimumRequirementSet="true" />
<Language Code="ti-et" InMinimumRequirementSet="true" />
<Language Code="tk-cyrl" InMinimumRequirementSet="true" />
<Language Code="tk-cyrl-tr" InMinimumRequirementSet="true" />
<Language Code="tk-latn" InMinimumRequirementSet="true" />
<Language Code="tk-latn-tr" InMinimumRequirementSet="true" />
<Language Code="tk-tm" InMinimumRequirementSet="true" />
<Language Code="tn" InMinimumRequirementSet="true" />
<Language Code="tn-bw" InMinimumRequirementSet="true" />
<Language Code="tn-za" InMinimumRequirementSet="true" />
<Language Code="tr" InMinimumRequirementSet="true" />
<Language Code="tr-tr" InMinimumRequirementSet="true" />
<Language Code="tt-arab" InMinimumRequirementSet="true" />
<Language Code="tt-cyrl" InMinimumRequirementSet="true" />
<Language Code="tt-latn" InMinimumRequirementSet="true" />
<Language Code="tt-ru" InMinimumRequirementSet="true" />
<Language Code="ug-arab" InMinimumRequirementSet="true" />
<Language Code="ug-cn" InMinimumRequirementSet="true" />
<Language Code="ug-cyrl" InMinimumRequirementSet="true" />
<Language Code="ug-latn" InMinimumRequirementSet="true" />
<Language Code="uk" InMinimumRequirementSet="true" />
<Language Code="uk-ua" InMinimumRequirementSet="true" />
<Language Code="ur" InMinimumRequirementSet="true" />
<Language Code="ur-pk" InMinimumRequirementSet="true" />
<Language Code="uz" InMinimumRequirementSet="true" />
<Language Code="uz-cyrl" InMinimumRequirementSet="true" />
<Language Code="uz-latn" InMinimumRequirementSet="true" />
<Language Code="uz-latn-uz" InMinimumRequirementSet="true" />
<Language Code="vi" InMinimumRequirementSet="true" />
<Language Code="vi-vn" InMinimumRequirementSet="true" />
<Language Code="wo" InMinimumRequirementSet="true" />
<Language Code="wo-sn" InMinimumRequirementSet="true" />
<Language Code="xh" InMinimumRequirementSet="true" />
<Language Code="xh-za" InMinimumRequirementSet="true" />
<Language Code="yo-latn" InMinimumRequirementSet="true" />
<Language Code="yo-ng" InMinimumRequirementSet="true" />
<Language Code="zh" InMinimumRequirementSet="true" />
<Language Code="zh-cn" InMinimumRequirementSet="true" />
<Language Code="zh-hans" InMinimumRequirementSet="true" />
<Language Code="zh-hans-cn" InMinimumRequirementSet="true" />
<Language Code="zh-hans-sg" InMinimumRequirementSet="true" />
<Language Code="zh-hant" InMinimumRequirementSet="true" />
<Language Code="zh-hant-hk" InMinimumRequirementSet="true" />
<Language Code="zh-hant-mo" InMinimumRequirementSet="true" />
<Language Code="zh-hant-tw" InMinimumRequirementSet="true" />
<Language Code="zh-hk" InMinimumRequirementSet="true" />
<Language Code="zh-mo" InMinimumRequirementSet="true" />
<Language Code="zh-sg" InMinimumRequirementSet="true" />
<Language Code="zh-tw" InMinimumRequirementSet="true" />
<Language Code="zu" InMinimumRequirementSet="true" />
<Language Code="zu-za" InMinimumRequirementSet="true" />
</SupportedLocales>
<ProductReservedInfo>
<MainPackageIdentityName>53949MichaelXFoxGordeev.FoxTube</MainPackageIdentityName>
<ReservedNames>
<ReservedName>FoxTube</ReservedName>
<ReservedName>FoxTube - A modern YouTube client</ReservedName>
<ReservedName>FoxTube Beta</ReservedName>
</ReservedNames>
</ProductReservedInfo>
<AccountPackageIdentityNames />
<PackageInfoList LandingUrl="https://developer.microsoft.com/dashboard/Application?appId=9NCQQXJTDLFH" />
</StoreAssociation>
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3" IgnorableNamespaces="uap mp uap3"> <Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3" IgnorableNamespaces="uap mp uap3">
<Identity Name="53949MichaelXFoxGordeev.FoxTube" Publisher="CN=FD7A34DD-FE4D-4D7D-9D33-2DA9EBBE7725" Version="0.4.7.0" /> <Identity Name="53949MichaelXFoxGordeev.FoxTube" Publisher="CN=FD7A34DD-FE4D-4D7D-9D33-2DA9EBBE7725" Version="0.4.8.0" />
<mp:PhoneIdentity PhoneProductId="04fd81c1-6473-4174-afd7-4ac71dd85721" PhonePublisherId="00000000-0000-0000-0000-000000000000" /> <mp:PhoneIdentity PhoneProductId="04fd81c1-6473-4174-afd7-4ac71dd85721" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties> <Properties>
<DisplayName>FoxTube</DisplayName> <DisplayName>FoxTube</DisplayName>
+17 -10
View File
@@ -8,9 +8,23 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pages="using:FoxTube.Pages" xmlns:pages="using:FoxTube.Pages"
xmlns:controls="using:FoxTube.Controls" xmlns:controls="using:FoxTube.Controls"
xmlns:Windows10version1809="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 7)"
mc:Ignorable="d"> mc:Ignorable="d">
<Page.Resources>
<Storyboard x:Name="showHeader">
<DoubleAnimation Storyboard.TargetName="ColapsedHeader" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
<Storyboard x:Name="hideHeader">
<DoubleAnimation Storyboard.TargetName="ColapsedHeader" Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
<Storyboard x:Name="showThumb">
<DoubleAnimation Storyboard.TargetName="channelCover" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
<Storyboard x:Name="hideThumb">
<DoubleAnimation Storyboard.TargetName="channelCover" Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="{StaticResource CardOpacityDuration}"/>
</Storyboard>
</Page.Resources>
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" SizeChanged="Grid_SizeChanged"> <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" SizeChanged="Grid_SizeChanged">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition/> <RowDefinition/>
@@ -22,11 +36,7 @@
<Grid> <Grid>
<ParallaxView Source="{x:Bind videoScroll}" VerticalShift="100"> <ParallaxView Source="{x:Bind videoScroll}" VerticalShift="100">
<Grid> <Grid>
<Image Source="/Assets/ChannelCoverTemplate.png" Name="channelCover" Stretch="Uniform" HorizontalAlignment="Left" VerticalAlignment="Top" Opacity="0" ImageOpened="ChannelCover_ImageOpened"> <Image Source="/Assets/ChannelCoverTemplate.png" Name="channelCover" Stretch="Uniform" HorizontalAlignment="Left" VerticalAlignment="Top" Opacity="0" ImageOpened="ChannelCover_ImageOpened"/>
<Windows10version1809:Image.OpacityTransition>
<ScalarTransition Duration="0:0:0.5"/>
</Windows10version1809:Image.OpacityTransition>
</Image>
</Grid> </Grid>
</ParallaxView> </ParallaxView>
<ScrollViewer ViewChanged="ScrollViewer_ViewChanged" Name="videoScroll"> <ScrollViewer ViewChanged="ScrollViewer_ViewChanged" Name="videoScroll">
@@ -78,14 +88,11 @@
<Pivot.RightHeader> <Pivot.RightHeader>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<StackPanel Orientation="Horizontal" Name="ColapsedHeader" Opacity="0"> <StackPanel Orientation="Horizontal" Name="ColapsedHeader" Opacity="0">
<Windows10version1809:StackPanel.OpacityTransition>
<ScalarTransition/>
</Windows10version1809:StackPanel.OpacityTransition>
<PersonPicture Height="32" Name="collapsedAvatar"/> <PersonPicture Height="32" Name="collapsedAvatar"/>
<TextBlock Text="Channel name" VerticalAlignment="Center" Margin="10,0" Name="collapsedTitle"/> <TextBlock Text="Channel name" VerticalAlignment="Center" Margin="10,0" Name="collapsedTitle"/>
<Button x:Uid="/Cards/subscribe" Background="Red" Foreground="White" FontWeight="SemiBold" Content="Subscribe" Width="150" Name="collapsedBtn" Click="Subscribe_Click" Padding="2"/> <Button x:Uid="/Cards/subscribe" Background="Red" Foreground="White" FontWeight="SemiBold" Content="Subscribe" Width="150" Name="collapsedBtn" Click="Subscribe_Click" Padding="2"/>
</StackPanel> </StackPanel>
<AutoSuggestBox x:Uid="/Channel/search" VerticalAlignment="Center" Width="250" Margin="8" PlaceholderText="Search on channel" QueryIcon="Find" Name="search" QuerySubmitted="AutoSuggestBox_QuerySubmitted"/> <AutoSuggestBox FontSize="14" x:Uid="/Channel/search" VerticalAlignment="Center" Width="250" Margin="8" PlaceholderText="Search on channel" QueryIcon="Find" Name="search" QuerySubmitted="AutoSuggestBox_QuerySubmitted"/>
</StackPanel> </StackPanel>
</Pivot.RightHeader> </Pivot.RightHeader>
</Pivot> </Pivot>
+11 -5
View File
@@ -74,7 +74,7 @@ namespace FoxTube.Pages
videosCount.Text = $"{item.Statistics.VideoCount:0,0} {resources.GetString("/Cards/videos")}"; videosCount.Text = $"{item.Statistics.VideoCount:0,0} {resources.GetString("/Cards/videos")}";
if (!item.BrandingSettings.Image.BannerImageUrl.Contains("default")) if (!item.BrandingSettings.Image.BannerImageUrl.Contains("default"))
try { channelCover.Source = new BitmapImage(item.BrandingSettings.Image.BannerImageUrl.ToUri()); } try { channelCover.Source = new BitmapImage(item.BrandingSettings.Image.BannerTabletExtraHdImageUrl == null ? item.BrandingSettings.Image.BannerImageUrl.ToUri() : item.BrandingSettings.Image.BannerTabletHdImageUrl.ToUri()); }
catch { } catch { }
try { avatar.ProfilePicture = collapsedAvatar.ProfilePicture = new BitmapImage(item.Snippet.Thumbnails.Medium.Url.ToUri()) { DecodePixelHeight = 100, DecodePixelWidth = 100 }; } try { avatar.ProfilePicture = collapsedAvatar.ProfilePicture = new BitmapImage(item.Snippet.Thumbnails.Medium.Url.ToUri()) { DecodePixelHeight = 100, DecodePixelWidth = 100 }; }
@@ -175,7 +175,7 @@ namespace FoxTube.Pages
if (content.SelectedIndex == 0) if (content.SelectedIndex == 0)
ScrollViewer_ViewChanged(this, null); ScrollViewer_ViewChanged(this, null);
else else
ColapsedHeader.Opacity = 1; showHeader.Begin();
} }
private async void ShowMorePlaylists_Click() private async void ShowMorePlaylists_Click()
@@ -259,9 +259,15 @@ namespace FoxTube.Pages
Rect view = new Rect(0.0, 0.0, videoScroll.ActualWidth, videoScroll.ActualHeight); Rect view = new Rect(0.0, 0.0, videoScroll.ActualWidth, videoScroll.ActualHeight);
if (view.Contains(new Point(panel.Left, panel.Bottom))) if (view.Contains(new Point(panel.Left, panel.Bottom)))
ColapsedHeader.Opacity = 0; {
if (ColapsedHeader.Opacity == 1)
hideHeader.Begin();
}
else else
ColapsedHeader.Opacity = 1; {
if (ColapsedHeader.Opacity == 0)
showHeader.Begin();
}
} }
private void Refresh_Click(object sender, RoutedEventArgs e) private void Refresh_Click(object sender, RoutedEventArgs e)
@@ -281,7 +287,7 @@ namespace FoxTube.Pages
private void ChannelCover_ImageOpened(object sender, RoutedEventArgs e) private void ChannelCover_ImageOpened(object sender, RoutedEventArgs e)
{ {
channelCover.Opacity = 1; showThumb.Begin();
infoStack.Margin = new Thickness(0, channelCover.ActualHeight, 0, 0); infoStack.Margin = new Thickness(0, channelCover.ActualHeight, 0, 0);
} }
+8
View File
@@ -51,7 +51,11 @@ namespace FoxTube.Pages
more.Visibility = Visibility.Collapsed; more.Visibility = Visibility.Collapsed;
foreach (CommentThread comment in response.Items) foreach (CommentThread comment in response.Items)
{
if ((placeholder.Children.Count - 5) % 20 == 0 && !SecretsVault.AdsDisabled)
placeholder.Children.Add(new Controls.Adverts.CommentAdvert());
placeholder.Children.Add(new CommentCard(comment)); placeholder.Children.Add(new CommentCard(comment));
}
} }
public void RemoveComment(CommentCard commentCard, string topCommentId = null) public void RemoveComment(CommentCard commentCard, string topCommentId = null)
@@ -156,7 +160,11 @@ namespace FoxTube.Pages
var response = await request.ExecuteAsync(); var response = await request.ExecuteAsync();
foreach (CommentThread comment in response.Items) foreach (CommentThread comment in response.Items)
{
if ((placeholder.Children.Count - 5) % 20 == 0 && !SecretsVault.AdsDisabled)
placeholder.Children.Add(new Controls.Adverts.CommentAdvert());
placeholder.Children.Add(new CommentCard(comment)); placeholder.Children.Add(new CommentCard(comment));
}
token = response.NextPageToken; token = response.NextPageToken;
more.Complete(); more.Complete();
+94 -56
View File
@@ -4,14 +4,10 @@
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"
xmlns:Windows10version1803="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 6)" xmlns:ui="using:Microsoft.UI.Xaml.Controls">
mc:Ignorable="d">
<Grid Name="grid" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <Grid Name="grid" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Windows10version1809:Grid.BackgroundTransition>
<BrushTransition/>
</Windows10version1809:Grid.BackgroundTransition>
<VisualStateManager.VisualStateGroups> <VisualStateManager.VisualStateGroups>
<VisualStateGroup> <VisualStateGroup>
<VisualState> <VisualState>
@@ -25,26 +21,68 @@
</VisualStateGroup> </VisualStateGroup>
</VisualStateManager.VisualStateGroups> </VisualStateManager.VisualStateGroups>
<Border x:Name="AppTitleBar" <Border x:Name="AppTitleBar"
IsHitTestVisible="True" IsHitTestVisible="True"
VerticalAlignment="Top" VerticalAlignment="Top"
Background="Transparent" Background="Transparent"
Canvas.ZIndex="1"> Canvas.ZIndex="1">
<TextBlock x:Name="AppTitle" <TextBlock x:Name="AppTitle"
Text="FoxTube" Text="FoxTube"
VerticalAlignment="Center" VerticalAlignment="Center"
Margin="12, 8, 0, 0" Margin="12, 8, 0, 0"
Style="{StaticResource CaptionTextBlockStyle}" /> Style="{StaticResource CaptionTextBlockStyle}" />
</Border> </Border>
<NavigationView SelectedItem="toHome" Windows10version1803:BackRequested="Nav_BackRequested" Windows10version1803:PaneClosing="Nav_PaneClosing" Windows10version1803:PaneOpened="Nav_PaneOpened" OpenPaneLength="300" Name="nav" SelectionChanged="Nav_SelectionChanged"> <ui:NavigationView FontSize="14" SelectedItem="toHome" BackRequested="Nav_BackRequested" PaneClosing="Nav_PaneClosing" PaneOpened="Nav_PaneOpened" OpenPaneLength="300" Name="nav" SelectionChanged="Nav_SelectionChanged">
<NavigationView.Header> <ui:NavigationView.Header>
<TextBlock Name="Title" Margin="0,30,0,10" Style="{StaticResource TitleTextBlockStyle}"/> <Grid>
</NavigationView.Header> <TextBlock Name="Title" Style="{StaticResource TitleTextBlockStyle}"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button x:Uid="/Main/feedback" Name="feedback" Click="Feedback_Click" Visibility="Collapsed" FontFamily="Segoe MDL2 Assets" Content="&#xED15;" Background="Transparent" Height="41" Width="60" FontSize="15"/>
<Button x:Uid="/Main/signIn" Name="account" Click="SignIn_Click" Visibility="Collapsed" FontFamily="Segoe MDL2 Assets" Content="&#xE8FA;" Background="Transparent" Height="41" Width="60" FontSize="15"/>
<Button Background="Transparent" Visibility="Collapsed" Name="avatar" Height="41" Width="60" FontSize="15" Padding="0">
<Button.Flyout>
<Flyout>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<PersonPicture Width="65" Name="avatarFlyout" VerticalAlignment="Top"/>
<StackPanel Grid.Column="1" Margin="5">
<TextBlock Name="myNameFlyout"/>
<TextBlock Style="{StaticResource CaptionTextBlockStyle}" Name="myEmail"/>
<HyperlinkButton x:Uid="/Main/signOut" Content="Log out" Click="Logout_Click"/>
</StackPanel>
</Grid>
</Flyout>
</Button.Flyout>
<PersonPicture Width="25"/>
</Button>
</StackPanel>
<CommandBar HorizontalAlignment="Right" Background="Transparent" OverflowButtonVisibility="Collapsed" Visibility="Collapsed" Margin="100,0">
<AppBarButton Label="Leave feedback">
<AppBarButton.Icon>
<FontIcon Glyph="&#xED15;"/>
</AppBarButton.Icon>
</AppBarButton>
<AppBarButton Label="Add account">
<AppBarButton.Icon>
<FontIcon Glyph="&#xE8FA;"/>
</AppBarButton.Icon>
</AppBarButton>
<AppBarButton>
<AppBarButton.Content>
<PersonPicture/>
</AppBarButton.Content>
</AppBarButton>
</CommandBar>
</Grid>
</ui:NavigationView.Header>
<NavigationView.MenuItemTemplate> <ui:NavigationView.MenuItemTemplate>
<DataTemplate> <DataTemplate>
<StackPanel Orientation="Horizontal" Padding="5" Margin="-5,0,0,0" Tag="{Binding Snippet.ResourceId.ChannelId}"> <StackPanel Orientation="Horizontal" Padding="5" Margin="-5,0,0,0" Tag="{Binding Snippet.ResourceId.ChannelId}">
<PersonPicture Height="20" Margin="-5,0,15,0"> <PersonPicture Height="20" Margin="-5,0,15,0">
@@ -52,61 +90,61 @@
<BitmapImage UriSource="{Binding Snippet.Thumbnails.Medium.Url}" DecodePixelHeight="20" DecodePixelWidth="20"/> <BitmapImage UriSource="{Binding Snippet.Thumbnails.Medium.Url}" DecodePixelHeight="20" DecodePixelWidth="20"/>
</PersonPicture.ProfilePicture> </PersonPicture.ProfilePicture>
</PersonPicture> </PersonPicture>
<TextBlock Text="{Binding Snippet.Title}"/> <TextBlock FontSize="14" Text="{Binding Snippet.Title}"/>
</StackPanel> </StackPanel>
</DataTemplate> </DataTemplate>
</NavigationView.MenuItemTemplate> </ui:NavigationView.MenuItemTemplate>
<NavigationView.MenuItems> <ui:NavigationView.MenuItems>
<NavigationViewItem x:Uid="/Main/home" Icon="Home" Content="Home" Name="toHome"/> <ui:NavigationViewItem x:Uid="/Main/home" Icon="Home" Content="Home" Name="toHome"/>
<NavigationViewItem x:Uid="/Main/myChannel" Icon="Contact" Content="My channel" Name="toChannel" Visibility="Collapsed"/> <ui:NavigationViewItem x:Uid="/Main/myChannel" Icon="Contact" Content="My channel" Name="toChannel" Visibility="Collapsed"/>
<NavigationViewItem x:Uid="/Main/subscriptions" Icon="People" Content="Subscriptions" Name="toSubscriptions" Visibility="Collapsed"/> <ui:NavigationViewItem x:Uid="/Main/subscriptions" Icon="People" Content="Subscriptions" Name="toSubscriptions" Visibility="Collapsed"/>
<NavigationViewItemHeader x:Uid="/Main/myLibrary" Content="My library" Name="libHeader" Visibility="Collapsed"/> <ui:NavigationViewItemHeader x:Uid="/Main/myLibrary" FontSize="14" Content="My library" Name="libHeader" Visibility="Collapsed"/>
<NavigationViewItem x:Uid="/Main/history" Content="History" Name="toHistory" Visibility="Collapsed"> <ui:NavigationViewItem x:Uid="/Main/history" Content="History" Name="toHistory" Visibility="Collapsed">
<NavigationViewItem.Icon> <ui:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE81C;"/> <FontIcon Glyph="&#xE81C;"/>
</NavigationViewItem.Icon> </ui:NavigationViewItem.Icon>
</NavigationViewItem> </ui:NavigationViewItem>
<NavigationViewItem x:Uid="/Main/liked" Icon="Like" Content="Liked videos" Name="toLiked" Visibility="Collapsed"/> <ui:NavigationViewItem x:Uid="/Main/liked" Icon="Like" Content="Liked videos" Name="toLiked" Visibility="Collapsed"/>
<NavigationViewItem x:Uid="/Main/later" Icon="Clock" Content="Watch later" Name="toLater" Visibility="Collapsed"/> <ui:NavigationViewItem x:Uid="/Main/later" Icon="Clock" Content="Watch later" Name="toLater" Visibility="Collapsed"/>
<NavigationViewItem x:Uid="/Main/downloads" Icon="Download" Content="Downloads" Name="toDownloads"/> <ui:NavigationViewItem x:Uid="/Main/downloads" Icon="Download" Content="Downloads" Name="toDownloads"/>
<NavigationViewItemHeader x:Uid="/Main/subscriptions" Content="Subscriptions" Name="subsHeader" Visibility="Collapsed"/> <ui:NavigationViewItemHeader x:Uid="/Main/subscriptions" FontSize="14" Content="Subscriptions" Name="subsHeader" Visibility="Collapsed"/>
</NavigationView.MenuItems> </ui:NavigationView.MenuItems>
<NavigationView.PaneFooter> <ui:NavigationView.PaneFooter>
<NavigationViewList> <ui:NavigationViewList>
<NavigationViewList.ItemContainerTransitions> <ui:NavigationViewList.ItemContainerTransitions>
<TransitionCollection> <TransitionCollection>
<EntranceThemeTransition IsStaggeringEnabled="True"/> <EntranceThemeTransition IsStaggeringEnabled="True"/>
<ReorderThemeTransition/> <ReorderThemeTransition/>
</TransitionCollection> </TransitionCollection>
</NavigationViewList.ItemContainerTransitions> </ui:NavigationViewList.ItemContainerTransitions>
<NavigationViewItem Name="openWeb" Tapped="Web_Tapped" Icon="Globe" Content="Browser" Visibility="Collapsed"/> <ui:NavigationViewItem Name="openWeb" Tapped="Web_Tapped" Icon="Globe" Content="Browser" Visibility="Collapsed"/>
<NavigationViewItem x:Uid="/Main/feedback" Name="feedback" Content="Give a feedback" Tapped="Feedback_Click" Visibility="Collapsed"> <!--<ui:NavigationViewItem x:Uid="/Main/feedback" Name="feedback" Content="Give a feedback" Tapped="Feedback_Click" Visibility="Collapsed">
<NavigationViewItem.Icon> <ui:NavigationViewItem.Icon>
<FontIcon Glyph="&#xED15;"/> <FontIcon Glyph="&#xED15;"/>
</NavigationViewItem.Icon> </ui:NavigationViewItem.Icon>
</NavigationViewItem> </ui:NavigationViewItem>-->
<NavigationViewItem x:Uid="/Main/adsFree" Content="Remove ads" Visibility="Collapsed" Tapped="RemoveAds_Tapped" Name="removeAds"> <ui:NavigationViewItem x:Uid="/Main/adsFree" Content="Remove ads" Visibility="Collapsed" Tapped="RemoveAds_Tapped" Name="removeAds">
<NavigationViewItem.Icon> <ui:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE14D;"/> <FontIcon Glyph="&#xE14D;"/>
</NavigationViewItem.Icon> </ui:NavigationViewItem.Icon>
</NavigationViewItem> </ui:NavigationViewItem>
<NavigationViewItem Name="account" x:Uid="/Main/signIn" Content="Add account" Tapped="SignIn_Click" Visibility="Collapsed"> <!--<ui:NavigationViewItem Name="account" x:Uid="/Main/signIn" Content="Add account" Tapped="SignIn_Click" Visibility="Collapsed">
<NavigationViewItem.Icon> <ui:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE8FA;"/> <FontIcon Glyph="&#xE8FA;"/>
</NavigationViewItem.Icon> </ui:NavigationViewItem.Icon>
</NavigationViewItem> </ui:NavigationViewItem>
<NavigationViewItem Visibility="Collapsed" Name="avatar" Tapped="OpenContext" Padding="-5"> <ui:NavigationViewItem Visibility="Collapsed" Name="avatar" Tapped="OpenContext" Padding="-5">
<StackPanel Orientation="Horizontal" Padding="5"> <StackPanel Orientation="Horizontal" Padding="5">
<PersonPicture Height="20" Margin="-5,0,15,0"/> <PersonPicture Height="20" Margin="-5,0,15,0"/>
<TextBlock Name="myName" Text="My account"/> <TextBlock Name="myName" Text="My account"/>
</StackPanel> </StackPanel>
<NavigationViewItem.ContextFlyout> <ui:NavigationViewItem.ContextFlyout>
<Flyout> <Flyout>
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
@@ -121,20 +159,20 @@
</StackPanel> </StackPanel>
</Grid> </Grid>
</Flyout> </Flyout>
</NavigationViewItem.ContextFlyout> </ui:NavigationViewItem.ContextFlyout>
</NavigationViewItem> </ui:NavigationViewItem>-->
</NavigationViewList> </ui:NavigationViewList>
</NavigationView.PaneFooter> </ui:NavigationView.PaneFooter>
<NavigationView.AutoSuggestBox> <ui:NavigationView.AutoSuggestBox>
<AutoSuggestBox x:Name="search" QueryIcon="Find" QuerySubmitted="Search_QuerySubmitted" TextChanged="Search_TextChanged" x:Uid="/Main/searchPlaceholder" PlaceholderText="Search"/> <AutoSuggestBox FontSize="14" x:Name="search" QueryIcon="Find" QuerySubmitted="Search_QuerySubmitted" TextChanged="Search_TextChanged" x:Uid="/Main/searchPlaceholder" PlaceholderText="Search"/>
</NavigationView.AutoSuggestBox> </ui:NavigationView.AutoSuggestBox>
<Grid> <Grid>
<Frame Name="content" Navigated="Content_Navigated"/> <Frame Name="content" Navigated="Content_Navigated"/>
<Frame Name="videoPlaceholder"/> <Frame Name="videoPlaceholder"/>
</Grid> </Grid>
</NavigationView> </ui:NavigationView>
</Grid> </Grid>
</Page> </Page>
+47 -32
View File
@@ -12,14 +12,11 @@ using System.Xml;
using Google.Apis.YouTube.v3.Data; using Google.Apis.YouTube.v3.Data;
using Windows.ApplicationModel.Core; using Windows.ApplicationModel.Core;
using Windows.System; using Windows.System;
using Google.Apis.Oauth2.v2;
using Google.Apis.Oauth2.v2.Data;
using FoxTube.Pages; using FoxTube.Pages;
using Windows.UI.Popups; using Windows.UI.Popups;
using Windows.Networking.Connectivity; using Windows.Networking.Connectivity;
using Windows.ApplicationModel.Resources; using Windows.ApplicationModel.Resources;
using Microsoft.Services.Store.Engagement; using Microsoft.Services.Store.Engagement;
using System.Linq;
namespace FoxTube namespace FoxTube
{ {
@@ -29,8 +26,12 @@ namespace FoxTube
public sealed partial class MainPage : Page public sealed partial class MainPage : Page
{ {
bool wasInvoked = false; bool wasInvoked = false;
public static event ObjectEventHandler VideoPageSizeChanged;
readonly ResourceLoader resources = ResourceLoader.GetForCurrentView("Main"); readonly ResourceLoader resources = ResourceLoader.GetForCurrentView("Main");
Dictionary<Type, Action> headers; Dictionary<Type, Action> headers;
public Page PageContent => content.Content as Page;
public MainPage() public MainPage()
{ {
InitializeComponent(); InitializeComponent();
@@ -43,11 +44,13 @@ namespace FoxTube
SecretsVault.SubscriptionsChanged += SecretsVault_SubscriptionsChanged; SecretsVault.SubscriptionsChanged += SecretsVault_SubscriptionsChanged;
SecretsVault.Purchased += async (sender, e) => SecretsVault.Purchased += async (sender, e) =>
{ {
//TODO: Localize strings
removeAds.Visibility = (e[0] as bool?).Value ? Visibility.Collapsed : Visibility.Visible; removeAds.Visibility = (e[0] as bool?).Value ? Visibility.Collapsed : Visibility.Visible;
MessageDialog dialog = new MessageDialog("Thanks for purchasing full version of the app (^∇^) In order to complete changes we need to reopen it. But you can do it later"); if (!(bool)e[0])
dialog.Commands.Add(new UICommand("Close the app", (command) => Methods.CloseApp())); return;
dialog.Commands.Add(new UICommand("Later"));
MessageDialog dialog = new MessageDialog(resources.GetString("/Main/purchaseSuccess"));
dialog.Commands.Add(new UICommand(resources.GetString("/Main/close"), (command) => Methods.CloseApp()));
dialog.Commands.Add(new UICommand(resources.GetString("/Main/delay")));
dialog.CancelCommandIndex = 1; dialog.CancelCommandIndex = 1;
dialog.DefaultCommandIndex = 0; dialog.DefaultCommandIndex = 0;
await dialog.ShowAsync(); await dialog.ShowAsync();
@@ -80,22 +83,21 @@ namespace FoxTube
async void PromptFeedback() async void PromptFeedback()
{ {
//TODO: Localize strings
if (SettingsStorage.Uptime.TotalHours >= 12 && SettingsStorage.PromptFeedback) if (SettingsStorage.Uptime.TotalHours >= 12 && SettingsStorage.PromptFeedback)
{ {
MessageDialog dialog = new MessageDialog("Have some thoughts to share about the app or any suggestions? Leave feedback!"); MessageDialog dialog = new MessageDialog(resources.GetString("/Main/feedbackMessage"));
dialog.Commands.Add(new UICommand("Don't ask me anymore", (command) => SettingsStorage.PromptFeedback = false)); dialog.Commands.Add(new UICommand(resources.GetString("/Main/dontAsk"), (command) => SettingsStorage.PromptFeedback = false));
dialog.Commands.Add(new UICommand("Maybe later")); dialog.Commands.Add(new UICommand(resources.GetString("/Main/promptLater")));
dialog.Commands.Add(new UICommand("Sure!", async (command) => dialog.Commands.Add(new UICommand(resources.GetString("/Main/sure"), async (command) =>
{ {
SettingsStorage.PromptFeedback = false; SettingsStorage.PromptFeedback = false;
if (StoreServicesFeedbackLauncher.IsSupported()) if (StoreServicesFeedbackLauncher.IsSupported())
await StoreServicesFeedbackLauncher.GetDefault().LaunchAsync(); await StoreServicesFeedbackLauncher.GetDefault().LaunchAsync();
else else
{ {
MessageDialog message = new MessageDialog("Oops. Seems like you don't have a Feedback Hub app. But you can stil send your feedback to michael.xfox@outlook.com"); MessageDialog message = new MessageDialog(resources.GetString("/Main/feedbackFail"));
message.Commands.Add(new UICommand("Send an E-mail", async (c) => await Launcher.LaunchUriAsync("mailto:michael.xfox@outlook.com".ToUri()))); message.Commands.Add(new UICommand(resources.GetString("/Main/sendEmail"), async (c) => await Launcher.LaunchUriAsync("mailto:michael.xfox@outlook.com".ToUri())));
message.Commands.Add(new UICommand("Nevermind. Get me back")); message.Commands.Add(new UICommand(resources.GetString("/Main/goBack")));
message.CancelCommandIndex = 1; message.CancelCommandIndex = 1;
message.DefaultCommandIndex = 0; message.DefaultCommandIndex = 0;
await message.ShowAsync(); await message.ShowAsync();
@@ -108,10 +110,10 @@ namespace FoxTube
if (SettingsStorage.Uptime.TotalHours >= 24 && SettingsStorage.PromptReview) if (SettingsStorage.Uptime.TotalHours >= 24 && SettingsStorage.PromptReview)
{ {
MessageDialog dialog = new MessageDialog("Like our app? Review it on Microsoft Store!"); MessageDialog dialog = new MessageDialog(resources.GetString("/Main/rate"));
dialog.Commands.Add(new UICommand("Don't ask me anymore", (command) => SettingsStorage.PromptReview = false)); dialog.Commands.Add(new UICommand(resources.GetString("/Main/dontAsk"), (command) => SettingsStorage.PromptReview = false));
dialog.Commands.Add(new UICommand("Maybe later")); dialog.Commands.Add(new UICommand(resources.GetString("/Main/promptLater")));
dialog.Commands.Add(new UICommand("Sure!", async (command) => dialog.Commands.Add(new UICommand(resources.GetString("/Main/sure"), async (command) =>
{ {
SettingsStorage.PromptReview = false; SettingsStorage.PromptReview = false;
await Launcher.LaunchUriAsync("ms-windows-store://review/?ProductId=9NCQQXJTDLFH".ToUri()); await Launcher.LaunchUriAsync("ms-windows-store://review/?ProductId=9NCQQXJTDLFH".ToUri());
@@ -157,7 +159,7 @@ namespace FoxTube
break; break;
case "remove": case "remove":
NavigationViewItem item = nav.MenuItems.Find(i => ((i as NavigationViewItem).Content as StackPanel).Tag.ToString() == (args[1] as Subscription).Snippet.ResourceId.ChannelId) as NavigationViewItem; Microsoft.UI.Xaml.Controls.NavigationViewItem item = nav.MenuItems.Find(i => ((i as Microsoft.UI.Xaml.Controls.NavigationViewItem).Content as StackPanel).Tag.ToString() == (args[1] as Subscription).Snippet.ResourceId.ChannelId) as Microsoft.UI.Xaml.Controls.NavigationViewItem;
if (item == null) if (item == null)
break; break;
else else
@@ -176,10 +178,11 @@ namespace FoxTube
case true: case true:
account.Visibility = Visibility.Collapsed; account.Visibility = Visibility.Collapsed;
myName.Text = myNameFlyout.Text = SecretsVault.UserInfo.Name; ToolTipService.SetToolTip(avatar, $"{SecretsVault.UserInfo.Name} ({SecretsVault.UserInfo.Email})");
myNameFlyout.Text = SecretsVault.UserInfo.Name;
myEmail.Text = SecretsVault.UserInfo.Email; myEmail.Text = SecretsVault.UserInfo.Email;
avatarFlyout.ProfilePicture = new BitmapImage(SecretsVault.UserInfo.Picture.ToUri()); avatarFlyout.ProfilePicture = new BitmapImage(SecretsVault.UserInfo.Picture.ToUri()) { DecodePixelHeight = 65, DecodePixelWidth = 65 };
((avatar.Content as StackPanel).Children[0] as PersonPicture).ProfilePicture = avatarFlyout.ProfilePicture; (avatar.Content as PersonPicture).ProfilePicture = new BitmapImage(SecretsVault.UserInfo.Picture.ToUri()) { DecodePixelHeight = 25, DecodePixelWidth = 25 };
avatar.Visibility = Visibility.Visible; avatar.Visibility = Visibility.Visible;
@@ -249,12 +252,12 @@ namespace FoxTube
GoToVideo((videoPlaceholder.Content as VideoPage).videoId, (videoPlaceholder.Content as VideoPage).playlistId); GoToVideo((videoPlaceholder.Content as VideoPage).videoId, (videoPlaceholder.Content as VideoPage).playlistId);
} }
private async void Feedback_Click(object sender, TappedRoutedEventArgs e) private async void Feedback_Click(object sender, RoutedEventArgs e)
{ {
await StoreServicesFeedbackLauncher.GetDefault().LaunchAsync(); await StoreServicesFeedbackLauncher.GetDefault().LaunchAsync();
} }
private void SignIn_Click(object sender, TappedRoutedEventArgs e) private void SignIn_Click(object sender, RoutedEventArgs e)
{ {
SecretsVault.Authorize(); SecretsVault.Authorize();
} }
@@ -338,7 +341,10 @@ namespace FoxTube
nav.ExpandedModeThresholdWidth = short.MaxValue; nav.ExpandedModeThresholdWidth = short.MaxValue;
nav.IsPaneOpen = false; nav.IsPaneOpen = false;
VideoPageSizeChanged?.Invoke(this, true);
videoPlaceholder.Navigate(typeof(VideoPage), new string[2] { id, playlistId }); videoPlaceholder.Navigate(typeof(VideoPage), new string[2] { id, playlistId });
Title.Text = resources.GetString("/Main/video");
} }
public void GoToDeveloper(string id) public void GoToDeveloper(string id)
@@ -383,6 +389,8 @@ namespace FoxTube
else else
nav.IsBackEnabled = false; nav.IsBackEnabled = false;
VideoPageSizeChanged?.Invoke(this, false);
SetNavigationMenu(); SetNavigationMenu();
try { headers[content.SourcePageType](); } try { headers[content.SourcePageType](); }
@@ -394,7 +402,7 @@ namespace FoxTube
if (content.SourcePageType == typeof(Home) || content.SourcePageType == typeof(Settings) || content.SourcePageType == typeof(Subscriptions)) if (content.SourcePageType == typeof(Home) || content.SourcePageType == typeof(Settings) || content.SourcePageType == typeof(Subscriptions))
{ {
nav.ExpandedModeThresholdWidth = 1008; nav.ExpandedModeThresholdWidth = 1008;
nav.IsPaneOpen = nav.DisplayMode == NavigationViewDisplayMode.Expanded ? true : false; nav.IsPaneOpen = nav.DisplayMode == Microsoft.UI.Xaml.Controls.NavigationViewDisplayMode.Expanded ? true : false;
} }
else else
nav.ExpandedModeThresholdWidth = short.MaxValue; nav.ExpandedModeThresholdWidth = short.MaxValue;
@@ -415,6 +423,8 @@ namespace FoxTube
Title.Text = resources.GetString("/Main/video"); Title.Text = resources.GetString("/Main/video");
nav.ExpandedModeThresholdWidth = short.MaxValue; nav.ExpandedModeThresholdWidth = short.MaxValue;
nav.IsPaneOpen = false; nav.IsPaneOpen = false;
VideoPageSizeChanged?.Invoke(this, true);
} }
public void CloseVideo() public void CloseVideo()
@@ -431,7 +441,12 @@ namespace FoxTube
else else
nav.IsBackEnabled = false; nav.IsBackEnabled = false;
VideoPageSizeChanged?.Invoke(this, false);
SetNavigationMenu(); SetNavigationMenu();
try { headers[content.SourcePageType](); }
catch { }
} }
private void Search_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args) private void Search_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
@@ -538,7 +553,7 @@ namespace FoxTube
private void OpenContext(object sender, TappedRoutedEventArgs e) private void OpenContext(object sender, TappedRoutedEventArgs e)
{ {
((NavigationViewItem)sender).ContextFlyout.ShowAt((NavigationViewItem)sender); ((Microsoft.UI.Xaml.Controls.NavigationViewItem)sender).ContextFlyout.ShowAt((Microsoft.UI.Xaml.Controls.NavigationViewItem)sender);
} }
private void RemoveAds_Tapped(object sender, TappedRoutedEventArgs e) private void RemoveAds_Tapped(object sender, TappedRoutedEventArgs e)
@@ -551,7 +566,7 @@ namespace FoxTube
content.Navigate(typeof(Home1)); content.Navigate(typeof(Home1));
} }
private void Nav_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args) private void Nav_SelectionChanged(Microsoft.UI.Xaml.Controls.NavigationView sender, Microsoft.UI.Xaml.Controls.NavigationViewSelectionChangedEventArgs args)
{ {
try try
{ {
@@ -586,7 +601,7 @@ namespace FoxTube
catch { } catch { }
} }
private void Nav_BackRequested(NavigationView sender, NavigationViewBackRequestedEventArgs args) private void Nav_BackRequested(Microsoft.UI.Xaml.Controls.NavigationView sender, Microsoft.UI.Xaml.Controls.NavigationViewBackRequestedEventArgs args)
{ {
if (videoPlaceholder.Content != null) if (videoPlaceholder.Content != null)
{ {
@@ -599,16 +614,16 @@ namespace FoxTube
content.GoBack(); content.GoBack();
} }
private void Nav_PaneClosing(NavigationView sender, NavigationViewPaneClosingEventArgs args) private void Nav_PaneClosing(Microsoft.UI.Xaml.Controls.NavigationView sender, Microsoft.UI.Xaml.Controls.NavigationViewPaneClosingEventArgs args)
{ {
AppTitle.Visibility = Visibility.Collapsed; AppTitle.Visibility = Visibility.Collapsed;
} }
private void Nav_PaneOpened(NavigationView sender, object args) private void Nav_PaneOpened(Microsoft.UI.Xaml.Controls.NavigationView sender, object args)
{ {
AppTitle.Visibility = Visibility.Visible; AppTitle.Visibility = Visibility.Visible;
if (sender.DisplayMode == NavigationViewDisplayMode.Expanded && sender.IsPaneOpen) if (sender.DisplayMode == Microsoft.UI.Xaml.Controls.NavigationViewDisplayMode.Expanded && sender.IsPaneOpen)
AppTitleBar.Margin = new Thickness(40, 0, 0, 0); AppTitleBar.Margin = new Thickness(40, 0, 0, 0);
else else
AppTitleBar.Margin = new Thickness(); AppTitleBar.Margin = new Thickness();
+8 -2
View File
@@ -54,12 +54,13 @@ namespace FoxTube.Pages
PlaylistsResource.ListRequest infoRequest = SecretsVault.Service.Playlists.List("snippet,contentDetails"); PlaylistsResource.ListRequest infoRequest = SecretsVault.Service.Playlists.List("snippet,contentDetails");
infoRequest.Id = id; infoRequest.Id = id;
infoRequest.Hl = SettingsStorage.RelevanceLanguage;
item = (await infoRequest.ExecuteAsync()).Items[0]; item = (await infoRequest.ExecuteAsync()).Items[0];
title.Text = item.Snippet.Title; title.Text = item.Snippet.Localized.Title;
info.Text = $"{item.ContentDetails.ItemCount} {ResourceLoader.GetForCurrentView("Playlist").GetString("/Playlist/videos")}"; info.Text = $"{item.ContentDetails.ItemCount} {ResourceLoader.GetForCurrentView("Playlist").GetString("/Playlist/videos")}";
description.Text = item.Snippet.Description; description.Text = item.Snippet.Localized.Description;
channelName.Text = item.Snippet.ChannelTitle; channelName.Text = item.Snippet.ChannelTitle;
@@ -147,5 +148,10 @@ namespace FoxTube.Pages
foreach (PlaylistItem i in response.Items) foreach (PlaylistItem i in response.Items)
list.Add(new VideoCard(i.ContentDetails.VideoId, playlistId)); list.Add(new VideoCard(i.ContentDetails.VideoId, playlistId));
} }
public void DeleteItem(FrameworkElement card)
{
list.DeleteItem(card);
}
} }
} }
+1 -1
View File
@@ -18,7 +18,7 @@
<TextBlock x:Uid="/General/restart" Foreground="Red" Text="Reopen the app to apply settings"/> <TextBlock x:Uid="/General/restart" Foreground="Red" Text="Reopen the app to apply settings"/>
<Button x:Uid="/General/closeApp" Content="Close app" Background="Red" Margin="5" Click="Button_Click"/> <Button x:Uid="/General/closeApp" Content="Close app" Background="Red" Margin="5" Click="Button_Click"/>
</StackPanel> </StackPanel>
<ComboBox Header="Search relevance language" MinWidth="250" Name="relLanguage" SelectionChanged="RelLanguage_SelectionChanged"/> <ComboBox x:Uid="/General/relevanceLanguage" Header="Search relevance language" MinWidth="250" Name="relLanguage" SelectionChanged="RelLanguage_SelectionChanged"/>
<ComboBox x:Uid="/General/region" Header="Region" MinWidth="250" Name="region" SelectionChanged="region_SelectionChanged"/> <ComboBox x:Uid="/General/region" Header="Region" MinWidth="250" Name="region" SelectionChanged="region_SelectionChanged"/>
<ComboBox x:Uid="/General/safeSearch" Header="SafeSearch" MinWidth="250" Name="safeSearch" SelectionChanged="safeSearch_SelectionChanged"> <ComboBox x:Uid="/General/safeSearch" Header="SafeSearch" MinWidth="250" Name="safeSearch" SelectionChanged="safeSearch_SelectionChanged">
<ComboBoxItem x:Uid="/General/moderate" Content="Moderate"/> <ComboBoxItem x:Uid="/General/moderate" Content="Moderate"/>
+2 -2
View File
@@ -79,7 +79,7 @@
</Grid> </Grid>
<StackPanel Grid.Column="1"> <StackPanel Grid.Column="1">
<TextBlock FontWeight="Bold" Text="{Binding Path=Title}" MaxLines="1" TextWrapping="Wrap"/> <TextBlock FontWeight="Bold" Text="{Binding Path=Title}" MaxLines="1" TextWrapping="Wrap"/>
<TextBlock Opacity=".5" Text="{Binding Path=Subtitle}"/> <TextBlock FontSize="14" Opacity=".5" Text="{Binding Path=Subtitle}"/>
<TextBlock Opacity=".5" FontSize="13" Text="{Binding Path=TimeStampString}" TextWrapping="WrapWholeWords"/> <TextBlock Opacity=".5" FontSize="13" Text="{Binding Path=TimeStampString}" TextWrapping="WrapWholeWords"/>
</StackPanel> </StackPanel>
</Grid> </Grid>
@@ -91,7 +91,7 @@
<ScrollViewer Grid.Column="1"> <ScrollViewer Grid.Column="1">
<StackPanel Margin="10"> <StackPanel Margin="10">
<TextBlock FontWeight="Bold" Text="Hello, World!" FontSize="26" Name="title"/> <TextBlock FontWeight="Bold" Text="Hello, World!" FontSize="26" Name="title"/>
<controls:MarkdownTextBlock IsTextSelectionEnabled="True" Text="Content" Name="content"/> <controls:MarkdownTextBlock IsTextSelectionEnabled="True" Text="Content" Name="content" Background="Transparent"/>
</StackPanel> </StackPanel>
</ScrollViewer> </ScrollViewer>
<Button Grid.Column="1" VerticalAlignment="Top" HorizontalAlignment="Right" Background="Transparent" FontFamily="Segoe MDL2 Assets" Content="&#xE106;" Width="50" Height="50" Name="close" Click="close_Click"/> <Button Grid.Column="1" VerticalAlignment="Top" HorizontalAlignment="Right" Background="Transparent" FontFamily="Segoe MDL2 Assets" Content="&#xE106;" Width="50" Height="50" Name="close" Click="close_Click"/>
+17 -3
View File
@@ -1,4 +1,5 @@
using System.Collections.Generic; using FoxTube.Controls.Adverts;
using System.Collections.Generic;
using Windows.UI.Xaml; using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls;
@@ -20,6 +21,7 @@ namespace FoxTube.Pages
} }
private int cols = 1; private int cols = 1;
public int Count => Children.Count; public int Count => Children.Count;
public bool IsRelatedVideos { get; set; } = false;
public List<UIElement> Children { get; } = new List<UIElement>(); public List<UIElement> Children { get; } = new List<UIElement>();
public VideoGrid() public VideoGrid()
@@ -31,8 +33,14 @@ namespace FoxTube.Pages
{ {
(grid.Children[Count % cols + 1] as StackPanel).Children.Add(card); (grid.Children[Count % cols + 1] as StackPanel).Children.Add(card);
Children.Add(card); Children.Add(card);
/*if (list.Items.Count % 10 == 0)
list.Items.Add(new CardAdvert());*/ if ((Children.Count - 5) % 25 == 0 && !SecretsVault.AdsDisabled)
{
CardAdvert advert = new CardAdvert(IsRelatedVideos);
(grid.Children[Count % cols + 1] as StackPanel).Children.Add(advert);
Children.Add(advert);
}
empty.Visibility = Visibility.Collapsed; empty.Visibility = Visibility.Collapsed;
} }
@@ -44,6 +52,12 @@ namespace FoxTube.Pages
empty.Visibility = Visibility.Visible; empty.Visibility = Visibility.Visible;
} }
public void DeleteItem(FrameworkElement item)
{
Children.Remove(item);
UpdateGrid();
}
void UpdateGrid() void UpdateGrid()
{ {
for (int k = 1; k <= 5; k++) for (int k = 1; k <= 5; k++)
+11 -68
View File
@@ -6,7 +6,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:pages="using:FoxTube.Pages" xmlns:pages="using:FoxTube.Pages"
xmlns:controls1="using:FoxTube.Controls"
mc:Ignorable="d"> mc:Ignorable="d">
<Grid Name="grid" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" SizeChanged="grid_SizeChanged"> <Grid Name="grid" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" SizeChanged="grid_SizeChanged">
@@ -110,73 +109,13 @@
<MenuFlyout x:Name="downloadSelector"/> <MenuFlyout x:Name="downloadSelector"/>
</AppBarButton.Flyout> </AppBarButton.Flyout>
</AppBarButton> </AppBarButton>
<AppBarButton x:Uid="/VideoPage/addTo" Name="addTo" Label="Add to" Icon="Add" Visibility="Collapsed"> <AppBarButton x:Uid="/VideoPage/addTo" Name="addTo" Label="Add to" Icon="Add" Visibility="Visible">
<AppBarButton.Flyout> <AppBarButton.Flyout>
<MenuFlyout x:Name="addList"> <MenuFlyout x:Name="addList">
<MenuFlyoutItem Text="New playlist" Name="newPlaylist" Click="NewPlaylist_Click"> <MenuFlyoutItem x:Uid="/VideoPage/newPlaylist" Text="New playlist" Name="newPlaylist" Click="NewPlaylist_Click" Icon="Add"/>
<MenuFlyoutItem.Icon> <ToggleMenuFlyoutItem x:Uid="/VideoPage/wl" Text="Watch later" Name="wl" Click="Wl_Click" Icon="Clock"/>
<FontIcon Glyph="&#xE109;"/>
</MenuFlyoutItem.Icon>
</MenuFlyoutItem>
<ToggleMenuFlyoutItem Text="Watch later" Background="Red" Name="wl" Click="Wl_Click">
<MenuFlyoutItem.Icon>
<FontIcon Glyph="&#xE728;"/>
</MenuFlyoutItem.Icon>
</ToggleMenuFlyoutItem>
<MenuFlyoutSeparator/> <MenuFlyoutSeparator/>
<ToggleMenuFlyoutItem Text="Cats">
<ToggleMenuFlyoutItem.Icon>
<FontIcon Glyph="&#xE292;"/>
</ToggleMenuFlyoutItem.Icon>
</ToggleMenuFlyoutItem>
<ToggleMenuFlyoutItem Text="Dogs">
<ToggleMenuFlyoutItem.Icon>
<FontIcon Glyph="&#xE292;"/>
</ToggleMenuFlyoutItem.Icon>
</ToggleMenuFlyoutItem>
<ToggleMenuFlyoutItem Text="Porn">
<ToggleMenuFlyoutItem.Icon>
<FontIcon Glyph="&#xE292;"/>
</ToggleMenuFlyoutItem.Icon>
</ToggleMenuFlyoutItem>
</MenuFlyout> </MenuFlyout>
<!--<Flyout>
<ScrollViewer Margin="-12" MaxHeight="300">
<NavigationViewList Width="200" IsMultiSelectCheckBoxEnabled="True" SelectionMode="Multiple">
<NavigationViewItem Content="Watch later">
<NavigationViewItem.Icon>
<FontIcon Glyph="&#xE728;"/>
</NavigationViewItem.Icon>
</NavigationViewItem>
<NavigationViewItem Content="New playlist">
<NavigationViewItem.Icon>
<FontIcon Glyph="&#xE109;"/>
</NavigationViewItem.Icon>
</NavigationViewItem>
<NavigationViewItemHeader Content="Other playlists"/>
<NavigationViewItem Content="My playlist">
<NavigationViewItem.Icon>
<FontIcon Glyph="&#xE292;"/>
</NavigationViewItem.Icon>
</NavigationViewItem>
<NavigationViewItem Content="Cats">
<NavigationViewItem.Icon>
<FontIcon Glyph="&#xE292;"/>
</NavigationViewItem.Icon>
</NavigationViewItem>
<NavigationViewItem Content="Dogs">
<NavigationViewItem.Icon>
<FontIcon Glyph="&#xE292;"/>
</NavigationViewItem.Icon>
</NavigationViewItem>
<NavigationViewItem Content="Another playlist">
<NavigationViewItem.Icon>
<FontIcon Glyph="&#xE292;"/>
</NavigationViewItem.Icon>
</NavigationViewItem>
</NavigationViewList>
</ScrollViewer>
</Flyout>-->
</AppBarButton.Flyout> </AppBarButton.Flyout>
</AppBarButton> </AppBarButton>
<AppBarButton x:Uid="/VideoPage/refresh" Name="refresh" Click="refresh_Click" Icon="Refresh" Label="Refresh page"/> <AppBarButton x:Uid="/VideoPage/refresh" Name="refresh" Click="refresh_Click" Icon="Refresh" Label="Refresh page"/>
@@ -188,7 +127,7 @@
<Pivot Grid.Row="1" Name="pivot" SelectedIndex="0" IsHeaderItemsCarouselEnabled="False"> <Pivot Grid.Row="1" Name="pivot" SelectedIndex="0" IsHeaderItemsCarouselEnabled="False">
<PivotItem x:Uid="/VideoPage/related" Header="Suggestions"> <PivotItem x:Uid="/VideoPage/related" Header="Suggestions">
<ScrollViewer> <ScrollViewer>
<pages:VideoGrid x:Name="relatedVideos"/> <pages:VideoGrid x:Name="relatedVideos" IsRelatedVideos="True"/>
</ScrollViewer> </ScrollViewer>
</PivotItem> </PivotItem>
<PivotItem x:Uid="/VideoPage/comments" Header="Comments" Name="commentsPlaceholder"> <PivotItem x:Uid="/VideoPage/comments" Header="Comments" Name="commentsPlaceholder">
@@ -224,10 +163,14 @@
</Pivot> </Pivot>
</Grid> </Grid>
<ContentDialog PrimaryButtonText="Create and add" Title="New playlist" DefaultButton="Primary" PrimaryButtonClick="ContentDialog_PrimaryButtonClick" Name="playlistDialog"> <ContentDialog x:Uid="/VideoPage/dialog" PrimaryButtonText="Create and add" Title="New playlist" CloseButtonText="Cancel" DefaultButton="Primary" PrimaryButtonClick="ContentDialog_PrimaryButtonClick" Name="playlistDialog">
<StackPanel> <StackPanel>
<TextBox PlaceholderText="Enter playlist name" Name="newListName"/> <TextBox x:Uid="/VideoPage/newPlaylistName" PlaceholderText="Enter playlist name" Name="newListName"/>
<TextBlock Text="Invalid name: playlist with the name already exists" TextWrapping="WrapWholeWords" Foreground="Red" Visibility="Collapsed" Name="newListErr"/> <ComboBox x:Uid="/VideoPage/privacy" Header="Availablity" SelectedIndex="0" HorizontalAlignment="Stretch" Name="newListDisc">
<ComboBoxItem x:Uid="/VideoPage/public" Content="Public"/>
<ComboBoxItem x:Uid="/VideoPage/private" Content="Private"/>
<ComboBoxItem x:Uid="/VideoPage/direct" Content="Direct link"/>
</ComboBox>
</StackPanel> </StackPanel>
</ContentDialog> </ContentDialog>
+139 -8
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;
@@ -115,6 +113,7 @@ namespace FoxTube.Pages
VideosResource.ListRequest request = SecretsVault.Service.Videos.List("snippet,statistics,status,contentDetails,liveStreamingDetails"); VideosResource.ListRequest request = SecretsVault.Service.Videos.List("snippet,statistics,status,contentDetails,liveStreamingDetails");
request.Id = ids[0]; request.Id = ids[0];
request.Hl = SettingsStorage.RelevanceLanguage;
item = (await request.ExecuteAsync()).Items[0]; item = (await request.ExecuteAsync()).Items[0];
if (item.Snippet.LiveBroadcastContent == "none") if (item.Snippet.LiveBroadcastContent == "none")
@@ -126,6 +125,7 @@ namespace FoxTube.Pages
SetSchedule(); SetSchedule();
LoadInfo(); LoadInfo();
LoadAddTo();
loading.Close(); loading.Close();
} }
@@ -184,6 +184,7 @@ namespace FoxTube.Pages
//Retrieving data //Retrieving data
PlaylistsResource.ListRequest playlistRequest = SecretsVault.Service.Playlists.List("snippet,contentDetails"); PlaylistsResource.ListRequest playlistRequest = SecretsVault.Service.Playlists.List("snippet,contentDetails");
playlistRequest.Id = id; playlistRequest.Id = id;
playlistRequest.Hl = SettingsStorage.RelevanceLanguage;
Playlist playlistItem = (await playlistRequest.ExecuteAsync()).Items[0]; Playlist playlistItem = (await playlistRequest.ExecuteAsync()).Items[0];
PlaylistItemsResource.ListRequest listRequest = SecretsVault.Service.PlaylistItems.List("snippet"); PlaylistItemsResource.ListRequest listRequest = SecretsVault.Service.PlaylistItems.List("snippet");
@@ -207,7 +208,7 @@ namespace FoxTube.Pages
items[k].Number = k + 1; items[k].Number = k + 1;
//Setting data //Setting data
playlistName.Text = playlistItem.Snippet.Title; playlistName.Text = playlistItem.Snippet.Localized.Title;
playlistChannel.Text = playlistItem.Snippet.ChannelTitle; playlistChannel.Text = playlistItem.Snippet.ChannelTitle;
playlistCounter.Text = $"{items.IndexOf(selection) + 1}/{playlistItem.ContentDetails.ItemCount}"; playlistCounter.Text = $"{items.IndexOf(selection) + 1}/{playlistItem.ContentDetails.ItemCount}";
@@ -227,9 +228,9 @@ namespace FoxTube.Pages
async void LoadInfo() async void LoadInfo()
{ {
//Setting meta //Setting meta
title.Text = item.Snippet.Title; title.Text = item.Snippet.Localized.Title;
date.Text = $"{resources.GetString("/VideoPage/publishedAt")}: {item.Snippet.PublishedAt} ({Methods.GetAgo(item.Snippet.PublishedAt.Value)})"; date.Text = $"{resources.GetString("/VideoPage/publishedAt")}: {item.Snippet.PublishedAt} ({Methods.GetAgo(item.Snippet.PublishedAt.Value)})";
Methods.FormatText(ref description, item.Snippet.Description); Methods.FormatText(ref description, item.Snippet.Localized.Description);
//Setting channel button //Setting channel button
ChannelsResource.ListRequest channelRequest = SecretsVault.Service.Channels.List("snippet, statistics"); ChannelsResource.ListRequest channelRequest = SecretsVault.Service.Channels.List("snippet, statistics");
@@ -567,20 +568,150 @@ namespace FoxTube.Pages
} }
} }
async void LoadAddTo()
{
if(SecretsVault.UserChannel == null)
{
addTo.Visibility = Visibility.Collapsed;
return;
}
if (SecretsVault.WatchLater.Contains(item.Id))
(addList.Items[1] as ToggleMenuFlyoutItem).IsChecked = true;
PlaylistsResource.ListRequest request = SecretsVault.Service.Playlists.List("snippet");
request.Mine = true;
request.MaxResults = 50;
PlaylistListResponse response = await request.ExecuteAsync();
PlaylistItemsResource.ListRequest itemRequest = SecretsVault.Service.PlaylistItems.List("snippet");
itemRequest.VideoId = item.Id;
foreach (Playlist i in response.Items)
{
itemRequest.PlaylistId = i.Id;
ToggleMenuFlyoutItem menuItem = new ToggleMenuFlyoutItem
{
Text = i.Snippet.Title,
IsChecked = (await itemRequest.ExecuteAsync()).Items.Count > 0,
Tag = i,
Icon = new FontIcon
{
Glyph = "\xE728"
}
};
menuItem.Click += Item_Click;
addList.Items.Add(menuItem);
}
}
private async void Item_Click(object sender, RoutedEventArgs e)
{
if(((ToggleMenuFlyoutItem)sender).IsChecked)
{
try
{
PlaylistItem playlist = new PlaylistItem
{
Snippet = new PlaylistItemSnippet
{
PlaylistId = (((ToggleMenuFlyoutItem)sender).Tag as Playlist).Id,
ResourceId = new ResourceId
{
VideoId = item.Id,
Kind = "youtube#video"
}
}
};
PlaylistItemsResource.InsertRequest request = SecretsVault.Service.PlaylistItems.Insert(playlist, "snippet");
await request.ExecuteAsync();
}
catch
{
((ToggleMenuFlyoutItem)sender).IsChecked = false;
}
}
else
{
try
{
PlaylistItemsResource.ListRequest itemRequest = SecretsVault.Service.PlaylistItems.List("snippet");
itemRequest.VideoId = item.Id;
itemRequest.PlaylistId = ((Playlist)((ToggleMenuFlyoutItem)sender).Tag).Id;
PlaylistItemsResource.DeleteRequest request = SecretsVault.Service.PlaylistItems.Delete((await itemRequest.ExecuteAsync()).Items[0].Id);
await request.ExecuteAsync();
}
catch
{
((ToggleMenuFlyoutItem)sender).IsChecked = true;
}
}
}
private async void NewPlaylist_Click(object sender, RoutedEventArgs e) private async void NewPlaylist_Click(object sender, RoutedEventArgs e)
{ {
//TODO: Localize strings
await playlistDialog.ShowAsync(); await playlistDialog.ShowAsync();
} }
private void Wl_Click(object sender, RoutedEventArgs e) private void Wl_Click(object sender, RoutedEventArgs e)
{ {
// TODO: Add video to WL playlist
} }
private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) private async void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
{ {
string privacy = "private";
switch(newListDisc.SelectedIndex)
{
case 0:
privacy = "public";
break;
case 1:
privacy = "private";
break;
case 2:
privacy = "unlisted";
break;
}
Playlist newItem = new Playlist
{
Snippet = new PlaylistSnippet
{
Title = newListName.Text
},
Status = new PlaylistStatus
{
PrivacyStatus = privacy,
}
};
Playlist i;
try { i = await SecretsVault.Service.Playlists.Insert(newItem, "snippet,status").ExecuteAsync(); }
catch
{
return;
}
ToggleMenuFlyoutItem menuItem = new ToggleMenuFlyoutItem
{
Text = i.Snippet.Title,
IsChecked = true,
Tag = i,
Icon = new FontIcon
{
Glyph = "\xE728"
}
};
menuItem.Click += Item_Click;
addList.Items.Add(menuItem);
Item_Click(menuItem, null);
} }
} }
} }
+9
View File
@@ -186,4 +186,13 @@
<data name="watched.Text" xml:space="preserve"> <data name="watched.Text" xml:space="preserve">
<value>Watched</value> <value>Watched</value>
</data> </data>
<data name="addTo.Text" xml:space="preserve">
<value>Add to</value>
</data>
<data name="delete.Text" xml:space="preserve">
<value>Delete from playlist</value>
</data>
<data name="downloads.Text" xml:space="preserve">
<value>Downloads</value>
</data>
</root> </root>
+4 -1
View File
@@ -184,7 +184,7 @@
<value>Remember my choice</value> <value>Remember my choice</value>
</data> </data>
<data name="restart.Text" xml:space="preserve"> <data name="restart.Text" xml:space="preserve">
<value>Reopen the app to apply changes</value> <value>Reopen the app to apply changes (otherwise some elements may not be displayed correctly)</value>
</data> </data>
<data name="ru.Content" xml:space="preserve"> <data name="ru.Content" xml:space="preserve">
<value>Russian (Russian Federation)</value> <value>Russian (Russian Federation)</value>
@@ -204,4 +204,7 @@
<data name="devNotifications.OnContent" xml:space="preserve"> <data name="devNotifications.OnContent" xml:space="preserve">
<value>Recieve messages from developers</value> <value>Recieve messages from developers</value>
</data> </data>
<data name="relevanceLanguage.Header" xml:space="preserve">
<value>Search relevance language</value>
</data>
</root> </root>
+35 -2
View File
@@ -126,18 +126,36 @@
<data name="channel" xml:space="preserve"> <data name="channel" xml:space="preserve">
<value>Channel</value> <value>Channel</value>
</data> </data>
<data name="close" xml:space="preserve">
<value>Close the app</value>
</data>
<data name="connectErrContent" xml:space="preserve"> <data name="connectErrContent" xml:space="preserve">
<value>We were unabled to retrieve your account information due to weak internet connection or Google servers' problems. PLease, try again later</value> <value>We were unabled to retrieve your account information due to weak internet connection or Google servers' problems. PLease, try again later</value>
</data> </data>
<data name="connectErrHeader" xml:space="preserve"> <data name="connectErrHeader" xml:space="preserve">
<value>Failed to connect</value> <value>Failed to connect</value>
</data> </data>
<data name="delay" xml:space="preserve">
<value>Later</value>
</data>
<data name="dontAsk" xml:space="preserve">
<value>Don't ask me anymore</value>
</data>
<data name="downloads.Content" xml:space="preserve"> <data name="downloads.Content" xml:space="preserve">
<value>Downloads</value> <value>Downloads</value>
</data> </data>
<data name="feedback.Content" xml:space="preserve"> <data name="feedback.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>Give a feedback</value> <value>Give a feedback</value>
</data> </data>
<data name="feedbackFail" xml:space="preserve">
<value>Oops. Seems like you don't have a Feedback Hub app. But you can stil send your feedback to michael.xfox@outlook.com</value>
</data>
<data name="feedbackMessage" xml:space="preserve">
<value>Have some thoughts to share about the app or any suggestions? Leave feedback!</value>
</data>
<data name="goBack" xml:space="preserve">
<value>Nevermind. Get me back</value>
</data>
<data name="history.Content" xml:space="preserve"> <data name="history.Content" xml:space="preserve">
<value>History</value> <value>History</value>
</data> </data>
@@ -168,19 +186,31 @@
<data name="playlist" xml:space="preserve"> <data name="playlist" xml:space="preserve">
<value>Playlist</value> <value>Playlist</value>
</data> </data>
<data name="promptLater" xml:space="preserve">
<value>Maybe later</value>
</data>
<data name="purchaseSuccess" xml:space="preserve">
<value>Thanks for purchasing full version of the app (^∇^) In order to complete changes we need to reopen it. But you can do it later (some elements may be broken)</value>
</data>
<data name="quit" xml:space="preserve"> <data name="quit" xml:space="preserve">
<value>Quit</value> <value>Quit</value>
</data> </data>
<data name="rate" xml:space="preserve">
<value>Like our app? Review it on Microsoft Store!</value>
</data>
<data name="searchPlaceholder.PlaceholderText" xml:space="preserve"> <data name="searchPlaceholder.PlaceholderText" xml:space="preserve">
<value>Search</value> <value>Search</value>
</data> </data>
<data name="sendEmail" xml:space="preserve">
<value>Send an E-mail</value>
</data>
<data name="settings.Content" xml:space="preserve"> <data name="settings.Content" xml:space="preserve">
<value>Settings</value> <value>Settings</value>
</data> </data>
<data name="signEx.Text" xml:space="preserve"> <data name="signEx.Text" xml:space="preserve">
<value>Sign in with existing account</value> <value>Sign in with existing account</value>
</data> </data>
<data name="signIn.Content" xml:space="preserve"> <data name="signIn.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>Add account</value> <value>Add account</value>
</data> </data>
<data name="signNew.Text" xml:space="preserve"> <data name="signNew.Text" xml:space="preserve">
@@ -192,6 +222,9 @@
<data name="subscriptions.Content" xml:space="preserve"> <data name="subscriptions.Content" xml:space="preserve">
<value>Subscriptions</value> <value>Subscriptions</value>
</data> </data>
<data name="sure" xml:space="preserve">
<value>Sure!</value>
</data>
<data name="tryAgain" xml:space="preserve"> <data name="tryAgain" xml:space="preserve">
<value>Try again</value> <value>Try again</value>
</data> </data>
+33
View File
@@ -264,4 +264,37 @@
<data name="publishedAt" xml:space="preserve"> <data name="publishedAt" xml:space="preserve">
<value>Published at</value> <value>Published at</value>
</data> </data>
<data name="dialog.CloseButtonText" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="dialog.PrimaryButtonText" xml:space="preserve">
<value>Create and add</value>
</data>
<data name="dialog.Title" xml:space="preserve">
<value>New playlist</value>
</data>
<data name="direct.Content" xml:space="preserve">
<value>Direct link</value>
</data>
<data name="newPlaylist.Text" xml:space="preserve">
<value>New playlist</value>
</data>
<data name="newPlaylistName.PlaceholderText" xml:space="preserve">
<value>Enter playlist name</value>
</data>
<data name="privacy.Header" xml:space="preserve">
<value>Availability</value>
</data>
<data name="private.Content" xml:space="preserve">
<value>Private</value>
</data>
<data name="public.Content" xml:space="preserve">
<value>Public</value>
</data>
<data name="wl.Text" xml:space="preserve">
<value>Watch later</value>
</data>
<data name="live.Text" xml:space="preserve">
<value>🔴 LIVE</value>
</data>
</root> </root>
+9
View File
@@ -186,4 +186,13 @@
<data name="watched.Text" xml:space="preserve"> <data name="watched.Text" xml:space="preserve">
<value>Просмотрено</value> <value>Просмотрено</value>
</data> </data>
<data name="addTo.Text" xml:space="preserve">
<value>Добавить в</value>
</data>
<data name="delete.Text" xml:space="preserve">
<value>Удалить из плейлиста</value>
</data>
<data name="downloads.Text" xml:space="preserve">
<value>Загрузки</value>
</data>
</root> </root>
+4 -1
View File
@@ -184,7 +184,7 @@
<value>Запомнить мой выбор</value> <value>Запомнить мой выбор</value>
</data> </data>
<data name="restart.Text" xml:space="preserve"> <data name="restart.Text" xml:space="preserve">
<value>Перезапустите приложение, чтобы применить настройки</value> <value>Перезапустите приложение, чтобы применить настройки (в противном случае некоторые элементы могут неправильно отображаться)</value>
</data> </data>
<data name="ru.Content" xml:space="preserve"> <data name="ru.Content" xml:space="preserve">
<value>Русский (Российская Федерация)</value> <value>Русский (Российская Федерация)</value>
@@ -204,4 +204,7 @@
<data name="devNotifications.OnContent" xml:space="preserve"> <data name="devNotifications.OnContent" xml:space="preserve">
<value>Получать уведомления от разработчиков</value> <value>Получать уведомления от разработчиков</value>
</data> </data>
<data name="relevanceLanguage.Header" xml:space="preserve">
<value>Предпочитаемый язык поиска</value>
</data>
</root> </root>
+35 -2
View File
@@ -126,18 +126,36 @@
<data name="channel" xml:space="preserve"> <data name="channel" xml:space="preserve">
<value>Канал</value> <value>Канал</value>
</data> </data>
<data name="close" xml:space="preserve">
<value>Закрыть приложение</value>
</data>
<data name="connectErrContent" xml:space="preserve"> <data name="connectErrContent" xml:space="preserve">
<value>Нам не удалось подключиться к серверу из-за плохого соединения или проблем на стороне YouTube. Пожалуйста, попробуйте позже</value> <value>Нам не удалось подключиться к серверу из-за плохого соединения или проблем на стороне YouTube. Пожалуйста, попробуйте позже</value>
</data> </data>
<data name="connectErrHeader" xml:space="preserve"> <data name="connectErrHeader" xml:space="preserve">
<value>Не удалось подключиться</value> <value>Не удалось подключиться</value>
</data> </data>
<data name="delay" xml:space="preserve">
<value>Позже</value>
</data>
<data name="dontAsk" xml:space="preserve">
<value>Больше не спрашивайте меня</value>
</data>
<data name="downloads.Content" xml:space="preserve"> <data name="downloads.Content" xml:space="preserve">
<value>Загрузки</value> <value>Загрузки</value>
</data> </data>
<data name="feedback.Content" xml:space="preserve"> <data name="feedback.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>Оставить отзыв</value> <value>Оставить отзыв</value>
</data> </data>
<data name="feedbackFail" xml:space="preserve">
<value>Ой. Похоже, у вас нет приложения "Центр отзывов". Но вы все еще можете отправить свой отзыв по почте</value>
</data>
<data name="feedbackMessage" xml:space="preserve">
<value>Есть мысли или идеи по поводу нашего приложения? Оставьте отзыв!</value>
</data>
<data name="goBack" xml:space="preserve">
<value>Не важно. Я передумал</value>
</data>
<data name="history.Content" xml:space="preserve"> <data name="history.Content" xml:space="preserve">
<value>История</value> <value>История</value>
</data> </data>
@@ -168,19 +186,31 @@
<data name="playlist" xml:space="preserve"> <data name="playlist" xml:space="preserve">
<value>Плейлист</value> <value>Плейлист</value>
</data> </data>
<data name="promptLater" xml:space="preserve">
<value>Может, позже</value>
</data>
<data name="purchaseSuccess" xml:space="preserve">
<value>Спасибо за покупку полной версии приложения (^∇^) Для завершения настройки нам необходимо перезапустить приложение. Но вы можете сделать это позже (некоторые элементы могут неправильно отображаться)</value>
</data>
<data name="quit" xml:space="preserve"> <data name="quit" xml:space="preserve">
<value>Выйти</value> <value>Выйти</value>
</data> </data>
<data name="rate" xml:space="preserve">
<value>Нравится наше приложение? Напишите отзыв в магазине Майкрософт!</value>
</data>
<data name="searchPlaceholder.PlaceholderText" xml:space="preserve"> <data name="searchPlaceholder.PlaceholderText" xml:space="preserve">
<value>Поиск</value> <value>Поиск</value>
</data> </data>
<data name="sendEmail" xml:space="preserve">
<value>Отправить письмо</value>
</data>
<data name="settings.Content" xml:space="preserve"> <data name="settings.Content" xml:space="preserve">
<value>Настройки</value> <value>Настройки</value>
</data> </data>
<data name="signEx.Text" xml:space="preserve"> <data name="signEx.Text" xml:space="preserve">
<value>Войти с помощью существующего аккаунта Google</value> <value>Войти с помощью существующего аккаунта Google</value>
</data> </data>
<data name="signIn.Content" xml:space="preserve"> <data name="signIn.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>Войти в аккаунт</value> <value>Войти в аккаунт</value>
</data> </data>
<data name="signNew.Text" xml:space="preserve"> <data name="signNew.Text" xml:space="preserve">
@@ -192,6 +222,9 @@
<data name="subscriptions.Content" xml:space="preserve"> <data name="subscriptions.Content" xml:space="preserve">
<value>Подписки</value> <value>Подписки</value>
</data> </data>
<data name="sure" xml:space="preserve">
<value>Конечно!</value>
</data>
<data name="tryAgain" xml:space="preserve"> <data name="tryAgain" xml:space="preserve">
<value>Попробовать снова</value> <value>Попробовать снова</value>
</data> </data>
+33
View File
@@ -264,4 +264,37 @@
<data name="publishedAt" xml:space="preserve"> <data name="publishedAt" xml:space="preserve">
<value>Опубликовано</value> <value>Опубликовано</value>
</data> </data>
<data name="dialog.CloseButtonText" xml:space="preserve">
<value>Отмена</value>
</data>
<data name="dialog.PrimaryButtonText" xml:space="preserve">
<value>Создать и добавить</value>
</data>
<data name="dialog.Title" xml:space="preserve">
<value>Новый плейлист</value>
</data>
<data name="direct.Content" xml:space="preserve">
<value>Прямая ссылка</value>
</data>
<data name="newPlaylist.Text" xml:space="preserve">
<value>Новый плейлист</value>
</data>
<data name="newPlaylistName.PlaceholderText" xml:space="preserve">
<value>Введите название плейлиста</value>
</data>
<data name="privacy.Header" xml:space="preserve">
<value>Доступность</value>
</data>
<data name="private.Content" xml:space="preserve">
<value>Закрытый</value>
</data>
<data name="public.Content" xml:space="preserve">
<value>Публичный</value>
</data>
<data name="wl.Text" xml:space="preserve">
<value>Посмотреть позже</value>
</data>
<data name="live.Text" xml:space="preserve">
<value>🔴 ПРЯМОЙ ЭФИР</value>
</data>
</root> </root>
+17 -9
View File
@@ -2,7 +2,8 @@
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" xmlns:local="using:FoxTube"
xmlns:controls="using:FoxTube.Controls"> xmlns:controls="using:FoxTube.Controls"
xmlns:adverts="using:FoxTube.Controls.Adverts">
<Style TargetType="local:PlayerControls"> <Style TargetType="local:PlayerControls">
<Setter Property="IsTabStop" Value="False" /> <Setter Property="IsTabStop" Value="False" />
@@ -13,14 +14,12 @@
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="local:PlayerControls"> <ControlTemplate TargetType="local:PlayerControls">
<Grid Background="Transparent"> <Grid Background="Transparent" Name="root">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.Resources> <Grid.Resources>
<Style TargetType="Button" BasedOn="{StaticResource ButtonRevealStyle}">
<Setter Property="Width" Value="50"/>
<Setter Property="Height" Value="50"/>
<Setter Property="Background" Value="Transparent"/>
</Style>
<Style x:Key="AppBarButtonStyle" TargetType="AppBarButton"> <Style x:Key="AppBarButtonStyle" TargetType="AppBarButton">
<Setter Property="Width" Value="{ThemeResource MTCMediaButtonWidth}" /> <Setter Property="Width" Value="{ThemeResource MTCMediaButtonWidth}" />
<Setter Property="Height" Value="{ThemeResource MTCMediaButtonHeight}" /> <Setter Property="Height" Value="{ThemeResource MTCMediaButtonHeight}" />
@@ -483,6 +482,13 @@
<Border x:Name="Border"> <Border x:Name="Border">
<Grid x:Name="ControlPanelGrid"> <Grid x:Name="ControlPanelGrid">
<Grid.Resources>
<Style TargetType="Button" BasedOn="{StaticResource ButtonRevealStyle}">
<Setter Property="Width" Value="50"/>
<Setter Property="Height" Value="50"/>
<Setter Property="Background" Value="Transparent"/>
</Style>
</Grid.Resources>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="auto"/> <RowDefinition Height="auto"/>
<RowDefinition/> <RowDefinition/>
@@ -575,7 +581,7 @@
</Button.Flyout> </Button.Flyout>
</Button> </Button>
<Button x:Name="goLive" Width="NaN" Visibility="Collapsed"> <Button x:Name="goLive" Width="NaN" Visibility="Collapsed">
<TextBlock Text="🔴 LIVE"/> <TextBlock x:Uid="/VideoPage/live" Text="🔴 LIVE"/>
</Button> </Button>
</StackPanel> </StackPanel>
@@ -628,6 +634,8 @@
</Grid> </Grid>
</Border> </Border>
<controls:LiveCaptions Visibility="Collapsed" x:Name="captions"/> <controls:LiveCaptions Visibility="Collapsed" x:Name="captions"/>
<adverts:PlayerAdvert Grid.Row="1" x:Name="ad" VerticalAlignment="Bottom"/>
</Grid> </Grid>
</ControlTemplate> </ControlTemplate>
</Setter.Value> </Setter.Value>
+46
View File
@@ -0,0 +1,46 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ui="using:Microsoft.UI.Xaml.Controls">
<Color x:Key="SystemAccentColor">Red</Color>
<Style TargetType="Button" BasedOn="{StaticResource ButtonRevealStyle}">
<Setter Property="FontSize" Value="14"/>
</Style>
<Style TargetType="ListViewItem" BasedOn="{StaticResource ListViewItemRevealStyle}"/>
<Style TargetType="TextBlock">
<Setter Property="SelectionHighlightColor" Value="Red"/>
<Setter Property="FontSize" Value="14"/>
</Style>
<Style TargetType="TextBox">
<Setter Property="SelectionHighlightColor" Value="Red"/>
<Setter Property="FontSize" Value="14"/>
</Style>
<Style TargetType="ComboBox">
<Setter Property="Margin" Value="0,5,0,0"/>
<Setter Property="FontSize" Value="14"/>
</Style>
<Style TargetType="ToggleSwitch">
<Setter Property="FontSize" Value="14"/>
</Style>
<Style TargetType="RadioButton">
<Setter Property="FontSize" Value="14"/>
</Style>
<Style TargetType="Run">
<Setter Property="FontSize" Value="{StaticResource Size}"/>
</Style>
<Style TargetType="HyperlinkButton">
<Setter Property="FontSize" Value="14"/>
</Style>
<Style TargetType="AutoSuggestBox">
<Setter Property="FontSize" Value="14"/>
</Style>
<Style TargetType="ui:NavigationViewItem">
<Setter Property="FontSize" Value="14"/>
</Style>
<Style TargetType="ui:NavigationViewItemHeader">
<Setter Property="FontSize" Value="14"/>
</Style>
<Duration x:Key="CardOpacityDuration">0:0:0.5</Duration>
</ResourceDictionary>