From 64019dccf786db58d5b4bdcd49139051ea40dc11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Szczodrzy=C5=84ski?= Date: Fri, 1 Nov 2019 22:30:39 +0100 Subject: [PATCH] [APIv2/Vulcan] Update uonet-request-signer. Update removing profile. Fix minor issues. --- app/build.gradle | 2 +- .../edziennik/api/v2/vulcan/data/VulcanApi.kt | 2 +- .../edziennik/api/v2/vulcan/data/api/VulcanApiEvents.kt | 2 +- .../edziennik/api/v2/vulcan/firstlogin/VulcanFirstLogin.kt | 2 +- .../pl/szczodrzynski/edziennik/data/api/Edziennik.java | 7 +++++++ 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 70a7de7f..8a721d8e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -161,7 +161,7 @@ dependencies { implementation "org.redundent:kotlin-xml-builder:1.5.3" - implementation "io.github.wulkanowy:signer-android:0.1.0" + implementation "io.github.wulkanowy:signer-android:0.1.1" } repositories { mavenCentral() diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/vulcan/data/VulcanApi.kt b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/vulcan/data/VulcanApi.kt index b9ebda85..0345c0a0 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/vulcan/data/VulcanApi.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/vulcan/data/VulcanApi.kt @@ -40,7 +40,7 @@ open class VulcanApi(open val data: DataVulcan) { d(tag, "Request: Vulcan/Api - $url") if (data.teamList.size() == 0) { - data.profile?.getStudentData("studentClassName", null)?.also { name -> + data.profile?.studentClassName?.also { name -> val id = Utils.crc16(name.toByteArray()).toLong() val teamObject = Team( diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/vulcan/data/api/VulcanApiEvents.kt b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/vulcan/data/api/VulcanApiEvents.kt index c24129b6..d971118c 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/vulcan/data/api/VulcanApiEvents.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/vulcan/data/api/VulcanApiEvents.kt @@ -63,7 +63,7 @@ class VulcanApiEvents(override val data: DataVulcan, private val isHomework: Boo else -> Event.TYPE_EXAM } } - val teamId = event.getLong("IdOddzial") ?: data.teamClass?.id ?: return@forEach + val teamId = event.getLong("IdOddzial") ?: data.teamClass?.id ?: -1 val eventObject = Event( profileId, diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/vulcan/firstlogin/VulcanFirstLogin.kt b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/vulcan/firstlogin/VulcanFirstLogin.kt index 3d0b0a44..61f38f53 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/vulcan/firstlogin/VulcanFirstLogin.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/vulcan/firstlogin/VulcanFirstLogin.kt @@ -44,7 +44,7 @@ class VulcanFirstLogin(val data: DataVulcan, val onSuccess: () -> Unit) { val studentId = student.getInt("Id") ?: return@forEach val studentLoginId = student.getInt("UzytkownikLoginId") ?: return@forEach val studentClassId = student.getInt("IdOddzial") ?: return@forEach - val studentClassName = student.getString("OkresPoziom").toString() + student.getString("OddzialSymbol") + val studentClassName = student.getString("OkresPoziom").toString() + (student.getString("OddzialSymbol") ?: return@forEach) val studentSemesterId = student.getInt("IdOkresKlasyfikacyjny") ?: return@forEach val studentFirstName = student.getString("Imie") ?: "" val studentLastName = student.getString("Nazwisko") ?: "" diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Edziennik.java b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Edziennik.java index e21a12dc..7b9997ca 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Edziennik.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Edziennik.java @@ -1161,6 +1161,13 @@ public class Edziennik { app.db.teamDao().clear(profileId); app.db.messageRecipientDao().clear(profileId); app.db.messageDao().clear(profileId); + app.db.endpointTimerDao().clear(profileId); + app.db.attendanceTypeDao().clear(profileId); + app.db.classroomDao().clear(profileId); + app.db.lessonRangeDao().clear(profileId); + app.db.noticeTypeDao().clear(profileId); + app.db.teacherAbsenceDao().clear(profileId); + app.db.teacherAbsenceTypeDao().clear(profileId); int loginStoreId = profileObject.getLoginStoreId(); List profilesUsingLoginStore = app.db.profileDao().getIdsByLoginStoreIdNow(loginStoreId);