diff --git a/FoxTube/Assets/Data/Patchnotes.xml b/FoxTube/Assets/Data/Patchnotes.xml index d898cb7..e74565d 100644 --- a/FoxTube/Assets/Data/Patchnotes.xml +++ b/FoxTube/Assets/Data/Patchnotes.xml @@ -1,5 +1,19 @@  + + + ### What's new: +- Fixed some cases when playlist cards aren't displayed +- Fixed some cases when the app crashes +- Fixed app crashes on trying to navigate to not existing channel/playlist/video + + ### Что нового: +- Исправлены некоторые случаи при которых карточки плейлистов не отображались +- Исправлены некоторые случай при которых приложение вылетало +- Исправлены вылеты приложения при попытке перейти на несуществующий канал/плейлист/видео + + + ### What's new: diff --git a/FoxTube/Classes/DownloadAgent.cs b/FoxTube/Classes/DownloadAgent.cs index 8bf1d48..8c7fd4d 100644 --- a/FoxTube/Classes/DownloadAgent.cs +++ b/FoxTube/Classes/DownloadAgent.cs @@ -28,6 +28,7 @@ namespace FoxTube } catch (Exception e) { + settings.Values["downloads"] = JsonConvert.SerializeObject(new List()); Analytics.TrackEvent("Failed to load downloads history", new Dictionary { { "Exception", e.GetType().ToString() }, diff --git a/FoxTube/Controls/PlaylistCard.xaml.cs b/FoxTube/Controls/PlaylistCard.xaml.cs index bdc5ecd..ce97d9b 100644 --- a/FoxTube/Controls/PlaylistCard.xaml.cs +++ b/FoxTube/Controls/PlaylistCard.xaml.cs @@ -9,6 +9,7 @@ using Windows.System; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Media.Imaging; +using YoutubeExplode; namespace FoxTube.Controls { @@ -46,8 +47,12 @@ namespace FoxTube.Controls ChannelsResource.ListRequest r = SecretsVault.Service.Channels.List("snippet"); r.Id = item.Snippet.ChannelId; - thumbnail.Source = new BitmapImage(item.Snippet.Thumbnails.Medium.Url.ToUri()); - avatar.ProfilePicture = new BitmapImage(new Uri((await r.ExecuteAsync()).Items[0].Snippet.Thumbnails.Medium.Url)) { DecodePixelWidth = 46, DecodePixelHeight = 46 }; + try + { + thumbnail.Source = new BitmapImage(item.Snippet.Thumbnails.Medium.Url.ToUri()); + avatar.ProfilePicture = new BitmapImage((await new YoutubeClient().GetChannelAsync(item.Snippet.ChannelId)).LogoUrl.ToUri()) { DecodePixelWidth = 46, DecodePixelHeight = 46 }; + } + catch { } show.Begin(); } diff --git a/FoxTube/Controls/VideoCard.xaml.cs b/FoxTube/Controls/VideoCard.xaml.cs index 5373e0b..a47ef55 100644 --- a/FoxTube/Controls/VideoCard.xaml.cs +++ b/FoxTube/Controls/VideoCard.xaml.cs @@ -121,6 +121,8 @@ namespace FoxTube.Controls { (Parent as AdaptiveGridView)?.Items.Remove(this); Visibility = Visibility.Collapsed; + if (item == null) + return; Analytics.TrackEvent("VideoCard loading failed", new Dictionary() { { "Exception", e.GetType().ToString() }, diff --git a/FoxTube/Pages/ChannelPage.xaml.cs b/FoxTube/Pages/ChannelPage.xaml.cs index aa69916..00bebb4 100644 --- a/FoxTube/Pages/ChannelPage.xaml.cs +++ b/FoxTube/Pages/ChannelPage.xaml.cs @@ -113,6 +113,12 @@ namespace FoxTube.Pages } catch (Exception e) { + if(item == null) + { + Methods.MainPage.PageContent.LoadingPage.Error("ChannelNotFound", "Such channel doesn't exist"); + return; + } + Methods.MainPage.PageContent.LoadingPage.Error(e.GetType().ToString(), e.Message); Analytics.TrackEvent("Channel loading error", new Dictionary() { diff --git a/FoxTube/Pages/PlaylistPage.xaml.cs b/FoxTube/Pages/PlaylistPage.xaml.cs index bfb5083..fb15b41 100644 --- a/FoxTube/Pages/PlaylistPage.xaml.cs +++ b/FoxTube/Pages/PlaylistPage.xaml.cs @@ -63,8 +63,12 @@ namespace FoxTube.Pages channelName.Text = Methods.GuardFromNull(item.Snippet.ChannelTitle); - avatar.ProfilePicture = new BitmapImage((await new YoutubeExplode.YoutubeClient().GetChannelAsync(item.Snippet.ChannelId)).LogoUrl.ToUri()) { DecodePixelWidth = 50, DecodePixelHeight = 50 }; - thumbnail.Source = new BitmapImage(item.Snippet.Thumbnails.Medium.Url.ToUri()); + try + { + thumbnail.Source = new BitmapImage(item.Snippet.Thumbnails.Medium.Url.ToUri()); + avatar.ProfilePicture = new BitmapImage((await new YoutubeExplode.YoutubeClient().GetChannelAsync(item.Snippet.ChannelId)).LogoUrl.ToUri()) { DecodePixelWidth = 50, DecodePixelHeight = 50 }; + } + catch { } request = SecretsVault.Service.PlaylistItems.List("contentDetails"); request.PlaylistId = id; @@ -126,6 +130,11 @@ namespace FoxTube.Pages } catch (Exception e) { + if (item == null) + { + Methods.MainPage.PageContent.LoadingPage.Error("PlaylistNotFound", "Such playlist doesn't exist"); + return; + } Methods.MainPage.PageContent.LoadingPage.Error(e.GetType().ToString(), e.Message); Analytics.TrackEvent("WL playlist loading error", new Dictionary() { @@ -148,7 +157,7 @@ namespace FoxTube.Pages private void refresh_Click(object sender, RoutedEventArgs e) { - Methods.MainPage.VideoContent.Refresh(); + Methods.MainPage.PageContent.Refresh(); } private void share_Click(object sender, RoutedEventArgs e) diff --git a/FoxTube/Pages/VideoPage.xaml.cs b/FoxTube/Pages/VideoPage.xaml.cs index 26765dd..c0bb70c 100644 --- a/FoxTube/Pages/VideoPage.xaml.cs +++ b/FoxTube/Pages/VideoPage.xaml.cs @@ -136,6 +136,12 @@ namespace FoxTube.Pages } catch (Exception e) { + if (item == null) + { + Methods.MainPage.PageContent.LoadingPage.Error("VideoNotFound", "Such video doesn't exist"); + return; + } + Methods.MainPage.VideoContent.LoadingPage.Error(e.GetType().ToString(), e.Message); Analytics.TrackEvent("Video loading error", new Dictionary() {