Added CommentAdvert
Activated pro version validation Leave feedback and account buttons were moved to header
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
- Added support of April 2018 Update (Windows 10 build 17134)
|
||||
- Added adverts
|
||||
- Fixed header titles
|
||||
- Some items were moved from menu to header
|
||||
</en-US>
|
||||
<ru-RU>### Что нового:
|
||||
- Добавлено уведомление со списком изменений при первом запуске после обновления
|
||||
@@ -21,6 +22,7 @@
|
||||
- Добавлена поддержка Апрельского Обновления 2018 (Windows 10 сборка 17134)
|
||||
- Добавлена реклама
|
||||
- Исправлено изменение заголовков
|
||||
- Некоторые пункты меню перемещены в заголовок
|
||||
</ru-RU>
|
||||
</content>
|
||||
</item>
|
||||
|
||||
@@ -110,9 +110,9 @@ namespace FoxTube
|
||||
/// </summary>
|
||||
public static void Initialize()
|
||||
{
|
||||
CheckAuthorization();
|
||||
// TODO: Reactivate addons initialization
|
||||
//CheckAddons();
|
||||
CheckAddons();
|
||||
CheckAuthorization();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
<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">
|
||||
|
||||
<Grid Margin="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="60"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<PersonPicture Margin="5,30,5,5" Name="icon" Initials="" 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" Style="{StaticResource SubtitleTextBlockStyle}"/>
|
||||
<TextBlock Name="description" Text="Description" TextWrapping="WrapWholeWords"/>
|
||||
|
||||
<Button Name="cta" Content="CALL TO ACTION TEXT" Margin="0,5"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,53 @@
|
||||
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 = advert.Description.GuardFromNull();
|
||||
icon.ProfilePicture = advert.AdIcon == null ? null : advert.AdIcon.Source;
|
||||
|
||||
cta.Content = advert.CallToActionText.GuardFromNull();
|
||||
cta.Visibility = advert.CallToActionText.IsNullOrWhiteSpace() ? Visibility.Collapsed : Visibility.Visible;
|
||||
|
||||
meta.Text += advert.Price;
|
||||
meta.Text += " " + advert.Rating;
|
||||
meta.Visibility = meta.Text.IsNullOrWhiteSpace() ? Visibility.Collapsed : Visibility.Visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -113,6 +113,9 @@
|
||||
<Compile Include="Controls\Adverts\CardAdvert.xaml.cs">
|
||||
<DependentUpon>CardAdvert.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Controls\Adverts\CommentAdvert.xaml.cs">
|
||||
<DependentUpon>CommentAdvert.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Controls\ChannelCard.xaml.cs">
|
||||
<DependentUpon>ChannelCard.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -282,6 +285,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Controls\Adverts\CommentAdvert.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Controls\ChannelCard.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:controls="using:FoxTube.Controls"
|
||||
xmlns:adverts="using:FoxTube.Controls.Adverts"
|
||||
mc:Ignorable="d"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
|
||||
|
||||
@@ -51,8 +51,12 @@ namespace FoxTube.Pages
|
||||
more.Visibility = Visibility.Collapsed;
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveComment(CommentCard commentCard, string topCommentId = null)
|
||||
{
|
||||
@@ -156,7 +160,11 @@ namespace FoxTube.Pages
|
||||
var response = await request.ExecuteAsync();
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
token = response.NextPageToken;
|
||||
more.Complete();
|
||||
|
||||
@@ -37,7 +37,49 @@
|
||||
<ui:NavigationView FontSize="14" SelectedItem="toHome" BackRequested="Nav_BackRequested" PaneClosing="Nav_PaneClosing" PaneOpened="Nav_PaneOpened" OpenPaneLength="300" Name="nav" SelectionChanged="Nav_SelectionChanged">
|
||||
|
||||
<ui:NavigationView.Header>
|
||||
<TextBlock Name="Title" Style="{StaticResource TitleTextBlockStyle}"/>
|
||||
<Grid>
|
||||
<TextBlock Text="Home" 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="" 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="" 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=""/>
|
||||
</AppBarButton.Icon>
|
||||
</AppBarButton>
|
||||
<AppBarButton Label="Add account">
|
||||
<AppBarButton.Icon>
|
||||
<FontIcon Glyph=""/>
|
||||
</AppBarButton.Icon>
|
||||
</AppBarButton>
|
||||
<AppBarButton>
|
||||
<AppBarButton.Content>
|
||||
<PersonPicture/>
|
||||
</AppBarButton.Content>
|
||||
</AppBarButton>
|
||||
</CommandBar>
|
||||
</Grid>
|
||||
</ui:NavigationView.Header>
|
||||
|
||||
<ui:NavigationView.MenuItemTemplate>
|
||||
@@ -78,11 +120,11 @@
|
||||
</TransitionCollection>
|
||||
</ui:NavigationViewList.ItemContainerTransitions>
|
||||
<ui:NavigationViewItem Name="openWeb" Tapped="Web_Tapped" Icon="Globe" Content="Browser" Visibility="Collapsed"/>
|
||||
<ui: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">
|
||||
<ui:NavigationViewItem.Icon>
|
||||
<FontIcon Glyph=""/>
|
||||
</ui:NavigationViewItem.Icon>
|
||||
</ui:NavigationViewItem>
|
||||
</ui:NavigationViewItem>-->
|
||||
|
||||
<ui:NavigationViewItem x:Uid="/Main/adsFree" Content="Remove ads" Visibility="Collapsed" Tapped="RemoveAds_Tapped" Name="removeAds">
|
||||
<ui:NavigationViewItem.Icon>
|
||||
@@ -90,7 +132,7 @@
|
||||
</ui:NavigationViewItem.Icon>
|
||||
</ui:NavigationViewItem>
|
||||
|
||||
<ui: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">
|
||||
<ui:NavigationViewItem.Icon>
|
||||
<FontIcon Glyph=""/>
|
||||
</ui:NavigationViewItem.Icon>
|
||||
@@ -118,7 +160,7 @@
|
||||
</Grid>
|
||||
</Flyout>
|
||||
</ui:NavigationViewItem.ContextFlyout>
|
||||
</ui:NavigationViewItem>
|
||||
</ui:NavigationViewItem>-->
|
||||
</ui:NavigationViewList>
|
||||
</ui:NavigationView.PaneFooter>
|
||||
|
||||
|
||||
@@ -41,8 +41,10 @@ namespace FoxTube
|
||||
SecretsVault.SubscriptionsChanged += SecretsVault_SubscriptionsChanged;
|
||||
SecretsVault.Purchased += async (sender, e) =>
|
||||
{
|
||||
//TODO: Localize strings
|
||||
removeAds.Visibility = (e[0] as bool?).Value ? Visibility.Collapsed : Visibility.Visible;
|
||||
if (!(bool)e[0])
|
||||
return;
|
||||
//TODO: Localize strings
|
||||
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");
|
||||
dialog.Commands.Add(new UICommand("Close the app", (command) => Methods.CloseApp()));
|
||||
dialog.Commands.Add(new UICommand("Later"));
|
||||
@@ -174,10 +176,11 @@ namespace FoxTube
|
||||
case true:
|
||||
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;
|
||||
avatarFlyout.ProfilePicture = new BitmapImage(SecretsVault.UserInfo.Picture.ToUri());
|
||||
((avatar.Content as StackPanel).Children[0] as PersonPicture).ProfilePicture = avatarFlyout.ProfilePicture;
|
||||
(avatar.Content as PersonPicture).ProfilePicture = avatarFlyout.ProfilePicture;
|
||||
|
||||
avatar.Visibility = Visibility.Visible;
|
||||
|
||||
@@ -247,12 +250,12 @@ namespace FoxTube
|
||||
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();
|
||||
}
|
||||
|
||||
private void SignIn_Click(object sender, TappedRoutedEventArgs e)
|
||||
private void SignIn_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
SecretsVault.Authorize();
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace FoxTube.Pages
|
||||
(grid.Children[Count % cols + 1] as StackPanel).Children.Add(card);
|
||||
Children.Add(card);
|
||||
|
||||
if ((Children.Count - 5) % 20 == 0)
|
||||
if ((Children.Count - 5) % 20 == 0 && !SecretsVault.AdsDisabled)
|
||||
{
|
||||
CardAdvert advert = new CardAdvert(IsRelatedVideos);
|
||||
(grid.Children[Count % cols + 1] as StackPanel).Children.Add(advert);
|
||||
|
||||
@@ -135,7 +135,7 @@
|
||||
<data name="downloads.Content" xml:space="preserve">
|
||||
<value>Downloads</value>
|
||||
</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>
|
||||
</data>
|
||||
<data name="history.Content" xml:space="preserve">
|
||||
@@ -180,7 +180,7 @@
|
||||
<data name="signEx.Text" xml:space="preserve">
|
||||
<value>Sign in with existing account</value>
|
||||
</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>
|
||||
</data>
|
||||
<data name="signNew.Text" xml:space="preserve">
|
||||
|
||||
@@ -135,7 +135,7 @@
|
||||
<data name="downloads.Content" xml:space="preserve">
|
||||
<value>Загрузки</value>
|
||||
</data>
|
||||
<data name="feedback.Content" xml:space="preserve">
|
||||
<data name="feedback.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>Оставить отзыв</value>
|
||||
</data>
|
||||
<data name="history.Content" xml:space="preserve">
|
||||
@@ -180,7 +180,7 @@
|
||||
<data name="signEx.Text" xml:space="preserve">
|
||||
<value>Войти с помощью существующего аккаунта Google</value>
|
||||
</data>
|
||||
<data name="signIn.Content" xml:space="preserve">
|
||||
<data name="signIn.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>Войти в аккаунт</value>
|
||||
</data>
|
||||
<data name="signNew.Text" xml:space="preserve">
|
||||
|
||||
Reference in New Issue
Block a user