From 243e28cb1e038b0b3a43abd9abe558249144c922 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 23 Apr 2017 22:38:54 +0200 Subject: [PATCH] properly handle the "count" field at importing events --- .../calendar/helpers/IcsImporter.kt | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) 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 c63415775..6bd4a4eec 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/IcsImporter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/IcsImporter.kt @@ -191,7 +191,6 @@ class IcsImporter { private fun parseRepeatInterval(fullString: String): Int { val parts = fullString.split(";") var frequencySeconds = 0 - var count = 0 for (part in parts) { val keyValue = part.split("=") val key = keyValue[0] @@ -203,19 +202,11 @@ class IcsImporter { curRepeatRule = Math.pow(2.0, (start.dayOfWeek - 1).toDouble()).toInt() } } else if (key == COUNT) { - count = value.toInt() - 1 - if (frequencySeconds != 0) { - curRepeatLimit = curStart + count * frequencySeconds - } + curRepeatLimit = -value.toInt() } else if (key == UNTIL) { curRepeatLimit = parseDateTimeValue(value) } else if (key == INTERVAL) { - val interval = value.toInt() - val repeatInterval = frequencySeconds * interval - if (count > 0) { - curRepeatLimit = curStart + count * repeatInterval - frequencySeconds *= interval - } + frequencySeconds *= value.toInt() } else if (key == BYDAY) { handleRepeatRule(value) }