diff --git a/Libraries/DSharpPlus b/Libraries/DSharpPlus index 01930ec3..8e079380 160000 --- a/Libraries/DSharpPlus +++ b/Libraries/DSharpPlus @@ -1 +1 @@ -Subproject commit 01930ec35e0465437c168f74ff1c3ede0f0e4561 +Subproject commit 8e0793805f85f826ed0014022f2e4f6b720ba89a diff --git a/Unicord.Universal.Background.Tasks/PeriodicNotificationsTask.cs b/Unicord.Universal.Background.Tasks/PeriodicNotificationsTask.cs index dae67704..21051923 100644 --- a/Unicord.Universal.Background.Tasks/PeriodicNotificationsTask.cs +++ b/Unicord.Universal.Background.Tasks/PeriodicNotificationsTask.cs @@ -25,6 +25,8 @@ public async void Run(IBackgroundTaskInstance taskInstance) var toastNotifier = ToastNotificationManager.CreateToastNotifier(); var restClient = new DiscordRestClient(new DiscordConfiguration() { Token = token, TokenType = TokenType.User }); + await restClient.InitializeAsync(); + var mentions = await restClient.GetUserMentionsAsync(25, true, true); foreach (var mention in mentions) diff --git a/Unicord.Universal.Package/Package.appxmanifest b/Unicord.Universal.Package/Package.appxmanifest index d0487591..aceabcaa 100644 --- a/Unicord.Universal.Package/Package.appxmanifest +++ b/Unicord.Universal.Package/Package.appxmanifest @@ -9,7 +9,7 @@ xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" IgnorableNamespaces="uap mp uap2 uap3 uap4 uap5 rescap"> - + ms-resource:AppDisplayName diff --git a/Unicord.Universal.Package/Unicord.Universal.Package.wapproj b/Unicord.Universal.Package/Unicord.Universal.Package.wapproj index fb985026..7b750e74 100644 --- a/Unicord.Universal.Package/Unicord.Universal.Package.wapproj +++ b/Unicord.Universal.Package/Unicord.Universal.Package.wapproj @@ -58,7 +58,6 @@ ..\Unicord.Universal\Unicord.Universal.csproj false false - 2C5F1F6080F0648BF786147323B846D8D0BA1638 False SHA256 False @@ -69,6 +68,7 @@ https://wamwoowam.co.uk/unicord/download true + 2C5F1F6080F0648BF786147323B846D8D0BA1638 diff --git a/Unicord.Universal.Shared/Constants.cs b/Unicord.Universal.Shared/Constants.cs index 04b248cf..92ecf92a 100644 --- a/Unicord.Universal.Shared/Constants.cs +++ b/Unicord.Universal.Shared/Constants.cs @@ -46,7 +46,7 @@ internal static partial class Constants public const string GIF_AUTOPLAY = "AutoPlayGifs"; public const string SAVE_CAPTURED_PHOTOS = "SavedPhotos"; - public const string TIMESTAMP_STYLE = "TimestampStyle1"; + public const string TIMESTAMP_STYLE = "TimestampStyle_1"; public const string BACKGROUND_NOTIFICATIONS = "BackgroundNotifications"; diff --git a/Unicord.Universal.Shared/MutedExtensions.cs b/Unicord.Universal.Shared/MutedExtensions.cs index 84995363..a161d258 100644 --- a/Unicord.Universal.Shared/MutedExtensions.cs +++ b/Unicord.Universal.Shared/MutedExtensions.cs @@ -52,7 +52,9 @@ public static bool IsMuted(this DiscordGuild guild) public static bool IsUnread(this DiscordChannel channel) { - var discord = (DiscordClient)channel.Discord; + if (!(channel.Discord is DiscordClient discord)) + return false; + var readState = channel.ReadState; // this shit should never happen but apparently it does sometimes, don't question it diff --git a/Unicord.Universal.Shared/NotificationUtils.cs b/Unicord.Universal.Shared/NotificationUtils.cs index dd01a23f..ca7c69e1 100644 --- a/Unicord.Universal.Shared/NotificationUtils.cs +++ b/Unicord.Universal.Shared/NotificationUtils.cs @@ -25,7 +25,7 @@ public static bool WillShowToast(BaseDiscordClient client, DiscordMessage messag if (client is DiscordClient discord && discord.UserSettings?.Status == "dnd") return false; - if (message.Channel.IsMuted() || (message.Channel.Guild != null && message.Channel.Guild.IsMuted()) || !message.Channel.IsUnread()) + if (message.Channel.IsMuted() || (message.Channel.Guild != null && message.Channel.Guild.IsMuted())) return false; bool willNotify = false; @@ -136,7 +136,7 @@ public static string GetChannelHeaderName(DiscordChannel channel) { if (dmChannel.Type == ChannelType.Private) { - if (dmChannel.Recipients.Count == 0) + if (dmChannel.Recipients == null || dmChannel.Recipients.Count == 0) return "Invalid DM channel"; return $"@{dmChannel.Recipients[0].DisplayName}"; diff --git a/Unicord.Universal/Controls/Channels/ChannelPageHeaderControl.xaml b/Unicord.Universal/Controls/Channels/ChannelPageHeaderControl.xaml index 6c1af40f..7caa29b9 100644 --- a/Unicord.Universal/Controls/Channels/ChannelPageHeaderControl.xaml +++ b/Unicord.Universal/Controls/Channels/ChannelPageHeaderControl.xaml @@ -61,50 +61,50 @@ + x:Load="{x:Bind ViewModel.IsDM}" + Source="{Binding ChannelIconUrl}" + Grid.Column="1" + Width="24" + Height="24" + Margin="12,0,0,0" + VerticalAlignment="Center"/> + x:Load="{x:Bind ViewModel.IsNotDM}" + Grid.Column="1" + Foreground="{ThemeResource SystemControlForegroundBaseMediumBrush}" + Text="{x:Bind ViewModel.Channel, Converter={StaticResource ChannelSymbolConverter}}" + FontFamily="{StaticResource FluentSystemIcons}" + VerticalAlignment="Center" + Margin="16,0,8,0" + FontSize="20"/> + Grid.Column="2" + Margin="8,0,8,0" + VerticalAlignment="Center" + FontSize="15" + FontWeight="Bold" + Foreground="{ThemeResource SystemControlForegroundBaseHighBrush}" + TextTrimming="Clip" + TextWrapping="NoWrap" + Text="{x:Bind ViewModel.DisplayName}"/> + x:Load="{x:Bind ViewModel.IsDM}" + Grid.Column="3" + Width="10" + Height="10" + Margin="-4,0,8,0" + Presence="{x:Bind ViewModel.Recipient.Presence}"/> + Grid.Column="4" + HorizontalAlignment="Stretch" + VerticalAlignment="Center" + Channel="{x:Bind ViewModel.Channel}" + Text="{x:Bind ViewModel.Topic}" + TextWrapping="NoWrap" /> diff --git a/Unicord.Universal/Controls/Channels/ChannelPageHeaderControl.xaml.cs b/Unicord.Universal/Controls/Channels/ChannelPageHeaderControl.xaml.cs index bf88138c..dd17ceed 100644 --- a/Unicord.Universal/Controls/Channels/ChannelPageHeaderControl.xaml.cs +++ b/Unicord.Universal/Controls/Channels/ChannelPageHeaderControl.xaml.cs @@ -40,8 +40,8 @@ public ChannelPageHeaderControl() private void OnLoaded(object sender, RoutedEventArgs e) { var windowHandle = WindowingService.Current.GetHandle(this); - if (AnalyticsInfo.VersionInfo.DeviceFamily == "Windows.Phone") - WindowingService.Current.HandleTitleBarForControl(TopGrid); + //if (SystemPlatform.Mobile) + // WindowingService.Current.HandleTitleBarForControl(TopGrid); if (!WindowingService.Current.IsMainWindow(windowHandle)) { diff --git a/Unicord.Universal/Controls/Flyouts/MessageContextFlyout.xaml b/Unicord.Universal/Controls/Flyouts/MessageContextFlyout.xaml index 020bb577..49f6ccde 100644 --- a/Unicord.Universal/Controls/Flyouts/MessageContextFlyout.xaml +++ b/Unicord.Universal/Controls/Flyouts/MessageContextFlyout.xaml @@ -69,7 +69,7 @@ diff --git a/Unicord.Universal/Controls/Flyouts/MessageContextFlyout.xaml.cs b/Unicord.Universal/Controls/Flyouts/MessageContextFlyout.xaml.cs index feebc6fb..1817846d 100644 --- a/Unicord.Universal/Controls/Flyouts/MessageContextFlyout.xaml.cs +++ b/Unicord.Universal/Controls/Flyouts/MessageContextFlyout.xaml.cs @@ -20,28 +20,12 @@ namespace Unicord.Universal.Controls.Flyouts { public sealed partial class MessageContextFlyout : MUXC.CommandBarFlyout { - public MessageControl Parent - { - get => (MessageControl)GetValue(ParentProperty); - set => SetValue(ParentProperty, value); - } - - public static readonly DependencyProperty ParentProperty = - DependencyProperty.Register("Parent", typeof(MessageControl), typeof(MessageContextFlyout), new PropertyMetadata(null)); - public MessageContextFlyout() { this.InitializeComponent(); } // todo: is there a less shit way of doing this? - private void EditFlyoutItem_Click(object sender, RoutedEventArgs e) - { - this.Hide(); - this.Target.FindParent().BeginEdit(); - } - - // ditto private void AddReactionButton_Click(object sender, RoutedEventArgs e) { this.Hide(); diff --git a/Unicord.Universal/Controls/Messages/AttachmentMediaControl.cs b/Unicord.Universal/Controls/Messages/AttachmentMediaControl.cs index 43eebbf1..db5ae762 100644 --- a/Unicord.Universal/Controls/Messages/AttachmentMediaControl.cs +++ b/Unicord.Universal/Controls/Messages/AttachmentMediaControl.cs @@ -86,19 +86,9 @@ private void OnAttachmentChanged(DependencyPropertyChangedEventArgs e) //} } - private async void OnFullWindowRequested(object sender, EventArgs e) + private void OnFullWindowRequested(object sender, EventArgs e) { - var service = FullscreenService.GetForCurrentView(); - if (_mediaPlayerElement.IsFullWindow) - { - _mediaPlayerElement.IsFullWindow = false; - await service.LeaveFullscreenAsync(_mediaPlayerElement, _mediaPlayerBorder); - } - else - { - await service.EnterFullscreenAsync(_mediaPlayerElement, _mediaPlayerBorder); - _mediaPlayerElement.IsFullWindow = true; - } + _mediaPlayerElement.IsFullWindow = !_mediaPlayerElement.IsFullWindow; } } } diff --git a/Unicord.Universal/Controls/Messages/Embeds/EmbedControl.xaml b/Unicord.Universal/Controls/Messages/Embeds/EmbedControl.xaml index bbc40005..a3a33266 100644 --- a/Unicord.Universal/Controls/Messages/Embeds/EmbedControl.xaml +++ b/Unicord.Universal/Controls/Messages/Embeds/EmbedControl.xaml @@ -9,164 +9,8 @@ xmlns:messages="using:Unicord.Universal.Models.Messages" xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls" mc:Ignorable="d" - MaxWidth="480" - Margin="0,4,0,0" d:DesignHeight="300" d:DesignWidth="400"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/Unicord.Universal/Controls/Messages/Embeds/EmbedFieldsView.cs b/Unicord.Universal/Controls/Messages/Embeds/EmbedFieldsView.cs index b972710b..b3aa56fa 100644 --- a/Unicord.Universal/Controls/Messages/Embeds/EmbedFieldsView.cs +++ b/Unicord.Universal/Controls/Messages/Embeds/EmbedFieldsView.cs @@ -11,10 +11,10 @@ public sealed class EmbedFieldsView : ItemsControl { protected override void PrepareContainerForItemOverride(DependencyObject element, object item) { + base.PrepareContainerForItemOverride(element, item); + if (item is EmbedFieldViewModel field) Grid.SetColumnSpan((FrameworkElement)element, field.ColumnSpan); - - base.PrepareContainerForItemOverride(element, item); } } } diff --git a/Unicord.Universal/Controls/Messages/Embeds/ImageEmbedControl.xaml b/Unicord.Universal/Controls/Messages/Embeds/ImageEmbedControl.xaml index c56a67f1..28fcb083 100644 --- a/Unicord.Universal/Controls/Messages/Embeds/ImageEmbedControl.xaml +++ b/Unicord.Universal/Controls/Messages/Embeds/ImageEmbedControl.xaml @@ -11,10 +11,10 @@ d:DesignHeight="300" d:DesignWidth="400"> - + - + diff --git a/Unicord.Universal/Controls/Messages/MessageControl.cs b/Unicord.Universal/Controls/Messages/MessageControl.cs index 5da1b989..3430533a 100644 --- a/Unicord.Universal/Controls/Messages/MessageControl.cs +++ b/Unicord.Universal/Controls/Messages/MessageControl.cs @@ -4,10 +4,6 @@ using System.Runtime.InteropServices.WindowsRuntime; using System.ServiceModel.Channels; using System.Threading.Tasks; -using DSharpPlus; -using DSharpPlus.Entities; -using DSharpPlus.EventArgs; -using Microsoft.Toolkit.Uwp.Helpers; using Unicord.Universal.Models.Messages; using Unicord.Universal.Pages; using Windows.System; @@ -26,7 +22,6 @@ namespace Unicord.Universal.Controls.Messages { public class MessageControl : Control { - private bool _addedEditHandlers; private ImageBrush _imageBrush; #region Dependency Properties @@ -62,17 +57,15 @@ protected override void OnApplyTemplate() protected virtual void OnMessageChanged(DependencyPropertyChangedEventArgs e) { + this.ApplyTemplate(); + if (e.NewValue is MessageViewModel message) { - this.DataContext = message; this.UpdateProfileImage(message); - this.UpdateCollapsedState(); } else { - this.DataContext = null; this.ClearProfileImage(); - // reset } } @@ -105,134 +98,5 @@ private void UpdateProfileImage(MessageViewModel message) DecodePixelType = DecodePixelType.Physical }; } - - // TODO: Could prolly move this somewhere better - // bro what was i thinking :skull: - private void UpdateCollapsedState() - { - if (MessageViewModel == null || !IsEnabled) - return; - - VisualStateManager.GoToState(this, "NotEditing", false); - VisualStateManager.GoToState(this, "NoMention", false); - - if (MessageViewModel.Parent == null) - { - VisualStateManager.GoToState(this, "None", false); - return; - } - - if (MessageViewModel.Parent.IsEditMode) - { - VisualStateManager.GoToState(this, "EditMode", false); - return; - } - - if (MessageViewModel.IsMention) - { - VisualStateManager.GoToState(this, "Mention", false); - } - - if (MessageViewModel.IsCollapsed) - { - VisualStateManager.GoToState(this, "Collapsed", false); - } - else - { - VisualStateManager.GoToState(this, "Normal", false); - } - } - - public virtual void BeginEdit() - { - VisualStateManager.GoToState(this, "Editing", true); - - var control = GetTemplateChild("MessageEditTools") as MessageEditTools; - control.ApplyTemplate(); - - var editBox = control.FindChild("MessageEditBox"); - - if (!_addedEditHandlers) - { - var editFinishButton = control.FindChild - @@ -444,12 +444,12 @@ + CornerRadius="{ThemeResource AudioMediaTransportControls_ControlPanel_CornerRadius}" + BorderThickness="{ThemeResource AudioMediaTransportControls_ControlPanel_BorderThickness}" + BorderBrush="{ThemeResource AudioMediaTransportControls_ControlPanel_BorderBrush}" + Background="{ThemeResource AudioMediaTransportControls_ControlPanel_Background}"> - + @@ -485,9 +485,7 @@ - - @@ -528,7 +526,6 @@ - diff --git a/Unicord.Universal/Themes/Styles/Fluent.xaml b/Unicord.Universal/Themes/Styles/Fluent.xaml index 7d04d264..966b629c 100644 --- a/Unicord.Universal/Themes/Styles/Fluent.xaml +++ b/Unicord.Universal/Themes/Styles/Fluent.xaml @@ -186,6 +186,30 @@ 0 + + + + 0 + 0 + 0 + + 12,8,8,8 + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + 0 diff --git a/Unicord.Universal/Themes/Styles/Performance.xaml b/Unicord.Universal/Themes/Styles/Performance.xaml index b279e88e..e7ca60e8 100644 --- a/Unicord.Universal/Themes/Styles/Performance.xaml +++ b/Unicord.Universal/Themes/Styles/Performance.xaml @@ -193,6 +193,30 @@ 0 + + + + 0 + 0 + 0 + + 12,8,8,8 + + + + 0 + 0 + + + + 0 + 0 + + + + 0 + 0 + 0 diff --git a/Unicord.Universal/Themes/Styles/SunValley.xaml b/Unicord.Universal/Themes/Styles/SunValley.xaml index 2771c5a7..9794f77f 100644 --- a/Unicord.Universal/Themes/Styles/SunValley.xaml +++ b/Unicord.Universal/Themes/Styles/SunValley.xaml @@ -112,6 +112,30 @@ + + + 1 + 4 + 3 + + 16,12,12,12 + + + + 1 + 2 + + + + 1 + 4 + + + + 1 + 4 + 4 + diff --git a/Unicord.Universal/Themes/Templates.xaml b/Unicord.Universal/Themes/Templates.xaml index 02d77478..cae37b0e 100644 --- a/Unicord.Universal/Themes/Templates.xaml +++ b/Unicord.Universal/Themes/Templates.xaml @@ -29,7 +29,7 @@ - +