diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/CalDAVHandler.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/CalDAVHandler.kt index 4eec22f77..94157f78f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/CalDAVHandler.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/CalDAVHandler.kt @@ -182,8 +182,6 @@ class CalDAVHandler(val context: Context) { colors.put(colorKey, color) } while (cursor.moveToNext()) } - } catch (e: Exception) { - Log.e("DEBUG", "exc $e") } finally { cursor?.close() } diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/Constants.kt index 969626802..c48763cf1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/Constants.kt @@ -87,7 +87,7 @@ const val STATUS = "STATUS:" const val EXDATE = "EXDATE" const val BYDAY = "BYDAY" const val BYMONTHDAY = "BYMONTHDAY" -const val LOCATION = "LOCATION:" +const val LOCATION = "LOCATION" // this tag isn't a standard ICS tag, but there's no official way of adding a category color in an ics file const val CATEGORY_COLOR = "CATEGORY_COLOR:" diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/IcsImporter.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/IcsImporter.kt index 222faffc0..1df27de0e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/IcsImporter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/IcsImporter.kt @@ -119,7 +119,7 @@ class IcsImporter(val activity: SimpleActivity) { curRepeatExceptions.add(getTimestamp(value)) } else if (line.startsWith(LOCATION)) { - curLocation = line.substring(LOCATION.length).replace("\\,", ",") + curLocation = getLocation(line.substring(LOCATION.length).replace("\\,", ",")) } else if (line == END_ALARM) { if (isProperReminderAction && curReminderTriggerMinutes != -1) { curReminderMinutes.add(curReminderTriggerMinutes) @@ -203,6 +203,14 @@ class IcsImporter(val activity: SimpleActivity) { } } + private fun getLocation(fullString: String): String { + return if (fullString.startsWith(":")) { + fullString.trimStart(':') + } else { + fullString.substringAfter(':').trim() + } + } + private fun tryAddCategories(categories: String, context: Context) { val eventTypeTitle = if (categories.contains(",")) { categories.split(",")[0]