1
0
mirror of https://github.com/etesync/android synced 2024-11-22 07:58:09 +00:00

Handle attendees and reminders for exceptions of recurring events

This commit is contained in:
Ricki Hirner 2015-08-10 11:54:05 +02:00
parent faeb3b7dd0
commit d7fff8a760
3 changed files with 8 additions and 12 deletions

View File

@ -58,7 +58,6 @@ import ezvcard.property.Uid;
import ezvcard.property.Url;
import lombok.Cleanup;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

View File

@ -30,7 +30,6 @@ import net.fortuna.ical4j.model.property.DtStart;
import net.fortuna.ical4j.model.property.Duration;
import net.fortuna.ical4j.model.property.ExDate;
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.Organizer;
import net.fortuna.ical4j.model.property.RDate;
@ -60,7 +59,6 @@ import at.bitfire.davdroid.DateUtils;
import lombok.Cleanup;
import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;
public class Event extends iCalendar {

View File

@ -603,7 +603,6 @@ public class LocalCalendar extends LocalCollection<Event> {
if (event.organizer != null) {
final URI uri = event.organizer.getCalAddress();
String email = null;
if (uri != null && "mailto".equalsIgnoreCase(uri.getScheme()))
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);
if (emailParam != null)
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) {
@ -646,8 +646,11 @@ public class LocalCalendar extends LocalCollection<Event> {
for (VAlarm alarm : event.getAlarms())
pendingOperations.add(buildReminder(newDataInsertBuilder(Reminders.CONTENT_URI, Reminders.EVENT_ID, localID, backrefIdx), alarm).build());
// 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());
addDataRows(exception, -1, backrefIdxEx); // build attendees and reminders for exception
}
}
@Override
@ -684,10 +687,6 @@ public class LocalCalendar extends LocalCollection<Event> {
builder.withValue(Events.ORIGINAL_INSTANCE_TIME, date.getTime());
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;
}