mirror of
https://github.com/etesync/android
synced 2024-11-23 00:18:19 +00:00
Handle attendees and reminders for exceptions of recurring events
This commit is contained in:
parent
faeb3b7dd0
commit
d7fff8a760
@ -58,7 +58,6 @@ import ezvcard.property.Uid;
|
|||||||
import ezvcard.property.Url;
|
import ezvcard.property.Url;
|
||||||
import lombok.Cleanup;
|
import lombok.Cleanup;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,7 +30,6 @@ import net.fortuna.ical4j.model.property.DtStart;
|
|||||||
import net.fortuna.ical4j.model.property.Duration;
|
import net.fortuna.ical4j.model.property.Duration;
|
||||||
import net.fortuna.ical4j.model.property.ExDate;
|
import net.fortuna.ical4j.model.property.ExDate;
|
||||||
import net.fortuna.ical4j.model.property.ExRule;
|
import net.fortuna.ical4j.model.property.ExRule;
|
||||||
import net.fortuna.ical4j.model.property.LastModified;
|
|
||||||
import net.fortuna.ical4j.model.property.Location;
|
import net.fortuna.ical4j.model.property.Location;
|
||||||
import net.fortuna.ical4j.model.property.Organizer;
|
import net.fortuna.ical4j.model.property.Organizer;
|
||||||
import net.fortuna.ical4j.model.property.RDate;
|
import net.fortuna.ical4j.model.property.RDate;
|
||||||
@ -60,7 +59,6 @@ import at.bitfire.davdroid.DateUtils;
|
|||||||
import lombok.Cleanup;
|
import lombok.Cleanup;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
|
|
||||||
public class Event extends iCalendar {
|
public class Event extends iCalendar {
|
||||||
|
@ -603,7 +603,6 @@ public class LocalCalendar extends LocalCollection<Event> {
|
|||||||
|
|
||||||
if (event.organizer != null) {
|
if (event.organizer != null) {
|
||||||
final URI uri = event.organizer.getCalAddress();
|
final URI uri = event.organizer.getCalAddress();
|
||||||
|
|
||||||
String email = null;
|
String email = null;
|
||||||
if (uri != null && "mailto".equalsIgnoreCase(uri.getScheme()))
|
if (uri != null && "mailto".equalsIgnoreCase(uri.getScheme()))
|
||||||
email = uri.getSchemeSpecificPart();
|
email = uri.getSchemeSpecificPart();
|
||||||
@ -611,10 +610,11 @@ public class LocalCalendar extends LocalCollection<Event> {
|
|||||||
iCalendar.Email emailParam = (iCalendar.Email)event.organizer.getParameter(iCalendar.Email.PARAMETER_NAME);
|
iCalendar.Email emailParam = (iCalendar.Email)event.organizer.getParameter(iCalendar.Email.PARAMETER_NAME);
|
||||||
if (emailParam != null)
|
if (emailParam != null)
|
||||||
email = emailParam.getValue();
|
email = emailParam.getValue();
|
||||||
else
|
|
||||||
Log.w(TAG, "Got ORGANIZER without email address, using given URI instead (may cause Android to behave unexpectedly)");
|
|
||||||
}
|
}
|
||||||
builder.withValue(Events.ORGANIZER, email != null ? email : uri.toString());
|
if (email != null)
|
||||||
|
builder.withValue(Events.ORGANIZER, email);
|
||||||
|
else
|
||||||
|
Log.w(TAG, "Got ORGANIZER without email address which is not supported by Android, ignoring");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.status!= null) {
|
if (event.status!= null) {
|
||||||
@ -646,8 +646,11 @@ public class LocalCalendar extends LocalCollection<Event> {
|
|||||||
for (VAlarm alarm : event.getAlarms())
|
for (VAlarm alarm : event.getAlarms())
|
||||||
pendingOperations.add(buildReminder(newDataInsertBuilder(Reminders.CONTENT_URI, Reminders.EVENT_ID, localID, backrefIdx), alarm).build());
|
pendingOperations.add(buildReminder(newDataInsertBuilder(Reminders.CONTENT_URI, Reminders.EVENT_ID, localID, backrefIdx), alarm).build());
|
||||||
// add exceptions
|
// add exceptions
|
||||||
for (Event exception : event.getExceptions())
|
for (Event exception : event.getExceptions()) {
|
||||||
|
final int backrefIdxEx = pendingOperations.size(); // save exception ID as backref value
|
||||||
pendingOperations.add(buildException(newDataInsertBuilder(Events.CONTENT_URI, Events.ORIGINAL_ID, localID, backrefIdx), event, exception).build());
|
pendingOperations.add(buildException(newDataInsertBuilder(Events.CONTENT_URI, Events.ORIGINAL_ID, localID, backrefIdx), event, exception).build());
|
||||||
|
addDataRows(exception, -1, backrefIdxEx); // build attendees and reminders for exception
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -684,10 +687,6 @@ public class LocalCalendar extends LocalCollection<Event> {
|
|||||||
|
|
||||||
builder.withValue(Events.ORIGINAL_INSTANCE_TIME, date.getTime());
|
builder.withValue(Events.ORIGINAL_INSTANCE_TIME, date.getTime());
|
||||||
builder.withValue(Events.ORIGINAL_ALL_DAY, originalAllDay ? 1 : 0);
|
builder.withValue(Events.ORIGINAL_ALL_DAY, originalAllDay ? 1 : 0);
|
||||||
|
|
||||||
/* TODO reminders and attendees for exceptions are currently not built because
|
|
||||||
* there's no backref index available */
|
|
||||||
|
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user