Add snooze support for calendar reminders (toast UI, service, DB) (#825)
* Filter reminder snooze options by default reminder * Some updates. * Fixing empty welcome page issue and attendee loading. * Icon system for notifications and snooze options etc.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Wino.Core.Domain;
|
||||
|
||||
public static class CalendarReminderSnoozeOptions
|
||||
{
|
||||
private static readonly int[] SupportedSnoozeMinutes = [5, 10, 15, 30];
|
||||
|
||||
public static IReadOnlyList<int> GetSupportedSnoozeMinutes()
|
||||
=> SupportedSnoozeMinutes;
|
||||
|
||||
public static IReadOnlyList<int> GetAllowedSnoozeMinutes(long reminderDurationInSeconds, long defaultReminderDurationInSeconds)
|
||||
{
|
||||
var reminderMinutes = (int)Math.Max(0, reminderDurationInSeconds / 60);
|
||||
|
||||
if (reminderMinutes <= 0)
|
||||
return [];
|
||||
|
||||
var maxSnoozeMinutes = reminderMinutes;
|
||||
var defaultReminderMinutes = (int)Math.Max(0, defaultReminderDurationInSeconds / 60);
|
||||
|
||||
if (defaultReminderMinutes > 0)
|
||||
maxSnoozeMinutes = Math.Min(maxSnoozeMinutes, defaultReminderMinutes);
|
||||
|
||||
return SupportedSnoozeMinutes.Where(minutes => minutes <= maxSnoozeMinutes).ToArray();
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,8 @@ 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 ToastCalendarSnoozeAction = nameof(ToastCalendarSnoozeAction);
|
||||
public const string ToastCalendarSnoozeDurationInputId = nameof(ToastCalendarSnoozeDurationInputId);
|
||||
public const string ToastModeKey = nameof(ToastModeKey);
|
||||
public const string ToastModeMail = nameof(ToastModeMail);
|
||||
public const string ToastModeCalendar = nameof(ToastModeCalendar);
|
||||
|
||||
@@ -138,6 +138,7 @@ public class CalendarItem : ICalendarItem
|
||||
// TODO
|
||||
public string CustomEventColorHex { get; set; }
|
||||
public string HtmlLink { get; set; }
|
||||
public DateTime? SnoozedUntil { get; set; }
|
||||
public CalendarItemStatus Status { get; set; }
|
||||
public CalendarItemVisibility Visibility { get; set; }
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ public interface ICalendarService
|
||||
Task UpdateCalendarItemAsync(CalendarItem calendarItem, List<CalendarEventAttendee> attendees);
|
||||
Task<List<Reminder>> GetRemindersAsync(Guid calendarItemId);
|
||||
Task SaveRemindersAsync(Guid calendarItemId, List<Reminder> reminders);
|
||||
Task SnoozeCalendarItemAsync(Guid calendarItemId, DateTime snoozedUntilLocal);
|
||||
|
||||
/// <summary>
|
||||
/// Checks due reminder windows and returns reminder notifications that should trigger now.
|
||||
|
||||
@@ -222,6 +222,11 @@ public interface IPreferencesService : INotifyPropertyChanged
|
||||
/// </summary>
|
||||
long DefaultReminderDurationInSeconds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Setting: Default snooze duration in minutes for calendar reminder notifications.
|
||||
/// </summary>
|
||||
int DefaultSnoozeDurationInMinutes { get; set; }
|
||||
|
||||
CalendarSettings GetCurrentCalendarSettings();
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -133,6 +133,14 @@
|
||||
"CalendarEventDetails_People": "People",
|
||||
"CalendarEventDetails_ReadOnlyEvent": "Read-only event",
|
||||
"CalendarEventDetails_Reminder": "Reminder",
|
||||
"CalendarReminder_StartedHoursAgo": "Started {0} hours ago",
|
||||
"CalendarReminder_StartedMinutesAgo": "Started {0} minutes ago",
|
||||
"CalendarReminder_StartedNow": "Started just now",
|
||||
"CalendarReminder_StartingNow": "Starting now",
|
||||
"CalendarReminder_StartsInHours": "Starts in {0} hours",
|
||||
"CalendarReminder_StartsInMinutes": "Starts in {0} minutes",
|
||||
"CalendarReminder_SnoozeAction": "Snooze",
|
||||
"CalendarReminder_SnoozeMinutesOption": "{0} minutes",
|
||||
"CalendarEventDetails_ShowAs": "Show as",
|
||||
"CalendarShowAs_Free": "Free",
|
||||
"CalendarShowAs_Tentative": "Tentative",
|
||||
@@ -646,6 +654,8 @@
|
||||
"SettingsAvailableThemes_Title": "Available Themes",
|
||||
"SettingsCalendarSettings_Description": "Change first day of week, hour cell height and more...",
|
||||
"SettingsCalendarSettings_Title": "Calendar Settings",
|
||||
"CalendarSettings_DefaultSnoozeDuration_Header": "Default snooze duration",
|
||||
"CalendarSettings_DefaultSnoozeDuration_Description": "Set a default snooze duration for calendar reminder notifications.",
|
||||
"SettingsComposer_Title": "Composer",
|
||||
"SettingsComposerFont_Title": "Default Composer Font",
|
||||
"SettingsComposerFontFamily_Description": "Change the default font family and font size for composing mails.",
|
||||
|
||||
Reference in New Issue
Block a user