|
|
|
@ -498,19 +498,25 @@ public class CalendarHelper {
|
|
|
|
|
|
|
|
|
|
static void delete(Context context, ICalendar icalendar, VEvent event, EntityAccount account, EntityMessage message) {
|
|
|
|
|
String uid = (event.getUid() == null ? null : event.getUid().getValue());
|
|
|
|
|
if (TextUtils.isEmpty(uid))
|
|
|
|
|
if (TextUtils.isEmpty(uid)) {
|
|
|
|
|
EntityLog.log(context, "Delete event without uid");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RecurrenceId recurrenceId = event.getProperty(biweekly.property.RecurrenceId.class);
|
|
|
|
|
if (recurrenceId != null) {
|
|
|
|
|
ICalDate start = recurrenceId.getValue();
|
|
|
|
|
if (!start.hasTime())
|
|
|
|
|
if (!start.hasTime()) {
|
|
|
|
|
EntityLog.log(context, "Delete recurring event without start time");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Pair<String, String> selected = getSelectedCalendar(account);
|
|
|
|
|
Long existId = exists(context, selected.first, selected.second, uid);
|
|
|
|
|
if (existId == null)
|
|
|
|
|
if (existId == null) {
|
|
|
|
|
EntityLog.log(context, "Existing recurring event not found uid=" + uid);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ContentValues values = new ContentValues();
|
|
|
|
|
values.put(CalendarContract.Events.ORIGINAL_INSTANCE_TIME, start.getTime());
|
|
|
|
@ -527,6 +533,7 @@ public class CalendarHelper {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ContentResolver resolver = context.getContentResolver();
|
|
|
|
|
boolean found = false;
|
|
|
|
|
try (Cursor cursor = resolver.query(CalendarContract.Events.CONTENT_URI,
|
|
|
|
|
new String[]{CalendarContract.Events._ID},
|
|
|
|
|
CalendarContract.Events.UID_2445 + " = ? ",
|
|
|
|
@ -540,7 +547,10 @@ public class CalendarHelper {
|
|
|
|
|
int rows = resolver.delete(deleteUri, null, null);
|
|
|
|
|
EntityLog.log(context, EntityLog.Type.General, message,
|
|
|
|
|
"Deleted event id=" + eventId + " uid=" + uid + " rows=" + rows);
|
|
|
|
|
found = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!found)
|
|
|
|
|
EntityLog.log(context, "Delete event not found uid=" + uid);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|