join online notification resolver fix.

This commit is contained in:
Burak Kaan Köse
2026-04-12 19:42:50 +02:00
parent 10c797fba4
commit 3977401057
3 changed files with 26 additions and 2 deletions
+1
View File
@@ -18,6 +18,7 @@ public static class Constants
public const string ToastCalendarItemIdKey = nameof(ToastCalendarItemIdKey); public const string ToastCalendarItemIdKey = nameof(ToastCalendarItemIdKey);
public const string ToastCalendarActionKey = nameof(ToastCalendarActionKey); public const string ToastCalendarActionKey = nameof(ToastCalendarActionKey);
public const string ToastCalendarNavigateAction = nameof(ToastCalendarNavigateAction); public const string ToastCalendarNavigateAction = nameof(ToastCalendarNavigateAction);
public const string ToastCalendarJoinOnlineAction = nameof(ToastCalendarJoinOnlineAction);
public const string ToastCalendarSnoozeAction = nameof(ToastCalendarSnoozeAction); public const string ToastCalendarSnoozeAction = nameof(ToastCalendarSnoozeAction);
public const string ToastCalendarSnoozeDurationInputId = nameof(ToastCalendarSnoozeDurationInputId); public const string ToastCalendarSnoozeDurationInputId = nameof(ToastCalendarSnoozeDurationInputId);
public const string ToastModeKey = nameof(ToastModeKey); public const string ToastModeKey = nameof(ToastModeKey);
+21
View File
@@ -593,6 +593,12 @@ public partial class App : WinoApplication,
await HandleCalendarToastSnoozeAsync(userInput, calendarItemId); await HandleCalendarToastSnoozeAsync(userInput, calendarItemId);
return; return;
} }
if (calendarAction == Constants.ToastCalendarJoinOnlineAction)
{
await HandleCalendarToastJoinOnlineAsync(calendarItemId);
return;
}
} }
// Check if this is a navigation toast (user clicked the notification). // 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); await calendarService.SnoozeCalendarItemAsync(calendarItemId, snoozedUntilLocal);
} }
private async Task HandleCalendarToastJoinOnlineAsync(Guid calendarItemId)
{
var calendarService = Services.GetRequiredService<ICalendarService>();
var nativeAppService = Services.GetRequiredService<INativeAppService>();
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<string, string>? userInput, out int snoozeDurationMinutes) private bool TryGetSnoozeDurationMinutes(IDictionary<string, string>? userInput, out int snoozeDurationMinutes)
{ {
snoozeDurationMinutes = _preferencesService?.DefaultSnoozeDurationInMinutes ?? 0; snoozeDurationMinutes = _preferencesService?.DefaultSnoozeDurationInMinutes ?? 0;
@@ -246,11 +246,13 @@ public class NotificationBuilder : INotificationBuilder
.AddArgument(Constants.ToastCalendarItemIdKey, calendarItem.Id.ToString()) .AddArgument(Constants.ToastCalendarItemIdKey, calendarItem.Id.ToString())
.AddArgument(Constants.ToastModeKey, Constants.ToastModeCalendar)); .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) builder.AddButton(new AppNotificationButton(Translator.CalendarEventDetails_JoinOnline)
.SetIcon(GetNotificationIconUri("calendar-join")) .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}"; var tag = $"calendar-reminder-{calendarItem.Id:N}-{reminderDurationInSeconds}";