Upcoming view, search/filters, lead reminders, birthdays, folder colors, ICS, sound, undo
- Upcoming: all folders grouped by overdue/today/tomorrow/7 days/later/done - Search (Ctrl+F) + All/Today/Overdue filters + hide done (persisted) - Lead reminder 1/2/3 days or 1 week before; birth year shows age - Several due reminders are combined into one balloon - Folder colors and reordering (drag, context menu) - iCalendar export with RRULE and VALARM - Generated reminder chime (ComfyUI / Stable Audio), can be turned off - Undo snackbar for deleted tasks/folders (Ctrl+Z), Ctrl+N, Del, Esc - 41 tests Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -36,7 +36,7 @@ namespace ReminderOrganizer.Models
|
||||
public DateTime ReminderDate
|
||||
{
|
||||
get => _reminderDate;
|
||||
set => SetProperty(ref _reminderDate, value);
|
||||
set { if (SetProperty(ref _reminderDate, value)) OnPropertyChanged(nameof(AgeText)); }
|
||||
}
|
||||
|
||||
public bool IsNotified
|
||||
@@ -48,15 +48,60 @@ namespace ReminderOrganizer.Models
|
||||
public bool IsRecurring
|
||||
{
|
||||
get => _isRecurring;
|
||||
set => SetProperty(ref _isRecurring, value);
|
||||
set { if (SetProperty(ref _isRecurring, value)) OnPropertyChanged(nameof(AgeText)); }
|
||||
}
|
||||
|
||||
public RecurrenceType RecurrenceType
|
||||
{
|
||||
get => _recurrenceType;
|
||||
set => SetProperty(ref _recurrenceType, value);
|
||||
set { if (SetProperty(ref _recurrenceType, value)) OnPropertyChanged(nameof(AgeText)); }
|
||||
}
|
||||
|
||||
private int _leadDays;
|
||||
/// <summary>Extra reminder this many days before the date (0 = none).</summary>
|
||||
public int LeadDays
|
||||
{
|
||||
get => _leadDays;
|
||||
set => SetProperty(ref _leadDays, Math.Max(0, value));
|
||||
}
|
||||
|
||||
private bool _isPreNotified;
|
||||
/// <summary>Lead reminder already shown for the current occurrence.</summary>
|
||||
public bool IsPreNotified
|
||||
{
|
||||
get => _isPreNotified;
|
||||
set => SetProperty(ref _isPreNotified, value);
|
||||
}
|
||||
|
||||
private int? _birthYear;
|
||||
/// <summary>Optional, for yearly birthdays: shows "turns 40".</summary>
|
||||
public int? BirthYear
|
||||
{
|
||||
get => _birthYear;
|
||||
set { if (SetProperty(ref _birthYear, value)) OnPropertyChanged(nameof(AgeText)); }
|
||||
}
|
||||
|
||||
/// <summary>Age reached on the next date (yearly tasks with birth year only).</summary>
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public int? UpcomingAge =>
|
||||
BirthYear is int y && IsRecurring && RecurrenceType == RecurrenceType.Yearly && ReminderDate.Year > y
|
||||
? ReminderDate.Year - y : null;
|
||||
|
||||
/// <summary>Set once by the app (localized "turns {0}").</summary>
|
||||
public static Func<int, string>? AgeFormatter { get; set; }
|
||||
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public string? AgeText => UpcomingAge is int a ? (AgeFormatter?.Invoke(a) ?? a.ToString()) : null;
|
||||
|
||||
private string _folderName = "";
|
||||
/// <summary>Runtime only: name of the folder holding this task (for the "Upcoming" view).</summary>
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public string FolderName { get => _folderName; set => SetProperty(ref _folderName, value); }
|
||||
|
||||
private string _folderColor = Folder.DefaultColor;
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public string FolderColor { get => _folderColor; set => SetProperty(ref _folderColor, value); }
|
||||
|
||||
public DateTime GetNextOccurrence() => GetNextOccurrence(DateTime.Now);
|
||||
|
||||
/// <summary>
|
||||
@@ -94,21 +139,31 @@ namespace ReminderOrganizer.Models
|
||||
|
||||
/// <summary>
|
||||
/// Marks every due task: one-off tasks become notified, recurring ones move to their next date.
|
||||
/// Returns the tasks that should be shown as a notification now.
|
||||
/// Also emits lead reminders (LeadDays before the date) once per occurrence.
|
||||
/// Returns what should be shown now; for lead reminders <see cref="DueReminder.Date"/> is the upcoming date.
|
||||
/// </summary>
|
||||
public static System.Collections.Generic.List<ReminderTask> ProcessDue(System.Collections.Generic.IEnumerable<Folder> folders, DateTime now)
|
||||
public static System.Collections.Generic.List<DueReminder> ProcessDue(System.Collections.Generic.IEnumerable<Folder> folders, DateTime now)
|
||||
{
|
||||
var due = new System.Collections.Generic.List<ReminderTask>();
|
||||
var due = new System.Collections.Generic.List<DueReminder>();
|
||||
foreach (var folder in folders)
|
||||
{
|
||||
foreach (var task in folder.Tasks)
|
||||
{
|
||||
if (task.IsNotified || task.ReminderDate > now) continue;
|
||||
due.Add(task);
|
||||
if (task.IsRecurring)
|
||||
task.ReminderDate = task.GetNextOccurrence(now);
|
||||
else
|
||||
task.IsNotified = true;
|
||||
if (task.IsNotified) continue;
|
||||
if (task.ReminderDate <= now)
|
||||
{
|
||||
due.Add(new DueReminder(task, task.ReminderDate, false, task.UpcomingAge));
|
||||
task.IsPreNotified = false;
|
||||
if (task.IsRecurring)
|
||||
task.ReminderDate = task.GetNextOccurrence(now);
|
||||
else
|
||||
task.IsNotified = true;
|
||||
}
|
||||
else if (task.LeadDays > 0 && !task.IsPreNotified && now >= task.ReminderDate.AddDays(-task.LeadDays))
|
||||
{
|
||||
due.Add(new DueReminder(task, task.ReminderDate, true, task.UpcomingAge));
|
||||
task.IsPreNotified = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return due;
|
||||
@@ -124,6 +179,9 @@ namespace ReminderOrganizer.Models
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>One notification to show. Age is the age reached on <paramref name="Date"/> (birthdays).</summary>
|
||||
public record DueReminder(ReminderTask Task, DateTime Date, bool IsLead, int? Age);
|
||||
|
||||
public enum RecurrenceType
|
||||
{
|
||||
Daily,
|
||||
@@ -156,6 +214,17 @@ namespace ReminderOrganizer.Models
|
||||
set => SetProperty(ref _tasks, value);
|
||||
}
|
||||
|
||||
public const string DefaultColor = "#6366F1";
|
||||
public static readonly string[] Palette =
|
||||
{ "#6366F1", "#3B82F6", "#14B8A6", "#22C55E", "#F59E0B", "#F97316", "#EF4444", "#EC4899", "#64748B" };
|
||||
|
||||
private string _color = DefaultColor;
|
||||
public string Color
|
||||
{
|
||||
get => _color;
|
||||
set => SetProperty(ref _color, string.IsNullOrWhiteSpace(value) ? DefaultColor : value);
|
||||
}
|
||||
|
||||
public Folder() { }
|
||||
|
||||
public Folder(string name)
|
||||
@@ -171,5 +240,7 @@ namespace ReminderOrganizer.Models
|
||||
public string Language { get; set; } = "";
|
||||
/// <summary>null = not chosen yet → Windows app theme.</summary>
|
||||
public bool? IsDarkMode { get; set; }
|
||||
public bool PlaySound { get; set; } = true;
|
||||
public bool HideDone { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user