diff --git a/FoxTube.Background/BackgroundProcessor.cs b/FoxTube.Background/BackgroundProcessor.cs index 97ca597..a05d2e3 100644 --- a/FoxTube.Background/BackgroundProcessor.cs +++ b/FoxTube.Background/BackgroundProcessor.cs @@ -1,6 +1,7 @@ using Google.Apis.Services; using Google.Apis.YouTube.v3; using Google.Apis.YouTube.v3.Data; +using Microsoft.AppCenter.Analytics; using Newtonsoft.Json; using System; using System.Collections.Generic; @@ -16,7 +17,7 @@ namespace FoxTube.Background public sealed class BackgroundProcessor : IBackgroundTask { private DateTime lastCheck = DateTime.Now; - private ApplicationDataContainer settings = ApplicationData.Current.LocalSettings; + private readonly ApplicationDataContainer settings = ApplicationData.Current.LocalSettings; private YouTubeService Service => new YouTubeService(new BaseClientService.Initializer() { ApiKey = "AIzaSyBgHrCnrlzlVmk0cJKL8RqP9Y8x6XSuk_0", @@ -29,6 +30,7 @@ namespace FoxTube.Background try { def = taskInstance.GetDeferral(); + taskInstance.Canceled += new BackgroundTaskCanceledEventHandler(OnCanceled); if (settings.Values["lastCheck"] == null) { @@ -45,7 +47,6 @@ namespace FoxTube.Background if (notificationsSettings[1]) await CheckAccount(); } - catch { } finally { settings.Values["lastCheck"] = DateTime.Now.ToString(); @@ -53,6 +54,15 @@ namespace FoxTube.Background } } + private void OnCanceled(IBackgroundTaskInstance sender, BackgroundTaskCancellationReason reason) + { + Analytics.TrackEvent("Background task caneled", new Dictionary() + { + { "Reason", reason.ToString() } + }); + settings.Values["lastCheck"] = DateTime.Now.ToString(); + } + async Task CheckAccount() { try diff --git a/FoxTube.Background/FoxTube.Background.csproj b/FoxTube.Background/FoxTube.Background.csproj index a9896f1..11a5b78 100644 --- a/FoxTube.Background/FoxTube.Background.csproj +++ b/FoxTube.Background/FoxTube.Background.csproj @@ -127,6 +127,9 @@ 1.29.2.1006 + + 1.13.0 + 6.1.5 diff --git a/FoxTube.Background/ResourceCreators.cs b/FoxTube.Background/ResourceCreators.cs index 1102a64..3df0305 100644 --- a/FoxTube.Background/ResourceCreators.cs +++ b/FoxTube.Background/ResourceCreators.cs @@ -1,6 +1,5 @@ using Newtonsoft.Json; using System.Collections.Generic; -using Windows.ApplicationModel.Resources; using Windows.Data.Xml.Dom; using Windows.Storage; using Windows.UI.Notifications; diff --git a/FoxTube/App.xaml.cs b/FoxTube/App.xaml.cs index e4ee801..5198496 100644 --- a/FoxTube/App.xaml.cs +++ b/FoxTube/App.xaml.cs @@ -1,5 +1,8 @@ using Google.Apis.YouTube.v3.Data; +using Microsoft.AppCenter; +using Microsoft.AppCenter.Analytics; using System; +using System.Collections.Generic; using System.Diagnostics; using System.Linq; using Windows.ApplicationModel; @@ -42,6 +45,9 @@ namespace FoxTube ApplicationLanguages.PrimaryLanguageOverride = SettingsStorage.Language; InitializeComponent(); Suspending += OnSuspending; + UnhandledException += UnhandledError; + AppCenter.Start("45774462-9ea7-438a-96fc-03982666f39e", typeof(Analytics)); + AppCenter.SetCountryCode(SettingsStorage.Region); } /// @@ -51,11 +57,9 @@ namespace FoxTube /// Details about the launch request and process. protected override void OnLaunched(LaunchActivatedEventArgs e) { - Frame rootFrame = Window.Current.Content as Frame; - // Do not repeat app initialization when the Window already has content, // just ensure that the window is active - if (rootFrame == null) + if (!(Window.Current.Content is Frame rootFrame)) { // Create a Frame to act as the navigation context and navigate to the first page rootFrame = new Frame(); @@ -180,13 +184,11 @@ namespace FoxTube { base.OnActivated(e); - Frame rootFrame = Window.Current.Content as Frame; - - if (rootFrame == null) + if (!(Window.Current.Content is Frame rootFrame)) { rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; - + Window.Current.Content = rootFrame; } @@ -248,5 +250,14 @@ namespace FoxTube DownloadAgent.QuitPrompt(); deferral.Complete(); } + private void UnhandledError(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e) + { + Analytics.TrackEvent("The app crashed", new Dictionary() + { + { "Exception", e.Exception.GetType().ToString() }, + { "Class", e.ToString() }, + { "Details", e.Message } + }); + } } } diff --git a/FoxTube/Assets/BadgeLogo.scale-100.png b/FoxTube/Assets/BadgeLogo.scale-100.png new file mode 100644 index 0000000..d7bd4fb Binary files /dev/null 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 new file mode 100644 index 0000000..079bb98 Binary files /dev/null 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 new file mode 100644 index 0000000..1166617 Binary files /dev/null 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 new file mode 100644 index 0000000..aa41fb1 Binary files /dev/null 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 new file mode 100644 index 0000000..bcddc3a Binary files /dev/null and b/FoxTube/Assets/BadgeLogo.scale-400.png differ diff --git a/FoxTube/Assets/Data/Patchnotes.xml b/FoxTube/Assets/Data/Patchnotes.xml index 89187ce..5d5cf2f 100644 --- a/FoxTube/Assets/Data/Patchnotes.xml +++ b/FoxTube/Assets/Data/Patchnotes.xml @@ -1,5 +1,21 @@  + + + ### What's new: + +- Small fixes +- First public pre-release version +- Some content was cut out due to its incompleteness + + ### Что нового: + +- Мелкие исправления багов +- Эта версия является первой пред-релизной публичной версией +- Некотроые функции были вырезаны из-за их незавершенности + + + ### What's new: diff --git a/FoxTube/Classes/DownloadAgent.cs b/FoxTube/Classes/DownloadAgent.cs index cd60ce3..5b21ec6 100644 --- a/FoxTube/Classes/DownloadAgent.cs +++ b/FoxTube/Classes/DownloadAgent.cs @@ -5,7 +5,6 @@ using FoxTube.Classes; using Newtonsoft.Json; using YoutubeExplode.Models.MediaStreams; using Google.Apis.YouTube.v3.Data; -using System.Diagnostics; using FoxTube.Controls; namespace FoxTube diff --git a/FoxTube/Classes/DownloadItemContainer.cs b/FoxTube/Classes/DownloadItemContainer.cs index b857c75..0a99e6d 100644 --- a/FoxTube/Classes/DownloadItemContainer.cs +++ b/FoxTube/Classes/DownloadItemContainer.cs @@ -1,5 +1,4 @@ using System; -using Windows.Storage; namespace FoxTube.Classes { diff --git a/FoxTube/Classes/InboxItem.cs b/FoxTube/Classes/InboxItem.cs index 640d8e5..5342d2c 100644 --- a/FoxTube/Classes/InboxItem.cs +++ b/FoxTube/Classes/InboxItem.cs @@ -1,5 +1,4 @@ using System; -using System.Xml; using Windows.ApplicationModel.Resources; namespace FoxTube.Classes diff --git a/FoxTube/Classes/Methods.cs b/FoxTube/Classes/Methods.cs index 7013a5a..be01184 100644 --- a/FoxTube/Classes/Methods.cs +++ b/FoxTube/Classes/Methods.cs @@ -1,7 +1,5 @@ -using FoxTube.Controls.Adverts; -using FoxTube.Pages; +using FoxTube.Pages; using Google.Apis.YouTube.v3; -using Microsoft.Advertising.WinRT.UI; using System; using System.Collections.Generic; using System.Diagnostics; @@ -223,41 +221,6 @@ namespace FoxTube } } - /*public static string QualityToString(YouTubeQuality quality) - { - switch(quality) - { - case YouTubeQuality.NotAvailable: - return "N/A"; - case YouTubeQuality.Quality1080P: - return "1080p"; - case YouTubeQuality.Quality144P: - return "144p"; - case YouTubeQuality.Quality2160P: - return "2160p"; - case YouTubeQuality.Quality240P: - return "240p"; - case YouTubeQuality.Quality270P: - return "270p"; - case YouTubeQuality.Quality360P: - return "360p"; - case YouTubeQuality.Quality480P: - return "480p"; - case YouTubeQuality.Quality520P: - return "520p"; - case YouTubeQuality.Quality720P: - return "720p"; - case YouTubeQuality.QualityHigh: - return "[Audio only] High quality"; - case YouTubeQuality.QualityLow: - return "[Audio only] Low quality"; - case YouTubeQuality.QualityMedium: - return "[Audio only] Medium quality"; - default: - return "Unknown"; - } - }*/ - public async static void ProcessLink(string url) { try diff --git a/FoxTube/Classes/SecretsVault.cs b/FoxTube/Classes/SecretsVault.cs index 55fe10f..7c7024d 100644 --- a/FoxTube/Classes/SecretsVault.cs +++ b/FoxTube/Classes/SecretsVault.cs @@ -43,7 +43,7 @@ namespace FoxTube //User info public static bool IsAuthorized => Credential != null; - private static UserCredential Credential { get; set; } + public static UserCredential Credential { get; set; } public static string AccountId => UserChannel?.Id; public static Channel UserChannel { get; private set; } @@ -61,7 +61,7 @@ namespace FoxTube { if (!IsAuthorized) return false; - + if(Subscriptions.Exists(x => x.Snippet.ResourceId.ChannelId == id)) { Subscription s = Subscriptions.Find(x => x.Snippet.ResourceId.ChannelId == id); diff --git a/FoxTube/FoxTube.csproj b/FoxTube/FoxTube.csproj index 4e452f8..f6e2692 100644 --- a/FoxTube/FoxTube.csproj +++ b/FoxTube/FoxTube.csproj @@ -17,12 +17,11 @@ 512 {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} true - - - E888C12EC9A02B902D03CDA4515BDBE9F5E71F1F + FoxTube_StoreKey.pfx + 50B93E6A246058D555BA65CD203D7A02064A7409 False - False - C:\Users\Michael Gordeev\Downloads\FoxTube dists\0.2.1901-1\ + True + D:\XFox\Documents\FoxTube builds\0.3\ Always x86|x64|arm 1 @@ -137,6 +136,9 @@ ShowMore.xaml + + Browser.xaml + ChannelPage.xaml @@ -201,6 +203,11 @@ + + + + + @@ -250,25 +257,8 @@ - - Designer - - - Designer - - - - - Designer - - - - Designer - - - - Designer - + + @@ -318,6 +308,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -411,7 +405,10 @@ 1.29.2.1006 - 10.1805.7001 + 10.1811.22001 + + + 1.13.0 6.1.9 @@ -420,13 +417,13 @@ 5.0.0 - 4.0.0 + 5.0.0 4.3.2 - 4.6.1 + 4.6.4 0.10.11 diff --git a/FoxTube/Package.appxmanifest b/FoxTube/Package.appxmanifest index dc0f77a..b03514d 100644 --- a/FoxTube/Package.appxmanifest +++ b/FoxTube/Package.appxmanifest @@ -1,10 +1,10 @@  - - + + FoxTube - Michael Gordeev + Michael "XFox" Gordeev Assets\StoreLogo.png @@ -15,7 +15,7 @@ - + @@ -24,6 +24,7 @@ + diff --git a/FoxTube/Pages/Browser.xaml b/FoxTube/Pages/Browser.xaml new file mode 100644 index 0000000..cb258d5 --- /dev/null +++ b/FoxTube/Pages/Browser.xaml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + diff --git a/FoxTube/Pages/Browser.xaml.cs b/FoxTube/Pages/Browser.xaml.cs new file mode 100644 index 0000000..bee5906 --- /dev/null +++ b/FoxTube/Pages/Browser.xaml.cs @@ -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 +{ + /// + /// An empty page that can be used on its own or navigated to within a Frame. + /// + 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(); + } + } +} diff --git a/FoxTube/Pages/ChannelPage.xaml b/FoxTube/Pages/ChannelPage.xaml index 78cf453..a3c4710 100644 --- a/FoxTube/Pages/ChannelPage.xaml +++ b/FoxTube/Pages/ChannelPage.xaml @@ -16,7 +16,7 @@ - + @@ -39,11 +39,11 @@ - 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(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() + { + { "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(); } diff --git a/FoxTube/Pages/Downloads.xaml b/FoxTube/Pages/Downloads.xaml index 6a50d3d..e51aca9 100644 --- a/FoxTube/Pages/Downloads.xaml +++ b/FoxTube/Pages/Downloads.xaml @@ -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}"> diff --git a/FoxTube/Pages/Downloads.xaml.cs b/FoxTube/Pages/Downloads.xaml.cs index 589b7b6..286f415 100644 --- a/FoxTube/Pages/Downloads.xaml.cs +++ b/FoxTube/Pages/Downloads.xaml.cs @@ -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 { /// - /// An empty page that can be used on its own or navigated to within a Frame. + /// Downloads page /// public sealed partial class Downloads : Page { diff --git a/FoxTube/Pages/History.xaml b/FoxTube/Pages/History.xaml index 5f274ca..b100b65 100644 --- a/FoxTube/Pages/History.xaml +++ b/FoxTube/Pages/History.xaml @@ -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}"> diff --git a/FoxTube/Pages/History.xaml.cs b/FoxTube/Pages/History.xaml.cs index 6211a17..0ffb030 100644 --- a/FoxTube/Pages/History.xaml.cs +++ b/FoxTube/Pages/History.xaml.cs @@ -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 { /// - /// An empty page that can be used on its own or navigated to within a Frame. + /// YouTube history page /// public sealed partial class History : Page { @@ -34,7 +31,7 @@ namespace FoxTube.Pages public void Initialize() { loading.Refresh(); - + loading.Close(); } diff --git a/FoxTube/Pages/Home.xaml.cs b/FoxTube/Pages/Home.xaml.cs index 4da57d8..df1fc2b 100644 --- a/FoxTube/Pages/Home.xaml.cs +++ b/FoxTube/Pages/Home.xaml.cs @@ -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 /// public sealed partial class Home : Page { + // TODO: Refactor home page private bool trendLoaded = false; VideoGrid trendGrid; @@ -75,9 +73,9 @@ namespace FoxTube public void Initialize() { - if(SecretsVault.IsAuthorized) + /*if(SecretsVault.IsAuthorized) LoadRecommendations(); - else + else*/ { pivot.Items.Remove(recommended); pivot.Items.Remove(subscriptions); diff --git a/FoxTube/Pages/MainPage.xaml b/FoxTube/Pages/MainPage.xaml index e158186..ee9c627 100644 --- a/FoxTube/Pages/MainPage.xaml +++ b/FoxTube/Pages/MainPage.xaml @@ -10,7 +10,7 @@ PreviewKeyUp="Page_PreviewKeyUp"> - + @@ -30,7 +30,8 @@ - + + @@ -42,7 +43,7 @@ - + @@ -50,13 +51,13 @@ - - + + - + @@ -64,9 +65,9 @@ - + - + @@ -74,11 +75,11 @@ - + - + diff --git a/FoxTube/Pages/MainPage.xaml.cs b/FoxTube/Pages/MainPage.xaml.cs index e9a59ed..a2492f7 100644 --- a/FoxTube/Pages/MainPage.xaml.cs +++ b/FoxTube/Pages/MainPage.xaml.cs @@ -33,9 +33,10 @@ namespace FoxTube /// Main app's layout /// 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(); @@ -185,9 +186,9 @@ namespace FoxTube toChannel.Visibility = Visibility.Visible; toSubscriptions.Visibility = Visibility.Visible; libHeader.Visibility = Visibility.Visible; - toHistory.Visibility = Visibility.Visible; + //toHistory.Visibility = Visibility.Visible; toLiked.Visibility = Visibility.Visible; - toLater.Visibility = Visibility.Visible; + //toLater.Visibility = Visibility.Visible; if (SecretsVault.Subscriptions.Count > 0) { @@ -229,9 +230,9 @@ namespace FoxTube toChannel.Visibility = Visibility.Collapsed; toSubscriptions.Visibility = Visibility.Collapsed; libHeader.Visibility = Visibility.Collapsed; - toHistory.Visibility = Visibility.Collapsed; + //toHistory.Visibility = Visibility.Collapsed; toLiked.Visibility = Visibility.Collapsed; - toLater.Visibility = Visibility.Collapsed; + //toLater.Visibility = Visibility.Collapsed; subsHeader.Visibility = Visibility.Collapsed; subsHeader.Visibility = Visibility.Collapsed; @@ -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 switchCase = new Dictionary() { @@ -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)); + } } } diff --git a/FoxTube/Pages/PlaylistPage.xaml b/FoxTube/Pages/PlaylistPage.xaml index 6d0f8ac..f4a2e50 100644 --- a/FoxTube/Pages/PlaylistPage.xaml +++ b/FoxTube/Pages/PlaylistPage.xaml @@ -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}"> @@ -64,7 +63,7 @@ - + diff --git a/FoxTube/Pages/PlaylistPage.xaml.cs b/FoxTube/Pages/PlaylistPage.xaml.cs index e967267..0bd0d5c 100644 --- a/FoxTube/Pages/PlaylistPage.xaml.cs +++ b/FoxTube/Pages/PlaylistPage.xaml.cs @@ -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() + { + { "Exception", e.GetType().ToString() }, + { "Message", e.Message }, + { "Playlist ID", playlistId } + }); } } diff --git a/FoxTube/Pages/Search.xaml b/FoxTube/Pages/Search.xaml index 1ba8195..9533e50 100644 --- a/FoxTube/Pages/Search.xaml +++ b/FoxTube/Pages/Search.xaml @@ -19,7 +19,7 @@ - + @@ -29,7 +29,7 @@ - + @@ -64,16 +64,16 @@ -