diff --git a/FoxTube.Core/FoxTube.Core.csproj b/FoxTube.Core/FoxTube.Core.csproj
index 8cade6a..6b56580 100644
--- a/FoxTube.Core/FoxTube.Core.csproj
+++ b/FoxTube.Core/FoxTube.Core.csproj
@@ -130,6 +130,7 @@
PackageReference
+
@@ -154,7 +155,7 @@
0.13.0
- 1.0.1
+ 1.0.2
1.42.0
@@ -189,11 +190,6 @@
Visual C++ 2015 Runtime for Universal Windows Platform Apps
-
-
- ..\..\..\..\NuGet\microsoft.advertising.xaml\10.1811.22001\SDK\Windows Kits\10\ExtensionSDKs\Microsoft.Advertising.Xaml\10.0\References\CommonConfiguration\neutral\Microsoft.Advertising.winmd
-
-
14.0
diff --git a/FoxTube.Core/Helpers/Constants.cs b/FoxTube.Core/Helpers/Constants.cs
new file mode 100644
index 0000000..ac65322
--- /dev/null
+++ b/FoxTube.Core/Helpers/Constants.cs
@@ -0,0 +1,8 @@
+namespace FoxTube.Core.Helpers
+{
+ public static class Constants
+ {
+ public static string ApplicationId => "9ncqqxjtdlfh";
+ public static string AdsId => "1100044398";
+ }
+}
diff --git a/FoxTube.Core/Helpers/UsersControl.cs b/FoxTube.Core/Helpers/UsersControl.cs
index 9bdbed1..e5fde2b 100644
--- a/FoxTube.Core/Helpers/UsersControl.cs
+++ b/FoxTube.Core/Helpers/UsersControl.cs
@@ -11,6 +11,10 @@ using FoxTube.Core.Models;
using YouTube;
using System.Threading;
using Google.Apis.YouTube.v3;
+using System.Net.Http;
+using Google.Apis.Auth.OAuth2.Responses;
+using Newtonsoft.Json;
+using Google.Apis.Auth.OAuth2.Flows;
namespace FoxTube
{
@@ -41,15 +45,17 @@ namespace FoxTube
public static async Task AddUser()
{
- Uri callbackUri = WebAuthenticationBroker.GetCurrentApplicationCallbackUri();
- Uri requestString = AuthorizationHelpers.FormQueryString(ClientSecrets, callbackUri, Scopes);
+ Uri requestString = AuthorizationHelpers.FormQueryString(ClientSecrets, Scopes);
WebAuthenticationResult result = await WebAuthenticationBroker.AuthenticateAsync(WebAuthenticationOptions.UseTitle, requestString, AuthorizationHelpers.Endpoint);
switch(result.ResponseStatus)
{
case WebAuthenticationStatus.Success:
- UserCredential credential = await AuthorizationHelpers.ExchangeToken(ClientSecrets, new Regex(@"(?<=code=).?\w+").Match(result.ResponseData).Value);
+ string successCode = new Regex(@"(?<=code=)(.*?)(?=&)").Match(result.ResponseData).Value;
+
+ UserCredential credential = await AuthorizationHelpers.ExchangeToken(ClientSecrets, successCode);
CurrentUser = new User(credential);
+
PasswordVault passwordVault = new PasswordVault();
passwordVault.Add(new PasswordCredential("foxtube", CurrentUser.UserInfo.Id, credential.Token.RefreshToken));
return true;
diff --git a/FoxTube.Core/Helpers/Utils.cs b/FoxTube.Core/Helpers/Utils.cs
index 1f8cfdf..8c7a586 100644
--- a/FoxTube.Core/Helpers/Utils.cs
+++ b/FoxTube.Core/Helpers/Utils.cs
@@ -1,6 +1,7 @@
-using Microsoft.Advertising.WinRT.UI;
-using System;
+using System;
+using System.Collections.Generic;
using Windows.ApplicationModel.Core;
+using Windows.Security.Credentials;
namespace FoxTube.Core.Helpers
{
@@ -23,15 +24,17 @@ namespace FoxTube.Core.Helpers
///
/// Parameters which will be provided to new application instance
public static async void RestartApp(string args) =>
- await CoreApplication.RequestRestartAsync(args);
+ await CoreApplication.RequestRestartAsync(args ?? "");
public static void InitializeFailsafeProtocol()
{
Metrics.AddEvent("Failsafe protocol initiated");
Settings.ResetSettings();
+ PasswordVault passwordVault = new PasswordVault();
+ IReadOnlyList credentialEntries = passwordVault.RetrieveAll();
+ foreach (PasswordCredential credential in credentialEntries)
+ passwordVault.Remove(credential);
RestartApp();
}
-
- public static NativeAdsManagerV2 AdManager => new NativeAdsManagerV2("9ncqqxjtdlfh", "1100044398");
}
}
diff --git a/FoxTube.Tests/FoxTube.Tests.csproj b/FoxTube.Tests/FoxTube.Tests.csproj
index f9a1b16..27bca12 100644
--- a/FoxTube.Tests/FoxTube.Tests.csproj
+++ b/FoxTube.Tests/FoxTube.Tests.csproj
@@ -149,13 +149,13 @@
- 6.2.8
+ 6.2.9
- 1.4.0
+ 2.0.0
- 1.4.0
+ 2.0.0
diff --git a/FoxTube/Controls/Cards/AdvertCard.xaml.cs b/FoxTube/Controls/Cards/AdvertCard.xaml.cs
index ba58a57..76ec312 100644
--- a/FoxTube/Controls/Cards/AdvertCard.xaml.cs
+++ b/FoxTube/Controls/Cards/AdvertCard.xaml.cs
@@ -11,7 +11,7 @@ namespace FoxTube.Controls.Cards
///
public sealed partial class AdvertCard : UserControl
{
- NativeAdsManagerV2 manager = Utils.AdManager;
+ NativeAdsManagerV2 manager = new NativeAdsManagerV2(Constants.ApplicationId, Constants.AdsId);
NativeAdV2 advert;
public AdvertCard()
{
@@ -21,7 +21,7 @@ namespace FoxTube.Controls.Cards
manager.RequestAd();
}
- private void ErrorOccurred(object sender, NativeAdErrorEventArgs e)
+ void ErrorOccurred(object sender, NativeAdErrorEventArgs e)
{
(Parent as StaggeredPanel)?.Children.Remove(this);
Metrics.AddEvent("Error has occured while loading ad",
@@ -30,7 +30,7 @@ namespace FoxTube.Controls.Cards
("Request ID", e.RequestId));
}
- private void AdReady(object sender, NativeAdReadyEventArgs e)
+ void AdReady(object sender, NativeAdReadyEventArgs e)
{
advert = e.NativeAd;
diff --git a/FoxTube/MainPage.xaml b/FoxTube/MainPage.xaml
index b56294a..a9b86df 100644
--- a/FoxTube/MainPage.xaml
+++ b/FoxTube/MainPage.xaml
@@ -74,64 +74,64 @@
-
-
+
+
-
+
-
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+