fix #596, make sure the proper event date is shown at all-day events
This commit is contained in:
parent
74387b2b76
commit
984769a438
|
@ -32,8 +32,8 @@ import com.simplemobiletools.calendar.receivers.CalDAVSyncReceiver
|
||||||
import com.simplemobiletools.calendar.receivers.NotificationReceiver
|
import com.simplemobiletools.calendar.receivers.NotificationReceiver
|
||||||
import com.simplemobiletools.calendar.services.SnoozeService
|
import com.simplemobiletools.calendar.services.SnoozeService
|
||||||
import com.simplemobiletools.commons.extensions.*
|
import com.simplemobiletools.commons.extensions.*
|
||||||
import com.simplemobiletools.commons.helpers.DAY_SECONDS
|
|
||||||
import com.simplemobiletools.commons.helpers.SILENT
|
import com.simplemobiletools.commons.helpers.SILENT
|
||||||
|
import com.simplemobiletools.commons.helpers.WEEK_SECONDS
|
||||||
import com.simplemobiletools.commons.helpers.YEAR_SECONDS
|
import com.simplemobiletools.commons.helpers.YEAR_SECONDS
|
||||||
import com.simplemobiletools.commons.helpers.isOreoPlus
|
import com.simplemobiletools.commons.helpers.isOreoPlus
|
||||||
import org.joda.time.DateTime
|
import org.joda.time.DateTime
|
||||||
|
@ -161,13 +161,16 @@ fun Context.notifyEvent(originalEvent: Event) {
|
||||||
var event = originalEvent.copy()
|
var event = originalEvent.copy()
|
||||||
val currentSeconds = getNowSeconds()
|
val currentSeconds = getNowSeconds()
|
||||||
|
|
||||||
|
var eventStartTS = if (event.getIsAllDay()) Formatter.getDayStartTS(Formatter.getDayCodeFromTS(event.startTS)) else event.startTS
|
||||||
// make sure refer to the proper repeatable event instance with "Tomorrow", or the specific date
|
// make sure refer to the proper repeatable event instance with "Tomorrow", or the specific date
|
||||||
if (event.repeatInterval != 0 && event.startTS - event.reminder1Minutes * 60 < currentSeconds) {
|
if (event.repeatInterval != 0 && eventStartTS - event.reminder1Minutes * 60 < currentSeconds) {
|
||||||
val events = dbHelper.getRepeatableEventsFor(currentSeconds - DAY_SECONDS, currentSeconds + YEAR_SECONDS, event.id)
|
val events = dbHelper.getRepeatableEventsFor(currentSeconds - WEEK_SECONDS, currentSeconds + YEAR_SECONDS, event.id)
|
||||||
for (currEvent in events) {
|
for (currEvent in events) {
|
||||||
if (currEvent.startTS - currEvent.reminder1Minutes * 60 > currentSeconds) {
|
eventStartTS = if (currEvent.getIsAllDay()) Formatter.getDayStartTS(Formatter.getDayCodeFromTS(currEvent.startTS)) else currEvent.startTS
|
||||||
|
if (eventStartTS - currEvent.reminder1Minutes * 60 > currentSeconds) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
event = currEvent
|
event = currEvent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue