From 3977401057fe2da00213f5ef15091dc1f8956160 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20Kaan=20K=C3=B6se?= Date: Sun, 12 Apr 2026 19:42:50 +0200 Subject: [PATCH] join online notification resolver fix. --- Wino.Core.Domain/Constants.cs | 1 + Wino.Mail.WinUI/App.xaml.cs | 21 +++++++++++++++++++ .../Services/NotificationBuilder.cs | 6 ++++-- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/Wino.Core.Domain/Constants.cs b/Wino.Core.Domain/Constants.cs index d6614c84..e57f7696 100644 --- a/Wino.Core.Domain/Constants.cs +++ b/Wino.Core.Domain/Constants.cs @@ -18,6 +18,7 @@ public static class Constants public const string ToastCalendarItemIdKey = nameof(ToastCalendarItemIdKey); public const string ToastCalendarActionKey = nameof(ToastCalendarActionKey); public const string ToastCalendarNavigateAction = nameof(ToastCalendarNavigateAction); + public const string ToastCalendarJoinOnlineAction = nameof(ToastCalendarJoinOnlineAction); public const string ToastCalendarSnoozeAction = nameof(ToastCalendarSnoozeAction); public const string ToastCalendarSnoozeDurationInputId = nameof(ToastCalendarSnoozeDurationInputId); public const string ToastModeKey = nameof(ToastModeKey); diff --git a/Wino.Mail.WinUI/App.xaml.cs b/Wino.Mail.WinUI/App.xaml.cs index 92fb2664..30bee35d 100644 --- a/Wino.Mail.WinUI/App.xaml.cs +++ b/Wino.Mail.WinUI/App.xaml.cs @@ -593,6 +593,12 @@ public partial class App : WinoApplication, await HandleCalendarToastSnoozeAsync(userInput, calendarItemId); return; } + + if (calendarAction == Constants.ToastCalendarJoinOnlineAction) + { + await HandleCalendarToastJoinOnlineAsync(calendarItemId); + return; + } } // Check if this is a navigation toast (user clicked the notification). @@ -711,6 +717,21 @@ public partial class App : WinoApplication, await calendarService.SnoozeCalendarItemAsync(calendarItemId, snoozedUntilLocal); } + private async Task HandleCalendarToastJoinOnlineAsync(Guid calendarItemId) + { + var calendarService = Services.GetRequiredService(); + var nativeAppService = Services.GetRequiredService(); + + var calendarItem = await calendarService.GetCalendarItemAsync(calendarItemId); + if (calendarItem == null || + !Uri.TryCreate(calendarItem.HtmlLink, UriKind.Absolute, out var joinUri)) + { + return; + } + + await nativeAppService.LaunchUriAsync(joinUri); + } + private bool TryGetSnoozeDurationMinutes(IDictionary? userInput, out int snoozeDurationMinutes) { snoozeDurationMinutes = _preferencesService?.DefaultSnoozeDurationInMinutes ?? 0; diff --git a/Wino.Mail.WinUI/Services/NotificationBuilder.cs b/Wino.Mail.WinUI/Services/NotificationBuilder.cs index 78adf337..3a134f50 100644 --- a/Wino.Mail.WinUI/Services/NotificationBuilder.cs +++ b/Wino.Mail.WinUI/Services/NotificationBuilder.cs @@ -246,11 +246,13 @@ public class NotificationBuilder : INotificationBuilder .AddArgument(Constants.ToastCalendarItemIdKey, calendarItem.Id.ToString()) .AddArgument(Constants.ToastModeKey, Constants.ToastModeCalendar)); - if (Uri.TryCreate(calendarItem.HtmlLink, UriKind.Absolute, out var joinUri)) + if (Uri.TryCreate(calendarItem.HtmlLink, UriKind.Absolute, out _)) { builder.AddButton(new AppNotificationButton(Translator.CalendarEventDetails_JoinOnline) .SetIcon(GetNotificationIconUri("calendar-join")) - .SetInvokeUri(joinUri)); + .AddArgument(Constants.ToastCalendarActionKey, Constants.ToastCalendarJoinOnlineAction) + .AddArgument(Constants.ToastCalendarItemIdKey, calendarItem.Id.ToString()) + .AddArgument(Constants.ToastModeKey, Constants.ToastModeCalendar)); } var tag = $"calendar-reminder-{calendarItem.Id:N}-{reminderDurationInSeconds}";