Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 04dcf5ca authored by Patrick Lang's avatar Patrick Lang Committed by GitHub
Browse files

Refactored ics-generation, using ical4android now

parent d7ef7a2a
Loading
Loading
Loading
Loading
+15 −5
Original line number Diff line number Diff line
@@ -535,11 +535,11 @@ open class JtxICalObject(
    }

    /**
     * Takes the current JtxICalObject, transforms it to an iCalendar and writes it in an OutputStream
     * @param [os] OutputStream where iCalendar should be written to
     * Takes the current JtxICalObject and transforms it to a Calendar (ical4j)
     * @return The current JtxICalObject transformed into a ical4j Calendar
     */
    @UsesThreadContextClassLoader
    fun write(os: OutputStream) {
    fun getICalendarFormat(): Calendar? {
        Ical4Android.checkThreadContextClassLoader()

        val ical = Calendar()
@@ -549,7 +549,7 @@ open class JtxICalObject(
        val calComponent = when (component) {
            JtxContract.JtxICalObject.Component.VTODO.name -> VToDo(true /* generates DTSTAMP */)
            JtxContract.JtxICalObject.Component.VJOURNAL.name -> VJournal(true /* generates DTSTAMP */)
            else -> return
            else -> return null
        }
        ical.components += calComponent
        addProperties(calComponent.properties)
@@ -625,7 +625,17 @@ open class JtxICalObject(
        }

        ICalendar.softValidate(ical)
        CalendarOutputter(false).output(ical, os)
        return ical
    }

    /**
     * Takes the current JtxICalObject, transforms it to an iCalendar and writes it in an OutputStream
     * @param [os] OutputStream where iCalendar should be written to
     */
    @UsesThreadContextClassLoader
    fun write(os: OutputStream) {
        Ical4Android.checkThreadContextClassLoader()
        CalendarOutputter(false).output(this.getICalendarFormat(), os)
    }

    /**