Bunch of calendar implementation thing.

This commit is contained in:
Burak Kaan Köse
2026-02-15 11:27:30 +01:00
parent acf0f649e8
commit 42e51571a8
14 changed files with 804 additions and 128 deletions
@@ -131,7 +131,7 @@ public static class GoogleIntegratorExtensions
}).ToList();
}
public static AccountCalendar AsCalendar(this CalendarListEntry calendarListEntry, Guid accountId)
public static AccountCalendar AsCalendar(this CalendarListEntry calendarListEntry, Guid accountId, string fallbackBackgroundColor = null)
{
var calendar = new AccountCalendar()
{
@@ -147,7 +147,9 @@ public static class GoogleIntegratorExtensions
// Bg color must present. Generate one if doesnt exists.
// Text color is optional. It'll be overriden by UI for readibility.
calendar.BackgroundColorHex = string.IsNullOrEmpty(calendarListEntry.BackgroundColor) ? ColorHelpers.GenerateFlatColorHex() : calendarListEntry.BackgroundColor;
calendar.BackgroundColorHex = string.IsNullOrEmpty(calendarListEntry.BackgroundColor)
? fallbackBackgroundColor ?? ColorHelpers.GenerateFlatColorHex()
: calendarListEntry.BackgroundColor;
calendar.TextColorHex = string.IsNullOrEmpty(calendarListEntry.ForegroundColor) ? "#000000" : calendarListEntry.ForegroundColor;
return calendar;
@@ -174,7 +174,7 @@ public static class OutlookIntegratorExtensions
return message;
}
public static AccountCalendar AsCalendar(this Calendar outlookCalendar, MailAccount assignedAccount)
public static AccountCalendar AsCalendar(this Calendar outlookCalendar, MailAccount assignedAccount, string fallbackBackgroundColor = null)
{
var calendar = new AccountCalendar()
{
@@ -191,7 +191,9 @@ public static class OutlookIntegratorExtensions
// Bg must be present. Generate flat one if doesn't exists.
// Text doesnt exists for Outlook.
calendar.BackgroundColorHex = string.IsNullOrEmpty(outlookCalendar.HexColor) ? ColorHelpers.GenerateFlatColorHex() : outlookCalendar.HexColor;
calendar.BackgroundColorHex = string.IsNullOrEmpty(outlookCalendar.HexColor)
? fallbackBackgroundColor ?? ColorHelpers.GenerateFlatColorHex()
: outlookCalendar.HexColor;
calendar.TextColorHex = "#000000";
return calendar;