diff --git a/FoxTube.Background/BackgroundProcessor.cs b/FoxTube.Background/BackgroundProcessor.cs index 2b2198c..2d75580 100644 --- a/FoxTube.Background/BackgroundProcessor.cs +++ b/FoxTube.Background/BackgroundProcessor.cs @@ -24,30 +24,33 @@ namespace FoxTube.Background public async void Run(IBackgroundTaskInstance taskInstance) { - def = taskInstance.GetDeferral(); try { + def = taskInstance.GetDeferral(); + if (settings.Values["lastCheck"] == null) - settings.Values.Add("lastCheck", XmlConvert.ToString(DateTime.Now)); - else lastCheck = XmlConvert.ToDateTime(settings.Values["lastCheck"] as string, XmlDateTimeSerializationMode.Unspecified); + { + settings.Values.Add("lastCheck", DateTime.UtcNow.ToString()); + def.Complete(); + return; + } + else + lastCheck = DateTime.Parse(settings.Values["lastCheck"] as string); + + //ToastNotificationManager.CreateToastNotifier().Show(Notification.GetInternalToast(null, $"{DateTime.Now} Retrieving videos since", lastCheck.ToString(), null, null)); + + bool[] notificationsSettings = JsonConvert.DeserializeObject(await FileIO.ReadTextAsync(await ApplicationData.Current.RoamingFolder.GetFileAsync("notifications.json"))); + if (notificationsSettings[0]) + CheckAnnouncements(); + if (notificationsSettings[1]) + CheckAccount(); } - catch + catch { } + finally { - lastCheck = DateTime.Now; + settings.Values["lastCheck"] = DateTime.UtcNow.ToString(); + def.Complete(); } - - ToastNotificationManager.CreateToastNotifier().Show(Notification.GetInternalToast(null, "Background task initialized. Retrieving videos since", lastCheck.ToString(), null, null)); - - bool[] notificationsSettings = JsonConvert.DeserializeObject(await FileIO.ReadTextAsync(await ApplicationData.Current.RoamingFolder.GetFileAsync("notifications.json"))); - if(notificationsSettings[0]) - CheckAnnouncements(); - if(notificationsSettings[1]) - CheckAccount(); - - settings.Values["lastCheck"] = XmlConvert.ToString(DateTime.Now, "YYYY-MM-DDThh:mm:ss"); - - def.Complete(); - ToastNotificationManager.CreateToastNotifier().Show(Notification.GetInternalToast(null, "Background task complete", DateTime.Now.ToString(), null, null)); } async void CheckAccount() @@ -77,8 +80,8 @@ namespace FoxTube.Background try { XmlDocument doc = new XmlDocument(); - doc.Load(XmlReader.Create("http://foxgame.hol.es/foxtube-messages.xml")); - if ((XmlConvert.ToDateTimeOffset((doc["posts"].FirstChild as XmlElement).GetAttribute("time"), "YYYY-MM-DDThh:mm:ss") - lastCheck.ToUniversalTime()).TotalSeconds > 0) + doc.Load(XmlReader.Create("http://foxgame-studio.000webhostapp.com/foxtube-messages.xml")); + if ((DateTime.Parse((doc["posts"].FirstChild as XmlElement).GetAttribute("time")) - lastCheck).TotalSeconds > 0) ToastNotificationManager.CreateToastNotifier().Show( Notification.GetInternalToast(doc["posts"].FirstChild["id"].InnerText, doc["posts"].FirstChild["header"].InnerText, diff --git a/FoxTube.Background/FoxTube.Background.csproj b/FoxTube.Background/FoxTube.Background.csproj index d6f90da..ff94edb 100644 --- a/FoxTube.Background/FoxTube.Background.csproj +++ b/FoxTube.Background/FoxTube.Background.csproj @@ -11,7 +11,7 @@ FoxTube.Background en-US UAP - 10.0.17134.0 + 10.0.17763.0 10.0.15063.0 14 512 diff --git a/FoxTube.Background/Notification.cs b/FoxTube.Background/Notification.cs index d49c352..4071a4b 100644 --- a/FoxTube.Background/Notification.cs +++ b/FoxTube.Background/Notification.cs @@ -12,8 +12,8 @@ namespace FoxTube.Background template.LoadXml($@" - - + + Changelog See what's new in version {version} @@ -31,7 +31,7 @@ namespace FoxTube.Background - + {title} {channel} uploaded a new video @@ -53,8 +53,8 @@ namespace FoxTube.Background template.LoadXml($@" - - + + {header} {content} diff --git a/FoxTube/App.xaml.cs b/FoxTube/App.xaml.cs index 99b88bd..acc846c 100644 --- a/FoxTube/App.xaml.cs +++ b/FoxTube/App.xaml.cs @@ -1,5 +1,6 @@ using Google.Apis.YouTube.v3; using Google.Apis.YouTube.v3.Data; +using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Diagnostics; @@ -13,6 +14,7 @@ using Windows.Globalization; using Windows.Storage; using Windows.System.Power; using Windows.UI.Notifications; +using Windows.UI.Popups; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Navigation; @@ -258,10 +260,20 @@ namespace FoxTube /// /// The source of the suspend request. /// Details about the suspend request. - private void OnSuspending(object sender, SuspendingEventArgs e) + private async void OnSuspending(object sender, SuspendingEventArgs e) { var deferral = e.SuspendingOperation.GetDeferral(); - //TODO: Save application state and stop any background activity + //await new MessageDialog("suspending").ShowAsync(); + //Saving history + await FileIO.WriteTextAsync( + await ApplicationData.Current.RoamingFolder.CreateFileAsync("history.json", CreationCollisionOption.ReplaceExisting), + JsonConvert.SerializeObject(SecretsVault.UserHistory)); + //Saving WL playlist + await FileIO.WriteTextAsync( + await ApplicationData.Current.RoamingFolder.CreateFileAsync("watchlater.json", CreationCollisionOption.ReplaceExisting), + JsonConvert.SerializeObject(SecretsVault.WatchLater)); + //Saving downloads + Methods.MainPage.Agent.QuitPrompt(); deferral.Complete(); } } diff --git a/FoxTube/Classes/DownloadAgent.cs b/FoxTube/Classes/DownloadAgent.cs index 8815996..7469530 100644 --- a/FoxTube/Classes/DownloadAgent.cs +++ b/FoxTube/Classes/DownloadAgent.cs @@ -7,6 +7,7 @@ using Newtonsoft.Json; using Windows.UI.Popups; using YoutubeExplode.Models.MediaStreams; using Google.Apis.YouTube.v3.Data; +using Windows.Foundation; namespace FoxTube.Controls { @@ -14,6 +15,7 @@ namespace FoxTube.Controls { public List items = new List(); StorageFolder roaming = ApplicationData.Current.RoamingFolder; + public IAsyncOperation prompt; public DownloadAgent() { @@ -50,13 +52,13 @@ namespace FoxTube.Controls items.Remove(item); } - public async void QuitPrompt() + public void QuitPrompt() { - if(items.Find(x => x.InProgress) != null) + if(items.Exists(x => x.InProgress)) { - MessageDialog dialog = new MessageDialog("You have some unfinished downloads. Quitting now will erase all downloaded data. Are you sure to continue?", "Some downloads are still pending"); + MessageDialog dialog = new MessageDialog($"Waiting pending downloads ({items.FindAll(x => x.InProgress).Count})..."); - dialog.Commands.Add(new UICommand("Yes", async (command) => + dialog.Commands.Add(new UICommand("Force quit", async (command) => { foreach (DownloadItem i in items.FindAll(x => x.InProgress)) i.Cancel(); @@ -70,10 +72,8 @@ namespace FoxTube.Controls await roaming.CreateFileAsync("downloads.json", CreationCollisionOption.ReplaceExisting), JsonConvert.SerializeObject(containers)); })); - dialog.Commands.Add(new UICommand("No")); - - dialog.DefaultCommandIndex = 1; - await dialog.ShowAsync(); + + prompt = dialog.ShowAsync(); } } } diff --git a/FoxTube/Classes/SecretsVault.cs b/FoxTube/Classes/SecretsVault.cs index 5bba87e..f8fdb78 100644 --- a/FoxTube/Classes/SecretsVault.cs +++ b/FoxTube/Classes/SecretsVault.cs @@ -16,6 +16,24 @@ using Windows.UI.Popups; namespace FoxTube { + public class HistoryItem + { + public string Id { get; set; } + public double LeftOn { get; set; } + + public HistoryItem(string id, TimeSpan elapsed, TimeSpan total) + { + Id = id; + LeftOn = elapsed.TotalSeconds / total.TotalSeconds * 100; + } + + public HistoryItem(string id) + { + Id = id; + LeftOn = 0; + } + } + public static class SecretsVault { public static event EventHandler AuthorizationStateChanged; @@ -40,7 +58,7 @@ namespace FoxTube public static Channel UserChannel { get; private set; } public static List WatchLater { get; private set; } = new List(); - public static List UserHistory { get; private set; } = new List(); + public static List UserHistory { get; private set; } = new List(); public static List Subscriptions { get; private set; } = new List(); public static YouTubeService NoAuthService => new YouTubeService(new BaseClientService.Initializer() @@ -59,35 +77,13 @@ namespace FoxTube } } - public static async void HistoryAdd(string id) + public static void HistoryAdd(string id, TimeSpan elapsed, TimeSpan total) { - UserHistory.Remove(id); - UserHistory.Add(id); + UserHistory.Remove(UserHistory.Find(x => x.Id == id)); + UserHistory.Add(new HistoryItem(id, elapsed, total)); if (UserHistory.Count > 100) UserHistory.RemoveAt(UserHistory.Count - 1); - - await FileIO.WriteTextAsync( - await ApplicationData.Current.RoamingFolder.CreateFileAsync("history.json", CreationCollisionOption.ReplaceExisting), - JsonConvert.SerializeObject(UserHistory)); - } - - public static async void LaterAdd(string id) - { - WatchLater.Add(id); - - await FileIO.WriteTextAsync( - await ApplicationData.Current.RoamingFolder.CreateFileAsync("watchlater.json", CreationCollisionOption.ReplaceExisting), - JsonConvert.SerializeObject(UserHistory)); - } - - public static async void LaterRemove(string id) - { - WatchLater.Remove(id); - - await FileIO.WriteTextAsync( - await ApplicationData.Current.RoamingFolder.CreateFileAsync("watchlater.json", CreationCollisionOption.ReplaceExisting), - JsonConvert.SerializeObject(UserHistory)); } public static async Task ChangeSubscriptionState(string id) @@ -95,7 +91,7 @@ namespace FoxTube if (!IsAuthorized) return false; - if(Subscriptions.Find(x => x.Snippet.ResourceId.ChannelId == id) != null) + if(Subscriptions.Exists(x => x.Snippet.ResourceId.ChannelId == id)) { Subscription s = Subscriptions.Find(x => x.Snippet.ResourceId.ChannelId == id); @@ -151,6 +147,8 @@ namespace FoxTube return false; Subscriptions.Add(s); SubscriptionsChanged.Invoke(null, "add", s); + + SaveSubscriptions(); return true; } @@ -213,27 +211,28 @@ namespace FoxTube try { await ApplicationData.Current.RoamingFolder.GetFileAsync("history.json"); + UserHistory = JsonConvert.DeserializeObject>(await FileIO.ReadTextAsync(await ApplicationData.Current.RoamingFolder.GetFileAsync("history.json"))); } - catch (FileNotFoundException) + catch { await FileIO.WriteTextAsync( await ApplicationData.Current.RoamingFolder.CreateFileAsync("history.json", CreationCollisionOption.ReplaceExisting), - JsonConvert.SerializeObject(new List())); + JsonConvert.SerializeObject(new List())); + UserHistory = new List(); } try { await ApplicationData.Current.RoamingFolder.GetFileAsync("watchlater.json"); + WatchLater = JsonConvert.DeserializeObject>(await FileIO.ReadTextAsync(await ApplicationData.Current.RoamingFolder.GetFileAsync("watchlater.json"))); } - catch (FileNotFoundException) + catch { await FileIO.WriteTextAsync( await ApplicationData.Current.RoamingFolder.CreateFileAsync("watchlater.json", CreationCollisionOption.ReplaceExisting), JsonConvert.SerializeObject(new List())); + WatchLater = new List(); } - UserHistory = JsonConvert.DeserializeObject>(await FileIO.ReadTextAsync(await ApplicationData.Current.RoamingFolder.GetFileAsync("history.json"))); - WatchLater = JsonConvert.DeserializeObject>(await FileIO.ReadTextAsync(await ApplicationData.Current.RoamingFolder.GetFileAsync("watchlater.json"))); - /*PlaylistItemsResource.ListRequest playlistRequest = Service.PlaylistItems.List("snippet"); playlistRequest.PlaylistId = UserChannel.ContentDetails.RelatedPlaylists.WatchHistory; playlistRequest.MaxResults = 50; @@ -280,12 +279,7 @@ namespace FoxTube foreach (Subscription s in subResponse.Items) Subscriptions.Add(s); } - - Dictionary subs = new Dictionary(); - Subscriptions.ForEach(x => subs.Add(x.Snippet.ResourceId.ChannelId, x.Snippet.Thumbnails.Medium.Url)); - await FileIO.WriteTextAsync( - await ApplicationData.Current.RoamingFolder.CreateFileAsync("background.json", CreationCollisionOption.ReplaceExisting), - JsonConvert.SerializeObject(subs)); + SaveSubscriptions(); } catch { @@ -309,6 +303,15 @@ namespace FoxTube AuthorizationStateChanged.Invoke(null, null); } + public static async void SaveSubscriptions() + { + Dictionary subs = new Dictionary(); + Subscriptions.ForEach(x => subs.Add(x.Snippet.ResourceId.ChannelId, x.Snippet.Thumbnails.Medium.Url)); + await FileIO.WriteTextAsync( + await ApplicationData.Current.RoamingFolder.CreateFileAsync("background.json", CreationCollisionOption.ReplaceExisting), + JsonConvert.SerializeObject(subs)); + } + public static async void Deauthenticate() { if(await Credential.RevokeTokenAsync(CancellationToken.None)) diff --git a/FoxTube/Controls/DownloadItem.xaml.cs b/FoxTube/Controls/DownloadItem.xaml.cs index 1775bd5..1931b8e 100644 --- a/FoxTube/Controls/DownloadItem.xaml.cs +++ b/FoxTube/Controls/DownloadItem.xaml.cs @@ -15,6 +15,7 @@ using Windows.UI.Popups; using Windows.Storage.Pickers; using Windows.UI.Notifications; using Microsoft.Toolkit.Uwp.Notifications; +using Windows.Foundation; // The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 diff --git a/FoxTube/Controls/VideoCard.xaml b/FoxTube/Controls/VideoCard.xaml index 5780c5b..47d85c2 100644 --- a/FoxTube/Controls/VideoCard.xaml +++ b/FoxTube/Controls/VideoCard.xaml @@ -22,6 +22,7 @@ + diff --git a/FoxTube/Controls/VideoCard.xaml.cs b/FoxTube/Controls/VideoCard.xaml.cs index 6b9511b..23a4cae 100644 --- a/FoxTube/Controls/VideoCard.xaml.cs +++ b/FoxTube/Controls/VideoCard.xaml.cs @@ -82,8 +82,11 @@ namespace FoxTube.Controls } catch { } - if(SecretsVault.UserHistory.Contains(videoId)) + if(SecretsVault.UserHistory.Exists(x => x.Id == videoId)) + { watched.Visibility = Visibility.Visible; + leftOn.Value = SecretsVault.UserHistory.Find(x => x.Id == videoId).LeftOn; + } } public async void Button_Click(object sender, RoutedEventArgs e) diff --git a/FoxTube/Controls/VideoPlayer.xaml.cs b/FoxTube/Controls/VideoPlayer.xaml.cs index 19bb268..64052d2 100644 --- a/FoxTube/Controls/VideoPlayer.xaml.cs +++ b/FoxTube/Controls/VideoPlayer.xaml.cs @@ -134,7 +134,7 @@ namespace FoxTube else s = (string)settings.Values["quality"]; - if (quality.Items.ToList().Find(x => (x as ComboBoxItem).Content as string == s) != null) + if (quality.Items.ToList().Exists(x => (x as ComboBoxItem).Content as string == s)) quality.SelectedItem = quality.Items.First(x => (x as ComboBoxItem).Content as string == s); else quality.SelectedItem = quality.Items.First(); @@ -203,6 +203,8 @@ namespace FoxTube systemControls.ButtonPressed += SystemControls_Engaged; systemControls.IsEnabled = true; + SecretsVault.HistoryAdd(videoId, elapsed, total); + t.Start(); Visibility = Visibility.Visible; @@ -348,7 +350,7 @@ namespace FoxTube settings.Values["rememberedQuality"] = (quality.SelectedItem as ComboBoxItem).Content as string; - if(streamInfo.Muxed.ToList().Find(x => x.VideoQualityLabel == (quality.SelectedItem as ComboBoxItem).Content as string) != null) + if(streamInfo.Muxed.ToList().Exists(x => x.VideoQualityLabel == (quality.SelectedItem as ComboBoxItem).Content as string)) { isMuxed = true; videoSource.Source = streamInfo.Muxed.First(x => x.VideoQualityLabel == (quality.SelectedItem as ComboBoxItem).Content as string).Url.ToUri(); @@ -612,6 +614,8 @@ namespace FoxTube systemControls.PlaybackStatus = MediaPlaybackStatus.Closed; break; } + + SecretsVault.HistoryAdd(videoId, elapsed, total); } private async void miniView_Click(object sender, RoutedEventArgs e) diff --git a/FoxTube/FoxTube.csproj b/FoxTube/FoxTube.csproj index 45f9b69..5772f30 100644 --- a/FoxTube/FoxTube.csproj +++ b/FoxTube/FoxTube.csproj @@ -11,7 +11,7 @@ FoxTube en-US UAP - 10.0.17134.0 + 10.0.17763.0 10.0.16299.0 14 512 diff --git a/FoxTube/Pages/History.xaml b/FoxTube/Pages/History.xaml index f471fb0..e618e2f 100644 --- a/FoxTube/Pages/History.xaml +++ b/FoxTube/Pages/History.xaml @@ -19,7 +19,8 @@ - + + diff --git a/FoxTube/Pages/History.xaml.cs b/FoxTube/Pages/History.xaml.cs index abfb7dc..7565c21 100644 --- a/FoxTube/Pages/History.xaml.cs +++ b/FoxTube/Pages/History.xaml.cs @@ -36,7 +36,7 @@ namespace FoxTube.Pages loading.Refresh(); list.Clear(); - SecretsVault.UserHistory.ForEach(i => list.Add(new VideoCard(i))); + SecretsVault.UserHistory.ForEach(i => list.Add(new VideoCard(i.Id))); loading.Close(); } @@ -45,5 +45,10 @@ namespace FoxTube.Pages { await Launcher.LaunchUriAsync(new Uri("youtube.com/feed/history")); } + + private void help_Click(object sender, RoutedEventArgs e) + { + Methods.MainPage.GoToDeveloper("local-history"); + } } } diff --git a/FoxTube/Pages/MainPage.xaml b/FoxTube/Pages/MainPage.xaml index 1d3d188..8d206ce 100644 --- a/FoxTube/Pages/MainPage.xaml +++ b/FoxTube/Pages/MainPage.xaml @@ -33,47 +33,48 @@ - - - - - - + + + diff --git a/FoxTube/Pages/MainPage.xaml.cs b/FoxTube/Pages/MainPage.xaml.cs index 387497b..f11b131 100644 --- a/FoxTube/Pages/MainPage.xaml.cs +++ b/FoxTube/Pages/MainPage.xaml.cs @@ -81,7 +81,7 @@ namespace FoxTube try { XmlDocument changelog = new XmlDocument(); - changelog.Load("http://foxgame.hol.es/foxtube-changelog.xml"); + changelog.Load("http://foxgame-studio.000webhostapp.com/foxtube-changelog.xml"); XmlElement e = changelog["items"].ChildNodes[0] as XmlElement; ToastNotificationManager.CreateToastNotifier().Show(FoxTube.Background.Notification.GetChangelogToast(e.GetAttribute("version"))); @@ -100,6 +100,11 @@ namespace FoxTube Initialize(); } + async void GetVideosFromToday() + { + + } + public async void Initialize() { if (await ApplicationData.Current.RoamingFolder.GetFileAsync("notifications.json") != null) @@ -130,7 +135,7 @@ namespace FoxTube titleBar.ButtonBackgroundColor = Colors.Red; titleBar.ButtonHoverBackgroundColor = Colors.IndianRed; titleBar.ButtonPressedBackgroundColor = Colors.DarkRed; - titleBar.ButtonInactiveBackgroundColor = Colors.DarkRed; + titleBar.ButtonInactiveBackgroundColor = Colors.Black; titleBar.ForegroundColor = Colors.White; CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = false; @@ -141,18 +146,23 @@ namespace FoxTube if ((string)args[0] == "add" && nav.MenuItems.Count < 19) { Subscription s = args[1] as Subscription; - StackPanel panel = new StackPanel() { Orientation = Orientation.Horizontal }; + StackPanel panel = new StackPanel() + { + Orientation = Orientation.Horizontal, + Padding = new Thickness(5) + }; panel.Children.Add(new PersonPicture() { Height = 20, - Margin = new Thickness(0, 0, 13, 0), + Margin = new Thickness(-5, 0, 15, 0), ProfilePicture = new BitmapImage(new Uri(s.Snippet.Thumbnails.Medium.Url)) }); panel.Children.Add(new TextBlock() { Text = s.Snippet.Title }); nav.MenuItems.Add(new NavigationViewItem() { Content = panel, - Name = (nav.MenuItems.Count - 9).ToString() + Name = (nav.MenuItems.Count - 9).ToString(), + Padding = new Thickness(-5) }); } else if ((string)args[0] == "remove" && (int)args[1] < 10) @@ -190,18 +200,23 @@ namespace FoxTube try { Subscription s = SecretsVault.Subscriptions[k]; - StackPanel panel = new StackPanel() { Orientation = Orientation.Horizontal }; + StackPanel panel = new StackPanel() + { + Orientation = Orientation.Horizontal, + Padding = new Thickness(5) + }; panel.Children.Add(new PersonPicture() { Height = 20, - Margin = new Thickness(0, 0, 13, 0), + Margin = new Thickness(-5, 0, 15, 0), ProfilePicture = new BitmapImage(new Uri(s.Snippet.Thumbnails.Medium.Url)) }); panel.Children.Add(new TextBlock() { Text = s.Snippet.Title }); nav.MenuItems.Add(new NavigationViewItem() { Content = panel, - Name = k.ToString() + Name = k.ToString(), + Padding = new Thickness(-5) }); } catch { continue; } @@ -234,7 +249,7 @@ namespace FoxTube GoToVideo((videoPlaceholder.Content as VideoPage).videoId); } - private async void feedback_Click(object sender, RoutedEventArgs e) + private async void feedback_Click(object sender, TappedRoutedEventArgs e) { await Launcher.LaunchUriAsync(new Uri("feedback-hub:")); } @@ -466,33 +481,37 @@ namespace FoxTube private void nav_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args) { - if (s == Sender.None) + try { - s = Sender.Menu; - if (args.IsSettingsSelected) - content.Navigate(typeof(Settings)); - else + if (s == Sender.None) { - if (args.SelectedItem == toHome) - content.Navigate(typeof(Home)); - else if (args.SelectedItem == toHistory) - content.Navigate(typeof(History)); - else if (args.SelectedItem == toLiked) - content.Navigate(typeof(PlaylistPage), SecretsVault.UserChannel.ContentDetails.RelatedPlaylists.Likes); - else if (args.SelectedItem == toLater) - content.Navigate(typeof(PlaylistPage), SecretsVault.UserChannel.ContentDetails.RelatedPlaylists.WatchLater); - else if (args.SelectedItem == toSubscriptions) - content.Navigate(typeof(Subscriptions)); - else if (args.SelectedItem == toDownloads) - content.Navigate(typeof(Downloads)); - else if (args.SelectedItem == toChannel) - content.Navigate(typeof(ChannelPage), SecretsVault.UserChannel.Id); + s = Sender.Menu; + if (args.IsSettingsSelected) + content.Navigate(typeof(Settings)); else - content.Navigate(typeof(ChannelPage), SecretsVault.Subscriptions[Convert.ToInt32((args.SelectedItem as NavigationViewItem).Name)].Snippet.ResourceId.ChannelId); + { + if (args.SelectedItem == toHome) + content.Navigate(typeof(Home)); + else if (args.SelectedItem == toHistory) + content.Navigate(typeof(History)); + else if (args.SelectedItem == toLiked) + content.Navigate(typeof(PlaylistPage), SecretsVault.UserChannel.ContentDetails.RelatedPlaylists.Likes); + else if (args.SelectedItem == toLater) + content.Navigate(typeof(PlaylistPage), SecretsVault.UserChannel.ContentDetails.RelatedPlaylists.WatchLater); + else if (args.SelectedItem == toSubscriptions) + content.Navigate(typeof(Subscriptions)); + else if (args.SelectedItem == toDownloads) + content.Navigate(typeof(Downloads)); + else if (args.SelectedItem == toChannel) + content.Navigate(typeof(ChannelPage), SecretsVault.UserChannel.Id); + else + content.Navigate(typeof(ChannelPage), SecretsVault.Subscriptions[Convert.ToInt32((args.SelectedItem as NavigationViewItem).Name)].Snippet.ResourceId.ChannelId); + } } + else + s = Sender.None; } - else - s = Sender.None; + catch { } } public void content_Navigated(object sender, NavigationEventArgs e) @@ -681,5 +700,10 @@ namespace FoxTube (videoPlaceholder.Content as VideoPage).player.KeyUpPressed(sender, e); } } + + private void openContext(object sender, TappedRoutedEventArgs e) + { + ((NavigationViewItem)sender).ContextFlyout.ShowAt((NavigationViewItem)sender); + } } } diff --git a/FoxTube/Pages/SettingsPages/Inbox.xaml.cs b/FoxTube/Pages/SettingsPages/Inbox.xaml.cs index 70cfad5..06dce6f 100644 --- a/FoxTube/Pages/SettingsPages/Inbox.xaml.cs +++ b/FoxTube/Pages/SettingsPages/Inbox.xaml.cs @@ -40,14 +40,14 @@ namespace FoxTube.Pages.SettingsPages { XmlDocument doc = new XmlDocument(); - doc.Load("http://foxgame.hol.es/foxtube-changelog.xml"); + doc.Load("http://foxgame-studio.000webhostapp.com/foxtube-changelog.xml"); foreach (XmlElement e in doc["items"].ChildNodes) items.Add(new InboxItem( e.GetAttribute("version"), e["content"].InnerText, e.GetAttribute("time"))); - doc.Load("http://foxgame.hol.es/foxtube-messages.xml"); + doc.Load("http://foxgame-studio.000webhostapp.com/foxtube-messages.xml"); foreach (XmlElement e in doc["posts"].ChildNodes) items.Add(new InboxItem( e["header"].InnerText, diff --git a/FoxTube/Pages/VideoPage.xaml.cs b/FoxTube/Pages/VideoPage.xaml.cs index 9b405a1..ccafc1a 100644 --- a/FoxTube/Pages/VideoPage.xaml.cs +++ b/FoxTube/Pages/VideoPage.xaml.cs @@ -208,8 +208,6 @@ namespace FoxTube.Pages } } subscribe.Visibility = Visibility.Visible; - - SecretsVault.HistoryAdd(videoId); } else { diff --git a/FoxTube/Strings/en-US/Main.resw b/FoxTube/Strings/en-US/Main.resw index d3b5ac1..ba22dcd 100644 --- a/FoxTube/Strings/en-US/Main.resw +++ b/FoxTube/Strings/en-US/Main.resw @@ -117,13 +117,13 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + Remove ads Downloads - + Give a feedback diff --git a/FoxTube/Strings/ru-RU/Main.resw b/FoxTube/Strings/ru-RU/Main.resw index d907b3b..5d461a8 100644 --- a/FoxTube/Strings/ru-RU/Main.resw +++ b/FoxTube/Strings/ru-RU/Main.resw @@ -117,13 +117,13 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + Убрать рекламу Загрузки - + Оставить отзыв