From 81678b2db74d7a106030baa0aea021c1a625c807 Mon Sep 17 00:00:00 2001 From: MaKrotos Date: Tue, 7 May 2024 17:01:42 +0300 Subject: [PATCH] Fix --- VK UI3/Controllers/AudioPlayer.xaml.cs | 6 +- VK UI3/VK UI3.csproj | 4 - VK UI3/VKs/IVK/IVKGetAudio.cs | 5 +- VK UI3/VKs/IVK/MessagesAudio.cs | 97 ++++++----- VK UI3/VKs/IVK/MixAudio.cs | 2 +- VK UI3/Views/LoginWindow/Password.xaml.cs | 2 - VK UI3/Views/SectionView.xaml.cs | 3 +- VK UI3/Views/Share/ChatList.xaml | 30 ---- VK UI3/Views/Share/ChatList.xaml.cs | 157 ------------------ .../AttachmentsController.xaml | 14 -- .../AttachmentsController.xaml.cs | 28 ---- .../ShareControllers/ConvController.xaml.cs | 14 +- VK UI3/Views/WaitView.xaml.cs | 2 + 13 files changed, 76 insertions(+), 288 deletions(-) delete mode 100644 VK UI3/Views/Share/ChatList.xaml delete mode 100644 VK UI3/Views/Share/ChatList.xaml.cs delete mode 100644 VK UI3/Views/Share/ShareControllers/AttachmentsController.xaml delete mode 100644 VK UI3/Views/Share/ShareControllers/AttachmentsController.xaml.cs diff --git a/VK UI3/Controllers/AudioPlayer.xaml.cs b/VK UI3/Controllers/AudioPlayer.xaml.cs index 095c078..cbf21c3 100644 --- a/VK UI3/Controllers/AudioPlayer.xaml.cs +++ b/VK UI3/Controllers/AudioPlayer.xaml.cs @@ -584,10 +584,12 @@ private async static Task PlayTrack(long? v = null) mediaPlayer.Source = mediaPlaybackItem; mediaPlayer.Play(); - iVKGetAudio.ChangePlayAudio(); - + iVKGetAudio.ChangePlayAudio(trackdata); + AudioPlayedChangeEvent.Invoke(trackdata, EventArgs.Empty); } + public static event EventHandler AudioPlayedChangeEvent; + private void PreviousBTN_Tapped(object sender, TappedRoutedEventArgs e) diff --git a/VK UI3/VK UI3.csproj b/VK UI3/VK UI3.csproj index 7c64c90..24c5e2c 100644 --- a/VK UI3/VK UI3.csproj +++ b/VK UI3/VK UI3.csproj @@ -66,7 +66,6 @@ - @@ -200,9 +199,6 @@ $(DefaultXamlRuntime) - - MSBuild:Compile - $(DefaultXamlRuntime) diff --git a/VK UI3/VKs/IVK/IVKGetAudio.cs b/VK UI3/VKs/IVK/IVKGetAudio.cs index 72b0ced..ded923f 100644 --- a/VK UI3/VKs/IVK/IVKGetAudio.cs +++ b/VK UI3/VKs/IVK/IVKGetAudio.cs @@ -66,11 +66,12 @@ public ObservableRangeCollection listAudio public void PhotoUpdated() { onPhotoUpdated?.RaiseEvent(this, EventArgs.Empty); } - private long? _countTracks { get; set; } + private long? _countTracks { get; set; } = null; public long? countTracks { get { - if (_countTracks != -1) return countTracks; + if (_countTracks == null) return null; + if (_countTracks != -1) return _countTracks; else return listAudio.Count; } diff --git a/VK UI3/VKs/IVK/MessagesAudio.cs b/VK UI3/VKs/IVK/MessagesAudio.cs index 975e358..7a69848 100644 --- a/VK UI3/VKs/IVK/MessagesAudio.cs +++ b/VK UI3/VKs/IVK/MessagesAudio.cs @@ -4,7 +4,10 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; +using TagLib.Ape; using VK_UI3.Helpers; +using VK_UI3.Views.Share; +using VkNet.Enums.SafetyEnums; using VkNet.Model; using VkNet.Model.Attachments; using VkNet.Model.RequestParams; @@ -14,35 +17,43 @@ namespace VK_UI3.VKs.IVK { public class MessagesAudio : IVKGetAudio { - public MessagesAudio(long id, DispatcherQueue dispatcher) : base(id, dispatcher) + public MessagesAudio(MessConv messConv, DispatcherQueue dispatcher) : base(dispatcher) { - base.id = id.ToString(); + base.id = messConv.conversation.Peer.LocalId.ToString(); + this.messConv = messConv; } - + + public override long? getCount() { - return api.Audio.GetCountAsync(long.Parse(id)).Result; + return -1; } - public User user; + MessConv messConv = null; public override string getName() { try { - List ids = new List { long.Parse(id) }; - user = api.Users.GetAsync(ids).Result[0]; - - var request = new VkParameters + switch (messConv.conversation.Peer.Type.ToString()) { - {"user_ids", string.Join(",", ids)}, - {"fields", string.Join(",", "photo_max_orig", "status")} - }; - - var response = api.Call("users.get", request); - user = User.FromJson(response[0]); - + case "chat": + return messConv.conversation.ChatSettings.Title; + + + break; + case "user": + return messConv.user.FirstName +" "+messConv.user.LastName; + break; + case "group": + return messConv.group.Name; + break; + case "email": + + break; + default: + break; + } - return user.FirstName + " " + user.LastName; } catch (Exception ex) { @@ -59,15 +70,27 @@ public override List getPhotosList() public override Uri getPhoto() { - if (user != null) + switch (messConv.conversation.Peer.Type.ToString()) { - return - user.PhotoMaxOrig; + case "chat": + return messConv.conversation.ChatSettings.Photo.JustGetPhoto; + + break; + case "user": + return messConv.user.JustGetPhoto; + break; + case "group": + return messConv.group.JustGetPhoto; + break; + case "email": + + break; + default: + break; } - else - return null; + return null; } - + string nextFrom = null; public override void GetTracks() { if (getLoadedTracks) return; @@ -75,27 +98,25 @@ public override void GetTracks() Task.Run(async () => { - int offset = listAudio.Count; - int count = 250; + + int count = 200; - if (countTracks > listAudio.Count) - { + VkCollection