Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handling parsing exception #567

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import org.dmfs.rfc5545.recur.Freq as RruleFreq
import org.dmfs.rfc5545.recur.RecurrenceRule as Rrule
import android.provider.CalendarContract.Colors
import androidx.collection.SparseArrayCompat
import android.util.Log

private const val RETRIEVE_CALENDARS_REQUEST_CODE = 0
private const val RETRIEVE_EVENTS_REQUEST_CODE = RETRIEVE_CALENDARS_REQUEST_CODE + 1
Expand Down Expand Up @@ -954,7 +955,11 @@ class CalendarDelegate(binding: ActivityPluginBinding?, context: Context) :
event.eventAllDay = allDay
event.eventLocation = location
event.eventURL = url
event.recurrenceRule = parseRecurrenceRuleString(recurringRule)
event.recurrenceRule = runCatching { parseRecurrenceRuleString(recurringRule) }
.onFailure {
Log.e("parse", "Error parsing to ${event.eventTitle} recurring rule: ${it.message}")
}
.getOrNull()
event.eventStartTimeZone = startTimeZone
event.eventEndTimeZone = endTimeZone
event.availability = availability
Expand All @@ -979,6 +984,8 @@ class CalendarDelegate(binding: ActivityPluginBinding?, context: Context) :
} ?: return null
//Avoid handling HOURLY/MINUTELY/SECONDLY frequencies for now

// Since we cannot identify which specific event is causing the issue,
// handle it in the parent function
val recurrenceRule = RecurrenceRule(frequency)

recurrenceRule.count = rfcRecurrenceRule.count
Expand Down
Loading