Archived
1
0

History and watch later pages

This commit is contained in:
Michael Gordeev
2019-02-03 19:57:39 +03:00
parent 5d92865ba2
commit 9548be15f3
11 changed files with 188 additions and 48 deletions
+55
View File
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8" ?>
<items>
<item time="2019-02-02" version="0.3">
<content>
<en-US>### What's new:
- Small fixes
- First public pre-release version
- Some content was cut out due to its incompleteness
</en-US>
<ru-RU>### Что нового:
- Мелкие исправления багов
- Эта версия является первой пред-релизной публичной версией
- Некотроые функции были вырезаны из-за их незавершенности
</ru-RU>
</content>
</item>
<item time="2019-01-05" version="0.2.19012">
<content>
<en-US>### What's new:
- 'Live' button fixed in the player
- Long channel names on crads fixed
- Fixed video description disappearing on window resizing
- Player seek is fixed
- Added video buffering progress indicatior
- Small fixes
### Known issues:
- Recommended and subscriptions pages aren't implemented
- History isn't implemented
- Playlists management isn't implemented
- Ads aren't implemented
</en-US>
<ru-RU>### Что нового:
- Кнопка перехода к прямому эфиру на стримах теперь работает
- Исправлен баг с длинными именами каналов на карточках
- Исправлено исчезание описания видео при изменении размеров окна
- Исправлен ползунок перемотки видео
- Добавлен индикатор буферизации видео
- Мелкие исправления
### Что по-прежнему не работает:
- Страница рекомендованных видео и страница видео с подписок
- История
- Работа с плейлистами
- Нет карточек рекламы
</ru-RU>
</content>
</item>
</items>
+33
View File
@@ -1,11 +1,14 @@
using FoxTube.Pages; using FoxTube.Pages;
using Google.Apis.YouTube.v3; using Google.Apis.YouTube.v3;
using Newtonsoft.Json;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Net.Http;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Web; using System.Web;
using System.Xml; using System.Xml;
using Windows.ApplicationModel.Core; using Windows.ApplicationModel.Core;
@@ -308,5 +311,35 @@ namespace FoxTube
deferral.Complete(); deferral.Complete();
} }
} }
public static async Task<List<string>> GetHistory()
{
List<string> list = new List<string>();
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", SecretsVault.Credential.Token.AccessToken);
string output = await client.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());
return list;
}
public static async Task<List<string>> GetLater()
{
List<string> list = new List<string>();
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", SecretsVault.Credential.Token.AccessToken);
string output = await client.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());
return list;
}
} }
} }
+5 -1
View File
@@ -110,7 +110,11 @@ namespace FoxTube
new[] new[]
{ {
Google.Apis.Oauth2.v2.Oauth2Service.Scope.UserinfoProfile, Google.Apis.Oauth2.v2.Oauth2Service.Scope.UserinfoProfile,
YouTubeService.Scope.YoutubeForceSsl YouTubeService.Scope.YoutubeForceSsl,
YouTubeService.Scope.Youtube,
YouTubeService.Scope.YoutubeUpload,
YouTubeService.Scope.YoutubeReadonly,
YouTubeService.Scope.Youtubepartner
}, },
"user", "user",
CancellationToken.None); CancellationToken.None);
+1
View File
@@ -209,6 +209,7 @@
<Content Include="Assets\BadgeLogo.scale-200.png" /> <Content Include="Assets\BadgeLogo.scale-200.png" />
<Content Include="Assets\BadgeLogo.scale-400.png" /> <Content Include="Assets\BadgeLogo.scale-400.png" />
<Content Include="Assets\ChannelCoverTemplate.png" /> <Content Include="Assets\ChannelCoverTemplate.png" />
<Content Include="Assets\Data\RevEn.xml" />
<Content Include="Assets\Data\Patchnotes.xml" /> <Content Include="Assets\Data\Patchnotes.xml" />
<Content Include="Assets\FoxGame.png" /> <Content Include="Assets\FoxGame.png" />
<Content Include="Assets\Icons\Profile.png" /> <Content Include="Assets\Icons\Profile.png" />
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3" IgnorableNamespaces="uap mp uap3"> <Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3" IgnorableNamespaces="uap mp uap3">
<Identity Name="53949MichaelXFoxGordeev.FoxTube" Publisher="CN=FD7A34DD-FE4D-4D7D-9D33-2DA9EBBE7725" Version="0.3.5.0" /> <Identity Name="53949MichaelXFoxGordeev.FoxTube" Publisher="CN=FD7A34DD-FE4D-4D7D-9D33-2DA9EBBE7725" Version="0.3.6.0" />
<mp:PhoneIdentity PhoneProductId="04fd81c1-6473-4174-afd7-4ac71dd85721" PhonePublisherId="00000000-0000-0000-0000-000000000000" /> <mp:PhoneIdentity PhoneProductId="04fd81c1-6473-4174-afd7-4ac71dd85721" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties> <Properties>
<DisplayName>FoxTube</DisplayName> <DisplayName>FoxTube</DisplayName>
+4 -15
View File
@@ -29,27 +29,16 @@ namespace FoxTube.Pages
public Browser() public Browser()
{ {
InitializeComponent(); InitializeComponent();
Initialize();
} }
public async void Initialize() public async void Initialize()
{ {
/*Debug.WriteLine(SecretsVault.Credential.Token.AccessToken);
WebClient client = new WebClient();
client.Headers.Add(HttpRequestHeader.Cookie, "SID=9wYUCqAm2D7AmC_Vi8uNGjYZAf6Js2hasI1gCEhznMjJbYqnt0J6m1sthArcXG_pMMadnQ.; HSID=AhyajPo6nPBx7VB-0; SSID=AaaOvEW6jZVcc4Asp; APISID=tXeMRBKErzlt6KOo/Aapw7Rv4U_HG1A0CQ; SAPISID=FGp4Ff7MMF8Yq0X4/AOdNjGueWyCkkK7C5; LOGIN_INFO=AFmmF2swRAIgZln6SD5aFUlABb9pBEq9uAwLBISe7sYR1NWVXyaDTY4CIBLo_KAFcoo4wtlW0ZPmJnHaa-xVhsA7MzdGm7-vvgX-:QUQ3MjNmekJTZ3M2dXJNaFh3M3NfTFVDS0RIaUM3WlJNWlRJbk5sZUE1eHR3bHkwckhQeEppazkyekhDb0ljcXpacDdwQXlIanhSbnpSWkUyZVFpdWtiT243Rzhad0N4aGZwUXJDZ1Mxd0tFTS0wVDdudk9xaFJDdTNYUWtnQlE3VXhQdVl5MjB2MGdEdl9keElDaS1yX0tmQWowS041ZWF1VU9tV0c3bTRVbWNGSHFjWHRDVTIw;");*/
HttpClient client = new HttpClient(); HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", "BQcUCusfz2zKN_ejHc3Xu15ahz8eEEaKouKJydqBAVKxWxcqfhht1zVux-G9bRf0KSTFBw"); client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", SecretsVault.Credential.Token.AccessToken);
/*SecretsVault.Credential.ToString(); string response = await SecretsVault.Service.HttpClient.GetStringAsync(adress.Text);
string url = $"https://www.youtube.com/list_ajax?style=json&action_get_list=1&list=HL&hl=en"; code.Text = response;
string response = client.DownloadString(url.ToUri()); view.NavigateToString(response);
HttpClient c = new HttpClient();*/
string response = await SecretsVault.Service.HttpClient.GetStringAsync("https://www.youtube.com/list_ajax?style=xml&action_get_list=1&list=HL");
//HttpResponseMessage res = await c.GetAsync("");
Debug.WriteLine(response);
/*new Google.Apis.Oauth2.v2.Oauth2Service.Initializer();
code.Text = response;*/
} }
private void Adress_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args) private void Adress_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
+6 -3
View File
@@ -1,5 +1,4 @@
<Page <Page
NavigationCacheMode="Enabled"
x:Class="FoxTube.Pages.History" x:Class="FoxTube.Pages.History"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -7,6 +6,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:foxtube="using:FoxTube" xmlns:foxtube="using:FoxTube"
xmlns:controls="using:FoxTube.Controls"
mc:Ignorable="d" mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
@@ -15,8 +15,11 @@
<RowDefinition/> <RowDefinition/>
<RowDefinition Height="auto"/> <RowDefinition Height="auto"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<ScrollViewer Name="scroll"> <ScrollViewer>
<local:VideoGrid/> <StackPanel Name="stack">
<local:VideoGrid/>
<controls:ShowMore Clicked="ShowMore_Clicked"/>
</StackPanel>
</ScrollViewer> </ScrollViewer>
<CommandBar Grid.Row="1" DefaultLabelPosition="Right"> <CommandBar Grid.Row="1" DefaultLabelPosition="Right">
<AppBarButton Icon="Refresh" Label="Refresh" Name="refresh" Click="Refresh_Click"/> <AppBarButton Icon="Refresh" Label="Refresh" Name="refresh" Click="Refresh_Click"/>
+53 -6
View File
@@ -1,4 +1,7 @@
using System; using FoxTube.Controls;
using Microsoft.AppCenter.Analytics;
using System;
using System.Collections.Generic;
using Windows.System; using Windows.System;
using Windows.UI.Xaml; using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls;
@@ -11,8 +14,12 @@ namespace FoxTube.Pages
/// </summary> /// </summary>
public sealed partial class History : Page public sealed partial class History : Page
{ {
List<string> entries;
int page = 1;
public string id = "HL";
LoadingPage loading; LoadingPage loading;
VideoGrid list; VideoGrid list;
ShowMore more;
public History() public History()
{ {
@@ -24,25 +31,65 @@ namespace FoxTube.Pages
base.OnNavigatedTo(e); base.OnNavigatedTo(e);
loading = grid.Children[2] as LoadingPage; loading = grid.Children[2] as LoadingPage;
list = scroll.Content as VideoGrid; list = stack.Children[0] as VideoGrid;
more = stack.Children[1] as ShowMore;
if (!string.IsNullOrWhiteSpace(e.Parameter.ToString()))
id = e.Parameter.ToString();
Initialize(); Initialize();
} }
public void Initialize() public async void Initialize()
{ {
loading.Refresh(); try
{
loading.Refresh();
loading.Close(); entries = id == "HL" ? await Methods.GetHistory() : await Methods.GetLater();
for (int k = 0; k < 50 && k < entries.Count; k++)
list.Add(new VideoCard(entries[k]));
if (list.Count >= entries.Count)
more.Complete(true);
loading.Close();
}
catch (System.Net.Http.HttpRequestException)
{
loading.Error("System.Net.Http.HttpRequestException", "Unable to connect to Google servers.", true);
}
catch (Exception e)
{
loading.Error(e.GetType().ToString(), e.Message);
Analytics.TrackEvent("History loading error", new Dictionary<string, string>()
{
{ "Exception", e.GetType().ToString() },
{ "Message", e.Message },
{ "ID", id }
});
}
} }
private async void toBrowser_Click(object sender, RoutedEventArgs e) private async void toBrowser_Click(object sender, RoutedEventArgs e)
{ {
await Launcher.LaunchUriAsync(new Uri("youtube.com/feed/history")); await Launcher.LaunchUriAsync(new Uri(id == "HL" ? "https://www.youtube.com/feed/history" : "https://www.youtube.com/playlist?list=WL"));
} }
private void Refresh_Click(object sender, RoutedEventArgs e) private void Refresh_Click(object sender, RoutedEventArgs e)
{ {
list.Clear();
Initialize();
}
private void ShowMore_Clicked()
{
for (int k = 50 * page++; k < 50 * page; k++)
list.Add(new VideoCard(entries[k]));
if (list.Count >= entries.Count)
more.Complete(true);
} }
} }
} }
+1 -1
View File
@@ -46,7 +46,7 @@ namespace FoxTube
try try
{ {
VideosResource.ListRequest request = SecretsVault.Service.Videos.List("id"); VideosResource.ListRequest request = SecretsVault.Service.Videos.List("id");
request.MaxResults = 48; request.MaxResults = 25;
request.PageToken = trendToken; request.PageToken = trendToken;
request.Chart = VideosResource.ListRequest.ChartEnum.MostPopular; request.Chart = VideosResource.ListRequest.ChartEnum.MostPopular;
+27 -21
View File
@@ -186,9 +186,9 @@ namespace FoxTube
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;
//toLater.Visibility = Visibility.Visible; toLater.Visibility = Visibility.Visible;
if (SecretsVault.Subscriptions.Count > 0) if (SecretsVault.Subscriptions.Count > 0)
{ {
@@ -230,9 +230,9 @@ namespace FoxTube
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;
//toLater.Visibility = Visibility.Collapsed; toLater.Visibility = Visibility.Collapsed;
subsHeader.Visibility = Visibility.Collapsed; subsHeader.Visibility = Visibility.Collapsed;
subsHeader.Visibility = Visibility.Collapsed; subsHeader.Visibility = Visibility.Collapsed;
@@ -557,11 +557,11 @@ namespace FoxTube
if (args.SelectedItem == toHome) if (args.SelectedItem == toHome)
content.Navigate(typeof(Home)); content.Navigate(typeof(Home));
else if (args.SelectedItem == toHistory) else if (args.SelectedItem == toHistory)
content.Navigate(typeof(History)); content.Navigate(typeof(History), "HL");
else if (args.SelectedItem == toLiked) else if (args.SelectedItem == toLiked)
content.Navigate(typeof(PlaylistPage), SecretsVault.UserChannel.ContentDetails.RelatedPlaylists.Likes); content.Navigate(typeof(PlaylistPage), SecretsVault.UserChannel.ContentDetails.RelatedPlaylists.Likes);
else if (args.SelectedItem == toLater) else if (args.SelectedItem == toLater)
content.Navigate(typeof(PlaylistPage), SecretsVault.UserChannel.ContentDetails.RelatedPlaylists.WatchLater); content.Navigate(typeof(History), "WL");
else if (args.SelectedItem == toSubscriptions) else if (args.SelectedItem == toSubscriptions)
content.Navigate(typeof(Subscriptions)); content.Navigate(typeof(Subscriptions));
else if (args.SelectedItem == toDownloads) else if (args.SelectedItem == toDownloads)
@@ -587,7 +587,14 @@ namespace FoxTube
{ typeof(PlaylistPage), () => nav.Header = resources.GetString("/Main/playlist") }, { typeof(PlaylistPage), () => nav.Header = resources.GetString("/Main/playlist") },
{ typeof(Search), () => nav.Header = resources.GetString("/Main/searchPlaceholder/PlaceholderText") }, { typeof(Search), () => nav.Header = resources.GetString("/Main/searchPlaceholder/PlaceholderText") },
{ typeof(Subscriptions), () => nav.Header = resources.GetString("/Main/subscriptions/Content") }, { typeof(Subscriptions), () => nav.Header = resources.GetString("/Main/subscriptions/Content") },
{ typeof(History), () => nav.Header = resources.GetString("/Main/history/Content") }, { typeof(History), () =>
{
if((content.Content as History).id == "HL")
nav.Header = resources.GetString("/Main/history/Content");
else
nav.Header = resources.GetString("/Main/later/Content");
} },
{ typeof(Home), () => nav.Header = resources.GetString("/Main/home/Content") }, { typeof(Home), () => nav.Header = resources.GetString("/Main/home/Content") },
{ typeof(Downloads), () => nav.Header = resources.GetString("/Main/downloads/Content") } { typeof(Downloads), () => nav.Header = resources.GetString("/Main/downloads/Content") }
}; };
@@ -642,9 +649,7 @@ namespace FoxTube
} }
if(!found) if(!found)
{
nav.SelectedItem = null; nav.SelectedItem = null;
}
} }
} }
else else
@@ -666,17 +671,8 @@ namespace FoxTube
else else
s = Sender.None; s = Sender.None;
} }
else if ((content.Content as PlaylistPage).playlistId == SecretsVault.UserChannel.ContentDetails.RelatedPlaylists.WatchLater)
{
if(nav.SelectedItem != toLater)
nav.SelectedItem = toLater;
else
s = Sender.None;
}
else else
{
nav.SelectedItem = null; nav.SelectedItem = null;
}
} }, } },
{ typeof(Search), () => nav.SelectedItem = null }, { typeof(Search), () => nav.SelectedItem = null },
{typeof(Subscriptions), () => {typeof(Subscriptions), () =>
@@ -688,10 +684,20 @@ namespace FoxTube
} }, } },
{ typeof(History), () => { typeof(History), () =>
{ {
if(nav.SelectedItem != toHistory) if((content.Content as History).id == "HL")
nav.SelectedItem = toHistory; {
if(nav.SelectedItem != toHistory)
nav.SelectedItem = toHistory;
else
s = Sender.None;
}
else else
s = Sender.None; {
if(nav.SelectedItem != toLater)
nav.SelectedItem = toLater;
else
s = Sender.None;
}
} }, } },
{ typeof(Home), () => { typeof(Home), () =>
{ {
+2
View File
@@ -8,6 +8,8 @@ namespace FoxTube.Pages
/// </summary> /// </summary>
public sealed partial class VideoGrid : Page public sealed partial class VideoGrid : Page
{ {
public int Count => list.Items.Count;
public VideoGrid() public VideoGrid()
{ {
InitializeComponent(); InitializeComponent();