fix #1258, properly handle importing events, if exdates are split by line
This commit is contained in:
parent
c8fae6c688
commit
c2b31a8de4
|
@ -134,7 +134,13 @@ class IcsImporter(val activity: SimpleActivity) {
|
||||||
value = value.substring(0, value.length - 1)
|
value = value.substring(0, value.length - 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
curRepeatExceptions.add(Formatter.getDayCodeFromTS(getTimestamp(value)))
|
if (value.contains(",")) {
|
||||||
|
value.split(",").forEach { exdate ->
|
||||||
|
curRepeatExceptions.add(Formatter.getDayCodeFromTS(getTimestamp(exdate)))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
curRepeatExceptions.add(Formatter.getDayCodeFromTS(getTimestamp(value)))
|
||||||
|
}
|
||||||
} else if (line.startsWith(LOCATION)) {
|
} else if (line.startsWith(LOCATION)) {
|
||||||
curLocation = getLocation(line.substring(LOCATION.length).replace("\\,", ","))
|
curLocation = getLocation(line.substring(LOCATION.length).replace("\\,", ","))
|
||||||
if (curLocation.trim().isEmpty()) {
|
if (curLocation.trim().isEmpty()) {
|
||||||
|
@ -247,17 +253,19 @@ class IcsImporter(val activity: SimpleActivity) {
|
||||||
|
|
||||||
private fun getTimestamp(fullString: String): Long {
|
private fun getTimestamp(fullString: String): Long {
|
||||||
return try {
|
return try {
|
||||||
if (fullString.startsWith(';')) {
|
when {
|
||||||
val value = fullString.substring(fullString.lastIndexOf(':') + 1).replace(" ", "")
|
fullString.startsWith(';') -> {
|
||||||
if (value.isEmpty()) {
|
val value = fullString.substring(fullString.lastIndexOf(':') + 1).replace(" ", "")
|
||||||
return 0
|
if (value.isEmpty()) {
|
||||||
} else if (!value.contains("T")) {
|
return 0
|
||||||
curFlags = curFlags or FLAG_ALL_DAY
|
} else if (!value.contains("T")) {
|
||||||
}
|
curFlags = curFlags or FLAG_ALL_DAY
|
||||||
|
}
|
||||||
|
|
||||||
Parser().parseDateTimeValue(value)
|
Parser().parseDateTimeValue(value)
|
||||||
} else {
|
}
|
||||||
Parser().parseDateTimeValue(fullString.substring(1))
|
fullString.startsWith(":") -> Parser().parseDateTimeValue(fullString.substring(1))
|
||||||
|
else -> Parser().parseDateTimeValue(fullString)
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
activity.showErrorToast(e)
|
activity.showErrorToast(e)
|
||||||
|
|
Loading…
Reference in New Issue