-Fixed Unspecified error on App.e.g.cs
-Refactoring
This commit is contained in:
@@ -11,18 +11,6 @@ namespace FoxTube
|
|||||||
|
|
||||||
public delegate void ObjectEventHandler(object sender, params object[] args);
|
public delegate void ObjectEventHandler(object sender, params object[] args);
|
||||||
|
|
||||||
/*public class SearchParameters
|
|
||||||
{
|
|
||||||
public string ChannelId { get; set; }
|
|
||||||
public string Term { get; set; }
|
|
||||||
|
|
||||||
public SearchParameters(string channelId, string term)
|
|
||||||
{
|
|
||||||
ChannelId = channelId;
|
|
||||||
Term = term;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
public class SearchParameters
|
public class SearchParameters
|
||||||
{
|
{
|
||||||
public class Filters
|
public class Filters
|
||||||
+39
-124
@@ -16,76 +16,49 @@ using Windows.UI.Popups;
|
|||||||
|
|
||||||
namespace FoxTube
|
namespace FoxTube
|
||||||
{
|
{
|
||||||
/*public class HistoryItem
|
|
||||||
{
|
|
||||||
public string Id { get; set; }
|
|
||||||
public double LeftOn { get; set; }
|
|
||||||
|
|
||||||
public HistoryItem(string id, TimeSpan elapsed, TimeSpan total)
|
|
||||||
{
|
|
||||||
Id = id;
|
|
||||||
LeftOn = elapsed.TotalSeconds / total.TotalSeconds * 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
public HistoryItem(string id)
|
|
||||||
{
|
|
||||||
Id = id;
|
|
||||||
LeftOn = 0;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
public static class SecretsVault
|
public static class SecretsVault
|
||||||
{
|
{
|
||||||
public static event EventHandler AuthorizationStateChanged;
|
#region Properties
|
||||||
|
//Events
|
||||||
|
public static event Event 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
|
||||||
|
|
||||||
private static ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
|
//Private properties
|
||||||
public static NetworkCredential EmailCredential => new NetworkCredential("youwillneverknowthisadress@gmail.com", "thisisthepassword12345");
|
private static ClientSecrets Secrets => new ClientSecrets()
|
||||||
public static ClientSecrets Secrets => new ClientSecrets()
|
|
||||||
{
|
{
|
||||||
ClientId = "349735264870-2ekqlm0a4mkg3mmrfcv90s3qp3o15dq0.apps.googleusercontent.com",
|
ClientId = "349735264870-2ekqlm0a4mkg3mmrfcv90s3qp3o15dq0.apps.googleusercontent.com",
|
||||||
ClientSecret = "BkVZOAaCU2Zclf0Zlicg6y2_"
|
ClientSecret = "BkVZOAaCU2Zclf0Zlicg6y2_"
|
||||||
};
|
};
|
||||||
private static UserCredential Credential;
|
private static YouTubeService NoAuthService => new YouTubeService(new BaseClientService.Initializer()
|
||||||
|
{
|
||||||
|
ApiKey = "AIzaSyBgHrCnrlzlVmk0cJKL8RqP9Y8x6XSuk_0",
|
||||||
|
ApplicationName = "FoxTube"
|
||||||
|
});
|
||||||
public static BaseClientService.Initializer Initializer => new BaseClientService.Initializer()
|
public static BaseClientService.Initializer Initializer => new BaseClientService.Initializer()
|
||||||
{
|
{
|
||||||
HttpClientInitializer = Credential,
|
HttpClientInitializer = Credential,
|
||||||
ApplicationName = "FoxTube"
|
ApplicationName = "FoxTube"
|
||||||
};
|
};
|
||||||
|
public static YouTubeService Service => IsAuthorized ? new YouTubeService(Initializer) : NoAuthService;
|
||||||
|
public static bool AdsDisabled { get; private set; } = true;
|
||||||
|
|
||||||
public static string AccountId { get; private set; }
|
//User info
|
||||||
public static bool IsAuthorized { get; private set; } = false;
|
public static bool IsAuthorized => Credential != null;
|
||||||
|
private static UserCredential Credential { get; set; }
|
||||||
|
|
||||||
|
public static string AccountId => UserChannel?.Id;
|
||||||
public static Channel UserChannel { get; private set; }
|
public static Channel UserChannel { get; private set; }
|
||||||
/*public static List<string> WatchLater { get; private set; } = new List<string>();
|
|
||||||
public static List<HistoryItem> UserHistory { get; private set; } = new List<HistoryItem>();*/
|
|
||||||
public static List<Subscription> Subscriptions { get; private set; } = new List<Subscription>();
|
|
||||||
|
|
||||||
public static YouTubeService NoAuthService => new YouTubeService(new BaseClientService.Initializer()
|
public static List<Subscription> Subscriptions { get; } = new List<Subscription>();
|
||||||
{
|
#endregion
|
||||||
ApiKey = "AIzaSyBgHrCnrlzlVmk0cJKL8RqP9Y8x6XSuk_0",
|
|
||||||
ApplicationName = "FoxTube"
|
|
||||||
});
|
|
||||||
public static YouTubeService Service
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (IsAuthorized)
|
|
||||||
return new YouTubeService(Initializer);
|
|
||||||
else
|
|
||||||
return NoAuthService;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*public static void HistoryAdd(string id, TimeSpan elapsed, TimeSpan total)
|
|
||||||
{
|
|
||||||
UserHistory.Remove(UserHistory.Find(x => x.Id == id));
|
|
||||||
UserHistory.Add(new HistoryItem(id, elapsed, total));
|
|
||||||
|
|
||||||
if (UserHistory.Count > 100)
|
|
||||||
UserHistory.RemoveAt(UserHistory.Count - 1);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
/// <summary>
|
||||||
|
/// Subscribes or unsibscribes authorized user from the channel
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The ID of channel which has to be added/removed</param>
|
||||||
|
/// <returns>Returns 'true' if channel is in subscriptions now; 'false' if it's not</returns>
|
||||||
public static async Task<bool> ChangeSubscriptionState(string id)
|
public static async Task<bool> ChangeSubscriptionState(string id)
|
||||||
{
|
{
|
||||||
if (!IsAuthorized)
|
if (!IsAuthorized)
|
||||||
@@ -125,62 +98,10 @@ namespace FoxTube
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task<bool> Subscribe(string id)
|
/// <summary>
|
||||||
{
|
/// Prompts to add an Youtube account and retrieves its info when successful
|
||||||
if (!IsAuthorized)
|
/// </summary>
|
||||||
return false;
|
/// <param name="retrieveSubs"></param>
|
||||||
|
|
||||||
var request = Service.Subscriptions.Insert(new Subscription()
|
|
||||||
{
|
|
||||||
Snippet = new SubscriptionSnippet()
|
|
||||||
{
|
|
||||||
ResourceId = new ResourceId()
|
|
||||||
{
|
|
||||||
ChannelId = id,
|
|
||||||
Kind = "youtube#channel"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, "snippet");
|
|
||||||
|
|
||||||
Subscription s = await request.ExecuteAsync();
|
|
||||||
if (s == null)
|
|
||||||
return false;
|
|
||||||
Subscriptions.Add(s);
|
|
||||||
SubscriptionsChanged.Invoke(null, "add", s);
|
|
||||||
|
|
||||||
SaveSubscriptions();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static async Task<bool> Unsubscibe(string id)
|
|
||||||
{
|
|
||||||
if (!IsAuthorized)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
Subscription s = null;
|
|
||||||
foreach(Subscription i in Subscriptions)
|
|
||||||
if (i.Snippet.ResourceId.ChannelId == id)
|
|
||||||
{
|
|
||||||
s = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (s == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
await Service.Subscriptions.Delete(s.Id).ExecuteAsync();
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
SubscriptionsChanged.Invoke(null, "remove", Subscriptions.IndexOf(s));
|
|
||||||
Subscriptions.Remove(s);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static async void Authorize(bool retrieveSubs = true)
|
public static async void Authorize(bool retrieveSubs = true)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -201,12 +122,10 @@ namespace FoxTube
|
|||||||
if (settings.Values["authorized"] == null)
|
if (settings.Values["authorized"] == null)
|
||||||
settings.Values.Add("authorized", true);
|
settings.Values.Add("authorized", true);
|
||||||
else settings.Values["authorized"] = true;
|
else settings.Values["authorized"] = true;
|
||||||
IsAuthorized = true;
|
|
||||||
|
|
||||||
var request = Service.Channels.List("snippet,contentDetails");
|
var request = Service.Channels.List("snippet,contentDetails");
|
||||||
request.Mine = true;
|
request.Mine = true;
|
||||||
UserChannel = (await request.ExecuteAsync()).Items[0];
|
UserChannel = (await request.ExecuteAsync()).Items[0];
|
||||||
AccountId = UserChannel.Id;
|
|
||||||
|
|
||||||
/*try
|
/*try
|
||||||
{
|
{
|
||||||
@@ -265,20 +184,20 @@ namespace FoxTube
|
|||||||
subRequest.Mine = true;
|
subRequest.Mine = true;
|
||||||
subRequest.MaxResults = 50;
|
subRequest.MaxResults = 50;
|
||||||
subRequest.Order = SubscriptionsResource.ListRequest.OrderEnum.Relevance;
|
subRequest.Order = SubscriptionsResource.ListRequest.OrderEnum.Relevance;
|
||||||
SubscriptionListResponse subResponse = await subRequest.ExecuteAsync();
|
SubscriptionListResponse subResponse;
|
||||||
|
string nextToken = null;
|
||||||
Subscriptions.Clear();
|
Subscriptions.Clear();
|
||||||
|
|
||||||
foreach (Subscription s in subResponse.Items)
|
do
|
||||||
Subscriptions.Add(s);
|
|
||||||
|
|
||||||
string nextToken = subResponse.NextPageToken;
|
|
||||||
while (nextToken != null)
|
|
||||||
{
|
{
|
||||||
subRequest.PageToken = nextToken;
|
subRequest.PageToken = nextToken;
|
||||||
subResponse = await subRequest.ExecuteAsync();
|
subResponse = await subRequest.ExecuteAsync();
|
||||||
foreach (Subscription s in subResponse.Items)
|
foreach (Subscription s in subResponse.Items)
|
||||||
Subscriptions.Add(s);
|
Subscriptions.Add(s);
|
||||||
}
|
nextToken = subResponse.NextPageToken;
|
||||||
|
|
||||||
|
} while (!string.IsNullOrWhiteSpace(nextToken));
|
||||||
|
|
||||||
SaveSubscriptions();
|
SaveSubscriptions();
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
@@ -317,21 +236,17 @@ namespace FoxTube
|
|||||||
if(await Credential.RevokeTokenAsync(CancellationToken.None))
|
if(await Credential.RevokeTokenAsync(CancellationToken.None))
|
||||||
{
|
{
|
||||||
Credential = null;
|
Credential = null;
|
||||||
IsAuthorized = false;
|
AuthorizationStateChanged.Invoke();
|
||||||
AuthorizationStateChanged.Invoke(null, null);
|
|
||||||
settings.Values["authorized"] = false;
|
settings.Values["authorized"] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CheckAuthorization(bool retrieveSubs = true)
|
public static void CheckAuthorization(bool retrieveSubs = true)
|
||||||
{
|
{
|
||||||
if (settings.Values["authorized"] == null || !(bool)settings.Values["authorized"])
|
if (settings.Values["authorized"] != null && (bool)settings.Values["authorized"])
|
||||||
IsAuthorized = false;
|
|
||||||
else
|
|
||||||
Authorize(retrieveSubs);
|
Authorize(retrieveSubs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool AdsDisabled { get; private set; } = true;
|
|
||||||
|
|
||||||
public static void CheckAddons()
|
public static void CheckAddons()
|
||||||
{
|
{
|
||||||
@@ -346,6 +261,6 @@ namespace FoxTube
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static event Event NotPurchased;
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,180 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Linq;
|
||||||
|
using Windows.ApplicationModel;
|
||||||
|
using Windows.Storage;
|
||||||
|
|
||||||
|
namespace FoxTube.Classes
|
||||||
|
{
|
||||||
|
public static class SettingsStorage
|
||||||
|
{
|
||||||
|
public static string VideoQuality
|
||||||
|
{
|
||||||
|
get { return (string)settings[0]; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
settings[0] = value;
|
||||||
|
SaveData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static string RememberedQuality
|
||||||
|
{
|
||||||
|
get { return (string)settings[1]; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
settings[1] = value;
|
||||||
|
SaveData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool VideoNotifications
|
||||||
|
{
|
||||||
|
get { return (bool)settings[2]; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
settings[2] = value;
|
||||||
|
SaveData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static bool DevNotifications
|
||||||
|
{
|
||||||
|
get { return (bool)settings[3]; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
settings[3] = value;
|
||||||
|
SaveData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool CheckConnection
|
||||||
|
{
|
||||||
|
get { return (bool)settings[4]; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
settings[4] = value;
|
||||||
|
SaveData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static bool Autoplay
|
||||||
|
{
|
||||||
|
get { return (bool)settings[5]; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
settings[5] = value;
|
||||||
|
SaveData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static int Volume
|
||||||
|
{
|
||||||
|
get { return (int)settings[6]; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
settings[6] = value;
|
||||||
|
SaveData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string Language
|
||||||
|
{
|
||||||
|
get { return (string)settings[7]; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
settings[7] = value;
|
||||||
|
SaveData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static string Region
|
||||||
|
{
|
||||||
|
get { return (string)settings[8]; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
settings[8] = value;
|
||||||
|
SaveData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static int SafeSearch
|
||||||
|
{
|
||||||
|
get { return (int)settings[9]; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
settings[9] = value;
|
||||||
|
SaveData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int Theme
|
||||||
|
{
|
||||||
|
get { return (int)settings[10]; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
settings[10] = value;
|
||||||
|
SaveData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static bool HasAccount
|
||||||
|
{
|
||||||
|
get { return (bool)settings[11]; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
settings[11] = value;
|
||||||
|
SaveData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string Version
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (storage.Values["ver"] == null)
|
||||||
|
{
|
||||||
|
PackageVersion ver = Package.Current.Id.Version;
|
||||||
|
return $"{ver.Major}.{ver.Minor}";
|
||||||
|
}
|
||||||
|
else return (string)storage.Values["version"];
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
storage.Values["version"] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Settings storage
|
||||||
|
private static ApplicationDataContainer storage = ApplicationData.Current.LocalSettings;
|
||||||
|
|
||||||
|
//Predefined preferences
|
||||||
|
private static object[] settings = new object[]
|
||||||
|
{
|
||||||
|
"remember",
|
||||||
|
"1080p",
|
||||||
|
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
100,
|
||||||
|
|
||||||
|
(new[] { "ua", "ru", "by", "kz", "kg", "md", "lv", "ee" }).Contains(CultureInfo.InstalledUICulture.TwoLetterISOLanguageName) ? "ru-RU" : "en-US",
|
||||||
|
CultureInfo.CurrentCulture.Name,
|
||||||
|
0,
|
||||||
|
|
||||||
|
2,
|
||||||
|
false
|
||||||
|
};
|
||||||
|
|
||||||
|
public static void LoadData()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
settings = JsonConvert.DeserializeObject<object[]>(storage.Values["settings"] as string);
|
||||||
|
}
|
||||||
|
catch (NullReferenceException) { }
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SaveData()
|
||||||
|
{
|
||||||
|
storage.Values["settings"] = JsonConvert.SerializeObject(settings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -39,7 +39,7 @@ namespace FoxTube.Controls
|
|||||||
|
|
||||||
public async void Initialize(string id, string live)
|
public async void Initialize(string id, string live)
|
||||||
{
|
{
|
||||||
ChannelsResource.ListRequest request = SecretsVault.NoAuthService.Channels.List("snippet,statistics,brandingSettings");
|
ChannelsResource.ListRequest request = SecretsVault.Service.Channels.List("snippet,statistics,brandingSettings");
|
||||||
request.Id = id;
|
request.Id = id;
|
||||||
ChannelListResponse response = await request.ExecuteAsync();
|
ChannelListResponse response = await request.ExecuteAsync();
|
||||||
|
|
||||||
|
|||||||
@@ -100,7 +100,8 @@
|
|||||||
<Compile Include="Classes\DownloadItemContainer.cs" />
|
<Compile Include="Classes\DownloadItemContainer.cs" />
|
||||||
<Compile Include="Classes\InboxItem.cs" />
|
<Compile Include="Classes\InboxItem.cs" />
|
||||||
<Compile Include="Classes\Methods.cs" />
|
<Compile Include="Classes\Methods.cs" />
|
||||||
<Compile Include="Classes\ObjectEventArgs.cs" />
|
<Compile Include="Classes\SearchPaameters.cs" />
|
||||||
|
<Compile Include="Classes\SettingsStorage.cs" />
|
||||||
<Compile Include="Controls\Advert.xaml.cs">
|
<Compile Include="Controls\Advert.xaml.cs">
|
||||||
<DependentUpon>Advert.xaml</DependentUpon>
|
<DependentUpon>Advert.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
</NavigationViewItem>
|
</NavigationViewItem>
|
||||||
<NavigationViewItem x:Uid="/Main/liked" Icon="Like" Content="Liked videos" Name="toLiked" Visibility="Collapsed"/>
|
<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"/>
|
<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" Visibility="Collapsed"/>
|
<NavigationViewItem x:Uid="/Main/downloads" Icon="Download" Content="Downloads" Name="toDownloads"/>
|
||||||
<NavigationViewItemHeader x:Uid="/Main/subscriptions" Content="Subscriptions" Name="subsHeader" Visibility="Collapsed"/>
|
<NavigationViewItemHeader x:Uid="/Main/subscriptions" Content="Subscriptions" Name="subsHeader" Visibility="Collapsed"/>
|
||||||
</NavigationView.MenuItems>
|
</NavigationView.MenuItems>
|
||||||
|
|
||||||
|
|||||||
@@ -40,37 +40,11 @@ namespace FoxTube
|
|||||||
|
|
||||||
public sealed partial class MainPage : Page
|
public sealed partial class MainPage : Page
|
||||||
{
|
{
|
||||||
ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
|
|
||||||
|
|
||||||
Sender s = Sender.None;
|
Sender s = Sender.None;
|
||||||
public MainPage()
|
public MainPage()
|
||||||
{
|
{
|
||||||
this.InitializeComponent();
|
this.InitializeComponent();
|
||||||
|
|
||||||
if (settings.Values["quality"] == null)
|
|
||||||
settings.Values.Add("quality", "remember");
|
|
||||||
if (settings.Values["rememberedQuality"] == null)
|
|
||||||
settings.Values.Add("rememberedQuality", "1080p");
|
|
||||||
|
|
||||||
if (settings.Values["newVideoNotification"] == null)
|
|
||||||
settings.Values.Add("newVideoNotification", true);
|
|
||||||
if (settings.Values["devNews"] == null)
|
|
||||||
settings.Values.Add("devNews", true);
|
|
||||||
|
|
||||||
if (settings.Values["moblieWarning"] == null)
|
|
||||||
settings.Values.Add("moblieWarning", false);
|
|
||||||
if (settings.Values["videoAutoplay"] == null)
|
|
||||||
settings.Values.Add("videoAutoplay", true);
|
|
||||||
if (settings.Values["themeMode"] == null)
|
|
||||||
settings.Values.Add("themeMode", 2);
|
|
||||||
if (settings.Values["volume"] == null)
|
|
||||||
settings.Values.Add("volume", 100);
|
|
||||||
|
|
||||||
if (settings.Values["region"] == null)
|
|
||||||
settings.Values.Add("region", CultureInfo.CurrentCulture.Name);
|
|
||||||
if (settings.Values["safeSearch"] == null)
|
|
||||||
settings.Values.Add("safeSearch", 0);
|
|
||||||
|
|
||||||
PackageVersion ver = Package.Current.Id.Version;
|
PackageVersion ver = Package.Current.Id.Version;
|
||||||
if (settings.Values["ver"] == null)
|
if (settings.Values["ver"] == null)
|
||||||
settings.Values.Add("ver", $"{ver.Major}.{ver.Minor}");
|
settings.Values.Add("ver", $"{ver.Major}.{ver.Minor}");
|
||||||
@@ -90,9 +64,7 @@ namespace FoxTube
|
|||||||
catch { }
|
catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
content.Navigate(typeof(Home));
|
SecretsVault.AuthorizationStateChanged += AuthorizationStateChanged;
|
||||||
|
|
||||||
SecretsVault.AuthorizationStateChanged += Vault_AuthorizationStateChanged;
|
|
||||||
SecretsVault.SubscriptionsChanged += SecretsVault_SubscriptionsChanged;
|
SecretsVault.SubscriptionsChanged += SecretsVault_SubscriptionsChanged;
|
||||||
SecretsVault.NotPurchased += () => removeAds.Visibility = Visibility.Visible;
|
SecretsVault.NotPurchased += () => removeAds.Visibility = Visibility.Visible;
|
||||||
SecretsVault.CheckAuthorization();
|
SecretsVault.CheckAuthorization();
|
||||||
@@ -165,7 +137,7 @@ namespace FoxTube
|
|||||||
nav.MenuItems.RemoveAt((int)args[1] + 9);
|
nav.MenuItems.RemoveAt((int)args[1] + 9);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void Vault_AuthorizationStateChanged(object sender, EventArgs e)
|
private async void AuthorizationStateChanged()
|
||||||
{
|
{
|
||||||
if(SecretsVault.IsAuthorized)
|
if(SecretsVault.IsAuthorized)
|
||||||
{
|
{
|
||||||
@@ -186,7 +158,6 @@ namespace FoxTube
|
|||||||
toHistory.Visibility = Visibility.Visible;
|
toHistory.Visibility = Visibility.Visible;
|
||||||
toLiked.Visibility = Visibility.Visible;
|
toLiked.Visibility = Visibility.Visible;
|
||||||
toLater.Visibility = Visibility.Visible;
|
toLater.Visibility = Visibility.Visible;
|
||||||
toDownloads.Visibility = Visibility.Visible;
|
|
||||||
subsHeader.Visibility = Visibility.Visible;
|
subsHeader.Visibility = Visibility.Visible;
|
||||||
|
|
||||||
if (SecretsVault.Subscriptions.Count > 0)
|
if (SecretsVault.Subscriptions.Count > 0)
|
||||||
@@ -229,7 +200,6 @@ namespace FoxTube
|
|||||||
toHistory.Visibility = Visibility.Collapsed;
|
toHistory.Visibility = Visibility.Collapsed;
|
||||||
toLiked.Visibility = Visibility.Collapsed;
|
toLiked.Visibility = Visibility.Collapsed;
|
||||||
toLater.Visibility = Visibility.Collapsed;
|
toLater.Visibility = Visibility.Collapsed;
|
||||||
toDownloads.Visibility = Visibility.Collapsed;
|
|
||||||
subsHeader.Visibility = Visibility.Collapsed;
|
subsHeader.Visibility = Visibility.Collapsed;
|
||||||
|
|
||||||
subsHeader.Visibility = Visibility.Collapsed;
|
subsHeader.Visibility = Visibility.Collapsed;
|
||||||
@@ -237,7 +207,6 @@ namespace FoxTube
|
|||||||
nav.MenuItems.RemoveAt(k);
|
nav.MenuItems.RemoveAt(k);
|
||||||
}
|
}
|
||||||
|
|
||||||
nav.SelectedItem = toHome;
|
|
||||||
content.Navigate(typeof(Home));
|
content.Navigate(typeof(Home));
|
||||||
|
|
||||||
if (videoPlaceholder.Content != null)
|
if (videoPlaceholder.Content != null)
|
||||||
@@ -261,7 +230,7 @@ namespace FoxTube
|
|||||||
|
|
||||||
private void myChannel_Click(object sender, RoutedEventArgs e)
|
private void myChannel_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
content.Navigate(typeof(Channel), SecretsVault.UserChannel.Id);
|
GoToChannel(SecretsVault.AccountId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logout_Click(object sender, RoutedEventArgs e)
|
private void logout_Click(object sender, RoutedEventArgs e)
|
||||||
|
|||||||
Reference in New Issue
Block a user