diff --git a/MusicX/App.xaml.cs b/MusicX/App.xaml.cs index be8b4198..5e22682a 100644 --- a/MusicX/App.xaml.cs +++ b/MusicX/App.xaml.cs @@ -74,16 +74,6 @@ private static void SetupAnalytics() Layout = "${message}" }); LogManager.Configuration.AddRuleForAllLevels(sentryTargetName); - - // TODO remove appcenter completely as msft is shutting it down soon - AppCenter.Start("02130c6d-0a3b-4aa2-b46c-8aeb66c3fd71", - typeof(Analytics), typeof(Crashes)); - - var properties = new Dictionary - { - {"Version", StaticService.Version } - }; - Analytics.TrackEvent("StartApp", properties); } static Mutex? InstanceCheckMutex; diff --git a/MusicX/Controls/BannerControl.xaml.cs b/MusicX/Controls/BannerControl.xaml.cs index ff8a07cf..bb61c2f3 100644 --- a/MusicX/Controls/BannerControl.xaml.cs +++ b/MusicX/Controls/BannerControl.xaml.cs @@ -75,21 +75,12 @@ private void CardAction_Click(object sender, RoutedEventArgs e) var notificationService = StaticService.Container.GetRequiredService(); notificationService.OpenExternalPage(new PlaylistView(playlistId, ownerId, accessKey)); - }catch (Exception ex) + } + catch (Exception ex) { - - var properties = new Dictionary - { -#if DEBUG - { "IsDebug", "True" }, -#endif - {"Version", StaticService.Version } - }; - Crashes.TrackError(ex, properties); - var logger = StaticService.Container.GetRequiredService(); - logger.Error(ex, ex.Message); + logger.Error(ex, "Failed to open playlist in banner control"); } } diff --git a/MusicX/Controls/BigBannerControl.xaml.cs b/MusicX/Controls/BigBannerControl.xaml.cs index f309148b..67c404fd 100644 --- a/MusicX/Controls/BigBannerControl.xaml.cs +++ b/MusicX/Controls/BigBannerControl.xaml.cs @@ -115,19 +115,9 @@ private async void ActionButton_Click(object sender, RoutedEventArgs e) } catch (Exception ex) { - - var properties = new Dictionary - { -#if DEBUG - { "IsDebug", "True" }, -#endif - {"Version", StaticService.Version } - }; - Crashes.TrackError(ex, properties); - var logger = StaticService.Container.GetRequiredService(); - logger.Error(ex, ex.Message); + logger.Error(ex, "Failed to open action in big banners control"); } } diff --git a/MusicX/Controls/BlockControl.xaml.cs b/MusicX/Controls/BlockControl.xaml.cs index 3eab337a..fe62fd5a 100644 --- a/MusicX/Controls/BlockControl.xaml.cs +++ b/MusicX/Controls/BlockControl.xaml.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using System.Windows; using System.Windows.Controls; @@ -11,11 +10,8 @@ using Microsoft.Extensions.DependencyInjection; using MusicX.Controls.Blocks; using MusicX.Core.Models; -using MusicX.Helpers; using MusicX.Services; using MusicX.ViewModels.Controls; -using NLog; -using Wpf.Ui; using Wpf.Ui.Controls; using Button = MusicX.Core.Models.Button; using NavigationService = MusicX.Services.NavigationService; @@ -50,431 +46,5 @@ public Artist? Artist get => (Artist)GetValue(ArtistProperty); set => SetValue(ArtistProperty, value); } - - private void UserControl_Loaded(object sender, RoutedEventArgs e) - { - var logger = StaticService.Container.GetRequiredService(); - - try - { - /*if (Block.DataType == "artist") - { - BlocksPanel.Children.Add(new ArtistBannerBlockControl(Block) { Block = Block }); - - logger.Info($"loaded {Block.DataType} block with block id = {Block.Id}"); - return; - } - - if (Block.DataType == "texts") - { - BlocksPanel.Children.Add(new TextsBlockControl() { Block = Block }); - - logger.Info($"loaded {Block.DataType} block with block id = {Block.Id}"); - - return; - } - - if (Block.DataType == "placeholder") - { - BlocksPanel.Children.Add(new PlaceholderBlockControl(Block)); - - logger.Info($"loaded {Block.DataType} block with block id = {Block.Id}"); - - return; - } - - if (Block.DataType == "groups_items") - { - BlocksPanel.Children.Add(new GroupsBlockControl() { Block = Block}); - - logger.Info($"loaded {Block.DataType} block with block id = {Block.Id}"); - - return; - - } - - if (Block.DataType == "curator") - { - BlocksPanel.Children.Add(new CuratorBannerBlockControl() { Block = Block }); - - logger.Info($"loaded {Block.DataType} block with block id = {Block.Id}"); - - return; - } - - if (Block.DataType == "music_playlists") - { - - if (Block.Layout.Name == "music_chart_large_slider") - { - BlocksPanel.Children.Add(new ListPlaylists() { Content = Block.Playlists, *//*TODO ShowChart = true,*//* ShowFull = false }); - logger.Info($"loaded {Block.DataType} block with block id = {Block.Id}"); - - return; - } - - if (Block.Layout.Name == "music_chart_list") - { - BlocksPanel.Children.Add(new ListPlaylists() { Content = Block.Playlists, ShowFull = true }); - logger.Info($"loaded {Block.DataType} block with block id = {Block.Id}"); - - return; - } - - if (Block.Layout.Name == "large_slider") - { - BlocksPanel.Children.Add(new ListPlaylists() { Content = Block.Playlists, ShowFull = false }); - logger.Info($"loaded {Block.DataType} block with block id = {Block.Id}"); - - return; - } - - if (Block.Layout.Name == "slider") - { - BlocksPanel.Children.Add(new ListPlaylists() { Content = Block.Playlists, ShowFull = false }); - logger.Info($"loaded {Block.DataType} block with block id = {Block.Id}"); - - return; - } - - if (Block.Layout.Name == "recomms_slider") - { - BlocksPanel.Children.Add(new RecommsPlaylistBlock() { Playlists = Block.Playlists }); - logger.Info($"loaded {Block.DataType} block with block id = {Block.Id}"); - - return; - } - - if (Block.Layout.Name == "list") - { - BlocksPanel.Children.Add(new ListPlaylists() { Content = Block.Playlists, ShowFull = true }); - logger.Info($"loaded {Block.DataType} block with block id = {Block.Id}"); - - return; - } - - if (Block.Layout.Name == "compact_list") - { - BlocksPanel.Children.Add(new ListPlaylists() { Content = Block.Playlists, ShowFull = false }); - logger.Info($"loaded {Block.DataType} block with block id = {Block.Id}"); - - return; - } - } - - if (Block.DataType == "search_suggestions") - { - - BlocksPanel.Children.Add(new SearchSuggestionsBlockControl() { Block = Block }); - logger.Info($"loaded {Block.DataType} block with block id = {Block.Id}"); - - return; - } - - if (Block.DataType == "links") - { - - if (Block.Layout.Name == "categories_list" && Block.Links.FirstOrDefault().Title == "Недавнee") - { - var downloadsLink = Block.Links.SingleOrDefault(x => x.Title == "Скачанная музыка"); - if(downloadsLink != null) - { - Block.Links.Remove(downloadsLink); - } - - try - { - Block.Links.SingleOrDefault(x => x.Title == "Недавнee").Image[0].Url = "https://fooxboy.blob.core.windows.net/musicx/icons/recent_white.png"; - Block.Links.SingleOrDefault(x => x.Title == "Плейлисты").Image[0].Url = "https://fooxboy.blob.core.windows.net/musicx/icons/playlists_white.png"; - Block.Links.SingleOrDefault(x => x.Title == "Альбомы").Image[0].Url = "https://fooxboy.blob.core.windows.net/musicx/icons/albums_white.png"; - Block.Links.SingleOrDefault(x => x.Title == "Подписки").Image[0].Url = "https://fooxboy.blob.core.windows.net/musicx/icons/follows_white.png"; - }catch(Exception ex) - { - logger.Error("Music X не смог заменить картинки в моей музыке:"); - logger.Error(ex,ex.Message); - } - - - BlocksPanel.Children.Add(new MusicCategoryBlockControl() { Links = Block.Links }); - logger.Info($"loaded {Block.DataType} block with block id = {Block.Id}"); - } - else if (Block.Layout.Name == "music_newsfeed_title") - { - BlocksPanel.Children.Add(new LinksNewsfeedBlockControl() { Links = Block.Links }); - logger.Info($"loaded {Block.DataType} block with block id = {Block.Id}"); - } - else - { - BlocksPanel.Children.Add(new LinksBlockControl() { Block = Block }); - logger.Info($"loaded {Block.DataType} block with block id = {Block.Id}"); - } - - - return; - } - - if (Block.DataType == "catalog_banners") - { - - if(Block.Banners[0].ClickAction.Action.Url.Contains("subscription")) return; - if(Block.Banners[0].ClickAction.Action.Url.Contains("combo")) return; - if(Block.Banners[0].ClickAction.Action.Url.Contains("https://vk.com/app")) return; - if(Block.Banners[0].ClickAction.Action.Url.Contains("https://vk.com/vk_music")) return; - //if (Block.Banners[0].Buttons != null) - - BlocksPanel.Children.Add(new BigBannerControl() { Banners = Block.Banners, Margin = new Thickness(0,0,-10,0) }); - - logger.Info($"loaded {Block.DataType} block with block id = {Block.Id}"); - - return; - } - - if (Block.DataType == "music_audios") - { - if (Block.Layout.Name == "triple_stacked_slider") - { - BlocksPanel.Children.Add(new ListTracks() { Tracks = Block.Audios }); - - logger.Info($"loaded {Block.DataType} block with block id = {Block.Id}"); - - return; - } - - if (Block.Layout.Name == "music_chart_triple_stacked_slider") - { - BlocksPanel.Children.Add(new ListTracks() { Tracks = Block.Audios, ShowChart = true }); - - logger.Info($"loaded {Block.DataType} block with block id = {Block.Id}"); - - return; - } - - if (Block.Layout.Name == "list") - { - - BlocksPanel.Children.Add(new AudiosListControl() { Audios = Block.Audios }); - - logger.Info($"loaded {Block.DataType} block with block id = {Block.Id}"); - - return; - - } - - if (Block.Layout.Name == "music_chart_list") - { - - BlocksPanel.Children.Add(new AudiosListControl() { Audios = Block.Audios }); - - logger.Info($"loaded {Block.DataType} block with block id = {Block.Id}"); - - return; - - } - - } - - if (Block.DataType == "action") - { - var buttons = new List