diff --git a/FoxTube.Background/BackgroundProcessor.cs b/FoxTube.Background/BackgroundProcessor.cs index 83ff2c7..03982f1 100644 --- a/FoxTube.Background/BackgroundProcessor.cs +++ b/FoxTube.Background/BackgroundProcessor.cs @@ -59,8 +59,8 @@ namespace FoxTube.Background UserCredential Credential = await GoogleWebAuthorizationBroker.AuthorizeAsync( new ClientSecrets { - ClientId = "349735264870-2ekqlm0a4mkg3mmrfcv90s3qp3o15dq0.apps.googleusercontent.com", - ClientSecret = "BkVZOAaCU2Zclf0Zlicg6y2_" + ClientId = "1096685398208-rsabgv4dfkopr3c7p27p61pkcans012g.apps.googleusercontent.com", + ClientSecret = "EtX5VkCwrl7EZsFM2Dt7Jzpd" }, new[] { @@ -107,7 +107,7 @@ namespace FoxTube.Background foreach (Subscription item in subscriptions) { SearchResource.ListRequest request = service.Search.List("snippet"); - request.PublishedAfter = lastCheck; + request.PublishedAfter = lastCheck.Subtract(TimeSpan.FromDays(3)); request.ChannelId = item.Snippet.ResourceId.ChannelId; request.Type = "video"; request.MaxResults = 5; diff --git a/FoxTube/Assets/BadgeLogo.scale-100.png b/FoxTube/Assets/BadgeLogo.scale-100.png index 986ba33..795f023 100644 Binary files a/FoxTube/Assets/BadgeLogo.scale-100.png and b/FoxTube/Assets/BadgeLogo.scale-100.png differ diff --git a/FoxTube/Assets/BadgeLogo.scale-125.png b/FoxTube/Assets/BadgeLogo.scale-125.png index 3e9cb8e..5b1d228 100644 Binary files a/FoxTube/Assets/BadgeLogo.scale-125.png and b/FoxTube/Assets/BadgeLogo.scale-125.png differ diff --git a/FoxTube/Assets/BadgeLogo.scale-150.png b/FoxTube/Assets/BadgeLogo.scale-150.png index 28bbb0c..4ca76dc 100644 Binary files a/FoxTube/Assets/BadgeLogo.scale-150.png and b/FoxTube/Assets/BadgeLogo.scale-150.png differ diff --git a/FoxTube/Assets/BadgeLogo.scale-200.png b/FoxTube/Assets/BadgeLogo.scale-200.png index f45a820..c49776c 100644 Binary files a/FoxTube/Assets/BadgeLogo.scale-200.png and b/FoxTube/Assets/BadgeLogo.scale-200.png differ diff --git a/FoxTube/Assets/BadgeLogo.scale-400.png b/FoxTube/Assets/BadgeLogo.scale-400.png index 42b17d6..16abe40 100644 Binary files a/FoxTube/Assets/BadgeLogo.scale-400.png and b/FoxTube/Assets/BadgeLogo.scale-400.png differ diff --git a/FoxTube/Assets/LargeTile.scale-100.png b/FoxTube/Assets/LargeTile.scale-100.png index 6bd2d5d..70d79a9 100644 Binary files a/FoxTube/Assets/LargeTile.scale-100.png and b/FoxTube/Assets/LargeTile.scale-100.png differ diff --git a/FoxTube/Assets/LargeTile.scale-125.png b/FoxTube/Assets/LargeTile.scale-125.png index f39bfbc..c6c4824 100644 Binary files a/FoxTube/Assets/LargeTile.scale-125.png and b/FoxTube/Assets/LargeTile.scale-125.png differ diff --git a/FoxTube/Assets/LargeTile.scale-150.png b/FoxTube/Assets/LargeTile.scale-150.png index 6536cd2..bddcbb9 100644 Binary files a/FoxTube/Assets/LargeTile.scale-150.png and b/FoxTube/Assets/LargeTile.scale-150.png differ diff --git a/FoxTube/Assets/LargeTile.scale-200.png b/FoxTube/Assets/LargeTile.scale-200.png index 067a34e..1418762 100644 Binary files a/FoxTube/Assets/LargeTile.scale-200.png and b/FoxTube/Assets/LargeTile.scale-200.png differ diff --git a/FoxTube/Assets/LargeTile.scale-400.png b/FoxTube/Assets/LargeTile.scale-400.png index f162c07..8c9c69f 100644 Binary files a/FoxTube/Assets/LargeTile.scale-400.png and b/FoxTube/Assets/LargeTile.scale-400.png differ diff --git a/FoxTube/Assets/SmallTile.scale-100.png b/FoxTube/Assets/SmallTile.scale-100.png index 2b2d279..2980f14 100644 Binary files a/FoxTube/Assets/SmallTile.scale-100.png and b/FoxTube/Assets/SmallTile.scale-100.png differ diff --git a/FoxTube/Assets/SmallTile.scale-125.png b/FoxTube/Assets/SmallTile.scale-125.png index d495087..88df199 100644 Binary files a/FoxTube/Assets/SmallTile.scale-125.png and b/FoxTube/Assets/SmallTile.scale-125.png differ diff --git a/FoxTube/Assets/SmallTile.scale-150.png b/FoxTube/Assets/SmallTile.scale-150.png index 80263ec..3b71249 100644 Binary files a/FoxTube/Assets/SmallTile.scale-150.png and b/FoxTube/Assets/SmallTile.scale-150.png differ diff --git a/FoxTube/Assets/SmallTile.scale-200.png b/FoxTube/Assets/SmallTile.scale-200.png index 7029107..d69e2b2 100644 Binary files a/FoxTube/Assets/SmallTile.scale-200.png and b/FoxTube/Assets/SmallTile.scale-200.png differ diff --git a/FoxTube/Assets/SmallTile.scale-400.png b/FoxTube/Assets/SmallTile.scale-400.png index e68e897..64ea065 100644 Binary files a/FoxTube/Assets/SmallTile.scale-400.png and b/FoxTube/Assets/SmallTile.scale-400.png differ diff --git a/FoxTube/Assets/SplashScreen.scale-100.png b/FoxTube/Assets/SplashScreen.scale-100.png index 5c05bb5..e93e4ee 100644 Binary files a/FoxTube/Assets/SplashScreen.scale-100.png and b/FoxTube/Assets/SplashScreen.scale-100.png differ diff --git a/FoxTube/Assets/SplashScreen.scale-125.png b/FoxTube/Assets/SplashScreen.scale-125.png index d31d279..5391a49 100644 Binary files a/FoxTube/Assets/SplashScreen.scale-125.png and b/FoxTube/Assets/SplashScreen.scale-125.png differ diff --git a/FoxTube/Assets/SplashScreen.scale-150.png b/FoxTube/Assets/SplashScreen.scale-150.png index c54b15c..5e275bd 100644 Binary files a/FoxTube/Assets/SplashScreen.scale-150.png and b/FoxTube/Assets/SplashScreen.scale-150.png differ diff --git a/FoxTube/Assets/SplashScreen.scale-200.png b/FoxTube/Assets/SplashScreen.scale-200.png index 8ff87be..5a9afbf 100644 Binary files a/FoxTube/Assets/SplashScreen.scale-200.png and b/FoxTube/Assets/SplashScreen.scale-200.png differ diff --git a/FoxTube/Assets/SplashScreen.scale-400.png b/FoxTube/Assets/SplashScreen.scale-400.png index 8b8c537..bd4e437 100644 Binary files a/FoxTube/Assets/SplashScreen.scale-400.png and b/FoxTube/Assets/SplashScreen.scale-400.png differ diff --git a/FoxTube/Assets/Square150x150Logo.scale-100.png b/FoxTube/Assets/Square150x150Logo.scale-100.png index 6311043..6adf766 100644 Binary files a/FoxTube/Assets/Square150x150Logo.scale-100.png and b/FoxTube/Assets/Square150x150Logo.scale-100.png differ diff --git a/FoxTube/Assets/Square150x150Logo.scale-125.png b/FoxTube/Assets/Square150x150Logo.scale-125.png index 6b74407..b73637a 100644 Binary files a/FoxTube/Assets/Square150x150Logo.scale-125.png and b/FoxTube/Assets/Square150x150Logo.scale-125.png differ diff --git a/FoxTube/Assets/Square150x150Logo.scale-150.png b/FoxTube/Assets/Square150x150Logo.scale-150.png index 3d6a09f..9134984 100644 Binary files a/FoxTube/Assets/Square150x150Logo.scale-150.png and b/FoxTube/Assets/Square150x150Logo.scale-150.png differ diff --git a/FoxTube/Assets/Square150x150Logo.scale-200.png b/FoxTube/Assets/Square150x150Logo.scale-200.png index f42ad59..6da6b23 100644 Binary files a/FoxTube/Assets/Square150x150Logo.scale-200.png and b/FoxTube/Assets/Square150x150Logo.scale-200.png differ diff --git a/FoxTube/Assets/Square150x150Logo.scale-400.png b/FoxTube/Assets/Square150x150Logo.scale-400.png index 6fb7558..f2b5199 100644 Binary files a/FoxTube/Assets/Square150x150Logo.scale-400.png and b/FoxTube/Assets/Square150x150Logo.scale-400.png differ diff --git a/FoxTube/Assets/Square44x44Logo.altform-lightunplated_targetsize-16.png b/FoxTube/Assets/Square44x44Logo.altform-lightunplated_targetsize-16.png new file mode 100644 index 0000000..9e55332 Binary files /dev/null and b/FoxTube/Assets/Square44x44Logo.altform-lightunplated_targetsize-16.png differ diff --git a/FoxTube/Assets/Square44x44Logo.altform-lightunplated_targetsize-24.png b/FoxTube/Assets/Square44x44Logo.altform-lightunplated_targetsize-24.png new file mode 100644 index 0000000..7130cc3 Binary files /dev/null and b/FoxTube/Assets/Square44x44Logo.altform-lightunplated_targetsize-24.png differ diff --git a/FoxTube/Assets/Square44x44Logo.altform-lightunplated_targetsize-256.png b/FoxTube/Assets/Square44x44Logo.altform-lightunplated_targetsize-256.png new file mode 100644 index 0000000..615c074 Binary files /dev/null and b/FoxTube/Assets/Square44x44Logo.altform-lightunplated_targetsize-256.png differ diff --git a/FoxTube/Assets/Square44x44Logo.altform-lightunplated_targetsize-32.png b/FoxTube/Assets/Square44x44Logo.altform-lightunplated_targetsize-32.png new file mode 100644 index 0000000..20da9ff Binary files /dev/null and b/FoxTube/Assets/Square44x44Logo.altform-lightunplated_targetsize-32.png differ diff --git a/FoxTube/Assets/Square44x44Logo.altform-lightunplated_targetsize-48.png b/FoxTube/Assets/Square44x44Logo.altform-lightunplated_targetsize-48.png new file mode 100644 index 0000000..d027f72 Binary files /dev/null and b/FoxTube/Assets/Square44x44Logo.altform-lightunplated_targetsize-48.png differ diff --git a/FoxTube/Assets/Square44x44Logo.altform-unplated_targetsize-16.png b/FoxTube/Assets/Square44x44Logo.altform-unplated_targetsize-16.png index 4190717..9e55332 100644 Binary files a/FoxTube/Assets/Square44x44Logo.altform-unplated_targetsize-16.png and b/FoxTube/Assets/Square44x44Logo.altform-unplated_targetsize-16.png differ diff --git a/FoxTube/Assets/Square44x44Logo.altform-unplated_targetsize-256.png b/FoxTube/Assets/Square44x44Logo.altform-unplated_targetsize-256.png index 3f8b07f..615c074 100644 Binary files a/FoxTube/Assets/Square44x44Logo.altform-unplated_targetsize-256.png and b/FoxTube/Assets/Square44x44Logo.altform-unplated_targetsize-256.png differ diff --git a/FoxTube/Assets/Square44x44Logo.altform-unplated_targetsize-32.png b/FoxTube/Assets/Square44x44Logo.altform-unplated_targetsize-32.png index 966ef2c..20da9ff 100644 Binary files a/FoxTube/Assets/Square44x44Logo.altform-unplated_targetsize-32.png and b/FoxTube/Assets/Square44x44Logo.altform-unplated_targetsize-32.png differ diff --git a/FoxTube/Assets/Square44x44Logo.altform-unplated_targetsize-48.png b/FoxTube/Assets/Square44x44Logo.altform-unplated_targetsize-48.png index d5566cd..d027f72 100644 Binary files a/FoxTube/Assets/Square44x44Logo.altform-unplated_targetsize-48.png and b/FoxTube/Assets/Square44x44Logo.altform-unplated_targetsize-48.png differ diff --git a/FoxTube/Assets/Square44x44Logo.scale-100.png b/FoxTube/Assets/Square44x44Logo.scale-100.png index 4d54ade..62c7778 100644 Binary files a/FoxTube/Assets/Square44x44Logo.scale-100.png and b/FoxTube/Assets/Square44x44Logo.scale-100.png differ diff --git a/FoxTube/Assets/Square44x44Logo.scale-125.png b/FoxTube/Assets/Square44x44Logo.scale-125.png index 1d10473..cb72de7 100644 Binary files a/FoxTube/Assets/Square44x44Logo.scale-125.png and b/FoxTube/Assets/Square44x44Logo.scale-125.png differ diff --git a/FoxTube/Assets/Square44x44Logo.scale-150.png b/FoxTube/Assets/Square44x44Logo.scale-150.png index 532eeb5..6fa01ea 100644 Binary files a/FoxTube/Assets/Square44x44Logo.scale-150.png and b/FoxTube/Assets/Square44x44Logo.scale-150.png differ diff --git a/FoxTube/Assets/Square44x44Logo.scale-200.png b/FoxTube/Assets/Square44x44Logo.scale-200.png index a388b69..98e9926 100644 Binary files a/FoxTube/Assets/Square44x44Logo.scale-200.png and b/FoxTube/Assets/Square44x44Logo.scale-200.png differ diff --git a/FoxTube/Assets/Square44x44Logo.scale-400.png b/FoxTube/Assets/Square44x44Logo.scale-400.png index 952b836..db3c2be 100644 Binary files a/FoxTube/Assets/Square44x44Logo.scale-400.png and b/FoxTube/Assets/Square44x44Logo.scale-400.png differ diff --git a/FoxTube/Assets/Square44x44Logo.targetsize-16.png b/FoxTube/Assets/Square44x44Logo.targetsize-16.png index ae65581..0175d40 100644 Binary files a/FoxTube/Assets/Square44x44Logo.targetsize-16.png and b/FoxTube/Assets/Square44x44Logo.targetsize-16.png differ diff --git a/FoxTube/Assets/Square44x44Logo.targetsize-24.png b/FoxTube/Assets/Square44x44Logo.targetsize-24.png index 2e920ea..718f3f1 100644 Binary files a/FoxTube/Assets/Square44x44Logo.targetsize-24.png and b/FoxTube/Assets/Square44x44Logo.targetsize-24.png differ diff --git a/FoxTube/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/FoxTube/Assets/Square44x44Logo.targetsize-24_altform-unplated.png index 157e51b..e437a17 100644 Binary files a/FoxTube/Assets/Square44x44Logo.targetsize-24_altform-unplated.png and b/FoxTube/Assets/Square44x44Logo.targetsize-24_altform-unplated.png differ diff --git a/FoxTube/Assets/Square44x44Logo.targetsize-256.png b/FoxTube/Assets/Square44x44Logo.targetsize-256.png index c512e4f..cad3511 100644 Binary files a/FoxTube/Assets/Square44x44Logo.targetsize-256.png and b/FoxTube/Assets/Square44x44Logo.targetsize-256.png differ diff --git a/FoxTube/Assets/Square44x44Logo.targetsize-32.png b/FoxTube/Assets/Square44x44Logo.targetsize-32.png index e21a640..6ba5542 100644 Binary files a/FoxTube/Assets/Square44x44Logo.targetsize-32.png and b/FoxTube/Assets/Square44x44Logo.targetsize-32.png differ diff --git a/FoxTube/Assets/Square44x44Logo.targetsize-48.png b/FoxTube/Assets/Square44x44Logo.targetsize-48.png index 9fb449f..be3bc65 100644 Binary files a/FoxTube/Assets/Square44x44Logo.targetsize-48.png and b/FoxTube/Assets/Square44x44Logo.targetsize-48.png differ diff --git a/FoxTube/Assets/StoreLogo.scale-100.png b/FoxTube/Assets/StoreLogo.scale-100.png index 7a7928b..1280fd4 100644 Binary files a/FoxTube/Assets/StoreLogo.scale-100.png and b/FoxTube/Assets/StoreLogo.scale-100.png differ diff --git a/FoxTube/Assets/StoreLogo.scale-125.png b/FoxTube/Assets/StoreLogo.scale-125.png index 6c6be97..457168c 100644 Binary files a/FoxTube/Assets/StoreLogo.scale-125.png and b/FoxTube/Assets/StoreLogo.scale-125.png differ diff --git a/FoxTube/Assets/StoreLogo.scale-150.png b/FoxTube/Assets/StoreLogo.scale-150.png index 22ec353..cb72c80 100644 Binary files a/FoxTube/Assets/StoreLogo.scale-150.png and b/FoxTube/Assets/StoreLogo.scale-150.png differ diff --git a/FoxTube/Assets/StoreLogo.scale-200.png b/FoxTube/Assets/StoreLogo.scale-200.png index 1b8d85e..39d5ddb 100644 Binary files a/FoxTube/Assets/StoreLogo.scale-200.png and b/FoxTube/Assets/StoreLogo.scale-200.png differ diff --git a/FoxTube/Assets/StoreLogo.scale-400.png b/FoxTube/Assets/StoreLogo.scale-400.png index 9a0689c..7c57775 100644 Binary files a/FoxTube/Assets/StoreLogo.scale-400.png and b/FoxTube/Assets/StoreLogo.scale-400.png differ diff --git a/FoxTube/Assets/Wide310x150Logo.scale-100.png b/FoxTube/Assets/Wide310x150Logo.scale-100.png index ff3b8a5..b25b168 100644 Binary files a/FoxTube/Assets/Wide310x150Logo.scale-100.png and b/FoxTube/Assets/Wide310x150Logo.scale-100.png differ diff --git a/FoxTube/Assets/Wide310x150Logo.scale-125.png b/FoxTube/Assets/Wide310x150Logo.scale-125.png index 091bc37..37237fa 100644 Binary files a/FoxTube/Assets/Wide310x150Logo.scale-125.png and b/FoxTube/Assets/Wide310x150Logo.scale-125.png differ diff --git a/FoxTube/Assets/Wide310x150Logo.scale-150.png b/FoxTube/Assets/Wide310x150Logo.scale-150.png index 0a54bc8..84deb5e 100644 Binary files a/FoxTube/Assets/Wide310x150Logo.scale-150.png and b/FoxTube/Assets/Wide310x150Logo.scale-150.png differ diff --git a/FoxTube/Assets/Wide310x150Logo.scale-200.png b/FoxTube/Assets/Wide310x150Logo.scale-200.png index 66e475d..ddcbfd8 100644 Binary files a/FoxTube/Assets/Wide310x150Logo.scale-200.png and b/FoxTube/Assets/Wide310x150Logo.scale-200.png differ diff --git a/FoxTube/Assets/Wide310x150Logo.scale-400.png b/FoxTube/Assets/Wide310x150Logo.scale-400.png index ffd0bd7..477930f 100644 Binary files a/FoxTube/Assets/Wide310x150Logo.scale-400.png and b/FoxTube/Assets/Wide310x150Logo.scale-400.png differ diff --git a/FoxTube/Classes/HistorySet.cs b/FoxTube/Classes/HistorySet.cs index 7e95ccc..35992cd 100644 --- a/FoxTube/Classes/HistorySet.cs +++ b/FoxTube/Classes/HistorySet.cs @@ -1,6 +1,8 @@ -using Newtonsoft.Json; +using Google.Apis.YouTube.v3.Data; +using Newtonsoft.Json; using System; using System.Collections.Generic; +using Windows.ApplicationModel.UserActivities; using Windows.Storage; namespace FoxTube @@ -15,7 +17,7 @@ namespace FoxTube { public static List Items { get; set; } = new List(); - public static void Update(HistoryItem item) + public static async void Update(HistoryItem item, Video video) { if (!SecretsVault.IsAuthorized) return; @@ -26,6 +28,23 @@ namespace FoxTube if (Items.Count > 200) Items.RemoveRange(200, Items.Count - 200); Save(); + + UserActivitySession _currentActivity = null; + // Get the default UserActivityChannel and query it for our UserActivity. If the activity doesn't exist, one is created. + UserActivityChannel channel = UserActivityChannel.GetDefault(); + UserActivity userActivity = await channel.GetOrCreateUserActivityAsync(item.Id); + + // Populate required properties + userActivity.VisualElements.DisplayText = video.Snippet.Title; + userActivity.VisualElements.Description = video.Snippet.ChannelTitle; + userActivity.ActivationUri = new Uri("my-app://page2?action=edit"); + + //Save + await userActivity.SaveAsync(); //save the new metadata + + // Dispose of any current UserActivitySession, and create a new one. + _currentActivity?.Dispose(); + _currentActivity = userActivity.CreateSession(); } public static void Delete(HistoryItem item) diff --git a/FoxTube/Classes/Methods.cs b/FoxTube/Classes/Methods.cs index c744546..8afe7cb 100644 --- a/FoxTube/Classes/Methods.cs +++ b/FoxTube/Classes/Methods.cs @@ -34,7 +34,7 @@ namespace FoxTube public static class Methods { private static readonly ResourceLoader resources = ResourceLoader.GetForCurrentView("Methods"); - + public static CommentsPage CommentsPage { get; set; } public static MainPage MainPage => (Window.Current.Content as Frame).Content as MainPage; @@ -241,7 +241,7 @@ namespace FoxTube return "Unknown"; } } - + public async static void ProcessLink(string url) { string type; @@ -304,29 +304,43 @@ namespace FoxTube public static async Task> GetHistory() { - SecretsVault.RefreshToken(); List list = new List(); - - string output = await SecretsVault.HttpClient.GetStringAsync($"https://www.youtube.com/list_ajax?style=json&action_get_list=1&list=HL&hl={SettingsStorage.RelevanceLanguage}"); + try + { + SecretsVault.RefreshToken(); - dynamic raw = JsonConvert.DeserializeObject(output); - foreach (dynamic i in raw.video) - list.Add(i.encrypted_id.ToString()); + string output = await SecretsVault.HttpClient.GetStringAsync($"https://www.youtube.com/list_ajax?style=json&action_get_list=1&list=HL&hl={SettingsStorage.RelevanceLanguage}"); + dynamic raw = JsonConvert.DeserializeObject(output); + foreach (dynamic i in raw.video) + list.Add(i.encrypted_id.ToString()); + } + catch + { + + } return list; } public static async Task> GetLater() { - SecretsVault.RefreshToken(); List list = new List(); - - string output = await SecretsVault.HttpClient.GetStringAsync($"https://www.youtube.com/list_ajax?style=json&action_get_list=1&list=WL&hl={SettingsStorage.RelevanceLanguage}"); + try + { + SecretsVault.RefreshToken(); - dynamic raw = JsonConvert.DeserializeObject(output); - foreach (dynamic i in raw.video) - list.Add(i.encrypted_id.ToString()); + string output = await SecretsVault.HttpClient.GetStringAsync($"https://www.youtube.com/list_ajax?style=json&action_get_list=1&list=WL&hl={SettingsStorage.RelevanceLanguage}"); + dynamic raw = JsonConvert.DeserializeObject(output); + foreach (dynamic i in raw.video) + list.Add(i.encrypted_id.ToString()); + + + } + catch + { + + } return list; } } diff --git a/FoxTube/Classes/SecretsVault.cs b/FoxTube/Classes/SecretsVault.cs index dd3fedf..80a88d5 100644 --- a/FoxTube/Classes/SecretsVault.cs +++ b/FoxTube/Classes/SecretsVault.cs @@ -15,6 +15,7 @@ using Google.Apis.Oauth2.v2; using static Google.Apis.Auth.OAuth2.UwpCodeReceiver; using Microsoft.AppCenter.Analytics; using System.Net; +using Google.Apis.Auth.OAuth2.Responses; namespace FoxTube { @@ -30,12 +31,12 @@ namespace FoxTube public static NetworkCredential EmailCredential => new NetworkCredential("mikhailagord@gmail.com", "JkY39w$.7?bT57O,8k3a"); private static ClientSecrets Secrets => new ClientSecrets { - ClientId = "349735264870-2ekqlm0a4mkg3mmrfcv90s3qp3o15dq0.apps.googleusercontent.com", - ClientSecret = "BkVZOAaCU2Zclf0Zlicg6y2_" + ClientId = "1096685398208-rsabgv4dfkopr3c7p27p61pkcans012g.apps.googleusercontent.com", + ClientSecret = "EtX5VkCwrl7EZsFM2Dt7Jzpd" }; private static YouTubeService NoAuthService => new YouTubeService(new BaseClientService.Initializer { - ApiKey = "AIzaSyBgHrCnrlzlVmk0cJKL8RqP9Y8x6XSuk_0", + ApiKey = "AIzaSyD7tpbuvmYDv9h4udo9L_g3r0sLPFAnN00", ApplicationName = "FoxTube" }); public static BaseClientService.Initializer Initializer => new BaseClientService.Initializer @@ -150,6 +151,16 @@ namespace FoxTube await Credential.RefreshTokenAsync(CancellationToken.None); } + catch (TokenResponseException e) + { + AuthorizationStateChanged?.Invoke(args: new bool?[] { null }); + Analytics.TrackEvent("Failed to authorize", new Dictionary + { + { "Exception", e.GetType().ToString() }, + { "Message", e.Message }, + { "StackTrace", e.StackTrace } + }); + } catch (AuthenticateException e) { if (e.Message.Contains("UserCancel")) @@ -212,10 +223,12 @@ namespace FoxTube } catch (Exception e) { + Deauthenticate(); + AuthorizationStateChanged?.Invoke(args: new bool?[] { null }); - Methods.SendMail($@"Exception: {e.GetType()} + /*Methods.SendMail($@"Exception: {e.GetType()} Message: {e.Message} -Stack trace: {e.StackTrace}"); +Stack trace: {e.StackTrace}");*/ Analytics.TrackEvent("Failed to retrieve user's info", new Dictionary { { "Exception", e.GetType().ToString() }, @@ -269,7 +282,7 @@ Stack trace: {e.StackTrace}"); { if (!await Credential.RevokeTokenAsync(CancellationToken.None)) return; - + Credential = null; UserChannel = null; UserInfo = null; diff --git a/FoxTube/Classes/SettingsStorage.cs b/FoxTube/Classes/SettingsStorage.cs index 1c68b7a..c46ee53 100644 --- a/FoxTube/Classes/SettingsStorage.cs +++ b/FoxTube/Classes/SettingsStorage.cs @@ -203,7 +203,7 @@ namespace FoxTube } set { - storage.Values["mature"] = value; + storage.Values["mature"] = (int)value; } } diff --git a/FoxTube/Controls/Player/PlayerControls.cs b/FoxTube/Controls/Player/PlayerControls.cs index c7d8894..31130d9 100644 --- a/FoxTube/Controls/Player/PlayerControls.cs +++ b/FoxTube/Controls/Player/PlayerControls.cs @@ -156,7 +156,7 @@ namespace FoxTube if (queue.Count > 0) foreach (Action i in queue) i(); - + base.OnApplyTemplate(); } @@ -214,6 +214,7 @@ namespace FoxTube private async void Quality_SelectionChanged(object sender, SelectionChangedEventArgs e) { + //return; if (Meta.Snippet.LiveBroadcastContent == "live") goto SetQuality; if(!needUpdateTimecode) @@ -222,12 +223,13 @@ namespace FoxTube Player.Pause(); Player.Source = null; - SetQuality: + SetQuality: object info = (quality.SelectedItem as ComboBoxItem).Tag; if (info is MuxedStreamInfo) Player.SetPlaybackSource(MediaSource.CreateFromUri((info as MuxedStreamInfo).Url.ToUri())); else if (info is VideoStreamInfo || info == null) - Player.SetPlaybackSource(MediaSource.CreateFromUri(await ManifestGenerator.GetManifest(Meta, info as VideoStreamInfo, MediaStreams))); + return; + //Player.SetPlaybackSource(MediaSource.CreateFromUri(await ManifestGenerator.GetManifest(Meta, info as VideoStreamInfo, MediaStreams))); else if (info is StreamQuality) Player.SetPlaybackSource(MediaSource.CreateFromUri((info as StreamQuality).Url)); } @@ -427,7 +429,19 @@ namespace FoxTube title.Text = meta.Snippet.Title; channel.Text = meta.Snippet.ChannelTitle; - MediaStreams = await new YoutubeClient().GetVideoMediaStreamInfosAsync(meta.Id); + try + { + MediaStreams = await new YoutubeClient().GetVideoMediaStreamInfosAsync(meta.Id); + } + catch + { + await new ContentDialog + { + Title = "Failed to load video", + PrimaryButtonText = "Ok" + }.ShowAsync(); + return; + } if (meta.Snippet.LiveBroadcastContent == "none") { diff --git a/FoxTube/Controls/Player/VideoPlayer.xaml.cs b/FoxTube/Controls/Player/VideoPlayer.xaml.cs index 7789a52..25d80f4 100644 --- a/FoxTube/Controls/Player/VideoPlayer.xaml.cs +++ b/FoxTube/Controls/Player/VideoPlayer.xaml.cs @@ -54,7 +54,7 @@ namespace FoxTube videoSource.Markers.Add(new TimelineMarker { Time = TimeSpan.FromMinutes(k * 30) }); if (!privateMode) - HistorySet.Update(history); + HistorySet.Update(history, item); } else if (item.Snippet.LiveBroadcastContent == "live") { @@ -130,11 +130,11 @@ namespace FoxTube videoSource.Pause(); systemControls.IsEnabled = false; videoSource.Source = null; - + if (!incognito && item.Snippet.LiveBroadcastContent == "none") { history.LeftOn = videoSource.Position; - HistorySet.Update(history); + HistorySet.Update(history, item); } Methods.MainPage.CloseVideo(); @@ -153,7 +153,7 @@ namespace FoxTube if (!incognito && item.Snippet.LiveBroadcastContent == "none") { history.LeftOn = videoSource.Position; - HistorySet.Update(history); + HistorySet.Update(history, item); } } diff --git a/FoxTube/FoxTube.csproj b/FoxTube/FoxTube.csproj index 7cc679e..5520b06 100644 --- a/FoxTube/FoxTube.csproj +++ b/FoxTube/FoxTube.csproj @@ -11,8 +11,8 @@ FoxTube en-US UAP - 10.0.17134.0 - 10.0.17134.0 + 10.0.18362.0 + 10.0.18362.0 14 512 {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} @@ -432,7 +432,7 @@ - 0.12.1 + 0.14.0 1.30.0-beta02 @@ -453,22 +453,22 @@ 10.1811.22001 - 2.1.1 + 3.2.2 - 6.2.8 + 6.2.10 10.1901.28001 - 5.1.1 + 6.1.0 - 5.1.1 + 6.1.0 - 2.0.181011001 + 2.4.2 4.3.2 @@ -477,7 +477,7 @@ 4.3.0 - 4.7.6 + 4.7.16 diff --git a/FoxTube/Package.appxmanifest b/FoxTube/Package.appxmanifest index a9a7768..867bedb 100644 --- a/FoxTube/Package.appxmanifest +++ b/FoxTube/Package.appxmanifest @@ -15,7 +15,7 @@ - + @@ -23,7 +23,7 @@ - + diff --git a/FoxTube/Pages/MainPage.xaml b/FoxTube/Pages/MainPage.xaml index 02448ca..b5f9069 100644 --- a/FoxTube/Pages/MainPage.xaml +++ b/FoxTube/Pages/MainPage.xaml @@ -8,6 +8,23 @@ xmlns:ui="using:Microsoft.UI.Xaml.Controls" xmlns:controls="using:FoxTube.Controls"> + + + + + + @@ -22,70 +39,63 @@ - + + - - - - - - - - - + + + - - - - - - - - - - - - + + + + + + - - + + - + @@ -95,8 +105,8 @@ - - + + @@ -110,7 +120,7 @@ - + diff --git a/FoxTube/Pages/MainPage.xaml.cs b/FoxTube/Pages/MainPage.xaml.cs index 3d28cef..3a58c75 100644 --- a/FoxTube/Pages/MainPage.xaml.cs +++ b/FoxTube/Pages/MainPage.xaml.cs @@ -206,7 +206,7 @@ namespace FoxTube } var titleBar = ApplicationView.GetForCurrentView().TitleBar; - + titleBar.ButtonBackgroundColor = Colors.Transparent; titleBar.ButtonHoverBackgroundColor = Colors.IndianRed; titleBar.ButtonPressedBackgroundColor = Colors.DarkRed; @@ -218,27 +218,27 @@ namespace FoxTube else titleBar.ButtonForegroundColor = Colors.Black; } - + private void SecretsVault_SubscriptionsChanged(object sender, params object[] args) { switch((string)args[0]) { case "add": - if (nav.MenuItems.Count < 19) - nav.MenuItems.Add(args[1] as Subscription); + if (subsHeader.MenuItems.Count < 10) + subsHeader.MenuItems.Add(GetFromSubscription(args[1] as Subscription)); break; case "remove": - if(nav.MenuItems.Contains((Subscription)args[1])) + if(subsHeader.MenuItems.Contains((Subscription)args[1])) { - nav.MenuItems.Remove(args[1]); - if (SecretsVault.Subscriptions.Count >= 10) - nav.MenuItems.Add(SecretsVault.Subscriptions[9]); + subsHeader.MenuItems.Remove(args[1]); + //if (SecretsVault.Subscriptions.Count >= 10) + // nav.MenuItems.Add(SecretsVault.Subscriptions[9]); } break; } } - + private async void AuthorizationStateChanged(object sender, params object[] e) { wasInvoked = false; @@ -257,7 +257,7 @@ namespace FoxTube avatar.Visibility = Visibility.Visible; toChannel.Visibility = Visibility.Visible; - toSubscriptions.Visibility = Visibility.Visible; + //toSubscriptions.Visibility = Visibility.Visible; libHeader.Visibility = Visibility.Visible; toHistory.Visibility = Visibility.Visible; toLiked.Visibility = Visibility.Visible; @@ -267,7 +267,7 @@ namespace FoxTube { subsHeader.Visibility = Visibility.Visible; for (int k = 0; k < SecretsVault.Subscriptions.Count && k < 10; k++) - nav.MenuItems.Add(SecretsVault.Subscriptions[k]); + subsHeader.MenuItems.Add(GetFromSubscription(SecretsVault.Subscriptions[k])); } HistorySet.Load(); @@ -280,14 +280,15 @@ namespace FoxTube case false: content.Frame.Navigate(typeof(Home)); - for (int k = nav.MenuItems.Count - 1; k > 8; k--) - nav.MenuItems.RemoveAt(k); + subsHeader.MenuItems.Clear(); + //for (int k = nav.MenuItems.Count - 1; k > 8; k--) + // nav.MenuItems.RemoveAt(k); account.Visibility = Visibility.Visible; avatar.Visibility = Visibility.Collapsed; toChannel.Visibility = Visibility.Collapsed; - toSubscriptions.Visibility = Visibility.Collapsed; + //toSubscriptions.Visibility = Visibility.Collapsed; libHeader.Visibility = Visibility.Collapsed; toHistory.Visibility = Visibility.Collapsed; toLiked.Visibility = Visibility.Collapsed; @@ -330,6 +331,35 @@ namespace FoxTube DownloadAgent.Initialize(); } + public Microsoft.UI.Xaml.Controls.NavigationViewItem GetFromSubscription(Subscription subscription) + { + Grid grid = new Grid + { + ColumnSpacing = 12 + }; + + grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(20) }); + grid.ColumnDefinitions.Add(new ColumnDefinition()); + + grid.Children.Add(new Microsoft.UI.Xaml.Controls.PersonPicture + { + Width = 20, + ProfilePicture = new BitmapImage(subscription.Snippet.Thumbnails.Default__.Url.ToUri()) { DecodePixelHeight = 20, DecodePixelWidth = 20 } + }); + + grid.Children.Add(new TextBlock + { + Text = subscription.Snippet.Title + }); + Grid.SetColumn(grid.Children[1] as TextBlock, 1); + + return new Microsoft.UI.Xaml.Controls.NavigationViewItem + { + Content = grid, + Tag = subscription.Snippet.ChannelId + }; + } + private async void Feedback_Click(object sender, RoutedEventArgs e) { await StoreServicesFeedbackLauncher.GetDefault().LaunchAsync(); @@ -525,7 +555,7 @@ namespace FoxTube if (e.SourcePageType == typeof(Settings)) SetNavigationItem(nav.SettingsItem); else if (e.SourcePageType == typeof(Subscriptions)) - SetNavigationItem(toSubscriptions); + SetNavigationItem(subsHeader); else if (e.SourcePageType == typeof(Downloads)) SetNavigationItem(toDownloads); else if (e.SourcePageType == typeof(Home)) @@ -538,8 +568,8 @@ namespace FoxTube { if (e.Parameter.ToString() == SecretsVault.AccountId) SetNavigationItem(toChannel); - else if (nav.MenuItems.Contains(SecretsVault.Subscriptions.Find(i => i.Snippet.ResourceId.ChannelId == e.Parameter.ToString()))) - SetNavigationItem(SecretsVault.Subscriptions.Find(i => i.Snippet.ResourceId.ChannelId == e.Parameter.ToString())); + else if (subsHeader.MenuItems.Find(i => SecretsVault.Subscriptions.Any(s => (i as Microsoft.UI.Xaml.Controls.NavigationViewItem).Tag.Equals(s.Snippet.ChannelId))) is object item) + SetNavigationItem(item); else SetNavigationItem(null); } @@ -596,14 +626,14 @@ namespace FoxTube content.Frame.Navigate(typeof(PlaylistPage), SecretsVault.UserChannel.ContentDetails.RelatedPlaylists.Likes); else if (args.SelectedItem == toLater) content.Frame.Navigate(typeof(PlaylistPage), "WL"); - else if (args.SelectedItem == toSubscriptions) + else if (args.SelectedItem == subsHeader) content.Frame.Navigate(typeof(Subscriptions)); else if (args.SelectedItem == toDownloads) content.Frame.Navigate(typeof(Downloads)); else if (args.SelectedItem == toChannel) content.Frame.Navigate(typeof(ChannelPage), SecretsVault.UserChannel.Id); else - content.Frame.Navigate(typeof(ChannelPage), (args.SelectedItem as Subscription).Snippet.ResourceId.ChannelId); + content.Frame.Navigate(typeof(ChannelPage), (args.SelectedItem as FrameworkElement).Tag as string); } } else @@ -634,5 +664,20 @@ namespace FoxTube { AppTitle.Visibility = Visibility.Visible; } - } + + private void PaneToggle(object sender, RoutedEventArgs e) + { + nav.IsPaneOpen = !nav.IsPaneOpen; + } + + ElementTheme savedTheme; + private void IncognitoToggle(object sender, RoutedEventArgs e) + { + savedTheme = RequestedTheme; + if ((sender as ToggleSwitch).IsOn) + RequestedTheme = ElementTheme.Dark; + else + RequestedTheme = savedTheme; + } + } }