Video cards fixes. Localization fixes. CardAdvert created
Related Work Items: #244, #245
This commit is contained in:
@@ -131,11 +131,6 @@
|
|||||||
<Version>6.1.5</Version>
|
<Version>6.1.5</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="System.Net.WebClient">
|
|
||||||
<HintPath>..\..\..\..\..\..\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.netcore.universalwindowsplatform\6.1.5\ref\uap10.0.15138\System.Net.WebClient.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup />
|
<ItemGroup />
|
||||||
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' ">
|
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' ">
|
||||||
<VisualStudioVersion>14.0</VisualStudioVersion>
|
<VisualStudioVersion>14.0</VisualStudioVersion>
|
||||||
|
|||||||
@@ -36,18 +36,6 @@ namespace FoxTube
|
|||||||
get { return (Window.Current.Content as Frame).Content as MainPage; }
|
get { return (Window.Current.Content as Frame).Content as MainPage; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CardAdvert CardAdvert { get; private set; }
|
|
||||||
|
|
||||||
public static void InitializeAds()
|
|
||||||
{
|
|
||||||
NativeAdsManagerV2 manager = new NativeAdsManagerV2(SecretsVault.AppId, SecretsVault.AdUnitId);
|
|
||||||
manager.AdReady += (s, e) =>
|
|
||||||
{
|
|
||||||
card = new CardAdvert(e.NativeAd);
|
|
||||||
e.NativeAd.RegisterAdContainer(card);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void CloseApp()
|
public static void CloseApp()
|
||||||
{
|
{
|
||||||
CoreApplication.Exit();
|
CoreApplication.Exit();
|
||||||
|
|||||||
@@ -2,13 +2,13 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using FoxTube.Controls.Adverts;
|
|
||||||
using Google.Apis.Auth.OAuth2;
|
using Google.Apis.Auth.OAuth2;
|
||||||
using Google.Apis.Services;
|
using Google.Apis.Services;
|
||||||
using Google.Apis.YouTube.v3;
|
using Google.Apis.YouTube.v3;
|
||||||
using Google.Apis.YouTube.v3.Data;
|
using Google.Apis.YouTube.v3.Data;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Windows.Storage;
|
using Windows.Storage;
|
||||||
|
using Windows.Services.Store;
|
||||||
|
|
||||||
namespace FoxTube
|
namespace FoxTube
|
||||||
{
|
{
|
||||||
@@ -18,7 +18,7 @@ namespace FoxTube
|
|||||||
//Events
|
//Events
|
||||||
public static event ObjectEventHandler AuthorizationStateChanged;
|
public static event ObjectEventHandler AuthorizationStateChanged;
|
||||||
public static event ObjectEventHandler SubscriptionsChanged;
|
public static event ObjectEventHandler SubscriptionsChanged;
|
||||||
public static event Event NotPurchased; //Rising when app finds out that it's not a PRO version
|
public static event ObjectEventHandler Purchased; //Rising when app finds out that it's not a PRO version
|
||||||
|
|
||||||
//Private properties
|
//Private properties
|
||||||
private static ClientSecrets Secrets => new ClientSecrets()
|
private static ClientSecrets Secrets => new ClientSecrets()
|
||||||
@@ -37,8 +37,8 @@ namespace FoxTube
|
|||||||
ApplicationName = "FoxTube"
|
ApplicationName = "FoxTube"
|
||||||
};
|
};
|
||||||
public static YouTubeService Service => IsAuthorized ? new YouTubeService(Initializer) : NoAuthService;
|
public static YouTubeService Service => IsAuthorized ? new YouTubeService(Initializer) : NoAuthService;
|
||||||
public static string AppId => "d25517cb-12d4-4699-8bdc-52040c712cab";
|
public static string AppId => true ? "d25517cb-12d4-4699-8bdc-52040c712cab" : "9ncqqxjtdlfh";
|
||||||
public static string AdUnitId => "test";
|
public static string AdUnitId => true ? "test" : "1100037769";
|
||||||
public static bool AdsDisabled { get; private set; } = true;
|
public static bool AdsDisabled { get; private set; } = true;
|
||||||
|
|
||||||
//User info
|
//User info
|
||||||
@@ -196,15 +196,38 @@ namespace FoxTube
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Connects to MS Store and checks if user has bought ad-free
|
/// Connects to MS Store and checks if user has bought ad-free
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void CheckAddons()
|
public static async void CheckAddons()
|
||||||
{
|
{
|
||||||
//TODO: Check addons list
|
try
|
||||||
bool purchased = true;
|
{
|
||||||
|
StoreContext store = StoreContext.GetDefault();
|
||||||
|
StoreProductQueryResult requset = await store.GetAssociatedStoreProductsAsync(new[] { "Consumable", "Durable", "UnmanagedConsumable" });
|
||||||
|
|
||||||
if(!purchased)
|
if (!requset.Products["foxtube-adsremove"].IsInUserCollection)
|
||||||
{
|
{
|
||||||
AdsDisabled = false;
|
AdsDisabled = false;
|
||||||
NotPurchased?.Invoke();
|
Purchased?.Invoke(args:false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async void GetAdblock()
|
||||||
|
{
|
||||||
|
StoreContext store = StoreContext.GetDefault();
|
||||||
|
StorePurchaseResult request = await store.RequestPurchaseAsync("foxtube-adsremove");
|
||||||
|
|
||||||
|
switch (request.Status)
|
||||||
|
{
|
||||||
|
case StorePurchaseStatus.AlreadyPurchased:
|
||||||
|
Purchased?.Invoke(args: true);
|
||||||
|
AdsDisabled = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case StorePurchaseStatus.Succeeded:
|
||||||
|
Purchased?.Invoke(args: true);
|
||||||
|
AdsDisabled = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ namespace FoxTube.Controls
|
|||||||
Visibility = Visibility.Visible;
|
Visibility = Visibility.Visible;
|
||||||
else
|
else
|
||||||
Visibility = Visibility.Collapsed;
|
Visibility = Visibility.Collapsed;
|
||||||
SecretsVault.NotPurchased += () => Visibility = Visibility.Visible;
|
SecretsVault.Purchased += (s, e) => Visibility = (bool)e[0] ? Visibility.Collapsed : Visibility.Visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Grid_SizeChanged(object sender, SizeChangedEventArgs e)
|
private void Grid_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ using Windows.UI.Xaml;
|
|||||||
using Windows.UI.Xaml.Controls;
|
using Windows.UI.Xaml.Controls;
|
||||||
using Microsoft.Advertising.WinRT.UI;
|
using Microsoft.Advertising.WinRT.UI;
|
||||||
using Windows.UI.Xaml.Media.Imaging;
|
using Windows.UI.Xaml.Media.Imaging;
|
||||||
using System.Diagnostics;
|
|
||||||
|
|
||||||
namespace FoxTube.Controls.Adverts
|
namespace FoxTube.Controls.Adverts
|
||||||
{
|
{
|
||||||
@@ -12,12 +11,20 @@ namespace FoxTube.Controls.Adverts
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed partial class CardAdvert : UserControl
|
public sealed partial class CardAdvert : UserControl
|
||||||
{
|
{
|
||||||
NativeAdV2 advert;
|
NativeAdsManagerV2 manager = new NativeAdsManagerV2(SecretsVault.AppId, SecretsVault.AdUnitId);
|
||||||
public CardAdvert(NativeAdV2 ad)
|
public NativeAdV2 advert;
|
||||||
|
public CardAdvert()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
advert = ad;
|
manager.AdReady += AdReady;
|
||||||
|
manager.RequestAd();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AdReady(object sender, NativeAdReadyEventArgs e)
|
||||||
|
{
|
||||||
|
advert = e.NativeAd;
|
||||||
Initialize();
|
Initialize();
|
||||||
|
e.NativeAd.RegisterAdContainer(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Initialize()
|
public void Initialize()
|
||||||
@@ -43,6 +50,8 @@ namespace FoxTube.Controls.Adverts
|
|||||||
desc.Text = advert.CallToActionText;
|
desc.Text = advert.CallToActionText;
|
||||||
else
|
else
|
||||||
desc.Text = advert.Price;
|
desc.Text = advert.Price;
|
||||||
|
|
||||||
|
Visibility = Visibility.Visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UserControl_SizeChanged(object sender, SizeChangedEventArgs e)
|
private void UserControl_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
</NavigationViewItem.Icon>
|
</NavigationViewItem.Icon>
|
||||||
</NavigationViewItem>
|
</NavigationViewItem>
|
||||||
|
|
||||||
<NavigationViewItem x:Uid="/Main/adsFree" Content="Remove ads" Visibility="Collapsed" Name="removeAds">
|
<NavigationViewItem x:Uid="/Main/adsFree" Content="Remove ads" Visibility="Collapsed" Tapped="RemoveAds_Tapped" Name="removeAds">
|
||||||
<NavigationViewItem.Icon>
|
<NavigationViewItem.Icon>
|
||||||
<FontIcon Glyph=""/>
|
<FontIcon Glyph=""/>
|
||||||
</NavigationViewItem.Icon>
|
</NavigationViewItem.Icon>
|
||||||
|
|||||||
@@ -44,7 +44,11 @@ namespace FoxTube
|
|||||||
|
|
||||||
SecretsVault.AuthorizationStateChanged += AuthorizationStateChanged;
|
SecretsVault.AuthorizationStateChanged += AuthorizationStateChanged;
|
||||||
SecretsVault.SubscriptionsChanged += SecretsVault_SubscriptionsChanged;
|
SecretsVault.SubscriptionsChanged += SecretsVault_SubscriptionsChanged;
|
||||||
SecretsVault.NotPurchased += () => removeAds.Visibility = Visibility.Visible;
|
SecretsVault.Purchased += (sender, e) =>
|
||||||
|
{
|
||||||
|
removeAds.Visibility = (e[0] as bool?).Value ? Visibility.Collapsed : Visibility.Visible;
|
||||||
|
content.Navigate(typeof(Home));
|
||||||
|
};
|
||||||
SecretsVault.CheckAuthorization();
|
SecretsVault.CheckAuthorization();
|
||||||
SecretsVault.CheckAddons();
|
SecretsVault.CheckAddons();
|
||||||
|
|
||||||
@@ -740,5 +744,10 @@ namespace FoxTube
|
|||||||
{
|
{
|
||||||
((NavigationViewItem)sender).ContextFlyout.ShowAt((NavigationViewItem)sender);
|
((NavigationViewItem)sender).ContextFlyout.ShowAt((NavigationViewItem)sender);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void RemoveAds_Tapped(object sender, TappedRoutedEventArgs e)
|
||||||
|
{
|
||||||
|
SecretsVault.GetAdblock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using FoxTube.Controls.Adverts;
|
using FoxTube.Controls.Adverts;
|
||||||
using Windows.UI.Xaml;
|
using Windows.UI.Xaml;
|
||||||
using Windows.UI.Xaml.Controls;
|
using Windows.UI.Xaml.Controls;
|
||||||
|
using Windows.UI.Xaml.Navigation;
|
||||||
|
|
||||||
namespace FoxTube.Pages
|
namespace FoxTube.Pages
|
||||||
{
|
{
|
||||||
@@ -17,8 +18,8 @@ namespace FoxTube.Pages
|
|||||||
public void Add(UIElement card)
|
public void Add(UIElement card)
|
||||||
{
|
{
|
||||||
list.Items.Add(card);
|
list.Items.Add(card);
|
||||||
if (list.Items.Count % 5 == 0)
|
/*if (list.Items.Count % 10 == 0)
|
||||||
list.Items.Add(new CardAdvert());
|
list.Items.Add(new CardAdvert());*/
|
||||||
empty.Visibility = Visibility.Collapsed;
|
empty.Visibility = Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using FoxTube.Controls;
|
using FoxTube.Controls;
|
||||||
|
using FoxTube.Controls.Adverts;
|
||||||
using Google.Apis.YouTube.v3;
|
using Google.Apis.YouTube.v3;
|
||||||
using Google.Apis.YouTube.v3.Data;
|
using Google.Apis.YouTube.v3.Data;
|
||||||
using System;
|
using System;
|
||||||
|
|||||||
@@ -151,7 +151,7 @@
|
|||||||
<value>Liked videos</value>
|
<value>Liked videos</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="metered" xml:space="preserve">
|
<data name="metered" xml:space="preserve">
|
||||||
<value>"You are on metered connection now. Additional charges may apply. Do you want to continue?"</value>
|
<value>You are on metered connection now. Additional charges may apply. Do you want to continue?</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="myChannel.Content" xml:space="preserve">
|
<data name="myChannel.Content" xml:space="preserve">
|
||||||
<value>My channel</value>
|
<value>My channel</value>
|
||||||
@@ -180,6 +180,9 @@
|
|||||||
<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">
|
||||||
|
<value>Add account</value>
|
||||||
|
</data>
|
||||||
<data name="signNew.Text" xml:space="preserve">
|
<data name="signNew.Text" xml:space="preserve">
|
||||||
<value>Create new Google account</value>
|
<value>Create new Google account</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -151,10 +151,7 @@
|
|||||||
<value>Понравившиеся</value>
|
<value>Понравившиеся</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="metered" xml:space="preserve">
|
<data name="metered" xml:space="preserve">
|
||||||
<value>"You are on metered connection now. Additional charges may apply. Do you want to continue?"</value>
|
<value>Передача данных в этой сети ограничена. Может взиматься дополнительная плата. Вы хотите продолжить?</value>
|
||||||
</data>
|
|
||||||
<data name="myAccount.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
|
||||||
<value>Мой аккаунт</value>
|
|
||||||
</data>
|
</data>
|
||||||
<data name="myChannel.Content" xml:space="preserve">
|
<data name="myChannel.Content" xml:space="preserve">
|
||||||
<value>Мой канал</value>
|
<value>Мой канал</value>
|
||||||
@@ -168,9 +165,6 @@
|
|||||||
<data name="no" xml:space="preserve">
|
<data name="no" xml:space="preserve">
|
||||||
<value>Нет</value>
|
<value>Нет</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="notifications.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
|
||||||
<value>Уведомления</value>
|
|
||||||
</data>
|
|
||||||
<data name="playlist" xml:space="preserve">
|
<data name="playlist" xml:space="preserve">
|
||||||
<value>Плейлист</value>
|
<value>Плейлист</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -186,8 +180,8 @@
|
|||||||
<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.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
<data name="signIn.Content" xml:space="preserve">
|
||||||
<value>Войти</value>
|
<value>Войти в аккаунт</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="signNew.Text" xml:space="preserve">
|
<data name="signNew.Text" xml:space="preserve">
|
||||||
<value>Создать новый аккаунт Google</value>
|
<value>Создать новый аккаунт Google</value>
|
||||||
|
|||||||
Reference in New Issue
Block a user