Merge pull request #1994 from supyrow/master

Description of the event is missing with import #1872
This commit is contained in:
Tibor Kaputa
2023-04-08 10:02:08 +02:00
committed by GitHub
3 changed files with 9 additions and 4 deletions

View File

@@ -171,7 +171,9 @@ const val LAST_MODIFIED = "LAST-MODIFIED"
const val DTSTAMP = "DTSTAMP:" const val DTSTAMP = "DTSTAMP:"
const val DURATION = "DURATION:" const val DURATION = "DURATION:"
const val SUMMARY = "SUMMARY" 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 UID = "UID:"
const val ACTION = "ACTION:" const val ACTION = "ACTION:"
const val TRANSP = "TRANSP:" const val TRANSP = "TRANSP:"

View File

@@ -87,7 +87,7 @@ class IcsExporter(private val context: Context) {
val reminder = it val reminder = it
out.apply { out.apply {
writeLn(BEGIN_ALARM) writeLn(BEGIN_ALARM)
writeLn("$DESCRIPTION$reminderLabel") writeLn("$DESCRIPTION_EXPORT$reminderLabel")
if (reminder.type == REMINDER_NOTIFICATION) { if (reminder.type == REMINDER_NOTIFICATION) {
writeLn("$ACTION$DISPLAY") writeLn("$ACTION$DISPLAY")
} else { } else {
@@ -118,7 +118,7 @@ class IcsExporter(private val context: Context) {
while (index < description.length) { while (index < description.length) {
val substring = description.substring(index, Math.min(index + MAX_LINE_LENGTH, description.length)) val substring = description.substring(index, Math.min(index + MAX_LINE_LENGTH, description.length))
if (isFirstLine) { if (isFirstLine) {
out.writeLn("$DESCRIPTION$substring") out.writeLn("$DESCRIPTION_EXPORT$substring")
} else { } else {
out.writeLn("\t$substring") out.writeLn("\t$substring")
} }

View File

@@ -115,7 +115,10 @@ class IcsImporter(val activity: SimpleActivity) {
curTitle = line.substring(SUMMARY.length) curTitle = line.substring(SUMMARY.length)
curTitle = getTitle(curTitle).replace("\\n", "\n").replace("\\,", ",") curTitle = getTitle(curTitle).replace("\\n", "\n").replace("\\,", ",")
} else if (line.startsWith(DESCRIPTION) && !isNotificationDescription) { } 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()) { if (curDescription.trim().isEmpty()) {
curDescription = "" curDescription = ""
} }