From a6c40538964c3834016197231ba4e0fc4c5dba7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Szczodrzy=C5=84ski?= Date: Tue, 31 Mar 2020 15:18:34 +0200 Subject: [PATCH] [API] Add interface method to get event details. --- .../data/api/edziennik/EdziennikTask.kt | 4 ++++ .../api/edziennik/edudziennik/Edudziennik.kt | 2 ++ .../data/api/edziennik/idziennik/Idziennik.kt | 3 +++ .../data/api/edziennik/librus/Librus.kt | 3 +++ .../edziennik/mobidziennik/Mobidziennik.kt | 3 +++ .../data/api/edziennik/template/Template.kt | 5 +++++ .../data/api/edziennik/vulcan/Vulcan.kt | 21 ++++++------------- .../data/api/interfaces/EdziennikInterface.kt | 2 ++ 8 files changed, 28 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/EdziennikTask.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/EdziennikTask.kt index db8186c9..773db107 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/EdziennikTask.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/EdziennikTask.kt @@ -22,6 +22,7 @@ import pl.szczodrzynski.edziennik.data.db.entity.LoginStore import pl.szczodrzynski.edziennik.data.db.entity.Message import pl.szczodrzynski.edziennik.data.db.entity.Teacher import pl.szczodrzynski.edziennik.data.db.full.AnnouncementFull +import pl.szczodrzynski.edziennik.data.db.full.EventFull import pl.szczodrzynski.edziennik.data.db.full.MessageFull open class EdziennikTask(override val profileId: Int, val request: Any) : IApiTask(profileId) { @@ -38,6 +39,7 @@ open class EdziennikTask(override val profileId: Int, val request: Any) : IApiTa fun announcementGet(profileId: Int, announcement: AnnouncementFull) = EdziennikTask(profileId, AnnouncementGetRequest(announcement)) fun attachmentGet(profileId: Int, message: Message, attachmentId: Long, attachmentName: String) = EdziennikTask(profileId, AttachmentGetRequest(message, attachmentId, attachmentName)) fun recipientListGet(profileId: Int) = EdziennikTask(profileId, RecipientListGetRequest()) + fun eventGet(profileId: Int, event: EventFull) = EdziennikTask(profileId, EventGetRequest(event)) } private lateinit var loginStore: LoginStore @@ -94,6 +96,7 @@ open class EdziennikTask(override val profileId: Int, val request: Any) : IApiTa is AnnouncementGetRequest -> edziennikInterface?.getAnnouncement(request.announcement) is AttachmentGetRequest -> edziennikInterface?.getAttachment(request.message, request.attachmentId, request.attachmentName) is RecipientListGetRequest -> edziennikInterface?.getRecipientList() + is EventGetRequest -> edziennikInterface?.getEvent(request.event) } } @@ -115,4 +118,5 @@ open class EdziennikTask(override val profileId: Int, val request: Any) : IApiTa data class AnnouncementGetRequest(val announcement: AnnouncementFull) data class AttachmentGetRequest(val message: Message, val attachmentId: Long, val attachmentName: String) class RecipientListGetRequest + data class EventGetRequest(val event: EventFull) } diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/Edudziennik.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/Edudziennik.kt index 7bc50511..d64c1120 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/Edudziennik.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/Edudziennik.kt @@ -20,6 +20,7 @@ import pl.szczodrzynski.edziennik.data.db.entity.Message import pl.szczodrzynski.edziennik.data.db.entity.Profile import pl.szczodrzynski.edziennik.data.db.entity.Teacher import pl.szczodrzynski.edziennik.data.db.full.AnnouncementFull +import pl.szczodrzynski.edziennik.data.db.full.EventFull import pl.szczodrzynski.edziennik.data.db.full.MessageFull import pl.szczodrzynski.edziennik.utils.Utils.d @@ -96,6 +97,7 @@ class Edudziennik(val app: App, val profile: Profile?, val loginStore: LoginStor override fun getAttachment(message: Message, attachmentId: Long, attachmentName: String) {} override fun getRecipientList() {} + override fun getEvent(eventFull: EventFull) {} override fun firstLogin() { EdudziennikFirstLogin(data) { completed() } } override fun cancel() { diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/Idziennik.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/Idziennik.kt index be0d0d1c..bee25d2e 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/Idziennik.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/Idziennik.kt @@ -22,6 +22,7 @@ import pl.szczodrzynski.edziennik.data.db.entity.Message import pl.szczodrzynski.edziennik.data.db.entity.Profile import pl.szczodrzynski.edziennik.data.db.entity.Teacher import pl.szczodrzynski.edziennik.data.db.full.AnnouncementFull +import pl.szczodrzynski.edziennik.data.db.full.EventFull import pl.szczodrzynski.edziennik.data.db.full.MessageFull import pl.szczodrzynski.edziennik.utils.Utils.d @@ -119,6 +120,8 @@ class Idziennik(val app: App, val profile: Profile?, val loginStore: LoginStore, } } + override fun getEvent(eventFull: EventFull) {} + override fun firstLogin() { IdziennikFirstLogin(data) { completed() } } override fun cancel() { d(TAG, "Cancelled") diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/Librus.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/Librus.kt index 0a1ed593..e9eabdf7 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/Librus.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/Librus.kt @@ -24,6 +24,7 @@ import pl.szczodrzynski.edziennik.data.db.entity.Message import pl.szczodrzynski.edziennik.data.db.entity.Profile import pl.szczodrzynski.edziennik.data.db.entity.Teacher import pl.szczodrzynski.edziennik.data.db.full.AnnouncementFull +import pl.szczodrzynski.edziennik.data.db.full.EventFull import pl.szczodrzynski.edziennik.data.db.full.MessageFull import pl.szczodrzynski.edziennik.utils.Utils.d @@ -134,6 +135,8 @@ class Librus(val app: App, val profile: Profile?, val loginStore: LoginStore, va } } + override fun getEvent(eventFull: EventFull) {} + override fun firstLogin() { LibrusFirstLogin(data) { completed() } } override fun cancel() { d(TAG, "Cancelled") diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/Mobidziennik.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/Mobidziennik.kt index 5e08f6c4..b6497d77 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/Mobidziennik.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/Mobidziennik.kt @@ -22,6 +22,7 @@ import pl.szczodrzynski.edziennik.data.db.entity.Message import pl.szczodrzynski.edziennik.data.db.entity.Profile import pl.szczodrzynski.edziennik.data.db.entity.Teacher import pl.szczodrzynski.edziennik.data.db.full.AnnouncementFull +import pl.szczodrzynski.edziennik.data.db.full.EventFull import pl.szczodrzynski.edziennik.data.db.full.MessageFull import pl.szczodrzynski.edziennik.utils.Utils.d @@ -121,6 +122,8 @@ class Mobidziennik(val app: App, val profile: Profile?, val loginStore: LoginSto } } + override fun getEvent(eventFull: EventFull) {} + override fun firstLogin() { MobidziennikFirstLogin(data) { completed() } } override fun cancel() { d(TAG, "Cancelled") diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/Template.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/Template.kt index 9048bbcf..eaf4e1d3 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/Template.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/Template.kt @@ -20,6 +20,7 @@ import pl.szczodrzynski.edziennik.data.db.entity.Message import pl.szczodrzynski.edziennik.data.db.entity.Profile import pl.szczodrzynski.edziennik.data.db.entity.Teacher import pl.szczodrzynski.edziennik.data.db.full.AnnouncementFull +import pl.szczodrzynski.edziennik.data.db.full.EventFull import pl.szczodrzynski.edziennik.data.db.full.MessageFull import pl.szczodrzynski.edziennik.utils.Utils.d @@ -87,6 +88,10 @@ class Template(val app: App, val profile: Profile?, val loginStore: LoginStore, } + override fun getEvent(eventFull: EventFull) { + + } + override fun firstLogin() { TemplateFirstLogin(data) { completed() diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/Vulcan.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/Vulcan.kt index 4e6def85..24a47d66 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/Vulcan.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/Vulcan.kt @@ -23,6 +23,7 @@ import pl.szczodrzynski.edziennik.data.db.entity.Message import pl.szczodrzynski.edziennik.data.db.entity.Profile import pl.szczodrzynski.edziennik.data.db.entity.Teacher import pl.szczodrzynski.edziennik.data.db.full.AnnouncementFull +import pl.szczodrzynski.edziennik.data.db.full.EventFull import pl.szczodrzynski.edziennik.data.db.full.MessageFull import pl.szczodrzynski.edziennik.utils.Utils.d @@ -101,21 +102,11 @@ class Vulcan(val app: App, val profile: Profile?, val loginStore: LoginStore, va } } - override fun markAllAnnouncementsAsRead() { - - } - - override fun getAnnouncement(announcement: AnnouncementFull) { - - } - - override fun getAttachment(message: Message, attachmentId: Long, attachmentName: String) { - - } - - override fun getRecipientList() { - - } + override fun markAllAnnouncementsAsRead() {} + override fun getAnnouncement(announcement: AnnouncementFull) {} + override fun getAttachment(message: Message, attachmentId: Long, attachmentName: String) {} + override fun getRecipientList() {} + override fun getEvent(eventFull: EventFull) {} override fun firstLogin() { VulcanFirstLogin(data) { completed() } } override fun cancel() { diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/interfaces/EdziennikInterface.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/interfaces/EdziennikInterface.kt index e19a19ee..00a292ae 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/interfaces/EdziennikInterface.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/interfaces/EdziennikInterface.kt @@ -8,6 +8,7 @@ import com.google.gson.JsonObject import pl.szczodrzynski.edziennik.data.db.entity.Message import pl.szczodrzynski.edziennik.data.db.entity.Teacher import pl.szczodrzynski.edziennik.data.db.full.AnnouncementFull +import pl.szczodrzynski.edziennik.data.db.full.EventFull import pl.szczodrzynski.edziennik.data.db.full.MessageFull interface EdziennikInterface { @@ -18,6 +19,7 @@ interface EdziennikInterface { fun getAnnouncement(announcement: AnnouncementFull) fun getAttachment(message: Message, attachmentId: Long, attachmentName: String) fun getRecipientList() + fun getEvent(eventFull: EventFull) fun firstLogin() fun cancel() }