Outlook calendar/event syncing basics without delta. Bunch of UI updates for the calendar view.

This commit is contained in:
Burak Kaan Köse
2025-01-06 02:15:21 +01:00
parent a7674d436d
commit 125c277c88
46 changed files with 1104 additions and 356 deletions

View File

@@ -43,6 +43,17 @@ namespace Wino.Core.Domain.Collections
return _allItems.FirstOrDefault(x => x.Id == calendarItemId);
}
public void ClearSelectionStates()
{
foreach (var item in _allItems)
{
if (item is ICalendarItemViewModel calendarItemViewModel)
{
calendarItemViewModel.IsSelected = false;
}
}
}
public void FilterByCalendars(IEnumerable<Guid> visibleCalendarIds)
{
foreach (var item in _allItems)
@@ -75,14 +86,7 @@ namespace Wino.Core.Domain.Collections
}
else if (calendarItem.IsMultiDayEvent)
{
if (Settings.GhostRenderAllDayItems)
{
return [_internalRegularEvents, _internalAllDayEvents];
}
else
{
return [_internalAllDayEvents];
}
return [_internalRegularEvents, _internalAllDayEvents];
}
else
{

View File

@@ -14,6 +14,10 @@ namespace Wino.Core.Domain.Entities.Calendar
public string Name { get; set; }
public bool IsPrimary { get; set; }
public bool IsExtended { get; set; } = true;
/// <summary>
/// Unused for now.
/// </summary>
public string TextColorHex { get; set; }
public string BackgroundColorHex { get; set; }
public string TimeZone { get; set; }

View File

@@ -1,4 +1,5 @@
using System;
using System.Diagnostics;
using Itenso.TimePeriod;
using SQLite;
using Wino.Core.Domain.Enums;
@@ -6,6 +7,7 @@ using Wino.Core.Domain.Interfaces;
namespace Wino.Core.Domain.Entities.Calendar
{
[DebuggerDisplay("{Title} ({StartDate} - {EndDate})")]
public class CalendarItem : ICalendarItem
{
[PrimaryKey]
@@ -52,6 +54,29 @@ namespace Wino.Core.Domain.Entities.Calendar
}
}
/// <summary>
/// Events that are either an exceptional instance of a recurring event or a recurring event itself.
/// </summary>
public bool IsRecurringEvent
{
get
{
return !string.IsNullOrEmpty(Recurrence) || RecurringCalendarItemId != null;
}
}
/// <summary>
/// Events that are belong to parent recurring event, but updated individually are considered single exceptional instances.
/// They will have different Id of their own.
/// </summary>
public bool IsSingleExceptionalInstance
{
get
{
return RecurringCalendarItemId != null;
}
}
/// <summary>
/// Events that are not all-day events and last more than one day are considered multi-day events.
/// </summary>
@@ -66,10 +91,13 @@ namespace Wino.Core.Domain.Entities.Calendar
public double DurationInSeconds { get; set; }
public string Recurrence { get; set; }
public string OrganizerDisplayName { get; set; }
public string OrganizerEmail { get; set; }
/// <summary>
/// The id of the parent calendar item of the recurring event.
/// Exceptional instances are stored as a separate calendar item.
/// This makes the calendar item a child of the recurring event.s
/// This makes the calendar item a child of the recurring event.
/// </summary>
public Guid? RecurringCalendarItemId { get; set; }
@@ -80,7 +108,7 @@ namespace Wino.Core.Domain.Entities.Calendar
/// <summary>
/// Hidden events must not be displayed to the user.
/// This usually happens when a child instance of recurring parent hapens.
/// This usually happens when a child instance of recurring parent is cancelled after creation.
/// </summary>
public bool IsHidden { get; set; }

View File

@@ -2,6 +2,7 @@
{
public enum CalendarItemStatus
{
NotResponded,
Confirmed,
Tentative,
Cancelled,

View File

@@ -12,7 +12,10 @@ namespace Wino.Core.Domain.Interfaces
DateTime EndDate { get; }
double DurationInSeconds { get; set; }
ITimePeriod Period { get; }
bool IsRecurringEvent { get; }
bool IsAllDayEvent { get; }
bool IsMultiDayEvent { get; }
bool IsSingleExceptionalInstance { get; }
}
}

View File

@@ -3,5 +3,8 @@
/// <summary>
/// Temporarily to enforce CalendarItemViewModel. Used in CalendarEventCollection.
/// </summary>
public interface ICalendarItemViewModel { }
public interface ICalendarItemViewModel
{
bool IsSelected { get; set; }
}
}

View File

@@ -187,7 +187,6 @@ namespace Wino.Core.Domain.Interfaces
DayOfWeek WorkingDayStart { get; set; }
DayOfWeek WorkingDayEnd { get; set; }
double HourHeight { get; set; }
bool GhostRenderAllDayEvents { get; set; }
CalendarSettings GetCurrentCalendarSettings();

View File

@@ -11,8 +11,7 @@ namespace Wino.Core.Domain.Models.Calendar
TimeSpan WorkingHourEnd,
double HourHeight,
DayHeaderDisplayType DayHeaderDisplayType,
CultureInfo CultureInfo,
bool GhostRenderAllDayItems)
CultureInfo CultureInfo)
{
public TimeSpan? GetTimeSpan(string selectedTime)
{

View File

@@ -13,6 +13,8 @@ namespace Wino.Core.Domain.Models.Calendar
{
public ITimePeriod Period { get; }
public List<CalendarDayModel> CalendarDays { get; } = [];
// TODO: Get rid of this at some point.
public List<DayHeaderRenderModel> DayHeaders { get; } = [];
public CalendarRenderOptions CalendarRenderOptions { get; }
@@ -46,12 +48,5 @@ namespace Wino.Core.Domain.Models.Calendar
DayHeaders.Add(new DayHeaderRenderModel(dayHeader, calendarRenderOptions.CalendarSettings.HourHeight));
}
}
//public void AddEvent(ICalendarItem calendarEventModel)
//{
// var calendarDayModel = CalendarDays.FirstOrDefault(x => x.Period.HasInside(calendarEventModel.Period.Start));
// calendarDayModel?.EventsCollection.AddCalendarItem(calendarEventModel);
//}
}
}

View File

@@ -132,6 +132,9 @@
"Dialog_DontAskAgain": "Don't ask again",
"CalendarAllDayEventSummary": "all-day events",
"CalendarItemAllDay": "all day",
"CalendarItem_DetailsPopup_JoinOnline": "Join online",
"CalendarItem_DetailsPopup_ViewEventButton": "View event",
"CalendarItem_DetailsPopup_ViewSeriesButton": "View series",
"CreateAccountAliasDialog_Title": "Create Account Alias",
"CreateAccountAliasDialog_Description": "Make sure your outgoing server allows sending mails from this alias.",
"CreateAccountAliasDialog_AliasAddress": "Address",
@@ -635,3 +638,4 @@
"QuickEventDialog_EventName": "Event name",
"QuickEventDialog_IsAllDay": "All day"
}