Bunch of calendar implementation thing.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user