From 238250e8c900dfcb4902d035c4f41b956e5c3691 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Szczodrzy=C5=84ski?= Date: Mon, 6 Apr 2020 19:28:04 +0200 Subject: [PATCH] [API/Mobidziennik] Fix homework attachment downloading. --- .../pl/szczodrzynski/edziennik/data/api/Regexes.kt | 2 +- .../data/web/MobidziennikWebGetAttachment.kt | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Regexes.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Regexes.kt index 8ad2a505..57dceb0e 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Regexes.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Regexes.kt @@ -97,7 +97,7 @@ object Regexes { """zadanieFormularz\(([0-9]+),""".toRegex(DOT_MATCHES_ALL) } val MOBIDZIENNIK_HOMEWORK_ATTACHMENT by lazy { - """zalacznik=([0-9]+)'.+?word-break">(.+?)""".toRegex(DOT_MATCHES_ALL) + """zalacznik(_zadania)?=([0-9]+)'.+?word-break">(.+?)""".toRegex(DOT_MATCHES_ALL) } diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebGetAttachment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebGetAttachment.kt index 1bb660c1..f25cee82 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebGetAttachment.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebGetAttachment.kt @@ -29,14 +29,14 @@ class MobidziennikWebGetAttachment(override val data: DataMobidziennik, val typeUrl = when (owner) { is Message -> if (owner.type == Message.TYPE_SENT) - "dziennik/wiadwyslana?id=" + "dziennik/wiadwyslana/?id=" else - "dziennik/wiadodebrana?id=" + "dziennik/wiadodebrana/?id=" is Event -> if (owner.date >= Date.getToday()) - "mobile/zadaniadomowe?id_zadania=" + "dziennik/zadaniedomowe/?id_zadania=" else - "mobile/zadaniadomowearchiwalne?id_zadania=" + "dziennik/zadaniedomowe/?id_zadania=" else -> "" } @@ -47,7 +47,7 @@ class MobidziennikWebGetAttachment(override val data: DataMobidziennik, else -> -1 } - webGetFile(TAG, "/$typeUrl${ownerId}&zalacznik=$attachmentId", targetFile, { file -> + webGetFile(TAG, "/$typeUrl${ownerId}&uczen=${data.studentId}&zalacznik=$attachmentId", targetFile, { file -> val event = AttachmentGetEvent( profileId,