parse repeat limit if it was set as event occurrence count, not a date
This commit is contained in:
parent
5f7623deeb
commit
4729b09004
|
@ -28,6 +28,7 @@ class IcsParser {
|
||||||
private val DISPLAY = "DISPLAY"
|
private val DISPLAY = "DISPLAY"
|
||||||
private val FREQ = "FREQ"
|
private val FREQ = "FREQ"
|
||||||
private val UNTIL = "UNTIL"
|
private val UNTIL = "UNTIL"
|
||||||
|
private val COUNT = "COUNT"
|
||||||
private val INTERVAL = "INTERVAL"
|
private val INTERVAL = "INTERVAL"
|
||||||
|
|
||||||
private val DAILY = "DAILY"
|
private val DAILY = "DAILY"
|
||||||
|
@ -171,14 +172,23 @@ class IcsParser {
|
||||||
private fun parseRepeatInterval(fullString: String): Int {
|
private fun parseRepeatInterval(fullString: String): Int {
|
||||||
val parts = fullString.split(";")
|
val parts = fullString.split(";")
|
||||||
var frequencySeconds = 0
|
var frequencySeconds = 0
|
||||||
|
var count = 0
|
||||||
for (part in parts) {
|
for (part in parts) {
|
||||||
val keyValue = part.split("=")
|
val keyValue = part.split("=")
|
||||||
if (keyValue[0] == FREQ) {
|
val key = keyValue[0]
|
||||||
frequencySeconds = getFrequencySeconds(keyValue[1])
|
val value = keyValue[1]
|
||||||
} else if (keyValue[0] == INTERVAL) {
|
if (key == FREQ) {
|
||||||
return frequencySeconds * keyValue[1].toInt()
|
frequencySeconds = getFrequencySeconds(value)
|
||||||
} else if (keyValue[0] == UNTIL) {
|
} else if (key == COUNT) {
|
||||||
curRepeatLimit = parseDateTimeValue(keyValue[1])
|
count = 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
|
||||||
|
return repeatInterval
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return frequencySeconds
|
return frequencySeconds
|
||||||
|
|
Loading…
Reference in New Issue