Skip to content

Fix JtxICalObject update mistakes#263

Open
sunkup wants to merge 5 commits intoical4j-3to4from
256-ical4j-4x-fix-failing-jtx-board-tests
Open

Fix JtxICalObject update mistakes#263
sunkup wants to merge 5 commits intoical4j-3to4from
256-ical4j-4x-fix-failing-jtx-board-tests

Conversation

@sunkup
Copy link
Member

@sunkup sunkup commented Mar 26, 2026

Made some mistakes when updating JtxICalObject this PR fixes them.

  • timezone issues with dtstart and due
  • add() and addAll() for lists from ical4j, don't alter the existing list, but instead return a a copy with the added elements. Always use that new list.
  • restructure/deduplicate some of the when{} blocks for simplicity

Also fixes empty VTODOs being uploaded (#250).

@sunkup sunkup self-assigned this Mar 26, 2026
@sunkup sunkup force-pushed the 256-ical4j-4x-fix-failing-jtx-board-tests branch from 79b8666 to cb9c22e Compare March 26, 2026 10:21
@sunkup sunkup marked this pull request as ready for review March 26, 2026 10:32
@rfc2822
Copy link
Member

rfc2822 commented Mar 26, 2026

Which issues does this PR address? There's no reference in the PR. I guess both #250 and #256?

@rfc2822 rfc2822 self-requested a review March 26, 2026 10:44
@rfc2822 rfc2822 added the jtx Board Related to jtx Board label Mar 26, 2026
@sunkup sunkup force-pushed the 256-ical4j-4x-fix-failing-jtx-board-tests branch from 6ae3e03 to ca2d8c1 Compare March 26, 2026 12:52
@sunkup sunkup requested a review from cketti March 26, 2026 13:08
@sunkup
Copy link
Member Author

sunkup commented Mar 26, 2026

@cketti You removed the Temporal.toEpochMilli from the DateUtils. It's currently still needed in JtxICalObject for jtx board, unless you have some other smart way to convert any temporal to timestamps (?), so I added it to the new TimeApiExtensions.

I added you as a reviewer here because of that change :)

@cketti
Copy link
Contributor

cketti commented Mar 26, 2026

@cketti You removed the Temporal.toEpochMilli from the DateUtils. It's currently still needed in JtxICalObject for jtx board, unless you have some other smart way to convert any temporal to timestamps (?), so I added it to the new TimeApiExtensions.

Use Temporal.toTimestamp() from AndroidTimeUtils.

@sunkup
Copy link
Member Author

sunkup commented Mar 26, 2026

Use Temporal.toTimestamp() from AndroidTimeUtils.

Ok. Tests fail then, so seems like it behaves slightly different. I will investigate that.

Edit: Zone offset was wrong by 2 ours when using Temporal.toEpochMilli. Works again now with Temporal.toTimestamp().

iCalObject.rdate = rdateList.toTypedArray().joinToString(separator = ",")
iCalObject.rdate = buildList {
if(!iCalObject.rdate.isNullOrEmpty())
add(JtxContract.getLongListFromString(iCalObject.rdate!!))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be be addAll().

iCalObject.exdate = exdateList.toTypedArray().joinToString(separator = ",")
iCalObject.exdate = buildList {
if(!iCalObject.exdate.isNullOrEmpty())
add(JtxContract.getLongListFromString(iCalObject.exdate!!))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be be addAll().

private fun addProperties(props: PropertyList) {
uid.let { props += Uid(it) }
sequence.let { props += Sequence(it.toInt()) }
private fun addProperties(props: PropertyList): PropertyList? {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tip for the future: If you renamed the function parameter and used the name props for the mutable list, the body could have remained mostly unchanged. That makes the change easier to review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jtx Board Related to jtx Board

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ical4j 4.x] Fix failing jtx Board tests [ical4j 4.x] Uploaded jtx Board tasks always empty

3 participants