Compare commits
1 Commits
main
...
feature/Da
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aba7539e7d |
@@ -142,5 +142,7 @@ public partial class AccountManagementViewModel : AccountManagementPageViewModel
|
|||||||
};
|
};
|
||||||
|
|
||||||
var synchronizationResponse = await WinoServerConnectionManager.GetResponseAsync<CalendarSynchronizationResult, NewCalendarSynchronizationRequested>(new NewCalendarSynchronizationRequested(synchronizationOptions, SynchronizationSource.Client));
|
var synchronizationResponse = await WinoServerConnectionManager.GetResponseAsync<CalendarSynchronizationResult, NewCalendarSynchronizationRequested>(new NewCalendarSynchronizationRequested(synchronizationOptions, SynchronizationSource.Client));
|
||||||
|
accountCreationDialog.Complete(cancel: false);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -237,20 +237,20 @@ public partial class CalendarPageViewModel : CalendarBaseViewModel,
|
|||||||
{
|
{
|
||||||
var durationSeconds = (QuickEventEndTime - QuickEventStartTime).TotalSeconds;
|
var durationSeconds = (QuickEventEndTime - QuickEventStartTime).TotalSeconds;
|
||||||
|
|
||||||
var testCalendarItem = new CalendarItem
|
//var testCalendarItem = new CalendarItem
|
||||||
{
|
//{
|
||||||
CalendarId = SelectedQuickEventAccountCalendar.Id,
|
// CalendarId = SelectedQuickEventAccountCalendar.Id,
|
||||||
StartDate = QuickEventStartTime,
|
// StartDate = QuickEventStartTime,
|
||||||
DurationInSeconds = durationSeconds,
|
// DurationInSeconds = durationSeconds,
|
||||||
CreatedAt = DateTime.UtcNow,
|
// CreatedAt = DateTime.UtcNow,
|
||||||
Description = string.Empty,
|
// Description = string.Empty,
|
||||||
Location = Location,
|
// Location = Location,
|
||||||
Title = EventName,
|
// Title = EventName,
|
||||||
Id = Guid.NewGuid()
|
// Id = Guid.NewGuid()
|
||||||
};
|
//};
|
||||||
|
|
||||||
IsQuickEventDialogOpen = false;
|
//IsQuickEventDialogOpen = false;
|
||||||
await _calendarService.CreateNewCalendarItemAsync(testCalendarItem, null);
|
//await _calendarService.CreateNewCalendarItemAsync(testCalendarItem, null);
|
||||||
|
|
||||||
// TODO: Create the request with the synchronizer.
|
// TODO: Create the request with the synchronizer.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,11 +17,11 @@ public partial class CalendarItemViewModel : ObservableObject, ICalendarItem, IC
|
|||||||
|
|
||||||
public IAccountCalendar AssignedCalendar => CalendarItem.AssignedCalendar;
|
public IAccountCalendar AssignedCalendar => CalendarItem.AssignedCalendar;
|
||||||
|
|
||||||
public DateTime StartDate { get => CalendarItem.StartDate; set => CalendarItem.StartDate = value; }
|
public DateTime StartDate => CalendarItem.StartDate;
|
||||||
|
|
||||||
public DateTime EndDate => CalendarItem.EndDate;
|
public DateTime EndDate => CalendarItem.EndDate;
|
||||||
|
|
||||||
public double DurationInSeconds { get => CalendarItem.DurationInSeconds; set => CalendarItem.DurationInSeconds = value; }
|
public double DurationInSeconds => CalendarItem.DurationInSeconds;
|
||||||
|
|
||||||
public ITimePeriod Period => CalendarItem.Period;
|
public ITimePeriod Period => CalendarItem.Period;
|
||||||
|
|
||||||
|
|||||||
@@ -17,24 +17,23 @@ public class CalendarItem : ICalendarItem
|
|||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
public string Location { get; set; }
|
public string Location { get; set; }
|
||||||
|
|
||||||
public DateTime StartDate { get; set; }
|
public string StartTimeOffset { get; set; }
|
||||||
|
public string EndTimeOffset { get; set; }
|
||||||
|
|
||||||
public DateTime EndDate
|
public DateTimeOffset StartDateTimeOffset => DateTimeOffset.Parse(StartTimeOffset);
|
||||||
{
|
public DateTimeOffset EndDateTimeOffsete => DateTimeOffset.Parse(EndTimeOffset);
|
||||||
get
|
|
||||||
{
|
|
||||||
return StartDate.AddSeconds(DurationInSeconds);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public TimeSpan StartDateOffset { get; set; }
|
public DateTime StartDate => StartDateTimeOffset.DateTime;//TimeZoneInfo.ConvertTime(StartDateTimeOffset, TimeZoneInfo.Local).DateTime;
|
||||||
public TimeSpan EndDateOffset { get; set; }
|
public DateTime EndDate => EndDateTimeOffsete.DateTime;// TimeZoneInfo.ConvertTime(, TimeZoneInfo.Local).DateTime;
|
||||||
|
|
||||||
private ITimePeriod _period;
|
private ITimePeriod _period;
|
||||||
public ITimePeriod Period
|
public ITimePeriod Period
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
// Period must be loaded by user's current UI culture based on StartDateTimeOffset and EndDateTimeOffset
|
||||||
|
// Get the time zone corresponding to the current culture
|
||||||
|
|
||||||
_period ??= new TimeRange(StartDate, EndDate);
|
_period ??= new TimeRange(StartDate, EndDate);
|
||||||
|
|
||||||
return _period;
|
return _period;
|
||||||
@@ -94,7 +93,7 @@ public class CalendarItem : ICalendarItem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public double DurationInSeconds { get; set; }
|
public double DurationInSeconds => Period.Duration.TotalSeconds;
|
||||||
public string Recurrence { get; set; }
|
public string Recurrence { get; set; }
|
||||||
|
|
||||||
public string OrganizerDisplayName { get; set; }
|
public string OrganizerDisplayName { get; set; }
|
||||||
@@ -144,7 +143,7 @@ public class CalendarItem : ICalendarItem
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Guid EventTrackingId => IsOccurrence ? RecurringCalendarItemId.Value : Id;
|
public Guid EventTrackingId => IsOccurrence ? RecurringCalendarItemId.Value : Id;
|
||||||
|
|
||||||
public CalendarItem CreateRecurrence(DateTime startDate, double durationInSeconds)
|
public CalendarItem CreateRecurrence(DateTimeOffset startDateOffset, DateTimeOffset endDateOffset)
|
||||||
{
|
{
|
||||||
// Create a copy with the new start date and duration
|
// Create a copy with the new start date and duration
|
||||||
|
|
||||||
@@ -154,8 +153,8 @@ public class CalendarItem : ICalendarItem
|
|||||||
Title = Title,
|
Title = Title,
|
||||||
Description = Description,
|
Description = Description,
|
||||||
Location = Location,
|
Location = Location,
|
||||||
StartDate = startDate,
|
StartTimeOffset = startDateOffset.ToString("o"),
|
||||||
DurationInSeconds = durationInSeconds,
|
EndTimeOffset = endDateOffset.ToString("o"),
|
||||||
Recurrence = Recurrence,
|
Recurrence = Recurrence,
|
||||||
OrganizerDisplayName = OrganizerDisplayName,
|
OrganizerDisplayName = OrganizerDisplayName,
|
||||||
OrganizerEmail = OrganizerEmail,
|
OrganizerEmail = OrganizerEmail,
|
||||||
@@ -168,8 +167,6 @@ public class CalendarItem : ICalendarItem
|
|||||||
Status = Status,
|
Status = Status,
|
||||||
CustomEventColorHex = CustomEventColorHex,
|
CustomEventColorHex = CustomEventColorHex,
|
||||||
HtmlLink = HtmlLink,
|
HtmlLink = HtmlLink,
|
||||||
StartDateOffset = StartDateOffset,
|
|
||||||
EndDateOffset = EndDateOffset,
|
|
||||||
RemoteEventId = RemoteEventId,
|
RemoteEventId = RemoteEventId,
|
||||||
IsHidden = IsHidden,
|
IsHidden = IsHidden,
|
||||||
IsLocked = IsLocked,
|
IsLocked = IsLocked,
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ public interface ICalendarItem
|
|||||||
string Title { get; }
|
string Title { get; }
|
||||||
Guid Id { get; }
|
Guid Id { get; }
|
||||||
IAccountCalendar AssignedCalendar { get; }
|
IAccountCalendar AssignedCalendar { get; }
|
||||||
DateTime StartDate { get; set; }
|
DateTime StartDate { get; }
|
||||||
DateTime EndDate { get; }
|
DateTime EndDate { get; }
|
||||||
double DurationInSeconds { get; set; }
|
double DurationInSeconds { get; }
|
||||||
ITimePeriod Period { get; }
|
ITimePeriod Period { get; }
|
||||||
|
|
||||||
bool IsAllDayEvent { get; }
|
bool IsAllDayEvent { get; }
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ public static class GoogleIntegratorExtensions
|
|||||||
return calendar;
|
return calendar;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DateTimeOffset? GetEventDateTimeOffset(EventDateTime calendarEvent)
|
public static DateTimeOffset GetEventDateTimeOffset(EventDateTime calendarEvent)
|
||||||
{
|
{
|
||||||
if (calendarEvent != null)
|
if (calendarEvent != null)
|
||||||
{
|
{
|
||||||
@@ -212,7 +212,7 @@ public static class GoogleIntegratorExtensions
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
throw new Exception("Invalid date format in Google Calendar event date.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -66,12 +66,6 @@ public class GmailChangeProcessor : DefaultChangeProcessor, IGmailChangeProcesso
|
|||||||
var eventStartDateTimeOffset = GoogleIntegratorExtensions.GetEventDateTimeOffset(calendarEvent.Start);
|
var eventStartDateTimeOffset = GoogleIntegratorExtensions.GetEventDateTimeOffset(calendarEvent.Start);
|
||||||
var eventEndDateTimeOffset = GoogleIntegratorExtensions.GetEventDateTimeOffset(calendarEvent.End);
|
var eventEndDateTimeOffset = GoogleIntegratorExtensions.GetEventDateTimeOffset(calendarEvent.End);
|
||||||
|
|
||||||
double totalDurationInSeconds = 0;
|
|
||||||
|
|
||||||
if (eventStartDateTimeOffset != null && eventEndDateTimeOffset != null)
|
|
||||||
{
|
|
||||||
totalDurationInSeconds = (eventEndDateTimeOffset.Value - eventStartDateTimeOffset.Value).TotalSeconds;
|
|
||||||
}
|
|
||||||
|
|
||||||
CalendarItem calendarItem = null;
|
CalendarItem calendarItem = null;
|
||||||
|
|
||||||
@@ -80,12 +74,6 @@ public class GmailChangeProcessor : DefaultChangeProcessor, IGmailChangeProcesso
|
|||||||
// Exceptions of parent events might not have all the fields populated.
|
// Exceptions of parent events might not have all the fields populated.
|
||||||
// We must use the parent event's data for fields that don't exists.
|
// We must use the parent event's data for fields that don't exists.
|
||||||
|
|
||||||
// Update duration if it's not populated.
|
|
||||||
if (totalDurationInSeconds == 0)
|
|
||||||
{
|
|
||||||
totalDurationInSeconds = parentRecurringEvent.DurationInSeconds;
|
|
||||||
}
|
|
||||||
|
|
||||||
var organizerMail = GetOrganizerEmail(calendarEvent, organizerAccount);
|
var organizerMail = GetOrganizerEmail(calendarEvent, organizerAccount);
|
||||||
var organizerName = GetOrganizerName(calendarEvent, organizerAccount);
|
var organizerName = GetOrganizerName(calendarEvent, organizerAccount);
|
||||||
|
|
||||||
@@ -96,10 +84,8 @@ public class GmailChangeProcessor : DefaultChangeProcessor, IGmailChangeProcesso
|
|||||||
CreatedAt = DateTimeOffset.UtcNow,
|
CreatedAt = DateTimeOffset.UtcNow,
|
||||||
Description = calendarEvent.Description ?? parentRecurringEvent.Description,
|
Description = calendarEvent.Description ?? parentRecurringEvent.Description,
|
||||||
Id = Guid.NewGuid(),
|
Id = Guid.NewGuid(),
|
||||||
StartDate = eventStartDateTimeOffset.Value.DateTime,
|
StartTimeOffset = eventStartDateTimeOffset.ToString("o"),
|
||||||
StartDateOffset = eventStartDateTimeOffset.Value.Offset,
|
EndTimeOffset = eventEndDateTimeOffset.ToString("o"),
|
||||||
EndDateOffset = eventEndDateTimeOffset?.Offset ?? parentRecurringEvent.EndDateOffset,
|
|
||||||
DurationInSeconds = totalDurationInSeconds,
|
|
||||||
Location = string.IsNullOrEmpty(calendarEvent.Location) ? parentRecurringEvent.Location : calendarEvent.Location,
|
Location = string.IsNullOrEmpty(calendarEvent.Location) ? parentRecurringEvent.Location : calendarEvent.Location,
|
||||||
|
|
||||||
// Leave it empty if it's not populated.
|
// Leave it empty if it's not populated.
|
||||||
@@ -120,22 +106,14 @@ public class GmailChangeProcessor : DefaultChangeProcessor, IGmailChangeProcesso
|
|||||||
// This is a parent event creation.
|
// This is a parent event creation.
|
||||||
// Start-End dates are guaranteed to be populated.
|
// Start-End dates are guaranteed to be populated.
|
||||||
|
|
||||||
if (eventStartDateTimeOffset == null || eventEndDateTimeOffset == null)
|
|
||||||
{
|
|
||||||
Log.Error("Failed to create parent event because either start or end date is not specified.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
calendarItem = new CalendarItem()
|
calendarItem = new CalendarItem()
|
||||||
{
|
{
|
||||||
CalendarId = assignedCalendar.Id,
|
CalendarId = assignedCalendar.Id,
|
||||||
CreatedAt = DateTimeOffset.UtcNow,
|
CreatedAt = DateTimeOffset.UtcNow,
|
||||||
Description = calendarEvent.Description,
|
Description = calendarEvent.Description,
|
||||||
Id = Guid.NewGuid(),
|
Id = Guid.NewGuid(),
|
||||||
StartDate = eventStartDateTimeOffset.Value.DateTime,
|
StartTimeOffset = eventStartDateTimeOffset.ToString("o"),
|
||||||
StartDateOffset = eventStartDateTimeOffset.Value.Offset,
|
EndTimeOffset = eventEndDateTimeOffset.ToString("o"),
|
||||||
EndDateOffset = eventEndDateTimeOffset.Value.Offset,
|
|
||||||
DurationInSeconds = totalDurationInSeconds,
|
|
||||||
Location = calendarEvent.Location,
|
Location = calendarEvent.Location,
|
||||||
Recurrence = GoogleIntegratorExtensions.GetRecurrenceString(calendarEvent),
|
Recurrence = GoogleIntegratorExtensions.GetRecurrenceString(calendarEvent),
|
||||||
Status = GetStatus(calendarEvent.Status),
|
Status = GetStatus(calendarEvent.Status),
|
||||||
|
|||||||
@@ -61,18 +61,21 @@ public class OutlookChangeProcessor(IDatabaseService databaseService,
|
|||||||
DateTimeOffset eventStartDateTimeOffset = OutlookIntegratorExtensions.GetDateTimeOffsetFromDateTimeTimeZone(calendarEvent.Start);
|
DateTimeOffset eventStartDateTimeOffset = OutlookIntegratorExtensions.GetDateTimeOffsetFromDateTimeTimeZone(calendarEvent.Start);
|
||||||
DateTimeOffset eventEndDateTimeOffset = OutlookIntegratorExtensions.GetDateTimeOffsetFromDateTimeTimeZone(calendarEvent.End);
|
DateTimeOffset eventEndDateTimeOffset = OutlookIntegratorExtensions.GetDateTimeOffsetFromDateTimeTimeZone(calendarEvent.End);
|
||||||
|
|
||||||
var durationInSeconds = (eventEndDateTimeOffset - eventStartDateTimeOffset).TotalSeconds;
|
|
||||||
|
|
||||||
savingItem.RemoteEventId = calendarEvent.Id;
|
savingItem.RemoteEventId = calendarEvent.Id;
|
||||||
savingItem.StartDate = eventStartDateTimeOffset.DateTime;
|
savingItem.StartTimeOffset = eventStartDateTimeOffset.ToString("O");
|
||||||
savingItem.StartDateOffset = eventStartDateTimeOffset.Offset;
|
savingItem.EndTimeOffset = eventEndDateTimeOffset.ToString("O");
|
||||||
savingItem.EndDateOffset = eventEndDateTimeOffset.Offset;
|
|
||||||
savingItem.DurationInSeconds = durationInSeconds;
|
|
||||||
|
|
||||||
savingItem.Title = calendarEvent.Subject;
|
savingItem.Title = calendarEvent.Subject;
|
||||||
savingItem.Description = calendarEvent.Body?.Content;
|
savingItem.Description = calendarEvent.Body?.Content;
|
||||||
savingItem.Location = calendarEvent.Location?.DisplayName;
|
savingItem.Location = calendarEvent.Location?.DisplayName;
|
||||||
|
|
||||||
|
if (savingItem.Title.Contains("Atatürk"))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (calendarEvent.Type == EventType.Exception && !string.IsNullOrEmpty(calendarEvent.SeriesMasterId))
|
if (calendarEvent.Type == EventType.Exception && !string.IsNullOrEmpty(calendarEvent.SeriesMasterId))
|
||||||
{
|
{
|
||||||
// This is a recurring event exception.
|
// This is a recurring event exception.
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ public class CalendarService : BaseDatabaseService, ICalendarService
|
|||||||
// There is no exception for the period.
|
// There is no exception for the period.
|
||||||
// Change the instance StartDate and Duration.
|
// Change the instance StartDate and Duration.
|
||||||
|
|
||||||
var recurrence = ev.CreateRecurrence(occurrence.Period.StartTime.Value, occurrence.Period.Duration.TotalSeconds);
|
var recurrence = ev.CreateRecurrence(occurrence.Period.StartTime.Value, occurrence.Period.EndTime.Value);
|
||||||
|
|
||||||
result.Add(recurrence);
|
result.Add(recurrence);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user