diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/VulcanFeatures.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/VulcanFeatures.kt index bf6c080b..859d7f20 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/VulcanFeatures.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/VulcanFeatures.kt @@ -7,7 +7,7 @@ package pl.szczodrzynski.edziennik.data.api.edziennik.vulcan import pl.szczodrzynski.edziennik.data.api.* import pl.szczodrzynski.edziennik.data.api.models.Feature -const val ENDPOINT_VULCAN_API_STUDENT_LIST = 1000 +const val ENDPOINT_VULCAN_API_UPDATE_SEMESTER = 1000 const val ENDPOINT_VULCAN_API_DICTIONARIES = 1010 const val ENDPOINT_VULCAN_API_TIMETABLE = 1020 const val ENDPOINT_VULCAN_API_EVENTS = 1030 @@ -54,7 +54,7 @@ val VulcanFeatures = listOf( ), listOf(LOGIN_METHOD_VULCAN_API)), Feature(LOGIN_TYPE_VULCAN, FEATURE_ALWAYS_NEEDED, listOf( - ENDPOINT_VULCAN_API_STUDENT_LIST to LOGIN_METHOD_VULCAN_API, + ENDPOINT_VULCAN_API_UPDATE_SEMESTER to LOGIN_METHOD_VULCAN_API, ENDPOINT_VULCAN_API_DICTIONARIES to LOGIN_METHOD_VULCAN_API ), listOf(LOGIN_METHOD_VULCAN_API)) /*Feature(LOGIN_TYPE_VULCAN, FEATURE_STUDENT_INFO, listOf( diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/VulcanData.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/VulcanData.kt index 378c5102..c24de472 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/VulcanData.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/VulcanData.kt @@ -36,6 +36,10 @@ class VulcanData(val data: DataVulcan, val onSuccess: () -> Unit) { private fun useEndpoint(endpointId: Int, onSuccess: () -> Unit) { Utils.d(TAG, "Using endpoint $endpointId") when (endpointId) { + ENDPOINT_VULCAN_API_UPDATE_SEMESTER -> { + data.startProgress(R.string.edziennik_progress_endpoint_student_info) + VulcanApiUpdateSemester(data, onSuccess) + } ENDPOINT_VULCAN_API_DICTIONARIES -> { data.startProgress(R.string.edziennik_progress_endpoint_dictionaries) VulcanApiDictionaries(data, onSuccess) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/login/VulcanApiUpdateSemester.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/api/VulcanApiUpdateSemester.kt similarity index 90% rename from app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/login/VulcanApiUpdateSemester.kt rename to app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/api/VulcanApiUpdateSemester.kt index e0518f9c..a5ce9189 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/login/VulcanApiUpdateSemester.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/api/VulcanApiUpdateSemester.kt @@ -1,13 +1,14 @@ /* - * Copyright (c) Kuba SzczodrzyƄski 2020-1-3. + * Copyright (c) Kuba SzczodrzyƄski 2020-2-1. */ -package pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.login +package pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.data.api import pl.szczodrzynski.edziennik.* import pl.szczodrzynski.edziennik.data.api.ERROR_NO_STUDENTS_IN_ACCOUNT import pl.szczodrzynski.edziennik.data.api.VULCAN_API_ENDPOINT_STUDENT_LIST import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.DataVulcan +import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.ENDPOINT_VULCAN_API_UPDATE_SEMESTER import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.data.VulcanApi import pl.szczodrzynski.edziennik.data.api.models.ApiError import pl.szczodrzynski.edziennik.utils.models.Date @@ -66,6 +67,7 @@ class VulcanApiUpdateSemester(override val data: DataVulcan, val onSuccess: () - dateYearEnd?.let { profile.dateYearEnd = it } } + data.setSyncNext(ENDPOINT_VULCAN_API_UPDATE_SEMESTER, if (data.studentSemesterNumber == 2) 7*DAY else 2*DAY) onSuccess() } } ?: onSuccess()} diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/login/VulcanLoginApi.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/login/VulcanLoginApi.kt index 1332bbe7..cd83c926 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/login/VulcanLoginApi.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/login/VulcanLoginApi.kt @@ -13,6 +13,7 @@ import io.github.wulkanowy.signer.android.getPrivateKeyFromCert import pl.szczodrzynski.edziennik.currentTimeUnix import pl.szczodrzynski.edziennik.data.api.* import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.DataVulcan +import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.data.api.VulcanApiUpdateSemester import pl.szczodrzynski.edziennik.data.api.models.ApiError import pl.szczodrzynski.edziennik.getJsonObject import pl.szczodrzynski.edziennik.getString