From 85106a01d73344eb5f256675b1a674ef89766951 Mon Sep 17 00:00:00 2001 From: Kacper Ziubryniewicz Date: Thu, 30 Apr 2020 21:41:42 +0200 Subject: [PATCH] [API/Librus] Add online lesson URL to events description. --- .../data/api/edziennik/librus/data/api/LibrusApiEvents.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiEvents.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiEvents.kt index 5999a48e..7a76f88e 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiEvents.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiEvents.kt @@ -35,7 +35,7 @@ class LibrusApiEvents(override val data: DataLibrus, events?.forEach { event -> val id = event.getLong("Id") ?: return@forEach val eventDate = Date.fromY_m_d(event.getString("Date")) - val topic = event.getString("Content")?.trim() ?: "" + var topic = event.getString("Content")?.trim() ?: "" val type = event.getJsonObject("Category")?.getLong("Id") ?: -1 val teacherId = event.getJsonObject("CreatedBy")?.getLong("Id") ?: -1 val subjectId = event.getJsonObject("Subject")?.getLong("Id") ?: -1 @@ -46,6 +46,12 @@ class LibrusApiEvents(override val data: DataLibrus, val startTime = lessonRange?.startTime ?: Time.fromH_m(event.getString("TimeFrom")) val addedDate = Date.fromIso(event.getString("AddDate")) + event.getJsonObject("onlineLessonUrl")?.let { onlineLesson -> + val text = onlineLesson.getString("text")?.let { "$it - " } ?: "" + val url = onlineLesson.getString("url") + topic += "\n\n$text$url" + } + val eventObject = Event( profileId = profileId, id = id,