diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt index ef5af39d1..1a3793d81 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt @@ -171,7 +171,9 @@ const val LAST_MODIFIED = "LAST-MODIFIED" const val DTSTAMP = "DTSTAMP:" const val DURATION = "DURATION:" const val SUMMARY = "SUMMARY" -const val DESCRIPTION = "DESCRIPTION:" +const val DESCRIPTION = "DESCRIPTION" +const val DESCRIPTION_EXPORT = "DESCRIPTION:" +val DESCRIPTION_REGEX = Regex("""DESCRIPTION(?:(?:;[^:;]*="[^"]*")*;?(?:;LANGUAGE=[^:;]*)?(?:;[^:;]*="[^"]*")*)*:(.*(?:\r?\n\s+.*)*)""") const val UID = "UID:" const val ACTION = "ACTION:" const val TRANSP = "TRANSP:" diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/IcsExporter.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/IcsExporter.kt index 1d2e8c753..94d5472cf 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/IcsExporter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/IcsExporter.kt @@ -87,7 +87,7 @@ class IcsExporter(private val context: Context) { val reminder = it out.apply { writeLn(BEGIN_ALARM) - writeLn("$DESCRIPTION$reminderLabel") + writeLn("$DESCRIPTION_EXPORT$reminderLabel") if (reminder.type == REMINDER_NOTIFICATION) { writeLn("$ACTION$DISPLAY") } else { @@ -118,7 +118,7 @@ class IcsExporter(private val context: Context) { while (index < description.length) { val substring = description.substring(index, Math.min(index + MAX_LINE_LENGTH, description.length)) if (isFirstLine) { - out.writeLn("$DESCRIPTION$substring") + out.writeLn("$DESCRIPTION_EXPORT$substring") } else { out.writeLn("\t$substring") } diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/IcsImporter.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/IcsImporter.kt index 4af4311e6..c7161c859 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/IcsImporter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/IcsImporter.kt @@ -115,7 +115,10 @@ class IcsImporter(val activity: SimpleActivity) { curTitle = line.substring(SUMMARY.length) curTitle = getTitle(curTitle).replace("\\n", "\n").replace("\\,", ",") } else if (line.startsWith(DESCRIPTION) && !isNotificationDescription) { - curDescription = line.substring(DESCRIPTION.length).replace("\\n", "\n").replace("\\,", ",") + val match = DESCRIPTION_REGEX.matchEntire(line) + if (match != null) { + curDescription = match.groups[1]!!.value.replace("\\n", "\n").replace("\\,", ",") ?: "" + } if (curDescription.trim().isEmpty()) { curDescription = "" }