diff --git a/FoxTube/Assets/Data/Patchnotes.xml b/FoxTube/Assets/Data/Patchnotes.xml
index d57de83..8a84cae 100644
--- a/FoxTube/Assets/Data/Patchnotes.xml
+++ b/FoxTube/Assets/Data/Patchnotes.xml
@@ -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
### Что нового:
- Добавлено уведомление со списком изменений при первом запуске после обновления
@@ -21,6 +22,7 @@
- Добавлена поддержка Апрельского Обновления 2018 (Windows 10 сборка 17134)
- Добавлена реклама
- Исправлено изменение заголовков
+- Некоторые пункты меню перемещены в заголовок
diff --git a/FoxTube/Classes/SecretsVault.cs b/FoxTube/Classes/SecretsVault.cs
index 197b339..307a658 100644
--- a/FoxTube/Classes/SecretsVault.cs
+++ b/FoxTube/Classes/SecretsVault.cs
@@ -110,9 +110,9 @@ namespace FoxTube
///
public static void Initialize()
{
- CheckAuthorization();
// TODO: Reactivate addons initialization
- //CheckAddons();
+ CheckAddons();
+ CheckAuthorization();
}
///
diff --git a/FoxTube/Controls/Adverts/CommentAdvert.xaml b/FoxTube/Controls/Adverts/CommentAdvert.xaml
new file mode 100644
index 0000000..39d1fc2
--- /dev/null
+++ b/FoxTube/Controls/Adverts/CommentAdvert.xaml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FoxTube/Controls/Adverts/CommentAdvert.xaml.cs b/FoxTube/Controls/Adverts/CommentAdvert.xaml.cs
new file mode 100644
index 0000000..c450839
--- /dev/null
+++ b/FoxTube/Controls/Adverts/CommentAdvert.xaml.cs
@@ -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
+{
+ ///
+ /// Advert which is looks similar to video comment
+ ///
+ 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 { 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;
+ }
+ }
+}
diff --git a/FoxTube/FoxTube.csproj b/FoxTube/FoxTube.csproj
index 9554342..85b9eff 100644
--- a/FoxTube/FoxTube.csproj
+++ b/FoxTube/FoxTube.csproj
@@ -113,6 +113,9 @@
CardAdvert.xaml
+
+ CommentAdvert.xaml
+
ChannelCard.xaml
@@ -282,6 +285,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
diff --git a/FoxTube/Pages/CommentsPage.xaml b/FoxTube/Pages/CommentsPage.xaml
index daf3362..65e3703 100644
--- a/FoxTube/Pages/CommentsPage.xaml
+++ b/FoxTube/Pages/CommentsPage.xaml
@@ -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}">
diff --git a/FoxTube/Pages/CommentsPage.xaml.cs b/FoxTube/Pages/CommentsPage.xaml.cs
index 16f2706..c1c614c 100644
--- a/FoxTube/Pages/CommentsPage.xaml.cs
+++ b/FoxTube/Pages/CommentsPage.xaml.cs
@@ -51,7 +51,11 @@ 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();
diff --git a/FoxTube/Pages/MainPage.xaml b/FoxTube/Pages/MainPage.xaml
index dae2056..64aad07 100644
--- a/FoxTube/Pages/MainPage.xaml
+++ b/FoxTube/Pages/MainPage.xaml
@@ -37,7 +37,49 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -78,11 +120,11 @@
-
+
@@ -90,7 +132,7 @@
-
+
diff --git a/FoxTube/Pages/MainPage.xaml.cs b/FoxTube/Pages/MainPage.xaml.cs
index d3c9499..afb86c1 100644
--- a/FoxTube/Pages/MainPage.xaml.cs
+++ b/FoxTube/Pages/MainPage.xaml.cs
@@ -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();
}
diff --git a/FoxTube/Pages/VideoGrid.xaml.cs b/FoxTube/Pages/VideoGrid.xaml.cs
index f17b5af..029c214 100644
--- a/FoxTube/Pages/VideoGrid.xaml.cs
+++ b/FoxTube/Pages/VideoGrid.xaml.cs
@@ -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);
diff --git a/FoxTube/Strings/en-US/Main.resw b/FoxTube/Strings/en-US/Main.resw
index f82db5d..c0e8941 100644
--- a/FoxTube/Strings/en-US/Main.resw
+++ b/FoxTube/Strings/en-US/Main.resw
@@ -135,7 +135,7 @@
Downloads
-
+
Give a feedback
@@ -180,7 +180,7 @@
Sign in with existing account
-
+
Add account
diff --git a/FoxTube/Strings/ru-RU/Main.resw b/FoxTube/Strings/ru-RU/Main.resw
index 34aad54..340c01e 100644
--- a/FoxTube/Strings/ru-RU/Main.resw
+++ b/FoxTube/Strings/ru-RU/Main.resw
@@ -135,7 +135,7 @@
Загрузки
-
+
Оставить отзыв
@@ -180,7 +180,7 @@
Войти с помощью существующего аккаунта Google
-
+
Войти в аккаунт