join online notification resolver fix.
This commit is contained in:
@@ -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);
|
||||||
|
|||||||
@@ -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}";
|
||||||
|
|||||||
Reference in New Issue
Block a user