do not parse caldav calendar id from "imported-ics"

This commit is contained in:
tibbi 2017-09-02 00:15:45 +02:00
parent 3b1374fae8
commit d62e565874
2 changed files with 9 additions and 9 deletions

View File

@ -130,8 +130,8 @@ class IcsImporter {
} }
private fun getTimestamp(fullString: String): Int { private fun getTimestamp(fullString: String): Int {
try { return try {
return if (fullString.startsWith(';')) { if (fullString.startsWith(';')) {
val value = fullString.substring(fullString.lastIndexOf(':') + 1) val value = fullString.substring(fullString.lastIndexOf(':') + 1)
if (!value.contains("T")) if (!value.contains("T"))
curFlags = curFlags or FLAG_ALL_DAY curFlags = curFlags or FLAG_ALL_DAY
@ -142,7 +142,7 @@ class IcsImporter {
} }
} catch (e: Exception) { } catch (e: Exception) {
eventsFailed++ eventsFailed++
return -1 -1
} }
} }
@ -154,11 +154,11 @@ class IcsImporter {
} }
val eventId = context.dbHelper.getEventTypeIdWithTitle(eventTypeTitle) val eventId = context.dbHelper.getEventTypeIdWithTitle(eventTypeTitle)
if (eventId == -1) { curEventType = if (eventId == -1) {
val eventType = EventType(0, eventTypeTitle, context.resources.getColor(R.color.color_primary)) val eventType = EventType(0, eventTypeTitle, context.resources.getColor(R.color.color_primary))
curEventType = context.dbHelper.insertEventType(eventType) context.dbHelper.insertEventType(eventType)
} else { } else {
curEventType = eventId eventId
} }
} }
@ -177,8 +177,8 @@ class IcsImporter {
curDescription = "" curDescription = ""
curImportId = "" curImportId = ""
curFlags = 0 curFlags = 0
curReminderMinutes = ArrayList<Int>() curReminderMinutes = ArrayList()
curRepeatExceptions = ArrayList<Int>() curRepeatExceptions = ArrayList()
curRepeatInterval = 0 curRepeatInterval = 0
curRepeatLimit = 0 curRepeatLimit = 0
curRepeatRule = 0 curRepeatRule = 0

View File

@ -112,5 +112,5 @@ data class Event(var id: Int = 0, var startTS: Int = 0, var endTS: Int = 0, var
} }
} }
fun getCalDAVCalendarId() = if (source.contains("-")) (source.split("-").lastOrNull() ?: "0").toString().toInt() else 0 fun getCalDAVCalendarId() = if (source.contains("-") && source != SOURCE_IMPORTED_ICS) (source.split("-").lastOrNull() ?: "0").toString().toInt() else 0
} }