From 485b126d510a0fb2cc6cd8870a2bf856c7c5d474 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 28 Jul 2017 22:32:58 +0200 Subject: [PATCH] apply the default calendar reminders where appropriate --- .../calendar/activities/SettingsActivity.kt | 2 +- .../calendar/asynctasks/FetchGoogleEventsTask.kt | 5 +++++ .../com/simplemobiletools/calendar/helpers/Constants.kt | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SettingsActivity.kt index adb6659df..715c447af 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SettingsActivity.kt @@ -392,7 +392,7 @@ class SettingsActivity : SimpleActivity() { reminderMinutes.add(it.minutes) } } - config.googleDefaultReminders = reminderMinutes.joinToString() + config.googleDefaultReminders = reminderMinutes.joinToString(",") } override fun onRequestPermissionsResult(requestCode: Int, permissions: Array, grantResults: IntArray) { diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/asynctasks/FetchGoogleEventsTask.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/asynctasks/FetchGoogleEventsTask.kt index ecc9559ea..96c86fbbf 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/asynctasks/FetchGoogleEventsTask.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/asynctasks/FetchGoogleEventsTask.kt @@ -216,6 +216,11 @@ class FetchGoogleEventsTask(val context: Context, val googleSyncListener: Google reminderMinutes.add(minutes) } } + } else if (json?.has(USE_DEFAULT) == true) { + val minutes = context.config.googleDefaultReminders.splitToSequence(',') + minutes.forEach { + reminderMinutes.add(it.toInt()) + } } return reminderMinutes } diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/Constants.kt index 52d8392b8..be46055d7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/Constants.kt @@ -131,3 +131,4 @@ val OPERATION_UPDATE = 2 val OPERATION_DELETE = 3 val OVERRIDES = "overrides" val DEFAULT_REMINDERS = "defaultReminders" +val USE_DEFAULT = "useDefault"