Archived
1
0

Refinements

This commit is contained in:
Michael Gordeev
2020-07-06 15:07:23 +03:00
parent fee80ef07f
commit 6a8896d804
66 changed files with 234 additions and 119 deletions
+3 -3
View File
@@ -59,8 +59,8 @@ namespace FoxTube.Background
UserCredential Credential = await GoogleWebAuthorizationBroker.AuthorizeAsync( UserCredential Credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
new ClientSecrets new ClientSecrets
{ {
ClientId = "349735264870-2ekqlm0a4mkg3mmrfcv90s3qp3o15dq0.apps.googleusercontent.com", ClientId = "1096685398208-rsabgv4dfkopr3c7p27p61pkcans012g.apps.googleusercontent.com",
ClientSecret = "BkVZOAaCU2Zclf0Zlicg6y2_" ClientSecret = "EtX5VkCwrl7EZsFM2Dt7Jzpd"
}, },
new[] new[]
{ {
@@ -107,7 +107,7 @@ namespace FoxTube.Background
foreach (Subscription item in subscriptions) foreach (Subscription item in subscriptions)
{ {
SearchResource.ListRequest request = service.Search.List("snippet"); SearchResource.ListRequest request = service.Search.List("snippet");
request.PublishedAfter = lastCheck; request.PublishedAfter = lastCheck.Subtract(TimeSpan.FromDays(3));
request.ChannelId = item.Snippet.ResourceId.ChannelId; request.ChannelId = item.Snippet.ResourceId.ChannelId;
request.Type = "video"; request.Type = "video";
request.MaxResults = 5; request.MaxResults = 5;
Binary file not shown.

Before

Width:  |  Height:  |  Size: 374 B

After

Width:  |  Height:  |  Size: 374 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 389 B

After

Width:  |  Height:  |  Size: 389 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 414 B

After

Width:  |  Height:  |  Size: 414 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 520 B

After

Width:  |  Height:  |  Size: 520 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 843 B

After

Width:  |  Height:  |  Size: 843 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 162 KiB

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 172 KiB

After

Width:  |  Height:  |  Size: 207 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 615 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 610 B

After

Width:  |  Height:  |  Size: 615 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 461 B

After

Width:  |  Height:  |  Size: 476 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 723 B

After

Width:  |  Height:  |  Size: 732 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 55 KiB

+21 -2
View File
@@ -1,6 +1,8 @@
using Newtonsoft.Json; using Google.Apis.YouTube.v3.Data;
using Newtonsoft.Json;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Windows.ApplicationModel.UserActivities;
using Windows.Storage; using Windows.Storage;
namespace FoxTube namespace FoxTube
@@ -15,7 +17,7 @@ namespace FoxTube
{ {
public static List<HistoryItem> Items { get; set; } = new List<HistoryItem>(); public static List<HistoryItem> Items { get; set; } = new List<HistoryItem>();
public static void Update(HistoryItem item) public static async void Update(HistoryItem item, Video video)
{ {
if (!SecretsVault.IsAuthorized) if (!SecretsVault.IsAuthorized)
return; return;
@@ -26,6 +28,23 @@ namespace FoxTube
if (Items.Count > 200) if (Items.Count > 200)
Items.RemoveRange(200, Items.Count - 200); Items.RemoveRange(200, Items.Count - 200);
Save(); 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) public static void Delete(HistoryItem item)
+16 -2
View File
@@ -304,22 +304,30 @@ namespace FoxTube
public static async Task<List<string>> GetHistory() public static async Task<List<string>> GetHistory()
{ {
SecretsVault.RefreshToken();
List<string> list = new List<string>(); List<string> list = new List<string>();
try
{
SecretsVault.RefreshToken();
string output = await SecretsVault.HttpClient.GetStringAsync($"https://www.youtube.com/list_ajax?style=json&action_get_list=1&list=HL&hl={SettingsStorage.RelevanceLanguage}"); 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); dynamic raw = JsonConvert.DeserializeObject(output);
foreach (dynamic i in raw.video) foreach (dynamic i in raw.video)
list.Add(i.encrypted_id.ToString()); list.Add(i.encrypted_id.ToString());
}
catch
{
}
return list; return list;
} }
public static async Task<List<string>> GetLater() public static async Task<List<string>> GetLater()
{ {
SecretsVault.RefreshToken();
List<string> list = new List<string>(); List<string> list = new List<string>();
try
{
SecretsVault.RefreshToken();
string output = await SecretsVault.HttpClient.GetStringAsync($"https://www.youtube.com/list_ajax?style=json&action_get_list=1&list=WL&hl={SettingsStorage.RelevanceLanguage}"); string output = await SecretsVault.HttpClient.GetStringAsync($"https://www.youtube.com/list_ajax?style=json&action_get_list=1&list=WL&hl={SettingsStorage.RelevanceLanguage}");
@@ -327,6 +335,12 @@ namespace FoxTube
foreach (dynamic i in raw.video) foreach (dynamic i in raw.video)
list.Add(i.encrypted_id.ToString()); list.Add(i.encrypted_id.ToString());
}
catch
{
}
return list; return list;
} }
} }
+18 -5
View File
@@ -15,6 +15,7 @@ using Google.Apis.Oauth2.v2;
using static Google.Apis.Auth.OAuth2.UwpCodeReceiver; using static Google.Apis.Auth.OAuth2.UwpCodeReceiver;
using Microsoft.AppCenter.Analytics; using Microsoft.AppCenter.Analytics;
using System.Net; using System.Net;
using Google.Apis.Auth.OAuth2.Responses;
namespace FoxTube namespace FoxTube
{ {
@@ -30,12 +31,12 @@ namespace FoxTube
public static NetworkCredential EmailCredential => new NetworkCredential("mikhailagord@gmail.com", "JkY39w$.7?bT57O,8k3a"); public static NetworkCredential EmailCredential => new NetworkCredential("mikhailagord@gmail.com", "JkY39w$.7?bT57O,8k3a");
private static ClientSecrets Secrets => new ClientSecrets private static ClientSecrets Secrets => new ClientSecrets
{ {
ClientId = "349735264870-2ekqlm0a4mkg3mmrfcv90s3qp3o15dq0.apps.googleusercontent.com", ClientId = "1096685398208-rsabgv4dfkopr3c7p27p61pkcans012g.apps.googleusercontent.com",
ClientSecret = "BkVZOAaCU2Zclf0Zlicg6y2_" ClientSecret = "EtX5VkCwrl7EZsFM2Dt7Jzpd"
}; };
private static YouTubeService NoAuthService => new YouTubeService(new BaseClientService.Initializer private static YouTubeService NoAuthService => new YouTubeService(new BaseClientService.Initializer
{ {
ApiKey = "AIzaSyBgHrCnrlzlVmk0cJKL8RqP9Y8x6XSuk_0", ApiKey = "AIzaSyD7tpbuvmYDv9h4udo9L_g3r0sLPFAnN00",
ApplicationName = "FoxTube" ApplicationName = "FoxTube"
}); });
public static BaseClientService.Initializer Initializer => new BaseClientService.Initializer public static BaseClientService.Initializer Initializer => new BaseClientService.Initializer
@@ -150,6 +151,16 @@ namespace FoxTube
await Credential.RefreshTokenAsync(CancellationToken.None); await Credential.RefreshTokenAsync(CancellationToken.None);
} }
catch (TokenResponseException e)
{
AuthorizationStateChanged?.Invoke(args: new bool?[] { null });
Analytics.TrackEvent("Failed to authorize", new Dictionary<string, string>
{
{ "Exception", e.GetType().ToString() },
{ "Message", e.Message },
{ "StackTrace", e.StackTrace }
});
}
catch (AuthenticateException e) catch (AuthenticateException e)
{ {
if (e.Message.Contains("UserCancel")) if (e.Message.Contains("UserCancel"))
@@ -212,10 +223,12 @@ namespace FoxTube
} }
catch (Exception e) catch (Exception e)
{ {
Deauthenticate();
AuthorizationStateChanged?.Invoke(args: new bool?[] { null }); AuthorizationStateChanged?.Invoke(args: new bool?[] { null });
Methods.SendMail($@"Exception: {e.GetType()} /*Methods.SendMail($@"Exception: {e.GetType()}
Message: {e.Message} Message: {e.Message}
Stack trace: {e.StackTrace}"); Stack trace: {e.StackTrace}");*/
Analytics.TrackEvent("Failed to retrieve user's info", new Dictionary<string, string> Analytics.TrackEvent("Failed to retrieve user's info", new Dictionary<string, string>
{ {
{ "Exception", e.GetType().ToString() }, { "Exception", e.GetType().ToString() },
+1 -1
View File
@@ -203,7 +203,7 @@ namespace FoxTube
} }
set set
{ {
storage.Values["mature"] = value; storage.Values["mature"] = (int)value;
} }
} }
+15 -1
View File
@@ -214,6 +214,7 @@ namespace FoxTube
private async void Quality_SelectionChanged(object sender, SelectionChangedEventArgs e) private async void Quality_SelectionChanged(object sender, SelectionChangedEventArgs e)
{ {
//return;
if (Meta.Snippet.LiveBroadcastContent == "live") if (Meta.Snippet.LiveBroadcastContent == "live")
goto SetQuality; goto SetQuality;
if(!needUpdateTimecode) if(!needUpdateTimecode)
@@ -227,7 +228,8 @@ namespace FoxTube
if (info is MuxedStreamInfo) if (info is MuxedStreamInfo)
Player.SetPlaybackSource(MediaSource.CreateFromUri((info as MuxedStreamInfo).Url.ToUri())); Player.SetPlaybackSource(MediaSource.CreateFromUri((info as MuxedStreamInfo).Url.ToUri()));
else if (info is VideoStreamInfo || info == null) 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) else if (info is StreamQuality)
Player.SetPlaybackSource(MediaSource.CreateFromUri((info as StreamQuality).Url)); Player.SetPlaybackSource(MediaSource.CreateFromUri((info as StreamQuality).Url));
} }
@@ -427,7 +429,19 @@ namespace FoxTube
title.Text = meta.Snippet.Title; title.Text = meta.Snippet.Title;
channel.Text = meta.Snippet.ChannelTitle; channel.Text = meta.Snippet.ChannelTitle;
try
{
MediaStreams = await new YoutubeClient().GetVideoMediaStreamInfosAsync(meta.Id); 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") if (meta.Snippet.LiveBroadcastContent == "none")
{ {
+3 -3
View File
@@ -54,7 +54,7 @@ namespace FoxTube
videoSource.Markers.Add(new TimelineMarker { Time = TimeSpan.FromMinutes(k * 30) }); videoSource.Markers.Add(new TimelineMarker { Time = TimeSpan.FromMinutes(k * 30) });
if (!privateMode) if (!privateMode)
HistorySet.Update(history); HistorySet.Update(history, item);
} }
else if (item.Snippet.LiveBroadcastContent == "live") else if (item.Snippet.LiveBroadcastContent == "live")
{ {
@@ -134,7 +134,7 @@ namespace FoxTube
if (!incognito && item.Snippet.LiveBroadcastContent == "none") if (!incognito && item.Snippet.LiveBroadcastContent == "none")
{ {
history.LeftOn = videoSource.Position; history.LeftOn = videoSource.Position;
HistorySet.Update(history); HistorySet.Update(history, item);
} }
Methods.MainPage.CloseVideo(); Methods.MainPage.CloseVideo();
@@ -153,7 +153,7 @@ namespace FoxTube
if (!incognito && item.Snippet.LiveBroadcastContent == "none") if (!incognito && item.Snippet.LiveBroadcastContent == "none")
{ {
history.LeftOn = videoSource.Position; history.LeftOn = videoSource.Position;
HistorySet.Update(history); HistorySet.Update(history, item);
} }
} }
+9 -9
View File
@@ -11,8 +11,8 @@
<AssemblyName>FoxTube</AssemblyName> <AssemblyName>FoxTube</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage> <DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier> <TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.17134.0</TargetPlatformVersion> <TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.18362.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17134.0</TargetPlatformMinVersion> <TargetPlatformMinVersion>10.0.18362.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion> <MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
@@ -432,7 +432,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="AngleSharp"> <PackageReference Include="AngleSharp">
<Version>0.12.1</Version> <Version>0.14.0</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Google.Apis"> <PackageReference Include="Google.Apis">
<Version>1.30.0-beta02</Version> <Version>1.30.0-beta02</Version>
@@ -453,22 +453,22 @@
<Version>10.1811.22001</Version> <Version>10.1811.22001</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.AppCenter.Analytics"> <PackageReference Include="Microsoft.AppCenter.Analytics">
<Version>2.1.1</Version> <Version>3.2.2</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform"> <PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.2.8</Version> <Version>6.2.10</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.Services.Store.Engagement"> <PackageReference Include="Microsoft.Services.Store.Engagement">
<Version>10.1901.28001</Version> <Version>10.1901.28001</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications"> <PackageReference Include="Microsoft.Toolkit.Uwp.Notifications">
<Version>5.1.1</Version> <Version>6.1.0</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.Toolkit.Uwp.UI.Controls"> <PackageReference Include="Microsoft.Toolkit.Uwp.UI.Controls">
<Version>5.1.1</Version> <Version>6.1.0</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.UI.Xaml"> <PackageReference Include="Microsoft.UI.Xaml">
<Version>2.0.181011001</Version> <Version>2.4.2</Version>
</PackageReference> </PackageReference>
<PackageReference Include="runtime.win10-arm64.runtime.native.System.IO.Compression"> <PackageReference Include="runtime.win10-arm64.runtime.native.System.IO.Compression">
<Version>4.3.2</Version> <Version>4.3.2</Version>
@@ -477,7 +477,7 @@
<Version>4.3.0</Version> <Version>4.3.0</Version>
</PackageReference> </PackageReference>
<PackageReference Include="YoutubeExplode"> <PackageReference Include="YoutubeExplode">
<Version>4.7.6</Version> <Version>4.7.16</Version>
</PackageReference> </PackageReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
+2 -2
View File
@@ -15,7 +15,7 @@
</Resources> </Resources>
<Applications> <Applications>
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="FoxTube.App" ResourceGroup="foxtube"> <Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="FoxTube.App" ResourceGroup="foxtube">
<uap:VisualElements DisplayName="FoxTube" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="YouTube Client for Windows 10" BackgroundColor="#282828"> <uap:VisualElements DisplayName="FoxTube" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="YouTube Client for Windows 10" BackgroundColor="#404040">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png" ShortName="FoxTube" Square310x310Logo="Assets\LargeTile.png" Square71x71Logo="Assets\SmallTile.png"> <uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png" ShortName="FoxTube" Square310x310Logo="Assets\LargeTile.png" Square71x71Logo="Assets\SmallTile.png">
<uap:ShowNameOnTiles> <uap:ShowNameOnTiles>
<uap:ShowOn Tile="square150x150Logo" /> <uap:ShowOn Tile="square150x150Logo" />
@@ -23,7 +23,7 @@
<uap:ShowOn Tile="square310x310Logo" /> <uap:ShowOn Tile="square310x310Logo" />
</uap:ShowNameOnTiles> </uap:ShowNameOnTiles>
</uap:DefaultTile> </uap:DefaultTile>
<uap:SplashScreen Image="Assets\SplashScreen.png" BackgroundColor="#282828" /> <uap:SplashScreen Image="Assets\SplashScreen.png" BackgroundColor="#404040" />
<uap:LockScreen Notification="badgeAndTileText" BadgeLogo="Assets\BadgeLogo.png"/> <uap:LockScreen Notification="badgeAndTileText" BadgeLogo="Assets\BadgeLogo.png"/>
</uap:VisualElements> </uap:VisualElements>
<Extensions> <Extensions>
+36 -26
View File
@@ -8,6 +8,23 @@
xmlns:ui="using:Microsoft.UI.Xaml.Controls" xmlns:ui="using:Microsoft.UI.Xaml.Controls"
xmlns:controls="using:FoxTube.Controls"> xmlns:controls="using:FoxTube.Controls">
<Page.Resources>
<Style x:Key="HeaderActionButton" TargetType="Button" BasedOn="{StaticResource ButtonRevealStyle}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="CornerRadius" Value="0" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="Height" Value="32" />
<Setter Property="Width" Value="40" />
<Setter Property="Padding" Value="0" />
<Setter Property="FontFamily" Value="Segoe MDL2 Assets" />
<Setter Property="FontSize" Value="15" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
</Style>
</Page.Resources>
<Grid Name="grid"> <Grid Name="grid">
<VisualStateManager.VisualStateGroups> <VisualStateManager.VisualStateGroups>
<VisualStateGroup> <VisualStateGroup>
@@ -22,27 +39,27 @@
</VisualStateGroup> </VisualStateGroup>
</VisualStateManager.VisualStateGroups> </VisualStateManager.VisualStateGroups>
<Button VerticalAlignment="Top" HorizontalAlignment="Left" Margin="40,0,0,0" Width="40" Height="40" Padding="0" FontFamily="Segoe MDL2 Assets" Content="&#xE700;" Canvas.ZIndex="2" Background="Transparent" CornerRadius="0" Click="PaneToggle"/>
<Border x:Name="AppTitleBar" <Border x:Name="AppTitleBar"
Margin="80,0,500,0"
Height="40"
IsHitTestVisible="True" IsHitTestVisible="True"
VerticalAlignment="Top" VerticalAlignment="Top"
Background="Transparent" Background="Transparent"
Canvas.ZIndex="1"> Canvas.ZIndex="1">
<TextBlock x:Name="AppTitle" <TextBlock x:Name="AppTitle"
Text="FoxTube" Text="FoxTube (v2.0 Preview 1)"
VerticalAlignment="Center" VerticalAlignment="Center"
Margin="12, 8, 0, 0" Margin="12,0"
Style="{StaticResource CaptionTextBlockStyle}" /> Style="{StaticResource CaptionTextBlockStyle}" />
</Border> </Border>
<ui:NavigationView SelectedItem="toHome" BackRequested="Nav_BackRequested" PaneClosing="Nav_PaneClosing" PaneOpened="Nav_PaneOpened" OpenPaneLength="300" Name="nav" SelectionChanged="Nav_SelectionChanged"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,0,350,0">
<ui:NavigationView.Header> <Button Style="{StaticResource HeaderActionButton}" x:Uid="/Main/feedback" Name="feedback" Click="Feedback_Click" Visibility="Visible" FontFamily="Segoe MDL2 Assets" Content="&#xED15;"/>
<Grid> <Button Style="{StaticResource HeaderActionButton}" x:Uid="/Main/signIn" Name="account" Click="SignIn_Click" Visibility="Collapsed" FontFamily="Segoe MDL2 Assets" Content="&#xE8FA;" />
<TextBlock Name="Title" Style="{StaticResource TitleTextBlockStyle}"/> <Button Style="{StaticResource HeaderActionButton}" Background="Transparent" Visibility="Collapsed" Name="avatar" Padding="0">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button x:Uid="/Main/feedback" Name="feedback" Click="Feedback_Click" Visibility="Collapsed" FontFamily="Segoe MDL2 Assets" Content="&#xED15;" Background="Transparent" Height="41" Width="60" FontSize="15"/>
<Button x:Uid="/Main/signIn" Name="account" Click="SignIn_Click" Visibility="Collapsed" FontFamily="Segoe MDL2 Assets" Content="&#xE8FA;" Background="Transparent" Height="41" Width="60" FontSize="15"/>
<Button Background="Transparent" Visibility="Collapsed" Name="avatar" Height="41" Width="60" FontSize="15" Padding="0">
<Button.Flyout> <Button.Flyout>
<Flyout> <Flyout>
<Grid> <Grid>
@@ -55,6 +72,7 @@
<TextBlock Name="myNameFlyout"/> <TextBlock Name="myNameFlyout"/>
<TextBlock Style="{StaticResource CaptionTextBlockStyle}" Name="myEmail"/> <TextBlock Style="{StaticResource CaptionTextBlockStyle}" Name="myEmail"/>
<HyperlinkButton x:Uid="/Main/signOut" Content="Log out" Click="Logout_Click"/> <HyperlinkButton x:Uid="/Main/signOut" Content="Log out" Click="Logout_Click"/>
<ToggleSwitch OnContent="Incognito mode" OffContent="Incognito mode" Toggled="IncognitoToggle"/>
</StackPanel> </StackPanel>
</Grid> </Grid>
</Flyout> </Flyout>
@@ -66,26 +84,18 @@
</Ellipse> </Ellipse>
</Button> </Button>
</StackPanel> </StackPanel>
<ui:NavigationView IsTitleBarAutoPaddingEnabled="False" IsPaneToggleButtonVisible="False" SelectedItem="toHome" BackRequested="Nav_BackRequested" PaneClosing="Nav_PaneClosing" PaneOpened="Nav_PaneOpened" OpenPaneLength="350" Name="nav" SelectionChanged="Nav_SelectionChanged">
<ui:NavigationView.Header>
<Grid Visibility="Collapsed">
<TextBlock Name="Title" Style="{StaticResource TitleTextBlockStyle}"/>
</Grid> </Grid>
</ui:NavigationView.Header> </ui:NavigationView.Header>
<ui:NavigationView.MenuItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Padding="5" Margin="-5,0,0,0" Tag="{Binding Snippet.ResourceId.ChannelId}">
<PersonPicture Height="20" Margin="-5,0,15,0">
<PersonPicture.ProfilePicture>
<BitmapImage UriSource="{Binding Snippet.Thumbnails.Medium.Url}" DecodePixelHeight="20" DecodePixelWidth="20"/>
</PersonPicture.ProfilePicture>
</PersonPicture>
<TextBlock FontSize="14" Text="{Binding Snippet.Title}"/>
</StackPanel>
</DataTemplate>
</ui:NavigationView.MenuItemTemplate>
<ui:NavigationView.MenuItems> <ui:NavigationView.MenuItems>
<ui:NavigationViewItem x:Uid="/Main/home" Icon="Home" Content="Home" Name="toHome"/> <ui:NavigationViewItem x:Uid="/Main/home" Icon="Home" Content="Home" Name="toHome"/>
<ui:NavigationViewItem x:Uid="/Main/myChannel" Icon="Contact" Content="My channel" Name="toChannel" Visibility="Collapsed"/> <ui:NavigationViewItem x:Uid="/Main/myChannel" Icon="Contact" Content="My channel" Name="toChannel" Visibility="Collapsed"/>
<ui:NavigationViewItem x:Uid="/Main/subscriptions" Icon="People" Content="Subscriptions" Name="toSubscriptions" Visibility="Collapsed"/> <!--<ui:NavigationViewItem x:Uid="/Main/subscriptions" Icon="People" Content="Subscriptions" Name="toSubscriptions" Visibility="Collapsed"/>-->
<ui:NavigationViewItemHeader x:Uid="/Main/myLibrary" FontSize="14" Content="My library" Name="libHeader" Visibility="Collapsed"/> <ui:NavigationViewItemHeader x:Uid="/Main/myLibrary" FontSize="14" Content="My library" Name="libHeader" Visibility="Collapsed"/>
<ui:NavigationViewItem x:Uid="/Main/history" Content="History" Name="toHistory" Visibility="Collapsed"> <ui:NavigationViewItem x:Uid="/Main/history" Content="History" Name="toHistory" Visibility="Collapsed">
<ui:NavigationViewItem.Icon> <ui:NavigationViewItem.Icon>
@@ -95,7 +105,7 @@
<ui:NavigationViewItem x:Uid="/Main/liked" Icon="Like" Content="Liked videos" Name="toLiked" Visibility="Collapsed"/> <ui:NavigationViewItem x:Uid="/Main/liked" Icon="Like" Content="Liked videos" Name="toLiked" Visibility="Collapsed"/>
<ui:NavigationViewItem x:Uid="/Main/later" Icon="Clock" Content="Watch later" Name="toLater" Visibility="Collapsed"/> <ui:NavigationViewItem x:Uid="/Main/later" Icon="Clock" Content="Watch later" Name="toLater" Visibility="Collapsed"/>
<ui:NavigationViewItem x:Uid="/Main/downloads" Icon="Download" Content="Downloads" Name="toDownloads"/> <ui:NavigationViewItem x:Uid="/Main/downloads" Icon="Download" Content="Downloads" Name="toDownloads"/>
<ui:NavigationViewItemHeader x:Uid="/Main/subscriptions" FontSize="14" Content="Subscriptions" Name="subsHeader" Visibility="Collapsed"/> <ui:NavigationViewItem x:Uid="/Main/subscriptions" Icon="People" FontSize="14" Content="Subscriptions" Name="subsHeader" Visibility="Collapsed"/>
</ui:NavigationView.MenuItems> </ui:NavigationView.MenuItems>
<ui:NavigationView.PaneFooter> <ui:NavigationView.PaneFooter>
@@ -110,7 +120,7 @@
<AutoSuggestBox x:Name="search" QueryIcon="Find" QuerySubmitted="Search_QuerySubmitted" TextChanged="Search_TextChanged" x:Uid="/Main/searchPlaceholder" PlaceholderText="Search"/> <AutoSuggestBox x:Name="search" QueryIcon="Find" QuerySubmitted="Search_QuerySubmitted" TextChanged="Search_TextChanged" x:Uid="/Main/searchPlaceholder" PlaceholderText="Search"/>
</ui:NavigationView.AutoSuggestBox> </ui:NavigationView.AutoSuggestBox>
<Grid> <Grid Margin="0,-24,0,0">
<controls:ContentFrame x:Name="content" Navigated="Content_Navigated"/> <controls:ContentFrame x:Name="content" Navigated="Content_Navigated"/>
<controls:ContentFrame x:Name="videoPlaceholder"/> <controls:ContentFrame x:Name="videoPlaceholder"/>
</Grid> </Grid>
+61 -16
View File
@@ -224,16 +224,16 @@ namespace FoxTube
switch((string)args[0]) switch((string)args[0])
{ {
case "add": case "add":
if (nav.MenuItems.Count < 19) if (subsHeader.MenuItems.Count < 10)
nav.MenuItems.Add(args[1] as Subscription); subsHeader.MenuItems.Add(GetFromSubscription(args[1] as Subscription));
break; break;
case "remove": case "remove":
if(nav.MenuItems.Contains((Subscription)args[1])) if(subsHeader.MenuItems.Contains((Subscription)args[1]))
{ {
nav.MenuItems.Remove(args[1]); subsHeader.MenuItems.Remove(args[1]);
if (SecretsVault.Subscriptions.Count >= 10) //if (SecretsVault.Subscriptions.Count >= 10)
nav.MenuItems.Add(SecretsVault.Subscriptions[9]); // nav.MenuItems.Add(SecretsVault.Subscriptions[9]);
} }
break; break;
} }
@@ -257,7 +257,7 @@ namespace FoxTube
avatar.Visibility = Visibility.Visible; avatar.Visibility = Visibility.Visible;
toChannel.Visibility = Visibility.Visible; toChannel.Visibility = Visibility.Visible;
toSubscriptions.Visibility = Visibility.Visible; //toSubscriptions.Visibility = Visibility.Visible;
libHeader.Visibility = Visibility.Visible; libHeader.Visibility = Visibility.Visible;
toHistory.Visibility = Visibility.Visible; toHistory.Visibility = Visibility.Visible;
toLiked.Visibility = Visibility.Visible; toLiked.Visibility = Visibility.Visible;
@@ -267,7 +267,7 @@ namespace FoxTube
{ {
subsHeader.Visibility = Visibility.Visible; subsHeader.Visibility = Visibility.Visible;
for (int k = 0; k < SecretsVault.Subscriptions.Count && k < 10; k++) 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(); HistorySet.Load();
@@ -280,14 +280,15 @@ namespace FoxTube
case false: case false:
content.Frame.Navigate(typeof(Home)); content.Frame.Navigate(typeof(Home));
for (int k = nav.MenuItems.Count - 1; k > 8; k--) subsHeader.MenuItems.Clear();
nav.MenuItems.RemoveAt(k); //for (int k = nav.MenuItems.Count - 1; k > 8; k--)
// nav.MenuItems.RemoveAt(k);
account.Visibility = Visibility.Visible; account.Visibility = Visibility.Visible;
avatar.Visibility = Visibility.Collapsed; avatar.Visibility = Visibility.Collapsed;
toChannel.Visibility = Visibility.Collapsed; toChannel.Visibility = Visibility.Collapsed;
toSubscriptions.Visibility = Visibility.Collapsed; //toSubscriptions.Visibility = Visibility.Collapsed;
libHeader.Visibility = Visibility.Collapsed; libHeader.Visibility = Visibility.Collapsed;
toHistory.Visibility = Visibility.Collapsed; toHistory.Visibility = Visibility.Collapsed;
toLiked.Visibility = Visibility.Collapsed; toLiked.Visibility = Visibility.Collapsed;
@@ -330,6 +331,35 @@ namespace FoxTube
DownloadAgent.Initialize(); 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) private async void Feedback_Click(object sender, RoutedEventArgs e)
{ {
await StoreServicesFeedbackLauncher.GetDefault().LaunchAsync(); await StoreServicesFeedbackLauncher.GetDefault().LaunchAsync();
@@ -525,7 +555,7 @@ namespace FoxTube
if (e.SourcePageType == typeof(Settings)) if (e.SourcePageType == typeof(Settings))
SetNavigationItem(nav.SettingsItem); SetNavigationItem(nav.SettingsItem);
else if (e.SourcePageType == typeof(Subscriptions)) else if (e.SourcePageType == typeof(Subscriptions))
SetNavigationItem(toSubscriptions); SetNavigationItem(subsHeader);
else if (e.SourcePageType == typeof(Downloads)) else if (e.SourcePageType == typeof(Downloads))
SetNavigationItem(toDownloads); SetNavigationItem(toDownloads);
else if (e.SourcePageType == typeof(Home)) else if (e.SourcePageType == typeof(Home))
@@ -538,8 +568,8 @@ namespace FoxTube
{ {
if (e.Parameter.ToString() == SecretsVault.AccountId) if (e.Parameter.ToString() == SecretsVault.AccountId)
SetNavigationItem(toChannel); SetNavigationItem(toChannel);
else if (nav.MenuItems.Contains(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(SecretsVault.Subscriptions.Find(i => i.Snippet.ResourceId.ChannelId == e.Parameter.ToString())); SetNavigationItem(item);
else else
SetNavigationItem(null); SetNavigationItem(null);
} }
@@ -596,14 +626,14 @@ namespace FoxTube
content.Frame.Navigate(typeof(PlaylistPage), SecretsVault.UserChannel.ContentDetails.RelatedPlaylists.Likes); content.Frame.Navigate(typeof(PlaylistPage), SecretsVault.UserChannel.ContentDetails.RelatedPlaylists.Likes);
else if (args.SelectedItem == toLater) else if (args.SelectedItem == toLater)
content.Frame.Navigate(typeof(PlaylistPage), "WL"); content.Frame.Navigate(typeof(PlaylistPage), "WL");
else if (args.SelectedItem == toSubscriptions) else if (args.SelectedItem == subsHeader)
content.Frame.Navigate(typeof(Subscriptions)); content.Frame.Navigate(typeof(Subscriptions));
else if (args.SelectedItem == toDownloads) else if (args.SelectedItem == toDownloads)
content.Frame.Navigate(typeof(Downloads)); content.Frame.Navigate(typeof(Downloads));
else if (args.SelectedItem == toChannel) else if (args.SelectedItem == toChannel)
content.Frame.Navigate(typeof(ChannelPage), SecretsVault.UserChannel.Id); content.Frame.Navigate(typeof(ChannelPage), SecretsVault.UserChannel.Id);
else 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 else
@@ -634,5 +664,20 @@ namespace FoxTube
{ {
AppTitle.Visibility = Visibility.Visible; 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;
}
} }
} }