Implemented recurring events

pull/209/head
M66B 2 years ago
parent 4a9fd7e923
commit 13f8ee4809

@ -189,8 +189,11 @@ import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import biweekly.Biweekly;
import biweekly.ICalVersion;
import biweekly.ICalendar;
import biweekly.component.VEvent;
import biweekly.io.WriteContext;
import biweekly.io.scribe.property.RecurrenceRuleScribe;
import biweekly.parameter.ParticipationStatus;
import biweekly.property.Attendee;
import biweekly.property.CalendarScale;
@ -199,6 +202,7 @@ import biweekly.property.LastModified;
import biweekly.property.Method;
import biweekly.property.Organizer;
import biweekly.property.RawProperty;
import biweekly.property.RecurrenceRule;
import biweekly.property.Summary;
import biweekly.property.Transparency;
import biweekly.util.ICalDate;
@ -3652,6 +3656,14 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
if (end != null)
intent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME, end.getTime());
RecurrenceRule recurrence = event.getRecurrenceRule();
if (recurrence != null) {
RecurrenceRuleScribe scribe = new RecurrenceRuleScribe();
WriteContext wcontext = new WriteContext(ICalVersion.V2_0, icalendar.getTimezoneInfo(), null);
String rrule = scribe.writeText(recurrence, wcontext);
intent.putExtra(CalendarContract.Events.RRULE, rrule);
}
// This will result in sending unwanted invites
//if (attendee.size() > 0)
// intent.putExtra(Intent.EXTRA_EMAIL, TextUtils.join(",", attendee));

@ -144,9 +144,13 @@ import javax.mail.internet.ParameterList;
import javax.mail.internet.ParseException;
import biweekly.Biweekly;
import biweekly.ICalVersion;
import biweekly.ICalendar;
import biweekly.component.VEvent;
import biweekly.io.WriteContext;
import biweekly.io.scribe.property.RecurrenceRuleScribe;
import biweekly.property.Method;
import biweekly.property.RecurrenceRule;
import biweekly.util.ICalDate;
public class MessageHelper {
@ -3901,14 +3905,27 @@ public class MessageHelper {
ICalDate start = (event.getDateStart() == null ? null : event.getDateStart().getValue());
ICalDate end = (event.getDateEnd() == null ? null : event.getDateEnd().getValue());
String rrule = null;
RecurrenceRule recurrence = event.getRecurrenceRule();
if (recurrence != null) {
RecurrenceRuleScribe scribe = new RecurrenceRuleScribe();
WriteContext wcontext = new WriteContext(ICalVersion.V2_0, icalendar.getTimezoneInfo(), null);
rrule = scribe.writeText(recurrence, wcontext);
}
String uid = (event.getUid() == null ? null : event.getUid().getValue());
EntityLog.log(context, EntityLog.Type.General, message, "Processing event" +
" uid=" + uid + " method=" + method + " calendar=" + account.calendar);
if (icalendar.getMethod() != null &&
start != null && end != null &&
!TextUtils.isEmpty(uid)) {
" uid=" + uid +
" method=" + method +
" start=" + (start != null) +
" end=" + (end != null) +
" rrule=" + rrule +
" calendar=" + account.calendar);
if (!TextUtils.isEmpty(uid) &&
icalendar.getMethod() != null &&
start != null && end != null) {
ContentResolver resolver = context.getContentResolver();
if (icalendar.getMethod().isRequest() || icalendar.getMethod().isCancel())
@ -3948,6 +3965,8 @@ public class MessageHelper {
values.put(CalendarContract.Events.EVENT_TIMEZONE, TimeZone.getDefault().getID());
values.put(CalendarContract.Events.DTSTART, start.getTime());
values.put(CalendarContract.Events.DTEND, end.getTime());
if (rrule != null)
values.put(CalendarContract.Events.RRULE, rrule);
if (!TextUtils.isEmpty(summary))
values.put(CalendarContract.Events.TITLE, summary);
if (!TextUtils.isEmpty(description))

Loading…
Cancel
Save