Archived
1
0

Fixes. Preparing for submission

This commit is contained in:
Michael Gordeev
2019-02-02 15:14:35 +03:00
parent c30a08f47a
commit 550192d540
51 changed files with 262 additions and 253 deletions
+27
View File
@@ -0,0 +1,27 @@
<Page
x:Class="FoxTube.Pages.Browser"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:FoxTube.Pages"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Windows10version1809="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 7)"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<AutoSuggestBox Grid.ColumnSpan="2" Text="https://youtube.com/" QueryIcon="Forward" QuerySubmitted="Adress_QuerySubmitted" Name="adress"/>
<ScrollViewer Grid.Row="1">
<TextBlock TextWrapping="Wrap" Name="code" IsTextSelectionEnabled="True"/>
</ScrollViewer>
<WebView Name="view" Grid.Row="1" Grid.Column="1"/>
</Grid>
</Page>
+60
View File
@@ -0,0 +1,60 @@
using Google.Apis.Http;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
namespace FoxTube.Pages
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class Browser : Page
{
public Browser()
{
InitializeComponent();
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();
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", "BQcUCusfz2zKN_ejHc3Xu15ahz8eEEaKouKJydqBAVKxWxcqfhht1zVux-G9bRf0KSTFBw");
/*SecretsVault.Credential.ToString();
string url = $"https://www.youtube.com/list_ajax?style=json&action_get_list=1&list=HL&hl=en";
string response = client.DownloadString(url.ToUri());
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)
{
Initialize();
}
}
}
+7 -7
View File
@@ -16,7 +16,7 @@
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Pivot SelectedIndex="0" Name="content" IsHeaderItemsCarouselEnabled="False" SelectionChanged="content_SelectionChanged">
<Pivot SelectedIndex="0" Name="content" IsHeaderItemsCarouselEnabled="False" SelectionChanged="Content_SelectionChanged">
<PivotItem x:Uid="/Channel/videos" Header="Videos">
<ScrollViewer>
<StackPanel Name="videos">
@@ -39,11 +39,11 @@
</TextBlock>
<Grid Visibility="Collapsed" Grid.Column="2" VerticalAlignment="Bottom" Margin="10" Name="subscriptionPane" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Button x:Uid="/Cards/subscribe" Click="subscribe_Click" Name="subscribe" Width="250" Height="50" Background="Red" Foreground="White" FontSize="18" FontWeight="SemiBold" Content="Subscirbe"/>
<Button x:Uid="/Cards/subscribe" Click="Subscribe_Click" Name="subscribe" Width="250" Height="50" Background="Red" Foreground="White" FontSize="18" FontWeight="SemiBold" Content="Subscirbe"/>
</Grid>
</Grid>
<pages:VideoGrid/>
<controls:ShowMore Clicked="videoMore_Clicked"/>
<controls:ShowMore Clicked="VideoMore_Clicked"/>
</StackPanel>
</ScrollViewer>
</PivotItem>
@@ -53,7 +53,7 @@
<StackPanel Margin="10" Visibility="Visible">
<TextBlock x:Uid="/Channel/playlistTitle" FontSize="28" Text="Playlists"/>
<pages:VideoGrid/>
<controls:ShowMore Clicked="showMorePlaylists_Click"/>
<controls:ShowMore Clicked="ShowMorePlaylists_Click"/>
</StackPanel>
<local:LoadingPage Visibility="Collapsed"/>
</Grid>
@@ -104,9 +104,9 @@
</Pivot>
<CommandBar Grid.Row="1" VerticalAlignment="Bottom" Name="commandBar">
<AppBarButton x:Uid="/Channel/openWeb" Icon="Globe" Label="Open in browser" Name="inBrowser" Click="inBrowser_Click"/>
<AppBarButton x:Uid="/Channel/refresh" Icon="Refresh" Label="Refresh" Name="refresh" Click="refresh_Click"/>
<AppBarButton x:Uid="/Channel/share" Icon="Share" Label="Share" Name="share" Click="share_Click"/>
<AppBarButton x:Uid="/Channel/openWeb" Icon="Globe" Label="Open in browser" Name="inBrowser" Click="InBrowser_Click"/>
<AppBarButton x:Uid="/Channel/refresh" Icon="Refresh" Label="Refresh" Name="refresh" Click="Refresh_Click"/>
<AppBarButton x:Uid="/Channel/share" Icon="Share" Label="Share" Name="share" Click="Share_Click"/>
</CommandBar>
<local:LoadingPage Grid.RowSpan="2" Visibility="Collapsed"/>
+22 -13
View File
@@ -13,6 +13,8 @@ using Windows.ApplicationModel.DataTransfer;
using Windows.System;
using Windows.UI;
using Windows.ApplicationModel.Resources;
using Microsoft.AppCenter.Analytics;
using System.Collections.Generic;
namespace FoxTube.Pages
{
@@ -21,14 +23,14 @@ namespace FoxTube.Pages
/// </summary>
public sealed partial class ChannelPage : Page
{
ResourceLoader resources = ResourceLoader.GetForCurrentView("Cards");
readonly ResourceLoader resources = ResourceLoader.GetForCurrentView("Cards");
public string channelId;
public Channel item;
LoadingPage loading, playlistLoading;
VideoGrid videoList, playlistList;
ShowMore videoMore, playlistMore;
readonly LoadingPage loading, playlistLoading;
readonly VideoGrid videoList, playlistList;
readonly ShowMore videoMore, playlistMore;
SearchResource.ListRequest videoRequest, playlistRequest;
@@ -48,7 +50,7 @@ namespace FoxTube.Pages
videoMore = videos.Children[3] as ShowMore;
playlistMore = (playlists.Children[0] as StackPanel).Children[2] as ShowMore;
loading.RefreshPage += refresh_Click;
loading.RefreshPage += Refresh_Click;
DataTransferManager.GetForCurrentView().DataRequested += new TypedEventHandler<DataTransferManager, DataRequestedEventArgs>(Share);
}
@@ -71,7 +73,7 @@ namespace FoxTube.Pages
{
channelId = id;
if (Methods.NeedToResponse)
Methods.MainPage.content_Navigated(this, null);
Methods.MainPage.Content_Navigated(this, null);
ChannelsResource.ListRequest request = SecretsVault.Service.Channels.List("snippet,statistics,brandingSettings");
request.Id = id;
@@ -138,6 +140,12 @@ namespace FoxTube.Pages
catch (Exception e)
{
loading.Error(e.GetType().ToString(), e.Message);
Analytics.TrackEvent("Channel loading error", new Dictionary<string, string>()
{
{ "Exception", e.GetType().ToString() },
{ "Message", e.Message },
{ "Channel ID", channelId }
});
}
}
@@ -167,6 +175,7 @@ namespace FoxTube.Pages
else
playlistMore.Visibility = Visibility.Collapsed;
playlistLoaded = true;
playlistLoading.Close();
}
catch (System.Net.Http.HttpRequestException)
@@ -179,13 +188,13 @@ namespace FoxTube.Pages
}
}
private void content_SelectionChanged(object sender, SelectionChangedEventArgs e)
private void Content_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (content.SelectedIndex == 1 && !playlistLoaded)
LoadPlaylist();
}
private async void showMorePlaylists_Click()
private async void ShowMorePlaylists_Click()
{
playlistRequest.PageToken = playlistToken;
SearchListResponse response = await playlistRequest.ExecuteAsync();
@@ -205,7 +214,7 @@ namespace FoxTube.Pages
playlistMore.Complete(true);
}
private async void videoMore_Clicked()
private async void VideoMore_Clicked()
{
videoRequest.PageToken = videoToken;
SearchListResponse response = await videoRequest.ExecuteAsync();
@@ -225,7 +234,7 @@ namespace FoxTube.Pages
videoMore.Complete(true);
}
private async void subscribe_Click(object sender, RoutedEventArgs e)
private async void Subscribe_Click(object sender, RoutedEventArgs e)
{
if(await SecretsVault.ChangeSubscriptionState(channelId))
{
@@ -265,12 +274,12 @@ namespace FoxTube.Pages
}
}
private void refresh_Click(object sender, RoutedEventArgs e)
private void Refresh_Click(object sender, RoutedEventArgs e)
{
Methods.MainPage.GoToChannel(channelId);
}
private async void inBrowser_Click(object sender, RoutedEventArgs e)
private async void InBrowser_Click(object sender, RoutedEventArgs e)
{
if (!string.IsNullOrWhiteSpace(item.Snippet.CustomUrl))
await Launcher.LaunchUriAsync(new Uri($"https://www.youtube.com/user/{item.Snippet.CustomUrl}"));
@@ -278,7 +287,7 @@ namespace FoxTube.Pages
await Launcher.LaunchUriAsync(new Uri($"https://www.youtube.com/channel/{item.Id}"));
}
private void share_Click(object sender, RoutedEventArgs e)
private void Share_Click(object sender, RoutedEventArgs e)
{
DataTransferManager.ShowShareUI();
}
-2
View File
@@ -2,10 +2,8 @@
x:Class="FoxTube.Pages.Downloads"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:FoxTube.Pages"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="using:FoxTube.Controls"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
+2 -13
View File
@@ -1,24 +1,13 @@
using FoxTube.Controls;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.Storage;
using Windows.Storage.Pickers;
using System;
using Windows.System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
namespace FoxTube.Pages
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// Downloads page
/// </summary>
public sealed partial class Downloads : Page
{
-1
View File
@@ -6,7 +6,6 @@
xmlns:local="using:FoxTube.Pages"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="using:FoxTube.Controls"
xmlns:foxtube="using:FoxTube"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
+3 -6
View File
@@ -1,16 +1,13 @@
using FoxTube.Controls;
using System;
using System;
using Windows.System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
namespace FoxTube.Pages
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// YouTube history page
/// </summary>
public sealed partial class History : Page
{
@@ -34,7 +31,7 @@ namespace FoxTube.Pages
public void Initialize()
{
loading.Refresh();
loading.Close();
}
+1 -3
View File
@@ -1,14 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Google.Apis.YouTube.v3;
using Google.Apis.YouTube.v3.Data;
using Windows.Storage;
using FoxTube.Controls;
using FoxTube.Pages;
using System.Globalization;
namespace FoxTube
{
@@ -17,6 +14,7 @@ namespace FoxTube
/// </summary>
public sealed partial class Home : Page
{
// TODO: Refactor home page
private bool trendLoaded = false;
VideoGrid trendGrid;
+11 -10
View File
@@ -10,7 +10,7 @@
PreviewKeyUp="Page_PreviewKeyUp">
<Grid Name="grid" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<NavigationView Header="Home" SelectedItem="toHome" Windows10version1803:BackRequested="nav_BackRequested" Windows10version1803:PaneTitle="FoxTube" OpenPaneLength="300" Name="nav" SelectionChanged="nav_SelectionChanged">
<NavigationView Header="Home" SelectedItem="toHome" Windows10version1803:BackRequested="Nav_BackRequested" Windows10version1803:PaneTitle="FoxTube" OpenPaneLength="300" Name="nav" SelectionChanged="Nav_SelectionChanged">
<NavigationView.MenuItems>
<NavigationViewItem x:Uid="/Main/home" Icon="Home" Content="Home" Name="toHome"/>
@@ -30,7 +30,8 @@
<NavigationView.PaneFooter>
<NavigationViewList>
<NavigationViewItem x:Uid="/Main/feedback" Name="feedback" Content="Give a feedback" Tapped="feedback_Click">
<NavigationViewItem Name="openWeb" Tapped="web_Tapped" Icon="Globe" Content="Browser" Visibility="Collapsed"/>
<NavigationViewItem x:Uid="/Main/feedback" Name="feedback" Content="Give a feedback" Tapped="Feedback_Click">
<NavigationViewItem.Icon>
<FontIcon Glyph="&#xED15;"/>
</NavigationViewItem.Icon>
@@ -42,7 +43,7 @@
</NavigationViewItem.Icon>
</NavigationViewItem>
<NavigationViewItem Name="account" Tapped="openContext">
<NavigationViewItem Name="account" Tapped="OpenContext">
<StackPanel Orientation="Horizontal">
<FontIcon Glyph="&#xE8FA;" FontSize="16" Margin="0,0,16,0"/>
<TextBlock x:Uid="/Main/signIn" Text="Add account"/>
@@ -50,13 +51,13 @@
<NavigationViewItem.ContextFlyout>
<MenuFlyout>
<MenuFlyoutItem x:Uid="/Main/signEx" Text="Sign in with existing account" Name="signIn" Click="signIn_Click"/>
<MenuFlyoutItem x:Uid="/Main/signNew" Text="Create new Google account" Name="createAccount" Click="createAccount_Click"/>
<MenuFlyoutItem x:Uid="/Main/signEx" Text="Sign in with existing account" Name="signIn" Click="SignIn_Click"/>
<MenuFlyoutItem x:Uid="/Main/signNew" Text="Create new Google account" Name="createAccount" Click="CreateAccount_Click"/>
</MenuFlyout>
</NavigationViewItem.ContextFlyout>
</NavigationViewItem>
<NavigationViewItem Visibility="Collapsed" Name="avatar" Tapped="openContext" Padding="-5">
<NavigationViewItem Visibility="Collapsed" Name="avatar" Tapped="OpenContext" Padding="-5">
<StackPanel Orientation="Horizontal" Padding="5">
<PersonPicture Height="20" Margin="-5,0,15,0"/>
<TextBlock Name="myName" Text="My account"/>
@@ -64,9 +65,9 @@
<NavigationViewItem.ContextFlyout>
<MenuFlyout>
<MenuFlyoutItem x:Uid="/Main/myChannelContext" Text="My channel" Name="myChannel" Click="myChannel_Click"/>
<MenuFlyoutItem x:Uid="/Main/myChannelContext" Text="My channel" Name="myChannel" Click="MyChannel_Click"/>
<MenuFlyoutSeparator/>
<MenuFlyoutItem x:Uid="/Main/signOut" Text="Log out" Name="logout" Click="logout_Click"/>
<MenuFlyoutItem x:Uid="/Main/signOut" Text="Log out" Name="logout" Click="Logout_Click"/>
</MenuFlyout>
</NavigationViewItem.ContextFlyout>
</NavigationViewItem>
@@ -74,11 +75,11 @@
</NavigationView.PaneFooter>
<NavigationView.AutoSuggestBox>
<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"/>
</NavigationView.AutoSuggestBox>
<Grid>
<Frame Name="content" Navigated="content_Navigated"/>
<Frame Name="content" Navigated="Content_Navigated"/>
<Frame Name="videoPlaceholder"/>
</Grid>
+19 -13
View File
@@ -33,9 +33,10 @@ namespace FoxTube
/// Main app's layout
/// </summary>
public sealed partial class MainPage : Page
{
{
// TODO: Refactor main page
Sender s = Sender.None;
ResourceLoader resources = ResourceLoader.GetForCurrentView("Main");
readonly ResourceLoader resources = ResourceLoader.GetForCurrentView("Main");
public MainPage()
{
InitializeComponent();
@@ -264,27 +265,27 @@ namespace FoxTube
GoToVideo((videoPlaceholder.Content as VideoPage).videoId);
}
private async void feedback_Click(object sender, TappedRoutedEventArgs e)
private async void Feedback_Click(object sender, TappedRoutedEventArgs e)
{
await Launcher.LaunchUriAsync(new Uri("feedback-hub:"));
}
private async void createAccount_Click(object sender, RoutedEventArgs e)
private async void CreateAccount_Click(object sender, RoutedEventArgs e)
{
await Launcher.LaunchUriAsync(new Uri("https://accounts.google.com/signup/v2/webcreateaccount?ManageAccount&flowName=GlifWebSignIn&flowEntry=SignUp"));
}
private void signIn_Click(object sender, RoutedEventArgs e)
private void SignIn_Click(object sender, RoutedEventArgs e)
{
SecretsVault.Authorize();
}
private void myChannel_Click(object sender, RoutedEventArgs e)
private void MyChannel_Click(object sender, RoutedEventArgs e)
{
GoToChannel(SecretsVault.AccountId);
}
private void logout_Click(object sender, RoutedEventArgs e)
private void Logout_Click(object sender, RoutedEventArgs e)
{
SecretsVault.Deauthenticate();
}
@@ -512,13 +513,13 @@ namespace FoxTube
nav.IsBackEnabled = false;
}
private void search_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
private void Search_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
{
if(!string.IsNullOrWhiteSpace(search.Text))
GoToSearch(new SearchParameters(search.Text));
}
private void search_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
private void Search_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
{
if (search.Text.Length > 2 && args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
{
@@ -541,7 +542,7 @@ namespace FoxTube
}
}
private void nav_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args)
private void Nav_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args)
{
Debug.WriteLine("Menu selection changed");
try
@@ -577,7 +578,7 @@ namespace FoxTube
catch { }
}
public void content_Navigated(object sender, NavigationEventArgs e)
public void Content_Navigated(object sender, NavigationEventArgs e)
{
Dictionary<Type, Action> switchCase = new Dictionary<Type, Action>()
{
@@ -735,7 +736,7 @@ namespace FoxTube
MinimizeAsInitializer();
}
private void nav_BackRequested(NavigationView sender, NavigationViewBackRequestedEventArgs args)
private void Nav_BackRequested(NavigationView sender, NavigationViewBackRequestedEventArgs args)
{
if (videoPlaceholder.Content != null)
{
@@ -757,7 +758,7 @@ namespace FoxTube
}
}
private void openContext(object sender, TappedRoutedEventArgs e)
private void OpenContext(object sender, TappedRoutedEventArgs e)
{
((NavigationViewItem)sender).ContextFlyout.ShowAt((NavigationViewItem)sender);
}
@@ -766,5 +767,10 @@ namespace FoxTube
{
SecretsVault.GetAdblock();
}
private void Web_Tapped(object sender, TappedRoutedEventArgs e)
{
content.Navigate(typeof(Browser));
}
}
}
-1
View File
@@ -7,7 +7,6 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:foxtube="using:FoxTube"
xmlns:ui="using:Microsoft.Advertising.WinRT.UI"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
+11 -3
View File
@@ -1,7 +1,9 @@
using FoxTube.Controls;
using Google.Apis.YouTube.v3;
using Google.Apis.YouTube.v3.Data;
using Microsoft.AppCenter.Analytics;
using System;
using System.Collections.Generic;
using Windows.ApplicationModel.DataTransfer;
using Windows.ApplicationModel.Resources;
using Windows.Foundation;
@@ -50,7 +52,7 @@ namespace FoxTube.Pages
{
playlistId = id;
if (Methods.NeedToResponse)
Methods.MainPage.content_Navigated(this, null);
Methods.MainPage.Content_Navigated(this, null);
PlaylistsResource.ListRequest request = SecretsVault.Service.Playlists.List("snippet,contentDetails");
request.Id = id;
@@ -98,9 +100,15 @@ namespace FoxTube.Pages
{
loading.Error("System.Net.Http.HttpRequestException", "Unable to connect to Google servers.", true);
}
catch
catch (Exception e)
{
loading.Error();
loading.Error(e.GetType().ToString(), e.Message);
Analytics.TrackEvent("Playlist loading error", new Dictionary<string, string>()
{
{ "Exception", e.GetType().ToString() },
{ "Message", e.Message },
{ "Playlist ID", playlistId }
});
}
}
+5 -5
View File
@@ -19,7 +19,7 @@
<TextBlock Name="searchTerm" Text="Search results for: [searchTerm]" FontSize="28"/>
<TextBlock Name="resultsCount" Text="Found: [resultCount] item(s)" FontSize="14" Foreground="Gray"/>
<HyperlinkButton x:Uid="/Search/filters" Name="toggleFilters" Click="toggleFilters_Click" Content="Show filters &#xE71C;" FontFamily="Default, Segoe MDL2 Assets" Visibility="Visible"/>
<HyperlinkButton x:Uid="/Search/filters" Name="toggleFilters" Click="ToggleFilters_Click" Content="Show filters &#xE71C;" FontFamily="Default, Segoe MDL2 Assets" Visibility="Visible"/>
<StackPanel Name="filters" Visibility="Collapsed">
<GridView Padding="5" SelectionMode="None">
<ComboBox x:Uid="/Search/order" Name="order" Header="Sort by" Width="150" SelectedIndex="0">
@@ -29,7 +29,7 @@
<ComboBoxItem x:Uid="/Search/rating" Content="Rating"/>
<ComboBoxItem x:Uid="/Search/title" Content="Title"/>
</ComboBox>
<ComboBox x:Uid="/Search/type" Name="type" Header="Type" Width="150" SelectedIndex="0" SelectionChanged="type_SelectionChanged">
<ComboBox x:Uid="/Search/type" Name="type" Header="Type" Width="150" SelectedIndex="0" SelectionChanged="Type_SelectionChanged">
<ComboBoxItem x:Uid="/Search/all" Content="All"/>
<ComboBoxItem x:Uid="/Search/video" Content="Video"/>
<ComboBoxItem x:Uid="/Search/channel" Content="Channel"/>
@@ -64,16 +64,16 @@
</Flyout>
</Button.Flyout>
</Button>
<Button x:Uid="/Search/apply" Content="Apply" Margin="10,0,0,10" Name="apply" Click="apply_Click"/>
<Button x:Uid="/Search/apply" Content="Apply" Margin="10,0,0,10" Name="apply" Click="Apply_Click"/>
</StackPanel>
</StackPanel>
<pages:VideoGrid/>
<controls:ShowMore Clicked="more_Clicked"/>
<controls:ShowMore Clicked="More_Clicked"/>
</StackPanel>
</ScrollViewer>
<CommandBar Grid.Row="1" DefaultLabelPosition="Right">
<AppBarButton Label="Open in browser" Icon="Globe" Name="inBrowser" Click="inBrowser_Click"/>
<AppBarButton Label="Open in browser" Icon="Globe" Name="inBrowser" Click="InBrowser_Click"/>
<AppBarButton Label="Refresh" Icon="Refresh" Click="AppBarButton_Click"/>
</CommandBar>
+9 -11
View File
@@ -3,7 +3,6 @@ using FoxTube.Pages;
using Google.Apis.YouTube.v3;
using Google.Apis.YouTube.v3.Data;
using System;
using Windows.Storage;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
@@ -17,16 +16,15 @@ namespace FoxTube
/// </summary>
public sealed partial class Search : Page
{
ResourceLoader resources = ResourceLoader.GetForCurrentView("Search");
readonly ResourceLoader resources = ResourceLoader.GetForCurrentView("Search");
public SearchParameters Parameters;
SearchResource.ListRequest request;
string nextToken;
ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
VideoGrid list;
LoadingPage loading;
ShowMore more;
readonly VideoGrid list;
readonly LoadingPage loading;
readonly ShowMore more;
public Search()
{
@@ -155,7 +153,7 @@ namespace FoxTube
}
}
private void toggleFilters_Click(object sender, RoutedEventArgs e)
private void ToggleFilters_Click(object sender, RoutedEventArgs e)
{
if(filters.Visibility == Visibility.Collapsed)
{
@@ -174,7 +172,7 @@ namespace FoxTube
Methods.MainPage.GoToSearch(Parameters);
}
private async void more_Clicked()
private async void More_Clicked()
{
request.PageToken = nextToken;
SearchListResponse response = await request.ExecuteAsync();
@@ -190,7 +188,7 @@ namespace FoxTube
more.Complete(true);
}
private void type_SelectionChanged(object sender, SelectionChangedEventArgs e)
private void Type_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
try
{
@@ -210,12 +208,12 @@ namespace FoxTube
catch (NullReferenceException) { }
}
private async void inBrowser_Click(object sender, RoutedEventArgs e)
private async void InBrowser_Click(object sender, RoutedEventArgs e)
{
await Launcher.LaunchUriAsync(new Uri($"https://www.youtube.com/results?search_query={searchTerm}"));
}
private void apply_Click(object sender, RoutedEventArgs e)
private void Apply_Click(object sender, RoutedEventArgs e)
{
Parameters.Filter.HD = features.SelectedItems.Contains(features.Items[0]);
Parameters.Filter.Is3D = features.SelectedItems.Contains(features.Items[1]);
+1 -8
View File
@@ -2,15 +2,13 @@
x:Class="FoxTube.Settings"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:FoxTube"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pages="using:FoxTube.Pages"
xmlns:settingspages="using:FoxTube.Pages.SettingsPages"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Pivot SelectedIndex="0" Name="pivot" IsHeaderItemsCarouselEnabled="False" SelectionChanged="pivot_SelectionChanged">
<Pivot SelectedIndex="0" Name="pivot" IsHeaderItemsCarouselEnabled="False" SelectionChanged="Pivot_SelectionChanged">
<PivotItem Header="General" x:Uid="/Settings/general">
<ScrollViewer>
<settingspages:General/>
@@ -21,11 +19,6 @@
<settingspages:About/>
</ScrollViewer>
</PivotItem>
<!--<PivotItem Header="Help us translate this app" x:Uid="/Settings/helpTranslate">
<ScrollViewer>
<settingspages:Translate/>
</ScrollViewer>
</PivotItem>-->
<PivotItem Header="Inbox" x:Uid="/Settings/inbox">
<ScrollViewer>
<settingspages:Inbox/>
+6 -32
View File
@@ -1,29 +1,11 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.ApplicationModel;
using System.Globalization;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.Storage;
using Windows.UI.Text;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
using FoxTube.Pages.SettingsPages;
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
namespace FoxTube
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// Settings tabs placeholder
/// </summary>
public sealed partial class Settings : Page
{
@@ -31,7 +13,7 @@ namespace FoxTube
string inboxId = null;
public Settings()
{
this.InitializeComponent();
InitializeComponent();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
@@ -45,20 +27,12 @@ namespace FoxTube
inboxId = e.Parameter as string;
pivot.SelectedIndex = 2;
}
else
switch(e.Parameter as string)
{
case "about":
pivot.SelectedIndex = 1;
break;
/*case "translate":
pivot.SelectedIndex = 3;
break;*/
}
else if ((e.Parameter as string) == "about")
pivot.SelectedIndex = 1;
}
}
private void pivot_SelectionChanged(object sender, SelectionChangedEventArgs e)
private void Pivot_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (pivot.SelectedIndex == 2 && !inboxLoaded)
{
-1
View File
@@ -2,7 +2,6 @@
x:Class="FoxTube.Pages.SettingsPages.About"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:FoxTube.Pages.SettingsPages"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
+1 -14
View File
@@ -1,25 +1,12 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.ApplicationModel;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
namespace FoxTube.Pages.SettingsPages
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// Page with general information about the app
/// </summary>
public sealed partial class About : Page
{
-1
View File
@@ -2,7 +2,6 @@
x:Class="FoxTube.Pages.SettingsPages.General"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:FoxTube.Pages.SettingsPages"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
+1 -2
View File
@@ -2,7 +2,6 @@
x:Class="FoxTube.Pages.SettingsPages.Inbox"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:FoxTube.Pages"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
@@ -101,7 +100,7 @@
<Grid Grid.Column="1" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" Name="block">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<TextBlock FontFamily="Segoe MDL2 Assets" Text="&#xE7EA;" FontSize="70" Foreground="Gray" Margin="10"/>
<TextBlock x:Uid="/Inbox/select" Text="Select item from list" FontSize="30" VerticalAlignment="Center" Foreground="Gray"/>
<TextBlock x:Uid="/Inbox/select" Text="Select item from list" FontSize="30" VerticalAlignment="Center" TextWrapping="WrapWholeWords" Foreground="Gray"/>
</StackPanel>
</Grid>
</Grid>
-1
View File
@@ -2,7 +2,6 @@
x:Class="FoxTube.Pages.Subscriptions"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:FoxTube.Pages"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:foxtube="using:FoxTube"
+3 -16
View File
@@ -1,32 +1,19 @@
using Google.Apis.YouTube.v3.Data;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
namespace FoxTube.Pages
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// User's subscriptions page
/// </summary>
public sealed partial class Subscriptions : Page
{
List<Subscription> list = SecretsVault.Subscriptions;
readonly List<Subscription> list = SecretsVault.Subscriptions;
public Subscriptions()
{
this.InitializeComponent();
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
-1
View File
@@ -2,7 +2,6 @@
x:Class="FoxTube.Pages.VideoGrid"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:FoxTube"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="using:Microsoft.Toolkit.Uwp.UI.Controls"
+1 -3
View File
@@ -1,7 +1,5 @@
using FoxTube.Controls.Adverts;
using Windows.UI.Xaml;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
namespace FoxTube.Pages
{
+7 -2
View File
@@ -1,7 +1,7 @@
using FoxTube.Controls;
using FoxTube.Controls.Adverts;
using Google.Apis.YouTube.v3;
using Google.Apis.YouTube.v3.Data;
using Microsoft.AppCenter.Analytics;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -10,7 +10,6 @@ using System.Linq;
using Windows.ApplicationModel.DataTransfer;
using Windows.ApplicationModel.Resources;
using Windows.Foundation;
using Windows.Storage;
using Windows.System;
using Windows.UI;
using Windows.UI.Xaml;
@@ -139,6 +138,12 @@ namespace FoxTube.Pages
catch (Exception e)
{
loading.Error(e.GetType().ToString(), e.Message);
Analytics.TrackEvent("Video loading error", new Dictionary<string, string>()
{
{ "Exception", e.GetType().ToString() },
{ "Message", e.Message },
{ "Video ID", videoId }
});
}
}