properly handle exporting and importing during day reminders
This commit is contained in:
parent
2ff02baeff
commit
b85b4e3acf
|
@ -95,7 +95,9 @@ class IcsExporter {
|
||||||
writeLn("$ATTENDEE$MAILTO$attendee")
|
writeLn("$ATTENDEE$MAILTO$attendee")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
writeLn("$TRIGGER-${Parser().getDurationCode(reminder.minutes.toLong())}")
|
|
||||||
|
val sign = if (reminder.minutes < -1) "" else "-"
|
||||||
|
writeLn("$TRIGGER$sign${Parser().getDurationCode(Math.abs(reminder.minutes.toLong()))}")
|
||||||
writeLn(END_ALARM)
|
writeLn(END_ALARM)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,7 +113,11 @@ class IcsImporter(val activity: SimpleActivity) {
|
||||||
curReminderTriggerAction = if (action == DISPLAY) REMINDER_NOTIFICATION else REMINDER_EMAIL
|
curReminderTriggerAction = if (action == DISPLAY) REMINDER_NOTIFICATION else REMINDER_EMAIL
|
||||||
}
|
}
|
||||||
} else if (line.startsWith(TRIGGER)) {
|
} else if (line.startsWith(TRIGGER)) {
|
||||||
curReminderTriggerMinutes = Parser().parseDurationSeconds(line.substring(TRIGGER.length)) / 60
|
val value = line.substring(TRIGGER.length)
|
||||||
|
curReminderTriggerMinutes = Parser().parseDurationSeconds(value) / 60
|
||||||
|
if (!value.startsWith("-")) {
|
||||||
|
curReminderTriggerMinutes *= -1
|
||||||
|
}
|
||||||
} else if (line.startsWith(CATEGORY_COLOR)) {
|
} else if (line.startsWith(CATEGORY_COLOR)) {
|
||||||
val color = line.substring(CATEGORY_COLOR.length)
|
val color = line.substring(CATEGORY_COLOR.length)
|
||||||
if (color.trimStart('-').areDigitsOnly()) {
|
if (color.trimStart('-').areDigitsOnly()) {
|
||||||
|
|
|
@ -230,10 +230,12 @@ class Parser {
|
||||||
days = Math.floor((remainder / DAY_MINUTES).toDouble()).toInt()
|
days = Math.floor((remainder / DAY_MINUTES).toDouble()).toInt()
|
||||||
remainder -= days * DAY_MINUTES
|
remainder -= days * DAY_MINUTES
|
||||||
}
|
}
|
||||||
|
|
||||||
if (remainder >= 60) {
|
if (remainder >= 60) {
|
||||||
hours = Math.floor((remainder / 60).toDouble()).toInt()
|
hours = Math.floor((remainder / 60).toDouble()).toInt()
|
||||||
remainder -= hours * 60
|
remainder -= hours * 60
|
||||||
}
|
}
|
||||||
|
|
||||||
return "P${days}DT${hours}H${remainder}M0S"
|
return "P${days}DT${hours}H${remainder}M0S"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue