add parsing Last-Modified field at importing .ics events
This commit is contained in:
parent
d89c723af7
commit
0b12748966
|
@ -76,6 +76,7 @@ val BEGIN_ALARM = "BEGIN:VALARM"
|
||||||
val END_ALARM = "END:VALARM"
|
val END_ALARM = "END:VALARM"
|
||||||
val DTSTART = "DTSTART"
|
val DTSTART = "DTSTART"
|
||||||
val DTEND = "DTEND"
|
val DTEND = "DTEND"
|
||||||
|
val LAST_MODIFIED = "LAST-MODIFIED"
|
||||||
val DURATION = "DURATION:"
|
val DURATION = "DURATION:"
|
||||||
val SUMMARY = "SUMMARY"
|
val SUMMARY = "SUMMARY"
|
||||||
val DESCRIPTION = "DESCRIPTION:"
|
val DESCRIPTION = "DESCRIPTION:"
|
||||||
|
|
|
@ -25,6 +25,7 @@ class IcsImporter {
|
||||||
var curRepeatLimit = 0
|
var curRepeatLimit = 0
|
||||||
var curRepeatRule = 0
|
var curRepeatRule = 0
|
||||||
var curEventType = DBHelper.REGULAR_EVENT_TYPE_ID
|
var curEventType = DBHelper.REGULAR_EVENT_TYPE_ID
|
||||||
|
var curLastModified = 0L
|
||||||
var isNotificationDescription = false
|
var isNotificationDescription = false
|
||||||
var lastReminderAction = ""
|
var lastReminderAction = ""
|
||||||
|
|
||||||
|
@ -84,6 +85,8 @@ class IcsImporter {
|
||||||
} else if (line.startsWith(CATEGORIES)) {
|
} else if (line.startsWith(CATEGORIES)) {
|
||||||
val categories = line.substring(CATEGORIES.length)
|
val categories = line.substring(CATEGORIES.length)
|
||||||
tryAddCategories(categories, context)
|
tryAddCategories(categories, context)
|
||||||
|
} else if (line.startsWith(LAST_MODIFIED)) {
|
||||||
|
curLastModified = getTimestamp(line.substring(LAST_MODIFIED.length)) * 1000L
|
||||||
} else if (line.startsWith(EXDATE)) {
|
} else if (line.startsWith(EXDATE)) {
|
||||||
curRepeatExceptions.add(getTimestamp(line.substring(EXDATE.length)))
|
curRepeatExceptions.add(getTimestamp(line.substring(EXDATE.length)))
|
||||||
} else if (line == END_EVENT) {
|
} else if (line == END_EVENT) {
|
||||||
|
@ -95,7 +98,7 @@ class IcsImporter {
|
||||||
|
|
||||||
val event = Event(0, curStart, curEnd, curTitle, curDescription, curReminderMinutes.getOrElse(0, { -1 }),
|
val event = Event(0, curStart, curEnd, curTitle, curDescription, curReminderMinutes.getOrElse(0, { -1 }),
|
||||||
curReminderMinutes.getOrElse(1, { -1 }), curReminderMinutes.getOrElse(2, { -1 }), curRepeatInterval,
|
curReminderMinutes.getOrElse(1, { -1 }), curReminderMinutes.getOrElse(2, { -1 }), curRepeatInterval,
|
||||||
curImportId, curFlags, curRepeatLimit, curRepeatRule, curEventType)
|
curImportId, curFlags, curRepeatLimit, curRepeatRule, curEventType, lastUpdated = curLastModified)
|
||||||
|
|
||||||
if (event.isAllDay && curEnd > curStart) {
|
if (event.isAllDay && curEnd > curStart) {
|
||||||
event.endTS -= DAY
|
event.endTS -= DAY
|
||||||
|
@ -197,6 +200,7 @@ class IcsImporter {
|
||||||
curRepeatLimit = 0
|
curRepeatLimit = 0
|
||||||
curRepeatRule = 0
|
curRepeatRule = 0
|
||||||
curEventType = DBHelper.REGULAR_EVENT_TYPE_ID
|
curEventType = DBHelper.REGULAR_EVENT_TYPE_ID
|
||||||
|
curLastModified = 0L
|
||||||
isNotificationDescription = false
|
isNotificationDescription = false
|
||||||
lastReminderAction = ""
|
lastReminderAction = ""
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue