From 256f6c87326d58d719f400a9931f6ff42b05adb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Szczodrzy=C5=84ski?= Date: Fri, 26 Feb 2021 22:30:01 +0100 Subject: [PATCH] [Idziennik] Remove iDziennik implementation [*] --- .../edziennik/data/api/Errors.kt | 25 -- .../edziennik/data/api/LoginMethods.kt | 18 +- .../data/api/edziennik/EdziennikTask.kt | 2 - .../api/edziennik/idziennik/DataIdziennik.kt | 175 ------------- .../data/api/edziennik/idziennik/Idziennik.kt | 169 ------------- .../edziennik/idziennik/IdziennikFeatures.kt | 71 ------ .../edziennik/idziennik/data/IdziennikApi.kt | 118 --------- .../edziennik/idziennik/data/IdziennikData.kt | 91 ------- .../edziennik/idziennik/data/IdziennikWeb.kt | 238 ------------------ .../data/api/IdziennikApiCurrentRegister.kt | 92 ------- .../data/api/IdziennikApiMessagesInbox.kt | 99 -------- .../data/api/IdziennikApiMessagesSent.kt | 87 ------- .../data/web/IdziennikWebAnnouncements.kt | 78 ------ .../data/web/IdziennikWebAttendance.kt | 180 ------------- .../idziennik/data/web/IdziennikWebExams.kt | 127 ---------- .../data/web/IdziennikWebGetAttachment.kt | 64 ----- .../data/web/IdziennikWebGetHomework.kt | 57 ----- .../web/IdziennikWebGetHomeworkAttachment.kt | 100 -------- .../data/web/IdziennikWebGetMessage.kt | 109 -------- .../data/web/IdziennikWebGetRecipientList.kt | 78 ------ .../idziennik/data/web/IdziennikWebGrades.kt | 178 ------------- .../data/web/IdziennikWebHomework.kt | 100 -------- .../idziennik/data/web/IdziennikWebNotices.kt | 84 ------- .../data/web/IdziennikWebProposedGrades.kt | 152 ----------- .../data/web/IdziennikWebSendMessage.kt | 69 ----- .../data/web/IdziennikWebSwitchRegister.kt | 36 --- .../data/web/IdziennikWebTimetable.kt | 194 -------------- .../firstlogin/IdziennikFirstLogin.kt | 97 ------- .../idziennik/login/IdziennikLogin.kt | 59 ----- .../idziennik/login/IdziennikLoginApi.kt | 22 -- .../idziennik/login/IdziennikLoginWeb.kt | 178 ------------- .../edziennik/ui/modules/login/LoginInfo.kt | 45 ---- .../res/drawable/login_help_iuczniowie.webp | Bin 12892 -> 0 bytes .../res/drawable/login_logo_iuczniowie.png | Bin 14082 -> 0 bytes app/src/main/res/drawable/logo_idziennik.png | Bin 2632 -> 0 bytes app/src/main/res/values/errors.xml | 50 ---- 36 files changed, 1 insertion(+), 3241 deletions(-) delete mode 100644 app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/DataIdziennik.kt delete mode 100644 app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/Idziennik.kt delete mode 100644 app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/IdziennikFeatures.kt delete mode 100644 app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/IdziennikApi.kt delete mode 100644 app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/IdziennikData.kt delete mode 100644 app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/IdziennikWeb.kt delete mode 100644 app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/api/IdziennikApiCurrentRegister.kt delete mode 100644 app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/api/IdziennikApiMessagesInbox.kt delete mode 100644 app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/api/IdziennikApiMessagesSent.kt delete mode 100644 app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebAnnouncements.kt delete mode 100644 app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebAttendance.kt delete mode 100644 app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebExams.kt delete mode 100644 app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebGetAttachment.kt delete mode 100644 app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebGetHomework.kt delete mode 100644 app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebGetHomeworkAttachment.kt delete mode 100644 app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebGetMessage.kt delete mode 100644 app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebGetRecipientList.kt delete mode 100644 app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebGrades.kt delete mode 100644 app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebHomework.kt delete mode 100644 app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebNotices.kt delete mode 100644 app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebProposedGrades.kt delete mode 100644 app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebSendMessage.kt delete mode 100644 app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebSwitchRegister.kt delete mode 100644 app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebTimetable.kt delete mode 100644 app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/firstlogin/IdziennikFirstLogin.kt delete mode 100644 app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/login/IdziennikLogin.kt delete mode 100644 app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/login/IdziennikLoginApi.kt delete mode 100644 app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/login/IdziennikLoginWeb.kt delete mode 100644 app/src/main/res/drawable/login_help_iuczniowie.webp delete mode 100644 app/src/main/res/drawable/login_logo_iuczniowie.png delete mode 100644 app/src/main/res/drawable/logo_idziennik.png diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Errors.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Errors.kt index 2656c1d3..153c30c2 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Errors.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Errors.kt @@ -173,28 +173,6 @@ const val ERROR_VULCAN_HEBE_SERVER_ERROR = 364 const val ERROR_VULCAN_HEBE_ENTITY_NOT_FOUND = 365 const val ERROR_VULCAN_API_DEPRECATED = 390 -const val ERROR_LOGIN_IDZIENNIK_WEB_INVALID_LOGIN = 401 -const val ERROR_LOGIN_IDZIENNIK_WEB_INVALID_SCHOOL_NAME = 402 -const val ERROR_LOGIN_IDZIENNIK_WEB_PASSWORD_CHANGE_NEEDED = 403 -const val ERROR_LOGIN_IDZIENNIK_WEB_MAINTENANCE = 404 -const val ERROR_LOGIN_IDZIENNIK_WEB_SERVER_ERROR = 405 -const val ERROR_LOGIN_IDZIENNIK_WEB_OTHER = 410 -const val ERROR_LOGIN_IDZIENNIK_WEB_API_NO_ACCESS = 411 /* {"d":{"__type":"mds.Web.mod_komunikator.WS_mod_wiadomosci+detailWiadomosci","Wiadomosc":{"_recordId":0,"DataNadania":null,"DataOdczytania":null,"Nadawca":null,"ListaOdbiorcow":[],"Tytul":null,"Text":null,"ListaZal":[]},"Bledy":{"__type":"mds.Module.Globalne+sBledy","CzyJestBlad":true,"ListaBledow":["Nie masz dostępu do tych zasobów!"],"ListaKodowBledow":[]},"czyJestWiecej":false}} */ -const val ERROR_LOGIN_IDZIENNIK_WEB_NO_SESSION = 420 -const val ERROR_LOGIN_IDZIENNIK_WEB_NO_AUTH = 421 -const val ERROR_LOGIN_IDZIENNIK_WEB_NO_BEARER = 422 -const val ERROR_IDZIENNIK_WEB_ACCESS_DENIED = 430 -const val ERROR_IDZIENNIK_WEB_OTHER = 431 -const val ERROR_IDZIENNIK_WEB_MAINTENANCE = 432 -const val ERROR_IDZIENNIK_WEB_SERVER_ERROR = 433 -const val ERROR_IDZIENNIK_WEB_PASSWORD_CHANGE_NEEDED = 434 -const val ERROR_LOGIN_IDZIENNIK_FIRST_NO_SCHOOL_YEAR = 440 -const val ERROR_IDZIENNIK_WEB_REQUEST_NO_DATA = 441 -const val ERROR_IDZIENNIK_API_ACCESS_DENIED = 450 -const val ERROR_IDZIENNIK_API_OTHER = 451 -const val ERROR_IDZIENNIK_API_NO_REGISTER = 452 -const val ERROR_IDZIENNIK_WEB_RECIPIENT_LIST_NO_PERMISSION = 453 - const val ERROR_LOGIN_EDUDZIENNIK_WEB_INVALID_LOGIN = 501 const val ERROR_LOGIN_EDUDZIENNIK_WEB_OTHER = 510 const val ERROR_LOGIN_EDUDZIENNIK_WEB_NO_SESSION_ID = 511 @@ -221,9 +199,6 @@ const val EXCEPTION_MOBIDZIENNIK_WEB_FILE_REQUEST = 908 const val EXCEPTION_LIBRUS_MESSAGES_FILE_REQUEST = 909 const val EXCEPTION_NOTIFY = 910 const val EXCEPTION_LIBRUS_MESSAGES_REQUEST = 911 -const val EXCEPTION_IDZIENNIK_WEB_REQUEST = 912 -const val EXCEPTION_IDZIENNIK_WEB_API_REQUEST = 913 -const val EXCEPTION_IDZIENNIK_API_REQUEST = 914 const val EXCEPTION_EDUDZIENNIK_WEB_REQUEST = 920 const val EXCEPTION_EDUDZIENNIK_FILE_REQUEST = 921 const val ERROR_ONEDRIVE_DOWNLOAD = 930 diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/LoginMethods.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/LoginMethods.kt index 876cb73a..b3db9f71 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/LoginMethods.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/LoginMethods.kt @@ -5,8 +5,6 @@ package pl.szczodrzynski.edziennik.data.api import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.login.EdudziennikLoginWeb -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.login.IdziennikLoginApi -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.login.IdziennikLoginWeb import pl.szczodrzynski.edziennik.data.api.edziennik.librus.login.LibrusLoginApi import pl.szczodrzynski.edziennik.data.api.edziennik.librus.login.LibrusLoginMessages import pl.szczodrzynski.edziennik.data.api.edziennik.librus.login.LibrusLoginPortal @@ -22,7 +20,7 @@ import pl.szczodrzynski.edziennik.data.api.models.LoginMethod // librus // mobidziennik -// idziennik +// idziennik [*] // vulcan // mobireg @@ -34,14 +32,10 @@ const val LOGIN_TYPE_IDZIENNIK = 3 const val LOGIN_TYPE_TEMPLATE = 21 // LOGIN MODES -const val LOGIN_MODE_IDZIENNIK_WEB = 0 - const val LOGIN_MODE_TEMPLATE_WEB = 0 // LOGIN METHODS const val LOGIN_METHOD_NOT_NEEDED = -1 -const val LOGIN_METHOD_IDZIENNIK_WEB = 100 -const val LOGIN_METHOD_IDZIENNIK_API = 200 const val LOGIN_METHOD_TEMPLATE_WEB = 100 const val LOGIN_METHOD_TEMPLATE_API = 200 @@ -124,16 +118,6 @@ val vulcanLoginMethods = listOf( .withRequiredLoginMethod { _, _ -> LOGIN_METHOD_NOT_NEEDED } ) -val idziennikLoginMethods = listOf( - LoginMethod(LOGIN_TYPE_IDZIENNIK, LOGIN_METHOD_IDZIENNIK_WEB, IdziennikLoginWeb::class.java) - .withIsPossible { _, _ -> true } - .withRequiredLoginMethod { _, _ -> LOGIN_METHOD_NOT_NEEDED }, - - LoginMethod(LOGIN_TYPE_IDZIENNIK, LOGIN_METHOD_IDZIENNIK_API, IdziennikLoginApi::class.java) - .withIsPossible { _, _ -> true } - .withRequiredLoginMethod { _, _ -> LOGIN_METHOD_IDZIENNIK_WEB } -) - const val LOGIN_TYPE_EDUDZIENNIK = 5 const val LOGIN_MODE_EDUDZIENNIK_WEB = 0 const val LOGIN_METHOD_EDUDZIENNIK_WEB = 100 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 c6938f7a..7a578356 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 @@ -9,7 +9,6 @@ import org.greenrobot.eventbus.EventBus import pl.szczodrzynski.edziennik.* import pl.szczodrzynski.edziennik.data.api.* import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.Edudziennik -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.Idziennik import pl.szczodrzynski.edziennik.data.api.edziennik.librus.Librus import pl.szczodrzynski.edziennik.data.api.edziennik.mobidziennik.Mobidziennik import pl.szczodrzynski.edziennik.data.api.edziennik.podlasie.Podlasie @@ -123,7 +122,6 @@ open class EdziennikTask(override val profileId: Int, val request: Any) : IApiTa LOGIN_TYPE_LIBRUS -> Librus(app, profile, loginStore, taskCallback) LOGIN_TYPE_MOBIDZIENNIK -> Mobidziennik(app, profile, loginStore, taskCallback) LOGIN_TYPE_VULCAN -> Vulcan(app, profile, loginStore, taskCallback) - LOGIN_TYPE_IDZIENNIK -> Idziennik(app, profile, loginStore, taskCallback) LOGIN_TYPE_EDUDZIENNIK -> Edudziennik(app, profile, loginStore, taskCallback) LOGIN_TYPE_PODLASIE -> Podlasie(app, profile, loginStore, taskCallback) LOGIN_TYPE_TEMPLATE -> Template(app, profile, loginStore, taskCallback) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/DataIdziennik.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/DataIdziennik.kt deleted file mode 100644 index 3e974539..00000000 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/DataIdziennik.kt +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) Kuba Szczodrzyński 2019-10-25. - */ - -package pl.szczodrzynski.edziennik.data.api.edziennik.idziennik - -import androidx.core.util.set -import pl.szczodrzynski.edziennik.* -import pl.szczodrzynski.edziennik.data.api.LOGIN_METHOD_IDZIENNIK_API -import pl.szczodrzynski.edziennik.data.api.LOGIN_METHOD_IDZIENNIK_WEB -import pl.szczodrzynski.edziennik.data.api.models.Data -import pl.szczodrzynski.edziennik.data.db.entity.LoginStore -import pl.szczodrzynski.edziennik.data.db.entity.Profile -import pl.szczodrzynski.edziennik.data.db.entity.Subject -import pl.szczodrzynski.edziennik.data.db.entity.Teacher - -class DataIdziennik(app: App, profile: Profile?, loginStore: LoginStore) : Data(app, profile, loginStore) { - - fun isWebLoginValid() = loginExpiryTime-30 > currentTimeUnix() && webSessionId.isNotNullNorEmpty() && webAuth.isNotNullNorEmpty() - fun isApiLoginValid() = apiExpiryTime-30 > currentTimeUnix() && apiBearer.isNotNullNorEmpty() - - override fun satisfyLoginMethods() { - loginMethods.clear() - if (isWebLoginValid()) { - loginMethods += LOGIN_METHOD_IDZIENNIK_WEB - app.cookieJar.set("iuczniowie.progman.pl", "ASP.NET_SessionId_iDziennik", webSessionId) - app.cookieJar.set("iuczniowie.progman.pl", ".ASPXAUTH", webAuth) - } - if (isApiLoginValid()) - loginMethods += LOGIN_METHOD_IDZIENNIK_API - } - - override fun generateUserCode() = "$webSchoolName:$webUsername:$registerId" - - private var mLoginExpiryTime: Long? = null - var loginExpiryTime: Long - get() { mLoginExpiryTime = mLoginExpiryTime ?: loginStore.getLoginData("loginExpiryTime", 0L); return mLoginExpiryTime ?: 0L } - set(value) { loginStore.putLoginData("loginExpiryTime", value); mLoginExpiryTime = value } - - private var mApiExpiryTime: Long? = null - var apiExpiryTime: Long - get() { mApiExpiryTime = mApiExpiryTime ?: loginStore.getLoginData("apiExpiryTime", 0L); return mApiExpiryTime ?: 0L } - set(value) { loginStore.putLoginData("apiExpiryTime", value); mApiExpiryTime = value } - - /* __ __ _ - \ \ / / | | - \ \ /\ / /__| |__ - \ \/ \/ / _ \ '_ \ - \ /\ / __/ |_) | - \/ \/ \___|_._*/ - private var mWebSchoolName: String? = null - var webSchoolName: String? - get() { mWebSchoolName = mWebSchoolName ?: loginStore.getLoginData("schoolName", null); return mWebSchoolName } - set(value) { loginStore.putLoginData("schoolName", value); mWebSchoolName = value } - private var mWebUsername: String? = null - var webUsername: String? - get() { mWebUsername = mWebUsername ?: loginStore.getLoginData("username", null); return mWebUsername } - set(value) { loginStore.putLoginData("username", value); mWebUsername = value } - private var mWebPassword: String? = null - var webPassword: String? - get() { mWebPassword = mWebPassword ?: loginStore.getLoginData("password", null); return mWebPassword } - set(value) { loginStore.putLoginData("password", value); mWebPassword = value } - - private var mWebSessionId: String? = null - var webSessionId: String? - get() { mWebSessionId = mWebSessionId ?: loginStore.getLoginData("webSessionId", null); return mWebSessionId } - set(value) { loginStore.putLoginData("webSessionId", value); mWebSessionId = value } - private var mWebAuth: String? = null - var webAuth: String? - get() { mWebAuth = mWebAuth ?: loginStore.getLoginData("webAuth", null); return mWebAuth } - set(value) { loginStore.putLoginData("webAuth", value); mWebAuth = value } - - private var mWebSelectedRegister: Int? = null - var webSelectedRegister: Int - get() { mWebSelectedRegister = mWebSelectedRegister ?: loginStore.getLoginData("webSelectedRegister", 0); return mWebSelectedRegister ?: 0 } - set(value) { loginStore.putLoginData("webSelectedRegister", value); mWebSelectedRegister = value } - - /* _ - /\ (_) - / \ _ __ _ - / /\ \ | '_ \| | - / ____ \| |_) | | - /_/ \_\ .__/|_| - | | - |*/ - private var mApiBearer: String? = null - var apiBearer: String? - get() { mApiBearer = mApiBearer ?: loginStore.getLoginData("apiBearer", null); return mApiBearer } - set(value) { loginStore.putLoginData("apiBearer", value); mApiBearer = value } - - /* ____ _ _ - / __ \| | | | - | | | | |_| |__ ___ _ __ - | | | | __| '_ \ / _ \ '__| - | |__| | |_| | | | __/ | - \____/ \__|_| |_|\___|*/ - private var mStudentId: String? = null - var studentId: String? - get() { mStudentId = mStudentId ?: profile?.getStudentData("studentId", null); return mStudentId } - set(value) { profile?.putStudentData("studentId", value) ?: return; mStudentId = value } - - private var mRegisterId: Int? = null - var registerId: Int - get() { mRegisterId = mRegisterId ?: profile?.getStudentData("registerId", 0); return mRegisterId ?: 0 } - set(value) { profile?.putStudentData("registerId", value) ?: return; mRegisterId = value } - - private var mSchoolYearId: Int? = null - var schoolYearId: Int - get() { mSchoolYearId = mSchoolYearId ?: profile?.getStudentData("schoolYearId", 0); return mSchoolYearId ?: 0 } - set(value) { profile?.putStudentData("schoolYearId", value) ?: return; mSchoolYearId = value } - - - - /* _ _ _ _ _ - | | | | | (_) | - | | | | |_ _| |___ - | | | | __| | / __| - | |__| | |_| | \__ \ - \____/ \__|_|_|__*/ - fun getSubject(name: String, id: Long?, shortName: String): Subject { - var subject = if (id == null) - subjectList.singleOrNull { it.longName == name } - else - subjectList.singleOrNull { it.id == id } - - if (subject == null) { - subject = Subject(profileId, id - ?: name.crc16().toLong(), name, shortName) - subjectList[subject.id] = subject - } - return subject - } - - fun getTeacher(firstName: String, lastName: String): Teacher { - val teacher = teacherList.singleOrNull { it.fullName == "$firstName $lastName" } - return validateTeacher(teacher, firstName, lastName) - } - - fun getTeacher(firstNameChar: Char, lastName: String): Teacher { - val teacher = teacherList.singleOrNull { it.shortName == "$firstNameChar.$lastName" } - return validateTeacher(teacher, firstNameChar.toString(), lastName) - } - - fun getTeacherByLastFirst(nameLastFirst: String): Teacher { - val nameParts = nameLastFirst.split(" ") - return if (nameParts.size == 1) getTeacher(nameParts[0], "") else getTeacher(nameParts[1], nameParts[0]) - } - - fun getTeacherByFirstLast(nameFirstLast: String): Teacher { - val nameParts = nameFirstLast.split(" ") - return if (nameParts.size == 1) getTeacher(nameParts[0], "") else getTeacher(nameParts[0], nameParts[1]) - } - - fun getTeacherByFDotLast(nameFDotLast: String): Teacher { - val nameParts = nameFDotLast.split(".") - return if (nameParts.size == 1) getTeacher(nameParts[0], "") else getTeacher(nameParts[0][0], nameParts[1]) - } - - fun getTeacherByFDotSpaceLast(nameFDotSpaceLast: String): Teacher { - val nameParts = nameFDotSpaceLast.split(".") - return if (nameParts.size == 1) getTeacher(nameParts[0], "") else getTeacher(nameParts[0][0], nameParts[1]) - } - - private fun validateTeacher(teacher: Teacher?, firstName: String, lastName: String): Teacher { - (teacher ?: Teacher(profileId, -1, firstName, lastName).apply { - id = shortName.crc16().toLong() - teacherList[id] = this - }).apply { - if (firstName.length > 1) - name = firstName - surname = lastName - return this - } - } -} 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 deleted file mode 100644 index e1550632..00000000 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/Idziennik.kt +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (c) Kuba Szczodrzyński 2019-10-25. - */ - -package pl.szczodrzynski.edziennik.data.api.edziennik.idziennik - -import com.google.gson.JsonObject -import pl.szczodrzynski.edziennik.App -import pl.szczodrzynski.edziennik.data.api.* -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.IdziennikData -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.web.* -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.firstlogin.IdziennikFirstLogin -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.login.IdziennikLogin -import pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikCallback -import pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface -import pl.szczodrzynski.edziennik.data.api.models.ApiError -import pl.szczodrzynski.edziennik.data.db.entity.* -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 - -class Idziennik(val app: App, val profile: Profile?, val loginStore: LoginStore, val callback: EdziennikCallback) : EdziennikInterface { - companion object { - private const val TAG = "Idziennik" - } - - val internalErrorList = mutableListOf() - val data: DataIdziennik - private var afterLogin: (() -> Unit)? = null - - init { - data = DataIdziennik(app, profile, loginStore).apply { - callback = wrapCallback(this@Idziennik.callback) - satisfyLoginMethods() - } - } - - private fun completed() { - data.saveData() - callback.onCompleted() - } - - /* _______ _ _ _ _ _ - |__ __| | /\ | | (_) | | | - | | | |__ ___ / \ | | __ _ ___ _ __ _| |_| |__ _ __ ___ - | | | '_ \ / _ \ / /\ \ | |/ _` |/ _ \| '__| | __| '_ \| '_ ` _ \ - | | | | | | __/ / ____ \| | (_| | (_) | | | | |_| | | | | | | | | - |_| |_| |_|\___| /_/ \_\_|\__, |\___/|_| |_|\__|_| |_|_| |_| |_| - __/ | - |__*/ - override fun sync(featureIds: List, viewId: Int?, onlyEndpoints: List?, arguments: JsonObject?) { - data.arguments = arguments - data.prepare(idziennikLoginMethods, IdziennikFeatures, featureIds, viewId, onlyEndpoints) - login() - } - - private fun login(loginMethodId: Int? = null, afterLogin: (() -> Unit)? = null) { - d(TAG, "Trying to login with ${data.targetLoginMethodIds}") - if (internalErrorList.isNotEmpty()) { - d(TAG, " - Internal errors:") - internalErrorList.forEach { d(TAG, " - code $it") } - } - loginMethodId?.let { data.prepareFor(idziennikLoginMethods, it) } - afterLogin?.let { this.afterLogin = it } - IdziennikLogin(data) { - data() - } - } - - private fun data() { - d(TAG, "Endpoint IDs: ${data.targetEndpointIds}") - if (internalErrorList.isNotEmpty()) { - d(TAG, " - Internal errors:") - internalErrorList.forEach { d(TAG, " - code $it") } - } - afterLogin?.invoke() ?: IdziennikData(data) { - completed() - } - } - - override fun getMessage(message: MessageFull) { - login(LOGIN_METHOD_IDZIENNIK_WEB) { - IdziennikWebGetMessage(data, message) { - completed() - } - } - } - - override fun sendMessage(recipients: List, subject: String, text: String) { - login(LOGIN_METHOD_IDZIENNIK_API) { - IdziennikWebSendMessage(data, recipients, subject, text) { - completed() - } - } - } - - override fun markAllAnnouncementsAsRead() {} - override fun getAnnouncement(announcement: AnnouncementFull) {} - - override fun getAttachment(owner: Any, attachmentId: Long, attachmentName: String) { - login(LOGIN_METHOD_IDZIENNIK_WEB) { - if (owner is Message) { - IdziennikWebGetAttachment(data, owner, attachmentId, attachmentName) { - completed() - } - } - else if (owner is Event) { - IdziennikWebGetHomeworkAttachment(data, owner, attachmentId, attachmentName) { - completed() - } - } - } - } - - override fun getRecipientList() { - login(LOGIN_METHOD_IDZIENNIK_WEB) { - IdziennikWebGetRecipientList(data) { - completed() - } - } - } - - override fun getEvent(eventFull: EventFull) { - login(LOGIN_METHOD_IDZIENNIK_WEB) { - IdziennikWebGetHomework(data, eventFull) { - completed() - } - } - } - - override fun firstLogin() { IdziennikFirstLogin(data) { completed() } } - override fun cancel() { - d(TAG, "Cancelled") - data.cancel() - } - - private fun wrapCallback(callback: EdziennikCallback): EdziennikCallback { - return object : EdziennikCallback { - override fun onCompleted() { callback.onCompleted() } - override fun onProgress(step: Float) { callback.onProgress(step) } - override fun onStartProgress(stringRes: Int) { callback.onStartProgress(stringRes) } - override fun onError(apiError: ApiError) { - if (apiError.errorCode in internalErrorList) { - // finish immediately if the same error occurs twice during the same sync - callback.onError(apiError) - return - } - internalErrorList.add(apiError.errorCode) - when (apiError.errorCode) { - ERROR_LOGIN_IDZIENNIK_WEB_NO_SESSION, - ERROR_LOGIN_IDZIENNIK_WEB_NO_AUTH, - ERROR_LOGIN_IDZIENNIK_WEB_NO_BEARER, - ERROR_IDZIENNIK_WEB_ACCESS_DENIED, - ERROR_IDZIENNIK_API_ACCESS_DENIED -> { - data.loginMethods.remove(LOGIN_METHOD_IDZIENNIK_WEB) - data.prepareFor(idziennikLoginMethods, LOGIN_METHOD_IDZIENNIK_WEB) - data.loginExpiryTime = 0 - login() - } - ERROR_IDZIENNIK_API_NO_REGISTER -> { - data() - } - else -> callback.onError(apiError) - } - } - } - } -} diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/IdziennikFeatures.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/IdziennikFeatures.kt deleted file mode 100644 index 02aaabb2..00000000 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/IdziennikFeatures.kt +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) Kuba Szczodrzyński 2019-10-25. - */ - -package pl.szczodrzynski.edziennik.data.api.edziennik.idziennik - -import pl.szczodrzynski.edziennik.data.api.* -import pl.szczodrzynski.edziennik.data.api.models.Feature - -const val ENDPOINT_IDZIENNIK_WEB_TIMETABLE = 1030 -const val ENDPOINT_IDZIENNIK_WEB_GRADES = 1040 -const val ENDPOINT_IDZIENNIK_WEB_PROPOSED_GRADES = 1050 -const val ENDPOINT_IDZIENNIK_WEB_EXAMS = 1060 -const val ENDPOINT_IDZIENNIK_WEB_HOMEWORK = 1061 -const val ENDPOINT_IDZIENNIK_WEB_NOTICES = 1070 -const val ENDPOINT_IDZIENNIK_WEB_ANNOUNCEMENTS = 1080 -const val ENDPOINT_IDZIENNIK_WEB_ATTENDANCE = 1090 -const val ENDPOINT_IDZIENNIK_WEB_MESSAGES_INBOX = 1110 -const val ENDPOINT_IDZIENNIK_WEB_MESSAGES_SENT = 1120 -const val ENDPOINT_IDZIENNIK_API_CURRENT_REGISTER = 2010 -const val ENDPOINT_IDZIENNIK_API_MESSAGES_INBOX = 2110 -const val ENDPOINT_IDZIENNIK_API_MESSAGES_SENT = 2120 - -val IdziennikFeatures = listOf( - Feature(LOGIN_TYPE_IDZIENNIK, FEATURE_TIMETABLE, listOf( - ENDPOINT_IDZIENNIK_WEB_TIMETABLE to LOGIN_METHOD_IDZIENNIK_WEB - ), listOf(LOGIN_METHOD_IDZIENNIK_WEB)), - - Feature(LOGIN_TYPE_IDZIENNIK, FEATURE_GRADES, listOf( - ENDPOINT_IDZIENNIK_WEB_GRADES to LOGIN_METHOD_IDZIENNIK_WEB, - ENDPOINT_IDZIENNIK_WEB_PROPOSED_GRADES to LOGIN_METHOD_IDZIENNIK_WEB - ), listOf(LOGIN_METHOD_IDZIENNIK_WEB)), - - Feature(LOGIN_TYPE_IDZIENNIK, FEATURE_AGENDA, listOf( - ENDPOINT_IDZIENNIK_WEB_EXAMS to LOGIN_METHOD_IDZIENNIK_WEB - ), listOf(LOGIN_METHOD_IDZIENNIK_WEB)), - - Feature(LOGIN_TYPE_IDZIENNIK, FEATURE_HOMEWORK, listOf( - ENDPOINT_IDZIENNIK_WEB_HOMEWORK to LOGIN_METHOD_IDZIENNIK_WEB - ), listOf(LOGIN_METHOD_IDZIENNIK_WEB)), - - Feature(LOGIN_TYPE_IDZIENNIK, FEATURE_BEHAVIOUR, listOf( - ENDPOINT_IDZIENNIK_WEB_NOTICES to LOGIN_METHOD_IDZIENNIK_WEB - ), listOf(LOGIN_METHOD_IDZIENNIK_WEB)), - - Feature(LOGIN_TYPE_IDZIENNIK, FEATURE_ATTENDANCE, listOf( - ENDPOINT_IDZIENNIK_WEB_ATTENDANCE to LOGIN_METHOD_IDZIENNIK_WEB - ), listOf(LOGIN_METHOD_IDZIENNIK_WEB)), - - Feature(LOGIN_TYPE_IDZIENNIK, FEATURE_ANNOUNCEMENTS, listOf( - ENDPOINT_IDZIENNIK_WEB_ANNOUNCEMENTS to LOGIN_METHOD_IDZIENNIK_WEB - ), listOf(LOGIN_METHOD_IDZIENNIK_WEB)), - - /*Feature(LOGIN_TYPE_IDZIENNIK, FEATURE_MESSAGES_INBOX, listOf( - ENDPOINT_IDZIENNIK_WEB_MESSAGES_INBOX to LOGIN_METHOD_IDZIENNIK_WEB - ), listOf(LOGIN_METHOD_IDZIENNIK_WEB)).withPriority(2), - Feature(LOGIN_TYPE_IDZIENNIK, FEATURE_MESSAGES_SENT, listOf( - ENDPOINT_IDZIENNIK_WEB_MESSAGES_SENT to LOGIN_METHOD_IDZIENNIK_WEB - ), listOf(LOGIN_METHOD_IDZIENNIK_WEB)).withPriority(2),*/ - - Feature(LOGIN_TYPE_IDZIENNIK, FEATURE_MESSAGES_INBOX, listOf( - ENDPOINT_IDZIENNIK_API_MESSAGES_INBOX to LOGIN_METHOD_IDZIENNIK_API - ), listOf(LOGIN_METHOD_IDZIENNIK_API)), - Feature(LOGIN_TYPE_IDZIENNIK, FEATURE_MESSAGES_SENT, listOf( - ENDPOINT_IDZIENNIK_API_MESSAGES_SENT to LOGIN_METHOD_IDZIENNIK_API - ), listOf(LOGIN_METHOD_IDZIENNIK_API)), - - Feature(LOGIN_TYPE_IDZIENNIK, FEATURE_LUCKY_NUMBER, listOf( - ENDPOINT_IDZIENNIK_API_CURRENT_REGISTER to LOGIN_METHOD_IDZIENNIK_API - ), listOf(LOGIN_METHOD_IDZIENNIK_API)) -) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/IdziennikApi.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/IdziennikApi.kt deleted file mode 100644 index 8da75603..00000000 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/IdziennikApi.kt +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) Kuba Szczodrzyński 2019-10-29. - */ - -package pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data - -import com.google.gson.JsonArray -import com.google.gson.JsonElement -import com.google.gson.JsonObject -import com.google.gson.JsonParser -import im.wangchao.mhttp.Request -import im.wangchao.mhttp.Response -import im.wangchao.mhttp.callback.TextCallbackHandler -import pl.szczodrzynski.edziennik.data.api.* -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.DataIdziennik -import pl.szczodrzynski.edziennik.data.api.models.ApiError -import pl.szczodrzynski.edziennik.getString -import pl.szczodrzynski.edziennik.utils.Utils -import java.net.HttpURLConnection - -open class IdziennikApi(open val data: DataIdziennik, open val lastSync: Long?) { - companion object { - const val TAG = "IdziennikApi" - } - - val profileId - get() = data.profile?.id ?: -1 - - val profile - get() = data.profile - - fun apiGet(tag: String, endpointTemplate: String, method: Int = GET, parameters: Map = emptyMap(), onSuccess: (json: JsonElement) -> Unit) { - val endpoint = endpointTemplate.replace("\$STUDENT_ID", data.studentId ?: "") - Utils.d(tag, "Request: Idziennik/API - $IDZIENNIK_API_URL/$endpoint") - - val callback = object : TextCallbackHandler() { - override fun onSuccess(text: String?, response: Response?) { - if (text == null) { - data.error(ApiError(TAG, ERROR_RESPONSE_EMPTY) - .withResponse(response)) - return - } - - val json = try { - JsonParser().parse(text) - } catch (_: Exception) { null } - - var error: String? = null - if (json == null) { - error = text - } - else if (json is JsonObject) { - error = if (response?.code() == 200) null else - json.getString("message") ?: json.toString() - } - error?.let { code -> - when (code) { - "Uczeń nie posiada aktywnej pozycji w dzienniku" -> ERROR_IDZIENNIK_API_NO_REGISTER - "Authorization has been denied for this request." -> ERROR_IDZIENNIK_API_ACCESS_DENIED - else -> ERROR_IDZIENNIK_API_OTHER - }.let { errorCode -> - data.error(ApiError(tag, errorCode) - .withApiResponse(text) - .withResponse(response)) - return - } - } - - try { - onSuccess(json!!) - } catch (e: Exception) { - data.error(ApiError(tag, EXCEPTION_IDZIENNIK_API_REQUEST) - .withResponse(response) - .withThrowable(e) - .withApiResponse(text)) - } - } - - override fun onFailure(response: Response?, throwable: Throwable?) { - data.error(ApiError(tag, ERROR_REQUEST_FAILURE) - .withResponse(response) - .withThrowable(throwable)) - } - } - - Request.builder() - .url("$IDZIENNIK_API_URL/$endpoint") - .userAgent(IDZIENNIK_API_USER_AGENT) - .addHeader("Authorization", "Bearer ${data.apiBearer}") - .apply { - when (method) { - GET -> get() - POST -> { - postJson() - val json = JsonObject() - parameters.map { (name, value) -> - when (value) { - is JsonObject -> json.add(name, value) - is JsonArray -> json.add(name, value) - is String -> json.addProperty(name, value) - is Int -> json.addProperty(name, value) - is Long -> json.addProperty(name, value) - is Float -> json.addProperty(name, value) - is Char -> json.addProperty(name, value) - } - } - setJsonBody(json) - } - } - } - .allowErrorCode(HttpURLConnection.HTTP_BAD_REQUEST) - .allowErrorCode(HttpURLConnection.HTTP_UNAUTHORIZED) - .allowErrorCode(HttpURLConnection.HTTP_INTERNAL_ERROR) - .callback(callback) - .build() - .enqueue() - } -} diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/IdziennikData.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/IdziennikData.kt deleted file mode 100644 index 8acb04cb..00000000 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/IdziennikData.kt +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) Kuba Szczodrzyński 2019-10-25. - */ - -package pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data - -import pl.szczodrzynski.edziennik.R -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.* -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.api.IdziennikApiCurrentRegister -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.api.IdziennikApiMessagesInbox -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.api.IdziennikApiMessagesSent -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.web.* -import pl.szczodrzynski.edziennik.utils.Utils - -class IdziennikData(val data: DataIdziennik, val onSuccess: () -> Unit) { - companion object { - private const val TAG = "IdziennikData" - } - - init { - nextEndpoint(onSuccess) - } - - private fun nextEndpoint(onSuccess: () -> Unit) { - if (data.targetEndpointIds.isEmpty()) { - onSuccess() - return - } - if (data.cancelled) { - onSuccess() - return - } - val id = data.targetEndpointIds.firstKey() - val lastSync = data.targetEndpointIds.remove(id) - useEndpoint(id, lastSync) { endpointId -> - data.progress(data.progressStep) - nextEndpoint(onSuccess) - } - } - - private fun useEndpoint(endpointId: Int, lastSync: Long?, onSuccess: (endpointId: Int) -> Unit) { - Utils.d(TAG, "Using endpoint $endpointId. Last sync time = $lastSync") - when (endpointId) { - ENDPOINT_IDZIENNIK_WEB_TIMETABLE -> { - data.startProgress(R.string.edziennik_progress_endpoint_timetable) - IdziennikWebTimetable(data, lastSync, onSuccess) - } - ENDPOINT_IDZIENNIK_WEB_GRADES -> { - data.startProgress(R.string.edziennik_progress_endpoint_grades) - IdziennikWebGrades(data, lastSync, onSuccess) - } - ENDPOINT_IDZIENNIK_WEB_PROPOSED_GRADES -> { - data.startProgress(R.string.edziennik_progress_endpoint_proposed_grades) - IdziennikWebProposedGrades(data, lastSync, onSuccess) - } - ENDPOINT_IDZIENNIK_WEB_EXAMS -> { - data.startProgress(R.string.edziennik_progress_endpoint_exams) - IdziennikWebExams(data, lastSync, onSuccess) - } - ENDPOINT_IDZIENNIK_WEB_HOMEWORK -> { - data.startProgress(R.string.edziennik_progress_endpoint_homework) - IdziennikWebHomework(data, lastSync, onSuccess) - } - ENDPOINT_IDZIENNIK_WEB_NOTICES -> { - data.startProgress(R.string.edziennik_progress_endpoint_notices) - IdziennikWebNotices(data, lastSync, onSuccess) - } - ENDPOINT_IDZIENNIK_WEB_ANNOUNCEMENTS -> { - data.startProgress(R.string.edziennik_progress_endpoint_announcements) - IdziennikWebAnnouncements(data, lastSync, onSuccess) - } - ENDPOINT_IDZIENNIK_WEB_ATTENDANCE -> { - data.startProgress(R.string.edziennik_progress_endpoint_attendance) - IdziennikWebAttendance(data, lastSync, onSuccess) - } - ENDPOINT_IDZIENNIK_API_CURRENT_REGISTER -> { - data.startProgress(R.string.edziennik_progress_endpoint_lucky_number) - IdziennikApiCurrentRegister(data, lastSync, onSuccess) - } - ENDPOINT_IDZIENNIK_API_MESSAGES_INBOX -> { - data.startProgress(R.string.edziennik_progress_endpoint_messages_inbox) - IdziennikApiMessagesInbox(data, lastSync, onSuccess) - } - ENDPOINT_IDZIENNIK_API_MESSAGES_SENT -> { - data.startProgress(R.string.edziennik_progress_endpoint_messages_outbox) - IdziennikApiMessagesSent(data, lastSync, onSuccess) - } - else -> onSuccess(endpointId) - } - } -} diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/IdziennikWeb.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/IdziennikWeb.kt deleted file mode 100644 index b871cd37..00000000 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/IdziennikWeb.kt +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Copyright (c) Kuba Szczodrzyński 2019-10-25. - */ - -package pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data - -import com.google.gson.JsonArray -import com.google.gson.JsonObject -import im.wangchao.mhttp.Request -import im.wangchao.mhttp.Response -import im.wangchao.mhttp.callback.FileCallbackHandler -import im.wangchao.mhttp.callback.JsonCallbackHandler -import im.wangchao.mhttp.callback.TextCallbackHandler -import pl.szczodrzynski.edziennik.data.api.* -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.DataIdziennik -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.web.IdziennikWebSwitchRegister -import pl.szczodrzynski.edziennik.data.api.models.ApiError -import pl.szczodrzynski.edziennik.utils.Utils.d -import java.io.File -import java.net.HttpURLConnection.HTTP_INTERNAL_ERROR -import java.net.HttpURLConnection.HTTP_UNAUTHORIZED - -open class IdziennikWeb(open val data: DataIdziennik, open val lastSync: Long?) { - companion object { - const val TAG = "IdziennikWeb" - } - - val profileId - get() = data.profile?.id ?: -1 - - val profile - get() = data.profile - - fun webApiGet(tag: String, endpoint: String, parameters: Map = emptyMap(), onSuccess: (json: JsonObject) -> Unit) { - d(tag, "Request: Idziennik/Web/API - $IDZIENNIK_WEB_URL/$endpoint") - - val callback = object : JsonCallbackHandler() { - override fun onSuccess(json: JsonObject?, response: Response?) { - if (json == null && response?.parserErrorBody == null) { - data.error(ApiError(TAG, ERROR_RESPONSE_EMPTY) - .withResponse(response)) - return - } - - if (response?.code() == HTTP_INTERNAL_ERROR && endpoint == IDZIENNIK_WEB_GET_RECIPIENT_LIST) { - data.error(ApiError(tag, ERROR_IDZIENNIK_WEB_RECIPIENT_LIST_NO_PERMISSION) - .withResponse(response) - .withApiResponse(json)) - return - } - - if (response?.code() == HTTP_INTERNAL_ERROR && endpoint == IDZIENNIK_WEB_GRADES) { - // special override for accounts where displaying grades - // for another student requires switching it manually - if (data.registerId != data.webSelectedRegister) { - IdziennikWebSwitchRegister(data, data.registerId) { - webApiGet(tag, endpoint, parameters, onSuccess) - } - return - } - } - - when { - response?.code() == HTTP_UNAUTHORIZED -> ERROR_IDZIENNIK_WEB_ACCESS_DENIED - response?.code() == HTTP_INTERNAL_ERROR -> ERROR_IDZIENNIK_WEB_SERVER_ERROR - response?.parserErrorBody != null -> when { - response.parserErrorBody.contains("Identyfikator zgłoszenia") -> ERROR_IDZIENNIK_WEB_SERVER_ERROR - response.parserErrorBody.contains("Hasło dostępu do systemu wygasło") -> ERROR_IDZIENNIK_WEB_PASSWORD_CHANGE_NEEDED - response.parserErrorBody.contains("Trwają prace konserwacyjne") -> ERROR_IDZIENNIK_WEB_MAINTENANCE - else -> ERROR_IDZIENNIK_WEB_OTHER - } - else -> null - }?.let { errorCode -> - data.error(ApiError(TAG, errorCode) - .withApiResponse(json?.toString() ?: response?.parserErrorBody) - .withResponse(response)) - return - } - - if (json == null) { - data.error(ApiError(tag, ERROR_RESPONSE_EMPTY) - .withResponse(response)) - return - } - - try { - onSuccess(json) - } catch (e: Exception) { - data.error(ApiError(tag, EXCEPTION_IDZIENNIK_WEB_API_REQUEST) - .withResponse(response) - .withThrowable(e) - .withApiResponse(json)) - } - } - - override fun onFailure(response: Response?, throwable: Throwable?) { - data.error(ApiError(tag, ERROR_REQUEST_FAILURE) - .withResponse(response) - .withThrowable(throwable)) - } - } - - Request.builder() - .url("$IDZIENNIK_WEB_URL/$endpoint") - .userAgent(IDZIENNIK_USER_AGENT) - .postJson() - .apply { - val json = JsonObject() - parameters.map { (name, value) -> - when (value) { - is JsonObject -> json.add(name, value) - is JsonArray -> json.add(name, value) - is String -> json.addProperty(name, value) - is Int -> json.addProperty(name, value) - is Long -> json.addProperty(name, value) - is Float -> json.addProperty(name, value) - is Char -> json.addProperty(name, value) - is Boolean -> json.addProperty(name, value) - } - } - setJsonBody(json) - } - .allowErrorCode(HTTP_UNAUTHORIZED) - .allowErrorCode(HTTP_INTERNAL_ERROR) - .callback(callback) - .build() - .enqueue() - } - - fun webGet(tag: String, endpoint: String, parameters: Map = emptyMap(), onSuccess: (text: String) -> Unit) { - d(tag, "Request: Idziennik/Web - $IDZIENNIK_WEB_URL/$endpoint") - - val callback = object : TextCallbackHandler() { - override fun onSuccess(text: String?, response: Response?) { - if (text == null) { - data.error(ApiError(TAG, ERROR_RESPONSE_EMPTY) - .withResponse(response)) - return - } - - if (!text.contains("czyWyswietlicDostepMobilny")) { - when { - text.contains("Identyfikator zgłoszenia") -> ERROR_IDZIENNIK_WEB_SERVER_ERROR - text.contains("Hasło dostępu do systemu wygasło") -> ERROR_IDZIENNIK_WEB_PASSWORD_CHANGE_NEEDED - text.contains("Trwają prace konserwacyjne") -> ERROR_IDZIENNIK_WEB_MAINTENANCE - else -> ERROR_IDZIENNIK_WEB_OTHER - }.let { errorCode -> - data.error(ApiError(TAG, errorCode) - .withApiResponse(text) - .withResponse(response)) - return - } - } - - try { - onSuccess(text) - } catch (e: Exception) { - data.error(ApiError(tag, EXCEPTION_IDZIENNIK_WEB_REQUEST) - .withResponse(response) - .withThrowable(e) - .withApiResponse(text)) - } - } - - override fun onFailure(response: Response?, throwable: Throwable?) { - data.error(ApiError(tag, ERROR_REQUEST_FAILURE) - .withResponse(response) - .withThrowable(throwable)) - } - } - - Request.builder() - .url("$IDZIENNIK_WEB_URL/$endpoint") - .userAgent(IDZIENNIK_USER_AGENT) - .apply { - if (parameters.isEmpty()) get() - else post() - - parameters.map { (name, value) -> - addParameter(name, value) - } - } - .callback(callback) - .build() - .enqueue() - } - - fun webGetFile(tag: String, endpoint: String, targetFile: File, parameters: Map, - onSuccess: (file: File) -> Unit, onProgress: (written: Long, total: Long) -> Unit) { - - d(tag, "Request: Idziennik/Web - $IDZIENNIK_WEB_URL/$endpoint") - - val callback = object : FileCallbackHandler(targetFile) { - override fun onSuccess(file: File?, response: Response?) { - if (file == null) { - data.error(ApiError(TAG, ERROR_FILE_DOWNLOAD) - .withResponse(response)) - return - } - - try { - onSuccess(file) - } catch (e: Exception) { - data.error(ApiError(tag, EXCEPTION_EDUDZIENNIK_FILE_REQUEST) - .withResponse(response) - .withThrowable(e)) - } - } - - override fun onProgress(bytesWritten: Long, bytesTotal: Long) { - try { - onProgress(bytesWritten, bytesTotal) - } catch (e: Exception) { - data.error(ApiError(tag, EXCEPTION_EDUDZIENNIK_FILE_REQUEST) - .withThrowable(e)) - } - } - - override fun onFailure(response: Response?, throwable: Throwable?) { - data.error(ApiError(tag, ERROR_REQUEST_FAILURE) - .withResponse(response) - .withThrowable(throwable)) - } - } - - Request.builder() - .url("$IDZIENNIK_WEB_URL/$endpoint") - .userAgent(IDZIENNIK_USER_AGENT) - .apply { - parameters.forEach { (k, v) -> addParameter(k, v) } - } - .contentType("application/x-www-form-urlencoded") - .post() - .callback(callback) - .build() - .enqueue() - } -} diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/api/IdziennikApiCurrentRegister.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/api/IdziennikApiCurrentRegister.kt deleted file mode 100644 index d5e59596..00000000 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/api/IdziennikApiCurrentRegister.kt +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) Kuba Szczodrzyński 2019-10-29. - */ - -package pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.api - -import com.google.gson.JsonObject -import pl.szczodrzynski.edziennik.DAY -import pl.szczodrzynski.edziennik.data.api.IDZIENNIK_API_CURRENT_REGISTER -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.DataIdziennik -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.ENDPOINT_IDZIENNIK_API_CURRENT_REGISTER -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.IdziennikApi -import pl.szczodrzynski.edziennik.data.db.entity.LuckyNumber -import pl.szczodrzynski.edziennik.data.db.entity.Metadata -import pl.szczodrzynski.edziennik.getInt -import pl.szczodrzynski.edziennik.getJsonObject -import pl.szczodrzynski.edziennik.getString -import pl.szczodrzynski.edziennik.utils.models.Date -import pl.szczodrzynski.edziennik.utils.models.Time - -class IdziennikApiCurrentRegister(override val data: DataIdziennik, - override val lastSync: Long?, - val onSuccess: (endpointId: Int) -> Unit -) : IdziennikApi(data, lastSync) { - companion object { - private const val TAG = "IdziennikApiCurrentRegister" - } - - init { - apiGet(TAG, IDZIENNIK_API_CURRENT_REGISTER) { json -> - if (json !is JsonObject) { - onSuccess(ENDPOINT_IDZIENNIK_API_CURRENT_REGISTER) - return@apiGet - } - - var nextSync = System.currentTimeMillis() + 14*DAY*1000 - - val settings = json.getJsonObject("ustawienia")?.apply { - getString("poczatekSemestru1")?.let { profile?.dateSemester1Start = Date.fromY_m_d(it) } - getString("koniecSemestru1")?.let { profile?.dateSemester2Start = Date.fromY_m_d(it).stepForward(0, 0, 1) } - getString("koniecSemestru2")?.let { profile?.dateYearEnd = Date.fromY_m_d(it) } - } - - json.getInt("szczesliwyNumerek")?.let { luckyNumber -> - val luckyNumberDate = Date.getToday() - settings.getString("godzinaPublikacjiSzczesliwegoLosu") - ?.let { Time.fromH_m(it) } - ?.let { publishTime -> - val now = Time.getNow() - if (publishTime.value < 150000 && now.value < publishTime.value) { - nextSync = luckyNumberDate.combineWith(publishTime) - luckyNumberDate.stepForward(0, 0, -1) // the lucky number is still for yesterday - } - else if (publishTime.value >= 150000 && now.value > publishTime.value) { - luckyNumberDate.stepForward(0, 0, 1) // the lucky number is already for tomorrow - nextSync = luckyNumberDate.combineWith(publishTime) - } - else if (publishTime.value < 150000) { - nextSync = luckyNumberDate - .clone() - .stepForward(0, 0, 1) - .combineWith(publishTime) - } - else { - nextSync = luckyNumberDate.combineWith(publishTime) - } - } - - - val luckyNumberObject = LuckyNumber( - profileId = data.profileId, - date = luckyNumberDate, - number = luckyNumber - ) - - data.luckyNumberList.add(luckyNumberObject) - data.metadataList.add( - Metadata( - profileId, - Metadata.TYPE_LUCKY_NUMBER, - luckyNumberObject.date.value.toLong(), - true, - data.profile?.empty ?: false - )) - } - - - data.setSyncNext(ENDPOINT_IDZIENNIK_API_CURRENT_REGISTER, syncAt = nextSync) - onSuccess(ENDPOINT_IDZIENNIK_API_CURRENT_REGISTER) - } - } -} diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/api/IdziennikApiMessagesInbox.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/api/IdziennikApiMessagesInbox.kt deleted file mode 100644 index 622068e2..00000000 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/api/IdziennikApiMessagesInbox.kt +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) Kuba Szczodrzyński 2019-10-30. - */ - -package pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.api - -import com.google.gson.JsonArray -import pl.szczodrzynski.edziennik.asJsonObjectList -import pl.szczodrzynski.edziennik.data.api.IDZIENNIK_API_MESSAGES_INBOX -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.DataIdziennik -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.ENDPOINT_IDZIENNIK_API_MESSAGES_INBOX -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.IdziennikApi -import pl.szczodrzynski.edziennik.data.db.entity.* -import pl.szczodrzynski.edziennik.data.db.entity.Message.Companion.TYPE_DELETED -import pl.szczodrzynski.edziennik.data.db.entity.Message.Companion.TYPE_RECEIVED -import pl.szczodrzynski.edziennik.getBoolean -import pl.szczodrzynski.edziennik.getString -import pl.szczodrzynski.edziennik.utils.Utils.crc32 -import pl.szczodrzynski.edziennik.utils.models.Date - -class IdziennikApiMessagesInbox(override val data: DataIdziennik, - override val lastSync: Long?, - val onSuccess: (endpointId: Int) -> Unit -) : IdziennikApi(data, lastSync) { - companion object { - private const val TAG = "IdziennikApiMessagesInbox" - } - - init { - apiGet(TAG, IDZIENNIK_API_MESSAGES_INBOX) { json -> - if (json !is JsonArray) { - onSuccess(ENDPOINT_IDZIENNIK_API_MESSAGES_INBOX) - return@apiGet - } - - json.asJsonObjectList().forEach { jMessage -> - val subject = jMessage.getString("tytul") ?: "" - if (subject.contains("(") && subject.startsWith("iDziennik - ")) - return@forEach - if (subject.startsWith("Uwaga dla ucznia (klasa:")) - return@forEach - - val messageIdStr = jMessage.getString("id") - val messageId = crc32((messageIdStr + "0").toByteArray()) - - var body = "[META:$messageIdStr;-1]" - body += jMessage.getString("tresc")?.replace("\n".toRegex(), "
") - - val readDate = if (jMessage.getBoolean("odczytana") == true) Date.fromIso(jMessage.getString("wersjaRekordu")) else 0 - val sentDate = Date.fromIso(jMessage.getString("dataWyslania")) - - val sender = jMessage.getAsJsonObject("nadawca") - var firstName = sender.getString("imie") - var lastName = sender.getString("nazwisko") - if (firstName.isNullOrEmpty() || lastName.isNullOrEmpty()) { - firstName = "usunięty" - lastName = "użytkownik" - } - val rTeacher = data.getTeacher( - firstName, - lastName - ) - rTeacher.loginId = /*sender.getString("id") + ":" + */sender.getString("usr") - rTeacher.setTeacherType(Teacher.TYPE_OTHER) - - val message = Message( - profileId = profileId, - id = messageId, - type = if (jMessage.getBoolean("rekordUsuniety") == true) TYPE_DELETED else TYPE_RECEIVED, - subject = subject, - body = body, - senderId = rTeacher.id, - addedDate = sentDate - ) - - val messageRecipient = MessageRecipient( - profileId, - -1 /* me */, - -1, - readDate, - /*messageId*/ messageId - ) - - data.messageList.add(message) - data.messageRecipientList.add(messageRecipient) - data.setSeenMetadataList.add(Metadata( - profileId, - Metadata.TYPE_MESSAGE, - message.id, - readDate > 0, - readDate > 0 || profile?.empty ?: false - )) - } - - data.setSyncNext(ENDPOINT_IDZIENNIK_API_MESSAGES_INBOX, SYNC_ALWAYS) - onSuccess(ENDPOINT_IDZIENNIK_API_MESSAGES_INBOX) - } - } -} diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/api/IdziennikApiMessagesSent.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/api/IdziennikApiMessagesSent.kt deleted file mode 100644 index 87b3264d..00000000 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/api/IdziennikApiMessagesSent.kt +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) Kuba Szczodrzyński 2019-10-30. - */ - -package pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.api - -import com.google.gson.JsonArray -import pl.szczodrzynski.edziennik.DAY -import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_MESSAGES -import pl.szczodrzynski.edziennik.asJsonObjectList -import pl.szczodrzynski.edziennik.data.api.IDZIENNIK_API_MESSAGES_SENT -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.DataIdziennik -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.ENDPOINT_IDZIENNIK_API_MESSAGES_SENT -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.IdziennikApi -import pl.szczodrzynski.edziennik.data.db.entity.Message -import pl.szczodrzynski.edziennik.data.db.entity.Message.Companion.TYPE_SENT -import pl.szczodrzynski.edziennik.data.db.entity.MessageRecipient -import pl.szczodrzynski.edziennik.data.db.entity.Metadata -import pl.szczodrzynski.edziennik.utils.Utils.crc32 -import pl.szczodrzynski.edziennik.utils.models.Date - -class IdziennikApiMessagesSent(override val data: DataIdziennik, - override val lastSync: Long?, - val onSuccess: (endpointId: Int) -> Unit -) : IdziennikApi(data, lastSync) { - companion object { - private const val TAG = "IdziennikApiMessagesSent" - } - - init { - apiGet(TAG, IDZIENNIK_API_MESSAGES_SENT) { json -> - if (json !is JsonArray) { - onSuccess(ENDPOINT_IDZIENNIK_API_MESSAGES_SENT) - return@apiGet - } - - json.asJsonObjectList()?.forEach { jMessage -> - val messageIdStr = jMessage.get("id").asString - val messageId = crc32((messageIdStr + "1").toByteArray()) - - val subject = jMessage.get("tytul").asString - - var body = "[META:$messageIdStr;-1]" - body += jMessage.get("tresc").asString.replace("\n".toRegex(), "
") - - val sentDate = Date.fromIso(jMessage.get("dataWyslania").asString) - - val message = Message( - profileId = profileId, - id = messageId, - type = TYPE_SENT, - subject = subject, - body = body, - senderId = null, - addedDate = sentDate - ) - - for (recipientEl in jMessage.getAsJsonArray("odbiorcy")) { - val recipient = recipientEl.asJsonObject - var firstName = recipient.get("imie").asString - var lastName = recipient.get("nazwisko").asString - if (firstName.isEmpty() || lastName.isEmpty()) { - firstName = "usunięty" - lastName = "użytkownik" - } - val rTeacher = data.getTeacher(firstName, lastName) - rTeacher.loginId = /*recipient.get("id").asString + ":" + */recipient.get("usr").asString - - val messageRecipient = MessageRecipient( - profileId, - rTeacher.id, - -1, - -1, - /*messageId*/ messageId - ) - data.messageRecipientIgnoreList.add(messageRecipient) - } - - data.messageList.add(message) - data.metadataList.add(Metadata(profileId, Metadata.TYPE_MESSAGE, message.id, true, true)) - } - - data.setSyncNext(ENDPOINT_IDZIENNIK_API_MESSAGES_SENT, DAY, DRAWER_ITEM_MESSAGES) - onSuccess(ENDPOINT_IDZIENNIK_API_MESSAGES_SENT) - } - } -} diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebAnnouncements.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebAnnouncements.kt deleted file mode 100644 index 531cbeeb..00000000 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebAnnouncements.kt +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) Kuba Szczodrzyński 2019-10-28. - */ - -package pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.web - -import com.google.gson.JsonArray -import com.google.gson.JsonObject -import pl.szczodrzynski.edziennik.data.api.ERROR_IDZIENNIK_WEB_REQUEST_NO_DATA -import pl.szczodrzynski.edziennik.data.api.IDZIENNIK_WEB_ANNOUNCEMENTS -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.DataIdziennik -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.ENDPOINT_IDZIENNIK_WEB_ANNOUNCEMENTS -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.IdziennikWeb -import pl.szczodrzynski.edziennik.data.api.models.ApiError -import pl.szczodrzynski.edziennik.data.db.entity.Announcement -import pl.szczodrzynski.edziennik.data.db.entity.Metadata -import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS -import pl.szczodrzynski.edziennik.getJsonObject -import pl.szczodrzynski.edziennik.getLong -import pl.szczodrzynski.edziennik.getString -import pl.szczodrzynski.edziennik.utils.models.Date - -class IdziennikWebAnnouncements(override val data: DataIdziennik, - override val lastSync: Long?, - val onSuccess: (endpointId: Int) -> Unit -) : IdziennikWeb(data, lastSync) { - companion object { - private const val TAG = "IdziennikWebAnnouncements" - } - - init { - val param = JsonObject() - param.add("parametryFiltrow", JsonArray()) - - webApiGet(TAG, IDZIENNIK_WEB_ANNOUNCEMENTS, mapOf( - "uczenId" to (data.studentId ?: ""), - "param" to param - )) { result -> - val json = result.getJsonObject("d") ?: run { - data.error(ApiError(TAG, ERROR_IDZIENNIK_WEB_REQUEST_NO_DATA) - .withApiResponse(result)) - return@webApiGet - } - - for (jAnnouncementEl in json.getAsJsonArray("ListK")) { - val jAnnouncement = jAnnouncementEl.asJsonObject - // jAnnouncement - val announcementId = jAnnouncement.getLong("Id") ?: -1 - - val rTeacher = data.getTeacherByFirstLast(jAnnouncement.getString("Autor") ?: "") - val addedDate = jAnnouncement.getString("DataDodania")?.replace("[^\\d]".toRegex(), "")?.toLongOrNull() ?: System.currentTimeMillis() - val startDate = jAnnouncement.getString("DataWydarzenia")?.replace("[^\\d]".toRegex(), "")?.toLongOrNull()?.let { Date.fromMillis(it) } - - val announcementObject = Announcement( - profileId = profileId, - id = announcementId, - subject = jAnnouncement.get("Temat").asString, - text = jAnnouncement.get("Tresc").asString, - startDate = startDate, - endDate = null, - teacherId = rTeacher.id, - addedDate = addedDate - ) - data.announcementList.add(announcementObject) - data.metadataList.add(Metadata( - profileId, - Metadata.TYPE_ANNOUNCEMENT, - announcementObject.id, - profile?.empty ?: false, - profile?.empty ?: false - )) - } - - data.setSyncNext(ENDPOINT_IDZIENNIK_WEB_ANNOUNCEMENTS, SYNC_ALWAYS) - onSuccess(ENDPOINT_IDZIENNIK_WEB_ANNOUNCEMENTS) - } - } -} diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebAttendance.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebAttendance.kt deleted file mode 100644 index e77c9eac..00000000 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebAttendance.kt +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright (c) Kuba Szczodrzyński 2019-10-28. - */ - -package pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.web - -import pl.szczodrzynski.edziennik.crc16 -import pl.szczodrzynski.edziennik.data.api.ERROR_IDZIENNIK_WEB_REQUEST_NO_DATA -import pl.szczodrzynski.edziennik.data.api.IDZIENNIK_WEB_ATTENDANCE -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.DataIdziennik -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.ENDPOINT_IDZIENNIK_WEB_ATTENDANCE -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.IdziennikWeb -import pl.szczodrzynski.edziennik.data.api.models.ApiError -import pl.szczodrzynski.edziennik.data.db.entity.Attendance -import pl.szczodrzynski.edziennik.data.db.entity.Attendance.Companion.TYPE_ABSENT -import pl.szczodrzynski.edziennik.data.db.entity.Attendance.Companion.TYPE_ABSENT_EXCUSED -import pl.szczodrzynski.edziennik.data.db.entity.Attendance.Companion.TYPE_BELATED -import pl.szczodrzynski.edziennik.data.db.entity.Attendance.Companion.TYPE_PRESENT -import pl.szczodrzynski.edziennik.data.db.entity.Attendance.Companion.TYPE_PRESENT_CUSTOM -import pl.szczodrzynski.edziennik.data.db.entity.Attendance.Companion.TYPE_RELEASED -import pl.szczodrzynski.edziennik.data.db.entity.Attendance.Companion.TYPE_UNKNOWN -import pl.szczodrzynski.edziennik.data.db.entity.Metadata -import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS -import pl.szczodrzynski.edziennik.getInt -import pl.szczodrzynski.edziennik.getJsonObject -import pl.szczodrzynski.edziennik.getString -import pl.szczodrzynski.edziennik.utils.models.Date -import pl.szczodrzynski.edziennik.utils.models.Time - -class IdziennikWebAttendance(override val data: DataIdziennik, - override val lastSync: Long?, - val onSuccess: (endpointId: Int) -> Unit -) : IdziennikWeb(data, lastSync) { - companion object { - private const val TAG = "IdziennikWebAttendance" - } - - private var attendanceYear = Date.getToday().year - private var attendanceMonth = Date.getToday().month - private var attendancePrevMonthChecked = false - - init { - getAttendance() - } - - private fun getAttendance() { - webApiGet(TAG, IDZIENNIK_WEB_ATTENDANCE, mapOf( - "idPozDziennika" to data.registerId, - "mc" to attendanceMonth, - "rok" to attendanceYear, - "dataTygodnia" to "" - )) { result -> - val json = result.getJsonObject("d") ?: run { - data.error(ApiError(TAG, ERROR_IDZIENNIK_WEB_REQUEST_NO_DATA) - .withApiResponse(result)) - return@webApiGet - } - - for (jAttendanceEl in json.getAsJsonArray("Obecnosci")) { - val jAttendance = jAttendanceEl.asJsonObject - // jAttendance - val type = jAttendance.get("TypObecnosci").asInt - - // skip "zajęcia nie odbyły się" and "Ferie" - if (type == 5 || type == 7) - continue - - val date = Date.fromY_m_d(jAttendance.get("Data").asString) - val time = Time.fromH_m(jAttendance.get("OdDoGodziny").asString) - if (date.combineWith(time) > System.currentTimeMillis()) - continue - - val id = jAttendance.get("IdLesson").asString.crc16().toLong() - val rSubject = data.getSubject(jAttendance.get("Przedmiot").asString, jAttendance.get("IdPrzedmiot").asLong, "") - val rTeacher = data.getTeacherByFDotSpaceLast(jAttendance.get("PrzedmiotNauczyciel").asString) - - var baseType = TYPE_UNKNOWN - var typeName = "nieznany rodzaj" - var typeSymbol: String? = null - var typeColor: Long? = null - - /* https://iuczniowie.progman.pl/idziennik/mod_panelRodzica/obecnosci/obecnosciUcznia_lmt637231494660000000.js */ - /* https://iuczniowie.progman.pl/idziennik/mod_panelRodzica/obecnosci/obecnosci_lmt637231494660000000.css */ - when (type) { - 1 -> { - baseType = TYPE_ABSENT_EXCUSED - typeName = "nieobecność usprawiedliwiona" - typeColor = 0xffffe099 - } - 2 -> { - baseType = TYPE_BELATED - typeName = "spóźnienie" - typeColor = 0xffffffaa - } - 3 -> { - baseType = TYPE_ABSENT - typeName = "nieobecność nieusprawiedliwiona" - typeColor = 0xffffad99 - } - 4, 9 -> { - baseType = TYPE_RELEASED - if (type == 4) { - typeName = "zwolnienie" - typeColor = 0xffa8beff - } - if (type == 9) { - typeName = "zwolniony / obecny" - typeSymbol = "zb" - typeColor = 0xffff69b4 - } - } - 8 -> { - baseType = TYPE_PRESENT_CUSTOM - typeName = "wycieczka" - typeSymbol = "w" - typeColor = null - } - 0 -> { - baseType = TYPE_PRESENT - typeName = "obecny" - typeColor = 0xffccffcc - } - } - - val semester = profile?.dateToSemester(date) ?: 1 - - val attendanceObject = Attendance( - profileId = profileId, - id = id, - baseType = baseType, - typeName = typeName, - typeShort = typeSymbol ?: data.app.attendanceManager.getTypeShort(baseType), - typeSymbol = typeSymbol ?: data.app.attendanceManager.getTypeShort(baseType), - typeColor = typeColor?.toInt(), - date = date, - startTime = time, - semester = semester, - teacherId = rTeacher.id, - subjectId = rSubject.id - ).also { - it.lessonTopic = jAttendance.getString("PrzedmiotTemat") - it.lessonNumber = jAttendance.getInt("Godzina") - } - - data.attendanceList.add(attendanceObject) - if (attendanceObject.baseType != TYPE_PRESENT) { - data.metadataList.add(Metadata( - profileId, - Metadata.TYPE_ATTENDANCE, - attendanceObject.id, - profile?.empty ?: false || baseType == TYPE_PRESENT_CUSTOM || baseType == TYPE_UNKNOWN, - profile?.empty ?: false || baseType == TYPE_PRESENT_CUSTOM || baseType == TYPE_UNKNOWN - )) - } - } - - val attendanceDateValue = attendanceYear * 10000 + attendanceMonth * 100 - if (profile?.empty == true && attendanceDateValue > profile?.getSemesterStart(1)?.value ?: 99999999) { - attendancePrevMonthChecked = true // do not need to check prev month later - attendanceMonth-- - if (attendanceMonth < 1) { - attendanceMonth = 12 - attendanceYear-- - } - getAttendance() - } else if (!attendancePrevMonthChecked /* get also the previous month */) { - attendanceMonth-- - if (attendanceMonth < 1) { - attendanceMonth = 12 - attendanceYear-- - } - attendancePrevMonthChecked = true - getAttendance() - } else { - data.setSyncNext(ENDPOINT_IDZIENNIK_WEB_ATTENDANCE, SYNC_ALWAYS) - onSuccess(ENDPOINT_IDZIENNIK_WEB_ATTENDANCE) - } - } - } -} diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebExams.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebExams.kt deleted file mode 100644 index 25c06945..00000000 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebExams.kt +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) Kuba Szczodrzyński 2019-10-28. - */ - -package pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.web - -import com.google.gson.JsonObject -import pl.szczodrzynski.edziennik.* -import pl.szczodrzynski.edziennik.data.api.ERROR_IDZIENNIK_WEB_REQUEST_NO_DATA -import pl.szczodrzynski.edziennik.data.api.IDZIENNIK_WEB_EXAMS -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.DataIdziennik -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.ENDPOINT_IDZIENNIK_WEB_EXAMS -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.IdziennikWeb -import pl.szczodrzynski.edziennik.data.api.models.ApiError -import pl.szczodrzynski.edziennik.data.api.models.DataRemoveModel -import pl.szczodrzynski.edziennik.data.db.entity.Event -import pl.szczodrzynski.edziennik.data.db.entity.Metadata -import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS -import pl.szczodrzynski.edziennik.utils.models.Date -import java.util.* - -class IdziennikWebExams(override val data: DataIdziennik, - override val lastSync: Long?, - val onSuccess: (endpointId: Int) -> Unit -) : IdziennikWeb(data, lastSync) { - companion object { - private const val TAG = "IdziennikWebExams" - } - - private var examsYear = Date.getToday().year - private var examsMonth = Date.getToday().month - private var examsMonthsChecked = 0 - private var examsNextMonthChecked = false // TO DO temporary // no more // idk - - init { - getExams() - } - - private fun getExams() { - val param = JsonObject().apply { - addProperty("strona", 1) - addProperty("iloscNaStrone", "99") - addProperty("iloscRekordow", -1) - addProperty("kolumnaSort", "ss.Nazwa,sp.Data_sprawdzianu") - addProperty("kierunekSort", 0) - addProperty("maxIloscZaznaczonych", 0) - addProperty("panelFiltrow", 0) - } - - webApiGet(TAG, IDZIENNIK_WEB_EXAMS, mapOf( - "idP" to data.registerId, - "rok" to examsYear, - "miesiac" to examsMonth, - "param" to param - )) { result -> - val json = result.getJsonObject("d") ?: run { - data.error(ApiError(TAG, ERROR_IDZIENNIK_WEB_REQUEST_NO_DATA) - .withApiResponse(result)) - return@webApiGet - } - - json.getJsonArray("ListK")?.asJsonObjectList()?.forEach { exam -> - val id = exam.getLong("_recordId") ?: return@forEach - val examDate = Date.fromY_m_d(exam.getString("data") ?: return@forEach) - val subjectName = exam.getString("przedmiot") ?: return@forEach - val subjectId = data.getSubject(subjectName, null, subjectName).id - val teacherName = exam.getString("wpisal") ?: return@forEach - val teacherId = data.getTeacherByLastFirst(teacherName).id - val topic = exam.getString("zakres")?.trim() ?: "" - - val lessonList = data.db.timetableDao().getAllForDateNow(profileId, examDate) - val startTime = lessonList.firstOrNull { it.subjectId == subjectId }?.startTime - - val eventType = when (exam.getString("rodzaj")?.toLowerCase(Locale.getDefault())) { - "sprawdzian/praca klasowa", - "sprawdzian", - "praca klasowa" -> Event.TYPE_EXAM - "kartkówka" -> Event.TYPE_SHORT_QUIZ - else -> Event.TYPE_EXAM - } - - val eventObject = Event( - profileId = profileId, - id = id, - date = examDate, - time = startTime, - topic = topic, - color = null, - type = eventType, - teacherId = teacherId, - subjectId = subjectId, - teamId = data.teamClass?.id ?: -1 - ) - - data.eventList.add(eventObject) - data.metadataList.add(Metadata( - profileId, - Metadata.TYPE_EVENT, - eventObject.id, - profile?.empty ?: false, - profile?.empty ?: false - )) - } - - if (profile?.empty == true && examsMonthsChecked < 3 /* how many months backwards to check? */) { - examsMonthsChecked++ - examsMonth-- - if (examsMonth < 1) { - examsMonth = 12 - examsYear-- - } - getExams() - } else if (!examsNextMonthChecked /* get also one month forward */) { - val showDate = Date.getToday().stepForward(0, 1, 0) - examsYear = showDate.year - examsMonth = showDate.month - examsNextMonthChecked = true - getExams() - } else { - data.toRemove.add(DataRemoveModel.Events.futureExceptType(Event.TYPE_HOMEWORK)) - - data.setSyncNext(ENDPOINT_IDZIENNIK_WEB_EXAMS, SYNC_ALWAYS) - onSuccess(ENDPOINT_IDZIENNIK_WEB_EXAMS) - } - } - } -} diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebGetAttachment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebGetAttachment.kt deleted file mode 100644 index b7a462f6..00000000 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebGetAttachment.kt +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) Kacper Ziubryniewicz 2019-12-28 - */ - -package pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.web - -import org.greenrobot.eventbus.EventBus -import pl.szczodrzynski.edziennik.data.api.IDZIENNIK_WEB_GET_ATTACHMENT -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.DataIdziennik -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.IdziennikWeb -import pl.szczodrzynski.edziennik.data.api.events.AttachmentGetEvent -import pl.szczodrzynski.edziennik.data.db.entity.Message -import pl.szczodrzynski.edziennik.get -import pl.szczodrzynski.edziennik.utils.Utils -import java.io.File - -class IdziennikWebGetAttachment(override val data: DataIdziennik, - val owner: Any, - val attachmentId: Long, - val attachmentName: String, - val onSuccess: () -> Unit -) : IdziennikWeb(data, null) { - companion object { - const val TAG = "IdziennikWebGetAttachment" - } - - init { - val message = owner as Message - - val messageId = "\\[META:([A-z0-9]+);([0-9-]+)]".toRegex().find(message.body ?: "")?.get(2) ?: -1 - val targetFile = File(Utils.getStorageDir(), attachmentName) - - webGetFile(TAG, IDZIENNIK_WEB_GET_ATTACHMENT, targetFile, mapOf( - "id" to messageId, - "fileName" to attachmentName - ), { file -> - val event = AttachmentGetEvent( - profileId, - owner, - attachmentId, - AttachmentGetEvent.TYPE_FINISHED, - file.absolutePath - ) - - val attachmentDataFile = File(Utils.getStorageDir(), ".${profileId}_${event.ownerId}_${event.attachmentId}") - Utils.writeStringToFile(attachmentDataFile, event.fileName) - - EventBus.getDefault().postSticky(event) - - onSuccess() - - }) { written, _ -> - val event = AttachmentGetEvent( - profileId, - owner, - attachmentId, - AttachmentGetEvent.TYPE_PROGRESS, - bytesWritten = written - ) - - EventBus.getDefault().postSticky(event) - } - } -} diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebGetHomework.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebGetHomework.kt deleted file mode 100644 index 12d804db..00000000 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebGetHomework.kt +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) Kuba Szczodrzyński 2020-4-1. - */ - -package pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.web - -import org.greenrobot.eventbus.EventBus -import pl.szczodrzynski.edziennik.data.api.ERROR_IDZIENNIK_WEB_REQUEST_NO_DATA -import pl.szczodrzynski.edziennik.data.api.IDZIENNIK_WEB_GET_HOMEWORK -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.DataIdziennik -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.IdziennikWeb -import pl.szczodrzynski.edziennik.data.api.events.EventGetEvent -import pl.szczodrzynski.edziennik.data.api.models.ApiError -import pl.szczodrzynski.edziennik.data.db.full.EventFull -import pl.szczodrzynski.edziennik.getBoolean -import pl.szczodrzynski.edziennik.getJsonObject -import pl.szczodrzynski.edziennik.getString - -class IdziennikWebGetHomework(override val data: DataIdziennik, - val event: EventFull, - val onSuccess: () -> Unit -) : IdziennikWeb(data, null) { - companion object { - private const val TAG = "IdziennikWebGetHomework" - } - - init { - webApiGet(TAG, IDZIENNIK_WEB_GET_HOMEWORK, mapOf( - "idP" to data.registerId, - "idPD" to event.id - )) { result -> - val json = result.getJsonObject("d") ?: run { - data.error(ApiError(TAG, ERROR_IDZIENNIK_WEB_REQUEST_NO_DATA) - .withApiResponse(result)) - return@webApiGet - } - - val homework = json.getJsonObject("praca") ?: return@webApiGet - - if (homework.getBoolean("zalacznik", false)) { - event.attachmentIds = mutableListOf(event.id) - event.attachmentNames = mutableListOf("Załącznik do zadania") - } - else { - event.attachmentIds = mutableListOf() - event.attachmentNames = mutableListOf() - } - event.homeworkBody = homework.getString("tresc") - - data.eventList.add(event) - data.eventListReplace = true - - EventBus.getDefault().postSticky(EventGetEvent(event)) - onSuccess() - } - } -} diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebGetHomeworkAttachment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebGetHomeworkAttachment.kt deleted file mode 100644 index f4a60f98..00000000 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebGetHomeworkAttachment.kt +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) Kuba Szczodrzyński 2020-4-1. - */ - -package pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.web - -import com.google.gson.JsonObject -import org.greenrobot.eventbus.EventBus -import pl.szczodrzynski.edziennik.data.api.IDZIENNIK_WEB_GET_HOMEWORK_ATTACHMENT -import pl.szczodrzynski.edziennik.data.api.Regexes -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.DataIdziennik -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.IdziennikWeb -import pl.szczodrzynski.edziennik.data.api.events.AttachmentGetEvent -import pl.szczodrzynski.edziennik.data.db.entity.Event -import pl.szczodrzynski.edziennik.get -import pl.szczodrzynski.edziennik.getString -import pl.szczodrzynski.edziennik.set -import pl.szczodrzynski.edziennik.utils.Utils -import java.io.File - -class IdziennikWebGetHomeworkAttachment(override val data: DataIdziennik, - val owner: Any, - val attachmentId: Long, - val attachmentName: String, - val onSuccess: () -> Unit -) : IdziennikWeb(data, null) { - companion object { - const val TAG = "IdziennikWebGetHomeworkAttachment" - } - - init { - val homework = owner as Event - - /*val request = Request.Builder() - .url("") - .build() - data.app.http.newCall(request).enqueue(object : Callback { - override fun onFailure(call: Call, e: IOException) { - data.error(ApiError(TAG, ERROR_REQUEST_FAILURE) - .withThrowable(e)) - } - - override fun onResponse(call: Call, response: Response) { - val filename = response.header("content-disposition")?.substringAfter("\"")?.substringBeforeLast("\"") - - val file: File = File(Utils.getStorageDir(), filename) - val sink = file.sink().buffer() - response.body()?.source()?.let { - sink.writeAll(it) - } - sink.close() - } - })*/ - - webGet(TAG, IDZIENNIK_WEB_GET_HOMEWORK_ATTACHMENT) { text -> - val hiddenFields = JsonObject() - Regexes.IDZIENNIK_LOGIN_HIDDEN_FIELDS.findAll(text).forEach { - hiddenFields[it[1]] = it[2] - } - - webGetFile(TAG, IDZIENNIK_WEB_GET_HOMEWORK_ATTACHMENT, Utils.getStorageDir(), mapOf( - "__VIEWSTATE" to hiddenFields.getString("__VIEWSTATE", ""), - "__VIEWSTATEGENERATOR" to hiddenFields.getString("__VIEWSTATEGENERATOR", ""), - "__EVENTVALIDATION" to hiddenFields.getString("__EVENTVALIDATION", ""), - "__EVENTTARGET" to "ctl00\$cphContent\$bt_pobraniePliku", - "ctl00\$dxComboUczniowie" to data.registerId, - "ctl00\$cphContent\$idPracyDomowej" to attachmentId - ), { file -> - val event = AttachmentGetEvent( - profileId, - owner, - attachmentId, - AttachmentGetEvent.TYPE_FINISHED, - file.absolutePath - ) - - val attachmentDataFile = File(Utils.getStorageDir(), ".${profileId}_${event.ownerId}_${event.attachmentId}") - Utils.writeStringToFile(attachmentDataFile, event.fileName) - - homework.attachmentNames = mutableListOf(file.name) - data.eventList.add(homework) - data.eventListReplace = true - - EventBus.getDefault().postSticky(event) - onSuccess() - - }) { written, _ -> - val event = AttachmentGetEvent( - profileId, - owner, - attachmentId, - AttachmentGetEvent.TYPE_PROGRESS, - bytesWritten = written - ) - - EventBus.getDefault().postSticky(event) - } - } - } -} diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebGetMessage.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebGetMessage.kt deleted file mode 100644 index bd1808df..00000000 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebGetMessage.kt +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) Kacper Ziubryniewicz 2019-12-28 - */ - -package pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.web - -import org.greenrobot.eventbus.EventBus -import pl.szczodrzynski.edziennik.* -import pl.szczodrzynski.edziennik.data.api.IDZIENNIK_WEB_GET_MESSAGE -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.DataIdziennik -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.IdziennikWeb -import pl.szczodrzynski.edziennik.data.api.events.MessageGetEvent -import pl.szczodrzynski.edziennik.data.db.entity.Message.Companion.TYPE_RECEIVED -import pl.szczodrzynski.edziennik.data.db.entity.Message.Companion.TYPE_SENT -import pl.szczodrzynski.edziennik.data.db.entity.Metadata -import pl.szczodrzynski.edziennik.data.db.full.MessageFull -import pl.szczodrzynski.edziennik.data.db.full.MessageRecipientFull -import pl.szczodrzynski.edziennik.utils.models.Date - -class IdziennikWebGetMessage(override val data: DataIdziennik, - private val message: MessageFull, - val onSuccess: () -> Unit -) : IdziennikWeb(data, null) { - companion object { - const val TAG = "IdziennikWebGetMessage" - } - - init { data.profile?.also { profile -> - val metaPattern = "\\[META:([A-z0-9]+);([0-9-]+)]".toRegex() - val meta = metaPattern.find(message.body!!) - val messageIdString = meta?.get(1) ?: "" - - webApiGet(TAG, IDZIENNIK_WEB_GET_MESSAGE, parameters = mapOf( - "idWiadomosci" to messageIdString, - "typWiadomosci" to if (message.type == TYPE_SENT) 1 else 0 - )) { json -> - json.getJsonObject("d")?.getJsonObject("Wiadomosc")?.also { - val id = it.getLong("_recordId") - message.body = message.body?.replace(metaPattern, "[META:$messageIdString;$id]") - - message.clearAttachments() - it.getJsonArray("ListaZal")?.asJsonObjectList()?.forEach { attachment -> - message.addAttachment( - attachment.getLong("Id") ?: return@forEach, - attachment.getString("Nazwa") ?: return@forEach, - -1 - ) - } - - message.recipients?.clear() - when (message.type) { - TYPE_RECEIVED -> { - val recipientObject = MessageRecipientFull( - profileId = profileId, - id = -1, - messageId = message.id - ) - - val readDateString = it.getString("DataOdczytania") - recipientObject.readDate = if (readDateString.isNullOrBlank()) System.currentTimeMillis() - else Date.fromIso(readDateString) - - recipientObject.fullName = profile.accountName ?: profile.studentNameLong - - data.messageRecipientList.add(recipientObject) - message.addRecipient(recipientObject) - } - - TYPE_SENT -> { - it.getJsonArray("ListaOdbiorcow")?.asJsonObjectList()?.forEach { recipient -> - val recipientName = recipient.getString("NazwaOdbiorcy") ?: return@forEach - val teacher = data.getTeacherByLastFirst(recipientName) - - val recipientObject = MessageRecipientFull( - profileId = profileId, - id = teacher.id, - messageId = message.id - ) - - recipientObject.readDate = recipient.getLong("Status") ?: return@forEach - recipientObject.fullName = teacher.fullName - - data.messageRecipientList.add(recipientObject) - message.addRecipient(recipientObject) - } - } - } - - if (!message.seen) { - message.seen = true - - data.setSeenMetadataList.add(Metadata( - profileId, - Metadata.TYPE_MESSAGE, - message.id, - message.seen, - message.notified - )) - } - - data.messageList.add(message) - data.messageListReplace = true - - EventBus.getDefault().postSticky(MessageGetEvent(message)) - onSuccess() - } - } - } ?: onSuccess() } -} diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebGetRecipientList.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebGetRecipientList.kt deleted file mode 100644 index a14efc24..00000000 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebGetRecipientList.kt +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) Kuba Szczodrzyński 2019-12-30. - */ - -package pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.web - -import androidx.room.OnConflictStrategy -import org.greenrobot.eventbus.EventBus -import pl.szczodrzynski.edziennik.* -import pl.szczodrzynski.edziennik.data.api.ERROR_IDZIENNIK_WEB_REQUEST_NO_DATA -import pl.szczodrzynski.edziennik.data.api.IDZIENNIK_WEB_GET_RECIPIENT_LIST -import pl.szczodrzynski.edziennik.data.api.Regexes -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.DataIdziennik -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.IdziennikWeb -import pl.szczodrzynski.edziennik.data.api.events.RecipientListGetEvent -import pl.szczodrzynski.edziennik.data.api.models.ApiError -import pl.szczodrzynski.edziennik.data.db.entity.Teacher - -class IdziennikWebGetRecipientList(override val data: DataIdziennik, - val onSuccess: () -> Unit -) : IdziennikWeb(data, null) { - companion object { - private const val TAG = "IdziennikWebGetRecipientList" - } - - init { - webApiGet(TAG, IDZIENNIK_WEB_GET_RECIPIENT_LIST, mapOf( - "idP" to data.registerId - )) { result -> - val json = result.getJsonObject("d") ?: run { - data.error(ApiError(TAG, ERROR_IDZIENNIK_WEB_REQUEST_NO_DATA) - .withApiResponse(result)) - return@webApiGet - } - - json.getJsonArray("ListK_Pracownicy")?.asJsonObjectList()?.forEach { recipient -> - val name = recipient.getString("ImieNazwisko") ?: ": " - val (fullName, subject) = name.split(": ").let { - Pair(it.getOrNull(0), it.getOrNull(1)) - } - val guid = recipient.getString("Id") ?: "" - // get teacher by ID or create it - val teacher = data.getTeacherByFirstLast(fullName ?: " ") - teacher.loginId = guid - teacher.setTeacherType(Teacher.TYPE_TEACHER) - // unset OTHER that is automatically set in IdziennikApiMessages* - teacher.unsetTeacherType(Teacher.TYPE_OTHER) - teacher.typeDescription = subject - } - - json.getJsonArray("ListK_Opiekunowie")?.asJsonObjectList()?.forEach { recipient -> - val name = recipient.getString("ImieNazwisko") ?: ": " - val (fullName, parentOf) = Regexes.IDZIENNIK_MESSAGES_RECIPIENT_PARENT.find(name)?.let { - Pair(it.groupValues.getOrNull(1), it.groupValues.getOrNull(2)) - } ?: Pair(null, null) - val guid = recipient.getString("Id") ?: "" - // get teacher by ID or create it - val teacher = data.getTeacherByFirstLast(fullName ?: " ") - teacher.loginId = guid - teacher.setTeacherType(Teacher.TYPE_PARENT) - // unset OTHER that is automatically set in IdziennikApiMessages* - teacher.unsetTeacherType(Teacher.TYPE_OTHER) - teacher.typeDescription = parentOf - } - - val event = RecipientListGetEvent( - data.profileId, - data.teacherList.filter { it.loginId != null } - ) - - profile?.lastReceiversSync = System.currentTimeMillis() - - data.teacherOnConflictStrategy = OnConflictStrategy.REPLACE - EventBus.getDefault().postSticky(event) - onSuccess() - } - } -} diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebGrades.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebGrades.kt deleted file mode 100644 index 90e17401..00000000 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebGrades.kt +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (c) Kuba Szczodrzyński 2019-10-28. - */ - -package pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.web - -import android.graphics.Color -import pl.szczodrzynski.edziennik.* -import pl.szczodrzynski.edziennik.data.api.ERROR_IDZIENNIK_WEB_REQUEST_NO_DATA -import pl.szczodrzynski.edziennik.data.api.IDZIENNIK_WEB_GRADES -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.DataIdziennik -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.ENDPOINT_IDZIENNIK_WEB_GRADES -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.IdziennikWeb -import pl.szczodrzynski.edziennik.data.api.models.ApiError -import pl.szczodrzynski.edziennik.data.api.models.DataRemoveModel -import pl.szczodrzynski.edziennik.data.db.entity.Grade -import pl.szczodrzynski.edziennik.data.db.entity.Grade.Companion.TYPE_NORMAL -import pl.szczodrzynski.edziennik.data.db.entity.Metadata -import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS -import pl.szczodrzynski.edziennik.utils.models.Date - -class IdziennikWebGrades(override val data: DataIdziennik, - override val lastSync: Long?, - val onSuccess: (endpointId: Int) -> Unit -) : IdziennikWeb(data, lastSync) { - companion object { - private const val TAG = "IdziennikWebGrades" - } - - init { data.profile?.also { profile -> - webApiGet(TAG, IDZIENNIK_WEB_GRADES, mapOf( - "idPozDziennika" to data.registerId - )) { result -> - val json = result.getJsonObject("d") ?: run { - data.error(ApiError(TAG, ERROR_IDZIENNIK_WEB_REQUEST_NO_DATA) - .withApiResponse(result)) - return@webApiGet - } - - json.getJsonArray("Przedmioty")?.asJsonObjectList()?.onEach { subjectJson -> - val subject = data.getSubject( - subjectJson.getString("Przedmiot") ?: return@onEach, - subjectJson.getLong("IdPrzedmiotu") ?: return@onEach, - subjectJson.getString("Przedmiot") ?: return@onEach - ) - subjectJson.getJsonArray("Oceny")?.asJsonObjectList()?.forEach { grade -> - val id = grade.getLong("idK") ?: return@forEach - val category = grade.getString("Kategoria") ?: "" - val name = grade.getString("Ocena") ?: "?" - val semester = grade.getInt("Semestr") ?: 1 - val teacher = data.getTeacherByLastFirst(grade.getString("Wystawil") ?: return@forEach) - - val countToAverage = grade.getBoolean("DoSredniej") ?: true - var value = grade.getFloat("WartoscDoSred") ?: 0.0f - val weight = if (countToAverage) - grade.getFloat("Waga") ?: 0.0f - else - 0.0f - - val gradeColor = grade.getString("Kolor") ?: "" - var colorInt = 0xff2196f3.toInt() - if (gradeColor.isNotEmpty()) { - colorInt = Color.parseColor("#$gradeColor") - } - - val addedDate = grade.getString("Data_wystaw")?.let { Date.fromY_m_d(it).inMillis } ?: System.currentTimeMillis() - - val gradeObject = Grade( - profileId = profileId, - id = id, - name = name, - type = TYPE_NORMAL, - value = value, - weight = weight, - color = colorInt, - category = category, - description = null, - comment = null, - semester = semester, - teacherId = teacher.id, - subjectId = subject.id, - addedDate = addedDate - ) - - when (grade.getInt("Typ")) { - 0 -> { - val history = grade.getJsonArray("Historia")?.asJsonObjectList() - if (history?.isNotEmpty() == true) { - var sum = gradeObject.value * gradeObject.weight - var count = gradeObject.weight - for (historyItem in history) { - val countToTheAverage = historyItem.getBoolean("DoSredniej") ?: false - value = historyItem.get("WartoscDoSred").asFloat - val weight = historyItem.get("Waga").asFloat - - if (value > 0 && countToTheAverage) { - sum += value * weight - count += weight - } - - val historyColor = historyItem.getString("Kolor") ?: "" - colorInt = 0xff2196f3.toInt() - if (historyColor.isNotEmpty()) { - colorInt = Color.parseColor("#$historyColor") - } - - val addedDate = historyItem.getString("Data_wystaw")?.let { Date.fromY_m_d(it).inMillis } ?: System.currentTimeMillis() - - val historyObject = Grade( - profileId = profileId, - id = gradeObject.id * -1, - name = historyItem.getString("Ocena") ?: "", - type = TYPE_NORMAL, - value = value, - weight = if (value > 0f && countToTheAverage) weight * -1f else 0f, - color = colorInt, - category = historyItem.getString("Kategoria"), - description = historyItem.getString("Uzasadnienie"), - comment = null, - semester = historyItem.getInt("Semestr") ?: 1, - teacherId = teacher.id, - subjectId = subject.id, - addedDate = addedDate - ) - historyObject.parentId = gradeObject.id - - data.gradeList.add(historyObject) - data.metadataList.add(Metadata( - profileId, - Metadata.TYPE_GRADE, - historyObject.id, - true, - true - )) - } - // update the current grade's value with an average of all historical grades and itself - if (sum > 0 && count > 0) { - gradeObject.value = sum / count - } - gradeObject.isImprovement = true // gradeObject is the improved grade. Originals are historyObjects - } - } - 1 -> { - gradeObject.type = Grade.TYPE_SEMESTER1_FINAL - gradeObject.name = value.toInt().toString() - gradeObject.weight = 0f - } - 2 -> { - gradeObject.type = Grade.TYPE_YEAR_FINAL - gradeObject.name = value.toInt().toString() - gradeObject.weight = 0f - } - } - - data.gradeList.add(gradeObject) - data.metadataList.add( - Metadata( - profileId, - Metadata.TYPE_GRADE, - id, - data.profile.empty, - data.profile.empty - )) - } - } - - data.toRemove.addAll(listOf( - Grade.TYPE_NORMAL, - Grade.TYPE_SEMESTER1_FINAL, - Grade.TYPE_YEAR_FINAL - ).map { - DataRemoveModel.Grades.semesterWithType(profile.currentSemester, it) - }) - data.setSyncNext(ENDPOINT_IDZIENNIK_WEB_GRADES, SYNC_ALWAYS) - onSuccess(ENDPOINT_IDZIENNIK_WEB_GRADES) - } - } ?: onSuccess(ENDPOINT_IDZIENNIK_WEB_GRADES) } -} diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebHomework.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebHomework.kt deleted file mode 100644 index 10b4a0c3..00000000 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebHomework.kt +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) Kacper Ziubryniewicz 2019-11-25 - */ - -package pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.web - -import com.google.gson.JsonObject -import pl.szczodrzynski.edziennik.* -import pl.szczodrzynski.edziennik.data.api.ERROR_IDZIENNIK_WEB_REQUEST_NO_DATA -import pl.szczodrzynski.edziennik.data.api.IDZIENNIK_WEB_HOMEWORK -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.DataIdziennik -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.ENDPOINT_IDZIENNIK_WEB_HOMEWORK -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.IdziennikWeb -import pl.szczodrzynski.edziennik.data.api.models.ApiError -import pl.szczodrzynski.edziennik.data.api.models.DataRemoveModel -import pl.szczodrzynski.edziennik.data.db.entity.Event -import pl.szczodrzynski.edziennik.data.db.entity.Metadata -import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS -import pl.szczodrzynski.edziennik.utils.models.Date - -class IdziennikWebHomework(override val data: DataIdziennik, - override val lastSync: Long?, - val onSuccess: (endpointId: Int) -> Unit -) : IdziennikWeb(data, lastSync) { - companion object { - private const val TAG = "IdziennikWebHomework" - } - - init { - val param = JsonObject().apply { - addProperty("strona", 1) - addProperty("iloscNaStrone", 997) - addProperty("iloscRekordow", -1) - addProperty("kolumnaSort", "DataZadania") - addProperty("kierunekSort", 0) - addProperty("maxIloscZaznaczonych", 0) - addProperty("panelFiltrow", 0) - } - - webApiGet(TAG, IDZIENNIK_WEB_HOMEWORK, mapOf( - "idP" to data.registerId, - "data" to Date.getToday().stringY_m_d, - "wszystkie" to true, - "param" to param - )) { result -> - val json = result.getJsonObject("d") ?: run { - data.error(ApiError(TAG, ERROR_IDZIENNIK_WEB_REQUEST_NO_DATA) - .withApiResponse(result)) - return@webApiGet - } - - json.getJsonArray("ListK")?.asJsonObjectList()?.forEach { homework -> - val id = homework.getLong("_recordId") ?: return@forEach - val eventDate = Date.fromY_m_d(homework.getString("dataO") ?: return@forEach) - val addedDate = Date.fromY_m_d(homework.getString("dataZ") ?: return@forEach) - val subjectName = homework.getString("przed") ?: return@forEach - val subjectId = data.getSubject(subjectName, null, subjectName).id - val teacherName = homework.getString("usr") ?: return@forEach - val teacherId = data.getTeacherByLastFirst(teacherName).id - val lessonList = data.db.timetableDao().getAllForDateNow(profileId, eventDate) - val startTime = lessonList.firstOrNull { it.subjectId == subjectId }?.displayStartTime - val topic = homework.getString("tytul")?.trim() ?: "" - - val seen = when (profile?.empty) { - true -> true - else -> eventDate < Date.getToday() - } - - - val eventObject = Event( - profileId = profileId, - id = id, - date = eventDate, - time = startTime, - topic = topic, - color = null, - type = Event.TYPE_HOMEWORK, - teacherId = teacherId, - subjectId = subjectId, - teamId = data.teamClass?.id ?: -1, - addedDate = addedDate.inMillis - ) - - data.eventList.add(eventObject) - data.metadataList.add(Metadata( - profileId, - Metadata.TYPE_HOMEWORK, - eventObject.id, - seen, - seen - )) - } - - data.toRemove.add(DataRemoveModel.Events.futureWithType(Event.TYPE_HOMEWORK)) - - data.setSyncNext(ENDPOINT_IDZIENNIK_WEB_HOMEWORK, SYNC_ALWAYS) - onSuccess(ENDPOINT_IDZIENNIK_WEB_HOMEWORK) - } - } -} diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebNotices.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebNotices.kt deleted file mode 100644 index 64108bfd..00000000 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebNotices.kt +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) Kuba Szczodrzyński 2019-10-28. - */ - -package pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.web - -import pl.szczodrzynski.edziennik.crc16 -import pl.szczodrzynski.edziennik.data.api.ERROR_IDZIENNIK_WEB_REQUEST_NO_DATA -import pl.szczodrzynski.edziennik.data.api.IDZIENNIK_WEB_NOTICES -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.DataIdziennik -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.ENDPOINT_IDZIENNIK_WEB_NOTICES -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.IdziennikWeb -import pl.szczodrzynski.edziennik.data.api.models.ApiError -import pl.szczodrzynski.edziennik.data.db.entity.Metadata -import pl.szczodrzynski.edziennik.data.db.entity.Notice -import pl.szczodrzynski.edziennik.data.db.entity.Notice.Companion.TYPE_NEGATIVE -import pl.szczodrzynski.edziennik.data.db.entity.Notice.Companion.TYPE_NEUTRAL -import pl.szczodrzynski.edziennik.data.db.entity.Notice.Companion.TYPE_POSITIVE -import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS -import pl.szczodrzynski.edziennik.getJsonObject -import pl.szczodrzynski.edziennik.getString -import pl.szczodrzynski.edziennik.utils.models.Date - -class IdziennikWebNotices(override val data: DataIdziennik, - override val lastSync: Long?, - val onSuccess: (endpointId: Int) -> Unit -) : IdziennikWeb(data, lastSync) { - companion object { - private const val TAG = "IdziennikWebNotices" - } - - init { - webApiGet(TAG, IDZIENNIK_WEB_NOTICES, mapOf( - "idPozDziennika" to data.registerId - )) { result -> - val json = result.getJsonObject("d") ?: run { - data.error(ApiError(TAG, ERROR_IDZIENNIK_WEB_REQUEST_NO_DATA) - .withApiResponse(result)) - return@webApiGet - } - - for (jNoticeEl in json.getAsJsonArray("SUwaga")) { - val jNotice = jNoticeEl.asJsonObject - // jNotice - val noticeId = jNotice.get("id").asString.crc16().toLong() - - val rTeacher = data.getTeacherByLastFirst(jNotice.get("Nauczyciel").asString) - val addedDate = Date.fromY_m_d(jNotice.get("Data").asString) - - var nType = TYPE_NEUTRAL - val jType = jNotice.get("Typ").asString - if (jType == "n") { - nType = TYPE_NEGATIVE - } else if (jType == "p") { - nType = TYPE_POSITIVE - } - - val noticeObject = Notice( - profileId = profileId, - id = noticeId, - type = nType, - semester = jNotice.get("Semestr").asInt, - text = jNotice.getString("Tresc") ?: "", - category = null, - points = null, - teacherId = rTeacher.id, - addedDate = addedDate.inMillis - ) - - data.noticeList.add(noticeObject) - data.metadataList.add(Metadata( - profileId, - Metadata.TYPE_NOTICE, - noticeObject.id, - profile?.empty ?: false, - profile?.empty ?: false - )) - } - - data.setSyncNext(ENDPOINT_IDZIENNIK_WEB_NOTICES, SYNC_ALWAYS) - onSuccess(ENDPOINT_IDZIENNIK_WEB_NOTICES) - } - } -} diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebProposedGrades.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebProposedGrades.kt deleted file mode 100644 index b23e9f98..00000000 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebProposedGrades.kt +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (c) Kuba Szczodrzyński 2019-10-28. - */ - -package pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.web - -import pl.szczodrzynski.edziennik.asJsonObjectList -import pl.szczodrzynski.edziennik.data.api.ERROR_IDZIENNIK_WEB_REQUEST_NO_DATA -import pl.szczodrzynski.edziennik.data.api.IDZIENNIK_WEB_MISSING_GRADES -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.DataIdziennik -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.ENDPOINT_IDZIENNIK_WEB_PROPOSED_GRADES -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.IdziennikWeb -import pl.szczodrzynski.edziennik.data.api.models.ApiError -import pl.szczodrzynski.edziennik.data.api.models.DataRemoveModel -import pl.szczodrzynski.edziennik.data.db.entity.Grade -import pl.szczodrzynski.edziennik.data.db.entity.Grade.Companion.TYPE_DESCRIPTIVE -import pl.szczodrzynski.edziennik.data.db.entity.Grade.Companion.TYPE_SEMESTER1_PROPOSED -import pl.szczodrzynski.edziennik.data.db.entity.Grade.Companion.TYPE_YEAR_PROPOSED -import pl.szczodrzynski.edziennik.data.db.entity.Metadata -import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS -import pl.szczodrzynski.edziennik.getJsonArray -import pl.szczodrzynski.edziennik.getJsonObject -import pl.szczodrzynski.edziennik.getString - -class IdziennikWebProposedGrades(override val data: DataIdziennik, - override val lastSync: Long?, - val onSuccess: (endpointId: Int) -> Unit -) : IdziennikWeb(data, lastSync) { - companion object { - private const val TAG = "IdziennikWebProposedGrades" - } - - init { data.profile?.also { profile -> - webApiGet(TAG, IDZIENNIK_WEB_MISSING_GRADES, mapOf( - "idPozDziennika" to data.registerId - )) { result -> - val json = result.getJsonObject("d") ?: run { - data.error(ApiError(TAG, ERROR_IDZIENNIK_WEB_REQUEST_NO_DATA) - .withApiResponse(result)) - return@webApiGet - } - val manager = data.app.gradesManager - - json.getJsonArray("Przedmioty")?.asJsonObjectList()?.forEach { subject -> - val subjectName = subject.getString("Przedmiot") ?: return@forEach - val subjectObject = data.getSubject(subjectName, null, subjectName) - - val semester1Proposed = subject.getString("OcenaSem1") ?: "" - val semester1Value = manager.getGradeValue(semester1Proposed) - val semester1Id = subjectObject.id * (-100) - 1 - val semester1Type = - if (semester1Value == 0f) TYPE_DESCRIPTIVE - else TYPE_SEMESTER1_PROPOSED - val semester1Name = when { - semester1Value == 0f -> " " - semester1Value % 1.0f == 0f -> semester1Value.toInt().toString() - else -> semester1Value.toString() - } - val semester1Color = - if (semester1Value == 0f) 0xff536dfe.toInt() - else -1 - - val semester2Proposed = subject.getString("OcenaSem2") ?: "" - val semester2Value = manager.getGradeValue(semester2Proposed) - val semester2Id = subjectObject.id * (-100) - 2 - val semester2Type = - if (semester2Value == 0f) TYPE_DESCRIPTIVE - else TYPE_YEAR_PROPOSED - val semester2Name = when { - semester2Value == 0f -> " " - semester2Value % 1.0f == 0f -> semester2Value.toInt().toString() - else -> semester2Value.toString() - } - val semester2Color = - if (semester2Value == 0f) 0xffff4081.toInt() - else -1 - - if (semester1Proposed != "") { - val addedDate = if (data.profile.empty) - data.profile.dateSemester1Start.inMillis - else - System.currentTimeMillis() - - val gradeObject = Grade( - profileId = profileId, - id = semester1Id, - name = semester1Name, - type = semester1Type, - value = semester1Value, - weight = 0f, - color = semester1Color, - category = if (semester1Value == 0f) "Ocena opisowa semestralna" else null, - description = if (semester1Value == 0f) semester1Proposed else null, - comment = null, - semester = 1, - teacherId = -1, - subjectId = subjectObject.id, - addedDate = addedDate - ) - - data.gradeList.add(gradeObject) - data.metadataList.add(Metadata( - profileId, - Metadata.TYPE_GRADE, - gradeObject.id, - profile.empty, - profile.empty - )) - } - - if (semester2Proposed != "") { - val addedDate = if (data.profile.empty) - data.profile.dateSemester2Start.inMillis - else - System.currentTimeMillis() - - val gradeObject = Grade( - profileId = profileId, - id = semester2Id, - name = semester2Name, - type = semester2Type, - value = semester2Value, - weight = 0f, - color = semester2Color, - category = if (semester2Value == 0f) "Ocena opisowa końcoworoczna" else null, - description = if (semester2Value == 0f) semester2Proposed else null, - comment = null, - semester = 2, - teacherId = -1, - subjectId = subjectObject.id, - addedDate = addedDate - ) - - data.gradeList.add(gradeObject) - data.metadataList.add(Metadata( - profileId, - Metadata.TYPE_GRADE, - gradeObject.id, - profile.empty, - profile.empty - )) - } - } - - data.toRemove.addAll(listOf(TYPE_SEMESTER1_PROPOSED, TYPE_YEAR_PROPOSED).map { - DataRemoveModel.Grades.semesterWithType(profile.currentSemester, it) - }) - data.setSyncNext(ENDPOINT_IDZIENNIK_WEB_PROPOSED_GRADES, SYNC_ALWAYS) - onSuccess(ENDPOINT_IDZIENNIK_WEB_PROPOSED_GRADES) - } - } ?: onSuccess(ENDPOINT_IDZIENNIK_WEB_PROPOSED_GRADES) } -} diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebSendMessage.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebSendMessage.kt deleted file mode 100644 index 343ebcac..00000000 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebSendMessage.kt +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) Kuba Szczodrzyński 2019-12-30. - */ - -package pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.web - -import org.greenrobot.eventbus.EventBus -import pl.szczodrzynski.edziennik.* -import pl.szczodrzynski.edziennik.data.api.ERROR_IDZIENNIK_WEB_REQUEST_NO_DATA -import pl.szczodrzynski.edziennik.data.api.IDZIENNIK_WEB_SEND_MESSAGE -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.DataIdziennik -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.IdziennikWeb -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.api.IdziennikApiMessagesSent -import pl.szczodrzynski.edziennik.data.api.events.MessageSentEvent -import pl.szczodrzynski.edziennik.data.api.models.ApiError -import pl.szczodrzynski.edziennik.data.db.entity.Message -import pl.szczodrzynski.edziennik.data.db.entity.Metadata -import pl.szczodrzynski.edziennik.data.db.entity.Teacher -import java.util.* - -class IdziennikWebSendMessage(override val data: DataIdziennik, - val recipients: List, - val subject: String, - val text: String, - val onSuccess: () -> Unit -) : IdziennikWeb(data, null) { - companion object { - private const val TAG = "IdziennikWebSendMessage" - } - - init { - val recipientsArray = JsonArray() - for (teacher in recipients) { - teacher.loginId?.let { - recipientsArray += it - } - } - - webApiGet(TAG, IDZIENNIK_WEB_SEND_MESSAGE, mapOf( - "Wiadomosc" to JsonObject( - "Tytul" to subject, - "Tresc" to text, - "Confirmation" to false, - "GuidMessage" to UUID.randomUUID().toString().toUpperCase(Locale.ROOT), - "Odbiorcy" to recipientsArray - ) - )) { result -> - val json = result.getJsonObject("d") ?: run { - data.error(ApiError(TAG, ERROR_IDZIENNIK_WEB_REQUEST_NO_DATA) - .withApiResponse(result)) - return@webApiGet - } - - if (json.getBoolean("CzyJestBlad") != false) { - // TODO error - return@webApiGet - } - - IdziennikApiMessagesSent(data, null) { - val message = data.messageList.firstOrNull { it.type == Message.TYPE_SENT && it.subject == subject } - val metadata = data.metadataList.firstOrNull { it.thingType == Metadata.TYPE_MESSAGE && it.thingId == message?.id } - val event = MessageSentEvent(data.profileId, message, message?.addedDate) - - EventBus.getDefault().postSticky(event) - onSuccess() - } - } - } -} diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebSwitchRegister.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebSwitchRegister.kt deleted file mode 100644 index f225f177..00000000 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebSwitchRegister.kt +++ /dev/null @@ -1,36 +0,0 @@ -package pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.web - -import com.google.gson.JsonObject -import pl.szczodrzynski.edziennik.data.api.IDZIENNIK_WEB_HOME -import pl.szczodrzynski.edziennik.data.api.Regexes -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.DataIdziennik -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.IdziennikWeb -import pl.szczodrzynski.edziennik.get -import pl.szczodrzynski.edziennik.getString - -class IdziennikWebSwitchRegister(override val data: DataIdziennik, - val registerId: Int, - val onSuccess: () -> Unit -) : IdziennikWeb(data, null) { - companion object { - private const val TAG = "IdziennikWebSwitchRegister" - } - - init { - val hiddenFields = data.loginStore.getLoginData("hiddenFields", JsonObject()) - // TODO error checking - - webGet(TAG, IDZIENNIK_WEB_HOME, mapOf( - "__VIEWSTATE" to hiddenFields.getString("__VIEWSTATE", ""), - "__VIEWSTATEGENERATOR" to hiddenFields.getString("__VIEWSTATEGENERATOR", ""), - "__EVENTVALIDATION" to hiddenFields.getString("__EVENTVALIDATION", ""), - "ctl00\$dxComboUczniowie" to registerId - )) { text -> - Regexes.IDZIENNIK_WEB_SELECTED_REGISTER.find(text)?.let { - val registerId = it[1].toIntOrNull() ?: return@let - data.webSelectedRegister = registerId - } - onSuccess() - } - } -} diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebTimetable.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebTimetable.kt deleted file mode 100644 index e7d293c4..00000000 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebTimetable.kt +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Copyright (c) Kacper Ziubryniewicz 2019-11-22 - */ - -package pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.web - -import androidx.core.util.set -import pl.szczodrzynski.edziennik.* -import pl.szczodrzynski.edziennik.data.api.ERROR_IDZIENNIK_WEB_REQUEST_NO_DATA -import pl.szczodrzynski.edziennik.data.api.IDZIENNIK_WEB_TIMETABLE -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.DataIdziennik -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.ENDPOINT_IDZIENNIK_WEB_TIMETABLE -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.IdziennikWeb -import pl.szczodrzynski.edziennik.data.api.models.ApiError -import pl.szczodrzynski.edziennik.data.api.models.DataRemoveModel -import pl.szczodrzynski.edziennik.data.db.entity.Lesson -import pl.szczodrzynski.edziennik.data.db.entity.LessonRange -import pl.szczodrzynski.edziennik.data.db.entity.Metadata -import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS -import pl.szczodrzynski.edziennik.utils.Utils.d -import pl.szczodrzynski.edziennik.utils.models.Date -import pl.szczodrzynski.edziennik.utils.models.Time -import pl.szczodrzynski.edziennik.utils.models.Week - -class IdziennikWebTimetable(override val data: DataIdziennik, - override val lastSync: Long?, - val onSuccess: (endpointId: Int) -> Unit -) : IdziennikWeb(data, lastSync) { - companion object { - private const val TAG = "IdziennikWebTimetable" - } - - init { data.profile?.also { profile -> - val currentWeekStart = Week.getWeekStart() - - if (Date.getToday().weekDay > 4) { - currentWeekStart.stepForward(0, 0, 7) - } - - val getDate = data.arguments?.getString("weekStart") ?: currentWeekStart.stringY_m_d - - val weekStart = Date.fromY_m_d(getDate) - val weekEnd = weekStart.clone().stepForward(0, 0, 6) - - webApiGet(TAG, IDZIENNIK_WEB_TIMETABLE, mapOf( - "idPozDziennika" to data.registerId, - "pidRokSzkolny" to data.schoolYearId, - "data" to "${weekStart.stringY_m_d}T10:00:00.000Z" - )) { result -> - val json = result.getJsonObject("d") ?: run { - data.error(ApiError(TAG, ERROR_IDZIENNIK_WEB_REQUEST_NO_DATA) - .withApiResponse(result)) - return@webApiGet - } - - json.getJsonArray("GodzinyLekcyjne")?.asJsonObjectList()?.forEachIndexed { index, range -> - val lessonRange = LessonRange( - profileId, - index + 1, - range.getString("Poczatek")?.let { Time.fromH_m(it) } - ?: return@forEachIndexed, - range.getString("Koniec")?.let { Time.fromH_m(it) } ?: return@forEachIndexed - ) - data.lessonRanges[lessonRange.lessonNumber] = lessonRange - } - - val dates = mutableSetOf() - val lessons = mutableListOf() - - json.getJsonArray("Przedmioty")?.asJsonObjectList()?.forEach { lesson -> - val subject = data.getSubject( - lesson.getString("Nazwa") ?: return@forEach, - lesson.getLong("Id"), - lesson.getString("Skrot") ?: "" - ) - val teacher = data.getTeacherByFDotLast(lesson.getString("Nauczyciel") - ?: return@forEach) - - val newSubjectName = lesson.getString("PrzedmiotZastepujacy") - val newSubject = when (newSubjectName.isNullOrBlank()) { - true -> null - else -> data.getSubject(newSubjectName, null, newSubjectName) - } - - val newTeacherName = lesson.getString("NauZastepujacy") - val newTeacher = when (newTeacherName.isNullOrBlank()) { - true -> null - else -> data.getTeacherByFDotLast(newTeacherName) - } - - val weekDay = lesson.getInt("DzienTygodnia")?.minus(1) ?: return@forEach - val lessonRange = data.lessonRanges[lesson.getInt("Godzina")?.plus(1) - ?: return@forEach] - val lessonDate = weekStart.clone().stepForward(0, 0, weekDay) - val classroom = lesson.getString("NazwaSali") - - val type = lesson.getInt("TypZastepstwa") ?: -1 - - val lessonObject = Lesson(profileId, -1) - - when (type) { - 1, 2, 3, 4, 5 -> { - lessonObject.apply { - this.type = Lesson.TYPE_CHANGE - - this.date = lessonDate - this.lessonNumber = lessonRange.lessonNumber - this.startTime = lessonRange.startTime - this.endTime = lessonRange.endTime - this.subjectId = newSubject?.id - this.teacherId = newTeacher?.id - this.teamId = data.teamClass?.id - this.classroom = classroom - - this.oldDate = lessonDate - this.oldLessonNumber = lessonRange.lessonNumber - this.oldStartTime = lessonRange.startTime - this.oldEndTime = lessonRange.endTime - this.oldSubjectId = subject.id - this.oldTeacherId = teacher.id - this.oldTeamId = data.teamClass?.id - this.oldClassroom = classroom - } - } - 0 -> { - lessonObject.apply { - this.type = Lesson.TYPE_CANCELLED - - this.oldDate = lessonDate - this.oldLessonNumber = lessonRange.lessonNumber - this.oldStartTime = lessonRange.startTime - this.oldEndTime = lessonRange.endTime - this.oldSubjectId = subject.id - this.oldTeacherId = teacher.id - this.oldTeamId = data.teamClass?.id - this.oldClassroom = classroom - } - } - else -> { - lessonObject.apply { - this.type = Lesson.TYPE_NORMAL - - this.date = lessonDate - this.lessonNumber = lessonRange.lessonNumber - this.startTime = lessonRange.startTime - this.endTime = lessonRange.endTime - this.subjectId = subject.id - this.teacherId = teacher.id - this.teamId = data.teamClass?.id - this.classroom = classroom - } - } - } - - lessonObject.id = lessonObject.buildId() - - dates.add(lessonDate.value) - lessons.add(lessonObject) - - val seen = profile.empty || lessonDate < Date.getToday() - - if (lessonObject.type != Lesson.TYPE_NORMAL && lessonDate >= Date.getToday()) { - data.metadataList.add(Metadata( - profileId, - Metadata.TYPE_LESSON_CHANGE, - lessonObject.id, - seen, - seen - )) - } - } - - val date: Date = weekStart.clone() - while (date <= weekEnd) { - if (!dates.contains(date.value)) { - lessons.add(Lesson(profileId, date.value.toLong()).apply { - this.type = Lesson.TYPE_NO_LESSONS - this.date = date.clone() - }) - } - - date.stepForward(0, 0, 1) - } - - d(TAG, "Clearing lessons between ${weekStart.stringY_m_d} and ${weekEnd.stringY_m_d} - timetable downloaded for $getDate") - - data.lessonList.addAll(lessons) - data.toRemove.add(DataRemoveModel.Timetable.between(weekStart, weekEnd)) - - data.setSyncNext(ENDPOINT_IDZIENNIK_WEB_TIMETABLE, SYNC_ALWAYS) - onSuccess(ENDPOINT_IDZIENNIK_WEB_TIMETABLE) - } - }} -} diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/firstlogin/IdziennikFirstLogin.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/firstlogin/IdziennikFirstLogin.kt deleted file mode 100644 index 1a07c609..00000000 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/firstlogin/IdziennikFirstLogin.kt +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) Kuba Szczodrzyński 2019-10-27. - */ - -package pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.firstlogin - -import org.greenrobot.eventbus.EventBus -import pl.szczodrzynski.edziennik.data.api.ERROR_LOGIN_IDZIENNIK_FIRST_NO_SCHOOL_YEAR -import pl.szczodrzynski.edziennik.data.api.IDZIENNIK_WEB_SETTINGS -import pl.szczodrzynski.edziennik.data.api.LOGIN_TYPE_IDZIENNIK -import pl.szczodrzynski.edziennik.data.api.Regexes -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.DataIdziennik -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.data.IdziennikWeb -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.login.IdziennikLoginWeb -import pl.szczodrzynski.edziennik.data.api.events.FirstLoginFinishedEvent -import pl.szczodrzynski.edziennik.data.api.models.ApiError -import pl.szczodrzynski.edziennik.data.db.entity.Profile -import pl.szczodrzynski.edziennik.fixName -import pl.szczodrzynski.edziennik.get -import pl.szczodrzynski.edziennik.set -import pl.szczodrzynski.edziennik.swapFirstLastName - -class IdziennikFirstLogin(val data: DataIdziennik, val onSuccess: () -> Unit) { - companion object { - private const val TAG = "IdziennikFirstLogin" - } - - private val web = IdziennikWeb(data, null) - private val profileList = mutableListOf() - - init { - val loginStoreId = data.loginStore.id - val loginStoreType = LOGIN_TYPE_IDZIENNIK - var firstProfileId = loginStoreId - - IdziennikLoginWeb(data) { - web.webGet(TAG, IDZIENNIK_WEB_SETTINGS) { text -> - //val accounts = json.getJsonArray("accounts") - - val isParent = Regexes.IDZIENNIK_LOGIN_FIRST_IS_PARENT.find(text)?.get(1) != "0" - val accountNameLong = if (isParent) - Regexes.IDZIENNIK_LOGIN_FIRST_ACCOUNT_NAME.find(text)?.get(1)?.swapFirstLastName()?.fixName() - else null - - var schoolYearStart: Int? = null - var schoolYearEnd: Int? = null - var schoolYearName: String? = null - val schoolYearId = Regexes.IDZIENNIK_LOGIN_FIRST_SCHOOL_YEAR.find(text)?.let { - schoolYearName = it[2]+"/"+it[3] - schoolYearStart = it[2].toIntOrNull() - schoolYearEnd = it[3].toIntOrNull() - it[1].toIntOrNull() - } ?: run { - data.error(ApiError(TAG, ERROR_LOGIN_IDZIENNIK_FIRST_NO_SCHOOL_YEAR) - .withApiResponse(text)) - return@webGet - } - - Regexes.IDZIENNIK_LOGIN_FIRST_STUDENT.findAll(text) - .toMutableList() - .reversed() - .forEach { match -> - val registerId = match[1].toIntOrNull() ?: return@forEach - val studentId = match[2] - val firstName = match[3] - val lastName = match[4] - val className = match[5] + " " + match[6] - - val studentNameLong = "$firstName $lastName".fixName() - val studentNameShort = "$firstName ${lastName[0]}.".fixName() - val accountName = if (accountNameLong == studentNameLong) null else accountNameLong - - val profile = Profile( - firstProfileId++, - loginStoreId, - loginStoreType, - studentNameLong, - data.webUsername, - studentNameLong, - studentNameShort, - accountName - ).apply { - schoolYearStart?.let { studentSchoolYearStart = it } - studentClassName = className - studentData["studentId"] = studentId - studentData["registerId"] = registerId - studentData["schoolYearId"] = schoolYearId - } - profileList.add(profile) - } - - EventBus.getDefault().postSticky(FirstLoginFinishedEvent(profileList, data.loginStore)) - onSuccess() - } - } - } -} diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/login/IdziennikLogin.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/login/IdziennikLogin.kt deleted file mode 100644 index e1cef5c1..00000000 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/login/IdziennikLogin.kt +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) Kuba Szczodrzyński 2019-10-25. - */ - -package pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.login - -import pl.szczodrzynski.edziennik.R -import pl.szczodrzynski.edziennik.data.api.LOGIN_METHOD_IDZIENNIK_API -import pl.szczodrzynski.edziennik.data.api.LOGIN_METHOD_IDZIENNIK_WEB -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.DataIdziennik -import pl.szczodrzynski.edziennik.utils.Utils - -class IdziennikLogin(val data: DataIdziennik, val onSuccess: () -> Unit) { - companion object { - private const val TAG = "IdziennikLogin" - } - - private var cancelled = false - - init { - nextLoginMethod(onSuccess) - } - - private fun nextLoginMethod(onSuccess: () -> Unit) { - if (data.targetLoginMethodIds.isEmpty()) { - onSuccess() - return - } - if (cancelled) { - onSuccess() - return - } - useLoginMethod(data.targetLoginMethodIds.removeAt(0)) { usedMethodId -> - data.progress(data.progressStep) - if (usedMethodId != -1) - data.loginMethods.add(usedMethodId) - nextLoginMethod(onSuccess) - } - } - - private fun useLoginMethod(loginMethodId: Int, onSuccess: (usedMethodId: Int) -> Unit) { - // this should never be true - if (data.loginMethods.contains(loginMethodId)) { - onSuccess(-1) - return - } - Utils.d(TAG, "Using login method $loginMethodId") - when (loginMethodId) { - LOGIN_METHOD_IDZIENNIK_WEB -> { - data.startProgress(R.string.edziennik_progress_login_idziennik_web) - IdziennikLoginWeb(data) { onSuccess(loginMethodId) } - } - LOGIN_METHOD_IDZIENNIK_API -> { - data.startProgress(R.string.edziennik_progress_login_idziennik_api) - IdziennikLoginApi(data) { onSuccess(loginMethodId) } - } - } - } -} diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/login/IdziennikLoginApi.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/login/IdziennikLoginApi.kt deleted file mode 100644 index 2afe481d..00000000 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/login/IdziennikLoginApi.kt +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) Kuba Szczodrzyński 2019-10-27. - */ - -package pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.login - -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.DataIdziennik - -class IdziennikLoginApi(val data: DataIdziennik, val onSuccess: () -> Unit) { - companion object { - private const val TAG = "IdziennikLoginApi" - } - - init { run { - if (data.isApiLoginValid()) { - onSuccess() - } - else { - onSuccess() - } - }} -} diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/login/IdziennikLoginWeb.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/login/IdziennikLoginWeb.kt deleted file mode 100644 index a2fd4d03..00000000 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/login/IdziennikLoginWeb.kt +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (c) Kuba Szczodrzyński 2019-10-26. - */ - -package pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.login - -import im.wangchao.mhttp.Request -import im.wangchao.mhttp.Response -import im.wangchao.mhttp.callback.TextCallbackHandler -import pl.szczodrzynski.edziennik.* -import pl.szczodrzynski.edziennik.data.api.* -import pl.szczodrzynski.edziennik.data.api.edziennik.idziennik.DataIdziennik -import pl.szczodrzynski.edziennik.data.api.models.ApiError -import pl.szczodrzynski.edziennik.data.db.entity.LuckyNumber -import pl.szczodrzynski.edziennik.data.db.entity.Metadata -import pl.szczodrzynski.edziennik.utils.Utils -import pl.szczodrzynski.edziennik.utils.models.Date - -class IdziennikLoginWeb(val data: DataIdziennik, val onSuccess: () -> Unit) { - companion object { - private const val TAG = "IdziennikLoginWeb" - } - - init { run { - if (data.isWebLoginValid()) { - data.app.cookieJar.set("iuczniowie.progman.pl", "ASP.NET_SessionId_iDziennik", data.webSessionId) - data.app.cookieJar.set("iuczniowie.progman.pl", ".ASPXAUTH", data.webAuth) - onSuccess() - } - else { - data.app.cookieJar.clear("iuczniowie.progman.pl") - if (data.webSchoolName != null && data.webUsername != null && data.webPassword != null) { - loginWithCredentials() - } - else { - data.error(ApiError(TAG, ERROR_LOGIN_DATA_MISSING)) - } - } - }} - - private fun loginWithCredentials() { - Utils.d(TAG, "Request: Idziennik/Login/Web - $IDZIENNIK_WEB_URL/$IDZIENNIK_WEB_LOGIN") - - val loginCallback = object : TextCallbackHandler() { - override fun onSuccess(text: String?, response: Response?) { - if (text.isNullOrEmpty()) { - data.error(ApiError(TAG, ERROR_RESPONSE_EMPTY) - .withResponse(response)) - return - } - - // login succeeded: there is a start page - if (text.contains("czyWyswietlicDostepMobilny")) { - val cookies = data.app.cookieJar.getAll("iuczniowie.progman.pl") - run { - data.webSessionId = cookies["ASP.NET_SessionId_iDziennik"] ?: return@run ERROR_LOGIN_IDZIENNIK_WEB_NO_SESSION - data.webAuth = cookies[".ASPXAUTH"] ?: return@run ERROR_LOGIN_IDZIENNIK_WEB_NO_AUTH - data.apiBearer = cookies["Bearer"]?: return@run ERROR_LOGIN_IDZIENNIK_WEB_NO_BEARER - data.loginExpiryTime = response.getUnixDate() + 30 * MINUTE /* after about 40 minutes the login didn't work already */ - data.apiExpiryTime = response.getUnixDate() + 12 * HOUR /* actually it expires after 24 hours but I'm not sure when does the token refresh. */ - - val hiddenFields = JsonObject() - Regexes.IDZIENNIK_LOGIN_HIDDEN_FIELDS.findAll(text).forEach { - hiddenFields[it[1]] = it[2] - } - data.loginStore.putLoginData("hiddenFields", hiddenFields) - - Regexes.IDZIENNIK_WEB_SELECTED_REGISTER.find(text)?.let { - val registerId = it[1].toIntOrNull() ?: return@let - data.webSelectedRegister = registerId - } - - // for profiles created after archiving - data.schoolYearId = Regexes.IDZIENNIK_LOGIN_FIRST_SCHOOL_YEAR.find(text)?.let { - it[1].toIntOrNull() - } ?: data.schoolYearId - data.profile?.studentClassName = Regexes.IDZIENNIK_LOGIN_FIRST_STUDENT.findAll(text) - .firstOrNull { it[1].toIntOrNull() == data.registerId } - ?.let { "${it[5]} ${it[6]}" } ?: data.profile?.studentClassName - - data.profile?.let { profile -> - Regexes.IDZIENNIK_WEB_LUCKY_NUMBER.find(text)?.also { - val number = it[1].toIntOrNull() ?: return@also - val luckyNumberObject = LuckyNumber( - profileId = data.profileId, - date = Date.getToday(), - number = number - ) - - data.luckyNumberList.add(luckyNumberObject) - data.metadataList.add( - Metadata( - profile.id, - Metadata.TYPE_LUCKY_NUMBER, - luckyNumberObject.date.value.toLong(), - true, - profile.empty - )) - } - } - - return@run null - }?.let { errorCode -> - data.error(ApiError(TAG, errorCode) - .withApiResponse(text) - .withResponse(response)) - return - } - - onSuccess() - return - } - - val errorText = Regexes.IDZIENNIK_LOGIN_ERROR.find(text)?.get(1) - when { - errorText?.contains("nieprawidłową nazwę szkoły") == true -> ERROR_LOGIN_IDZIENNIK_WEB_INVALID_SCHOOL_NAME - errorText?.contains("nieprawidłowy login lub hasło") == true -> ERROR_LOGIN_IDZIENNIK_WEB_INVALID_LOGIN - text.contains("Identyfikator zgłoszenia") -> ERROR_LOGIN_IDZIENNIK_WEB_SERVER_ERROR - text.contains("Hasło dostępu do systemu wygasło") -> ERROR_LOGIN_IDZIENNIK_WEB_PASSWORD_CHANGE_NEEDED - text.contains("Trwają prace konserwacyjne") -> ERROR_LOGIN_IDZIENNIK_WEB_MAINTENANCE - else -> ERROR_LOGIN_IDZIENNIK_WEB_OTHER - }.let { errorCode -> - data.error(ApiError(TAG, errorCode) - .withApiResponse(text) - .withResponse(response)) - return - } - } - - override fun onFailure(response: Response?, throwable: Throwable?) { - data.error(ApiError(TAG, ERROR_REQUEST_FAILURE) - .withResponse(response) - .withThrowable(throwable)) - } - } - - val getCallback = object : TextCallbackHandler() { - override fun onSuccess(text: String?, response: Response?) { - Request.builder() - .url("$IDZIENNIK_WEB_URL/$IDZIENNIK_WEB_LOGIN") - .userAgent(IDZIENNIK_USER_AGENT) - .addHeader("Origin", "https://iuczniowie.progman.pl") - .addHeader("Referer", "$IDZIENNIK_WEB_URL/$IDZIENNIK_WEB_LOGIN") - .apply { - Regexes.IDZIENNIK_LOGIN_HIDDEN_FIELDS.findAll(text ?: return@apply).forEach { - addParameter(it[1], it[2]) - } - } - .addParameter("ctl00\$ContentPlaceHolder\$nazwaPrzegladarki", IDZIENNIK_USER_AGENT) - .addParameter("ctl00\$ContentPlaceHolder\$NazwaSzkoly", data.webSchoolName) - .addParameter("ctl00\$ContentPlaceHolder\$UserName", data.webUsername) - .addParameter("ctl00\$ContentPlaceHolder\$Password", data.webPassword) - .addParameter("ctl00\$ContentPlaceHolder\$captcha", "") - .addParameter("ctl00\$ContentPlaceHolder\$Logowanie", "Zaloguj") - .post() - .allowErrorCode(502) - .callback(loginCallback) - .build() - .enqueue() - } - - override fun onFailure(response: Response?, throwable: Throwable?) { - data.error(ApiError(TAG, ERROR_REQUEST_FAILURE) - .withResponse(response) - .withThrowable(throwable)) - } - } - - Request.builder() - .url("$IDZIENNIK_WEB_URL/$IDZIENNIK_WEB_LOGIN") - .userAgent(IDZIENNIK_USER_AGENT) - .get() - .allowErrorCode(502) - .callback(getCallback) - .build() - .enqueue() - } -} diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginInfo.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginInfo.kt index cf632af5..949848a5 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginInfo.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginInfo.kt @@ -270,51 +270,6 @@ object LoginInfo { ) ) ), - Register( - loginType = LOGIN_TYPE_IDZIENNIK, - internalName = "idziennik", - registerName = R.string.login_type_idziennik, - registerLogo = R.drawable.login_logo_iuczniowie, - loginModes = listOf( - Mode( - loginMode = LOGIN_MODE_IDZIENNIK_WEB, - name = R.string.login_mode_idziennik_web, - icon = R.drawable.login_mode_idziennik_web, - hintText = R.string.login_mode_idziennik_web_hint, - guideText = R.string.login_mode_idziennik_web_guide, - credentials = listOf( - FormField( - keyName = "schoolName", - name = R.string.login_hint_school_name, - icon = CommunityMaterial.Icon2.cmd_school, - emptyText = R.string.login_error_no_school_name, - invalidText = R.string.login_error_incorrect_school_name, - errorCodes = mapOf( - ERROR_LOGIN_IDZIENNIK_WEB_INVALID_SCHOOL_NAME to R.string.login_error_incorrect_school_name - ), - isRequired = true, - validationRegex = "^[a-z0-9_\\-.]+$", - caseMode = FormField.CaseMode.LOWER_CASE - ), - FormField( - keyName = "username", - name = R.string.login_hint_username, - icon = CommunityMaterial.Icon.cmd_account_outline, - emptyText = R.string.login_error_no_username, - invalidText = R.string.login_error_incorrect_username, - errorCodes = mapOf(), - isRequired = true, - validationRegex = "^[a-z0-9_\\-.]+$", - caseMode = FormField.CaseMode.LOWER_CASE - ), - getPasswordCredential("password") - ), - errorCodes = mapOf( - ERROR_LOGIN_IDZIENNIK_WEB_INVALID_LOGIN to R.string.login_error_incorrect_login_or_password - ) - ) - ) - ), Register( loginType = LOGIN_TYPE_EDUDZIENNIK, internalName = "edudziennik", diff --git a/app/src/main/res/drawable/login_help_iuczniowie.webp b/app/src/main/res/drawable/login_help_iuczniowie.webp deleted file mode 100644 index 5a163bb9f8d6ea8126f766aa54b3925285d93af6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12892 zcmZ{KQ*b2=u=I(w*ZQD5ad;9fEQ@`- zM%2x`!0PkYY(C8+iq^Q-cM z;_YVY=b}KTZ=rx*ui@7w=`ZKe@jt|gVo|ga! z^v)0Ed*b)VP4K00IqjJ&cGNBoU%!@lpIz1N^5ZxAt}op~ zSbA1G;WiB>Y2K1MoXrsw`P7x5_HS=X2CO}eJC!n!Hf$XFH z!l0)#8uQiG?g1A5@KzK@OkYDYrV?$nsuc5zQ;m?guGV-i*EG}veJV|i#*j|>Lk>y~ zc^r#NEBL1*^45oO`dsN(VJrcp4bx6%E*ueSd4N4toN=fJb9I**14D6^u~P*-3WZIC5-A;ZOy&j5OuWuk; zySEto*Z)mRN?2vQSLC1j#r^qTL%B|9( zMO2Yz4i%wkU)u5D&Wt?Ncm01r{?yXnP6jsuJj3|aMhLYgZNnAoV>-uVqIcojWTr82 z%}6jf;qI!3NivT)d<9Dcd_<0sb}#e<(A7iT8wg>2 z3(^0V39=ryto#Ju^b;30$CTPutWpCFDv2mmY0V#sXDq!fWjMg&7gk-HkbgHCYC)Pj zxZ8~h*+O_a+=*zWF)YuBnw6Y=b+(D=e72nhblRZIUddfX@Wg0Gk!UhX%Bag=V&c$J zoL+v!g;`DGisnVtQ>qV(P3HZVi5?V~wfgED@Po|98qzf_WYgS5l$fuZh#}LFEV6ISj$w@TE$J-%~WN#ZI8?oVB^>Wj=88BDbw7)GHj43L>q4Y5jv{u}zH zUm?YBDmdMSLBKM_-c(dDx%3;Kd{}PgemzA6l&^IX zUR8I|&tzOwC79@2-1(9HxxY=UBK;dOS0&H$9~M3|g;+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CV z2OQPBk2=smizwJ#@x`^W=wbHa&x#u@0J~v_N%yJ73nZ!fLkLe3?BP8lgxGN+sW)W9 zG+7TdD>2l)m(cVN4yL@C0i^|tPD<9j>C!}xPB47{+sABhOr&s*#QDvl{(nOBe*hU% BkbD3D diff --git a/app/src/main/res/drawable/login_logo_iuczniowie.png b/app/src/main/res/drawable/login_logo_iuczniowie.png deleted file mode 100644 index 4356c3058aaad753dafa5c5272e7e05ea75e66fd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 14082 zcmV+dH~q+oP)0037A1^@s6@+r4|00009a7bBm000ie z000ie0hKEb8vp#+ zy6l0~E^W)IYkorTgHetr*9dwFz%8aPe%scqH+GHpcwTFiSJyrP;1t*PvguP>nr?YA z!XZsD#T3JE{IW}m=Jd?$acwW4y``aUL6|mW)ivi6+!(qqX-`XI{hYAv#tQ=gM(U4T zvh~2eTl?|BSwLBH7$4(7<;>9-vXdYNS#6$0}33tNj&hs%!3L50$>873njfB32rjb zJ&^s`+{#_gjKi-n#Sx5zT_oP<*gS6vU7CbDbR!eJ$sMmPlly28{9xLqK2Tm&vo3B^ zUq~c2>>lqi9chqihqFfKq<&Tj?6$A^hGV$8cpp&hl4B;c}ICw?N1k-b@jaQ z9?p@1=;IVOxvWX;iPHbo(NubC%IYrwzedp6yFUyB&avtABb{4H&(BAHQykIwII)I) zUyZEu25R~8?UQEnWdI;%)6tvU(=q2WbV8Hn20BBWA4~UbEvvrrtnnVok$^}a6W*k7 zh-=?cx~QY6WTO!tBXKFog8Ywy(`E6~jxD7Z=fCeMjub>MlY8j*RdU{;!&{RQs39vyim_hBKA1A;%4Rn>fKyoWN`k?7;)KB0H$JDcVo-O*HftFdSy zc|JM5$2BAf;nw!1g;R^sDctaSUmbj20{2bg?Ad!JmqIT{ry|~=tMBGd-V^yE;Yfr) zoaAlgRW+Z()VaDdMd|)LpULGOZCg~(*;MjRam1d=?8q@;&hiMv0`OMdH@U)krkEgj zD0DIWajxX9(38o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oy15(dP1{!DCdzn442e{NckHCT4Qv z)+%^G_z$)c0xUz);%Yq8?eeYjZHx{ku?*SJT-mjb9lmjg5CYTC`0|-9Mu$3CD+f%? zct-6mcBy8juQt zpaMikSRhfQQYr5mP$rYP7lvW+$kK@-e`;!Kyx#t%9-#R0<;yqb=jU%7RX}rdbK|eS z{`$N1TvB%@clYkyXkudGFQcQQ&!$qTc0h~cSj2J6A-=`cYSo{doczDnUVH67u3Wj2 z0ZKs4VzgZ^Zvt&2BO|@9zWVC7`}_L`4a0B`vueUH^ylX0?!WQI8}Ht@abpHp1^lgS zwjCg`0V%O@b2e0WSigy=HtZAtYa7a`Y^5G{kf^q?Z!ERROR_VULCAN_HEBE_ENTITY_NOT_FOUND ERROR_VULCAN_API_DEPRECATED - ERROR_LOGIN_IDZIENNIK_WEB_INVALID_LOGIN - ERROR_LOGIN_IDZIENNIK_WEB_INVALID_SCHOOL_NAME - ERROR_LOGIN_IDZIENNIK_WEB_PASSWORD_CHANGE_NEEDED - ERROR_LOGIN_IDZIENNIK_WEB_MAINTENANCE - ERROR_LOGIN_IDZIENNIK_WEB_SERVER_ERROR - ERROR_LOGIN_IDZIENNIK_WEB_OTHER - ERROR_LOGIN_IDZIENNIK_WEB_API_NO_ACCESS - ERROR_LOGIN_IDZIENNIK_WEB_NO_SESSION - ERROR_LOGIN_IDZIENNIK_WEB_NO_AUTH - ERROR_LOGIN_IDZIENNIK_WEB_NO_BEARER - ERROR_IDZIENNIK_WEB_ACCESS_DENIED - ERROR_IDZIENNIK_WEB_OTHER - ERROR_IDZIENNIK_WEB_MAINTENANCE - ERROR_IDZIENNIK_WEB_SERVER_ERROR - ERROR_IDZIENNIK_WEB_PASSWORD_CHANGE_NEEDED - ERROR_LOGIN_IDZIENNIK_FIRST_NO_SCHOOL_YEAR - ERROR_IDZIENNIK_WEB_REQUEST_NO_DATA - ERROR_IDZIENNIK_API_ACCESS_DENIED - ERROR_IDZIENNIK_API_OTHER - ERROR_IDZIENNIK_API_NO_REGISTER - ERROR_IDZIENNIK_WEB_RECIPIENT_LIST_NO_PERMISSION - ERROR_LOGIN_EDUDZIENNIK_WEB_INVALID_LOGIN ERROR_LOGIN_EDUDZIENNIK_WEB_OTHER ERROR_LOGIN_EDUDZIENNIK_WEB_NO_SESSION_ID @@ -191,9 +169,6 @@ EXCEPTION_LIBRUS_MESSAGES_FILE_REQUEST EXCEPTION_NOTIFY EXCEPTION_LIBRUS_MESSAGES_REQUEST - EXCEPTION_IDZIENNIK_WEB_REQUEST - EXCEPTION_IDZIENNIK_WEB_API_REQUEST - EXCEPTION_IDZIENNIK_API_REQUEST EXCEPTION_EDUDZIENNIK_WEB_REQUEST EXCEPTION_EDUDZIENNIK_FILE_REQUEST ERROR_ONEDRIVE_DOWNLOAD @@ -342,28 +317,6 @@ VULCAN®: nie znaleziono bytu W związku z wygaszeniem aplikacji Dzienniczek+ przez firmę Vulcan, należy zalogować się ponownie.\n\nAby móc dalej korzystać z aplikacji Szkolny.eu, otwórz Ustawienia i wybierz opcję Dodaj nowego ucznia.\nNastępnie zaloguj się do dziennika Vulcan zgodnie z instrukcją.\n\nPrzepraszamy za niedogodności. - Nieprawidłowe dane logowania - Nieprawidłowa nazwa szkoły - iDziennik: wymagana zmiana hasła. Zaloguj się na stronie iDziennika, by dokonać zmiany hasła. - Chwilowa przerwa techniczna iDziennika, lub inny problem z serwerem - Chwilowa przerwa techniczna iDziennika, lub inny problem z serwerem (serwer zwrócił błąd) - iDziennik: inny błąd logowania - iDziennik: brak dostępu do API - iDziennik: nie znaleziono sesji - iDziennik: nie znaleziono tokenu autoryzacji - iDziennik: nie znaleziono tokenu API - iDziennik: brak dostępu. Zaloguj się ponownie. - iDziennik: inny błąd synchronizacji - Chwilowa przerwa techniczna iDziennika, lub inny problem z serwerem - Chwilowa przerwa techniczna iDziennika, lub inny problem z serwerem (serwer zwrócił błąd) - iDziennik: wymagana zmiana hasła. Zaloguj się na stronie iDziennika, by dokonać zmiany hasła. - iDziennik: nie znaleziono numeru roku szkolnego. Uczeń może nie być aktywny w aktualnym roku szkolnym. - iDziennik: serwer nie zwrócił żadnych danych - Brak dostępu do API iDziennika - Inny błąd API iDziennika - iDziennik: nie znaleziono ID dziennika. Zgłoś błąd programiście. - Twoje konto nie ma uprawnień do wysyłania wiadomości (bądź wystąpił inny błąd serwera iDziennika) - Błędny email lub hasło Inny błąd logowania Brak ID sesji @@ -390,9 +343,6 @@ EXCEPTION_LIBRUS_MESSAGES_FILE_REQUEST EXCEPTION_NOTIFY Zgłoś błąd: pobieranie wiadomości LIBRUS® - EXCEPTION_IDZIENNIK_WEB_REQUEST - EXCEPTION_IDZIENNIK_WEB_API_REQUEST - EXCEPTION_IDZIENNIK_API_REQUEST Wystąpił błąd Wystąpił błąd podczas pobierania pliku Nie udało się pobrać pliku z OneDrive