From 07f8685741253be50216694524e6753876d03c68 Mon Sep 17 00:00:00 2001 From: saunaklogan Date: Mon, 4 May 2020 21:23:21 +0530 Subject: [PATCH 1/3] Fix for parsing .ics file when the key BYMONTHDAY is present in the .ics file. --- .../com/simplemobiletools/calendar/pro/helpers/Parser.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Parser.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Parser.kt index 81e480568..f868d5e50 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Parser.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Parser.kt @@ -60,8 +60,11 @@ class Parser { } else if (repeatInterval.isXMonthlyRepetition() || repeatInterval.isXYearlyRepetition()) { repeatRule = if (value.startsWith("-1")) REPEAT_ORDER_WEEKDAY_USE_LAST else REPEAT_ORDER_WEEKDAY } - } else if (key == BYMONTHDAY && value.toInt() == -1) { - repeatRule = REPEAT_LAST_DAY + } else if (key == BYMONTHDAY) { + val byMonthDayValueArray = value.split(",") + val intFlag = byMonthDayValueArray.find { it.toInt() == -1 } + if (intFlag == null) + repeatRule = REPEAT_LAST_DAY } } return EventRepetition(repeatInterval, repeatRule, repeatLimit) From 0b07825fd340063296602687d510e54633ff12ce Mon Sep 17 00:00:00 2001 From: saunaklogan Date: Mon, 4 May 2020 22:18:12 +0530 Subject: [PATCH 2/3] Fix for parsing .ics file when the key BYMONTHDAY is present in the .ics file. Earlier commit had a wrong check which has been updated. --- .../kotlin/com/simplemobiletools/calendar/pro/helpers/Parser.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Parser.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Parser.kt index f868d5e50..e4ee0a0e3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Parser.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Parser.kt @@ -63,7 +63,7 @@ class Parser { } else if (key == BYMONTHDAY) { val byMonthDayValueArray = value.split(",") val intFlag = byMonthDayValueArray.find { it.toInt() == -1 } - if (intFlag == null) + if (intFlag != null) repeatRule = REPEAT_LAST_DAY } } From 5538daf4098b03078e7b878432c36eaa991ffc05 Mon Sep 17 00:00:00 2001 From: Tibor Kaputa Date: Tue, 5 May 2020 09:50:15 +0200 Subject: [PATCH 3/3] tweaking a repetition rule check --- .../com/simplemobiletools/calendar/pro/helpers/Parser.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Parser.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Parser.kt index e4ee0a0e3..b9420dac7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Parser.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Parser.kt @@ -61,10 +61,9 @@ class Parser { repeatRule = if (value.startsWith("-1")) REPEAT_ORDER_WEEKDAY_USE_LAST else REPEAT_ORDER_WEEKDAY } } else if (key == BYMONTHDAY) { - val byMonthDayValueArray = value.split(",") - val intFlag = byMonthDayValueArray.find { it.toInt() == -1 } - if (intFlag != null) + if (value.split(",").any { it.toInt() == -1 }) { repeatRule = REPEAT_LAST_DAY + } } } return EventRepetition(repeatInterval, repeatRule, repeatLimit)