diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/WidgetTimetable.kt b/app/src/main/java/pl/szczodrzynski/edziennik/WidgetTimetable.kt index ab5d21da..ea5deca1 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/WidgetTimetable.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/WidgetTimetable.kt @@ -214,8 +214,8 @@ class WidgetTimetable : AppWidgetProvider() { model.lessonId = lesson.id model.lessonDate = timetableDate - model.startTime = lesson.startTime - model.endTime = lesson.endTime + model.startTime = lesson.displayStartTime + model.endTime = lesson.displayEndTime // check if the lesson has already passed or it's currently in progress if (lesson.displayDate == today) { diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/Errors.kt b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/Errors.kt index a3b41c45..0704d2a0 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/Errors.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/Errors.kt @@ -41,7 +41,6 @@ const val ERROR_REQUEST_HTTP_410 = 56 const val ERROR_REQUEST_HTTP_500 = 57 const val ERROR_RESPONSE_EMPTY = 100 const val ERROR_LOGIN_DATA_MISSING = 101 -const val ERROR_LOGIN_DATA_INVALID = 102 const val ERROR_PROFILE_MISSING = 105 const val ERROR_INVALID_LOGIN_MODE = 110 const val ERROR_LOGIN_METHOD_NOT_SATISFIED = 111 @@ -99,6 +98,12 @@ const val ERROR_LOGIN_LIBRUS_PORTAL_REFRESH_INVALID = 172 const val ERROR_LOGIN_LIBRUS_PORTAL_REFRESH_REVOKED = 173 const val ERROR_LIBRUS_SYNERGIA_OTHER = 174 const val ERROR_LIBRUS_SYNERGIA_MAINTENANCE = 175 +const val ERROR_LIBRUS_MESSAGES_MAINTENANCE = 176 +const val ERROR_LIBRUS_MESSAGES_ERROR = 177 +const val ERROR_LIBRUS_MESSAGES_OTHER = 178 +const val ERROR_LOGIN_LIBRUS_MESSAGES_INVALID_LOGIN = 179 +const val ERROR_LOGIN_LIBRUS_PORTAL_INVALID_LOGIN = 180 +const val ERROR_LIBRUS_API_MAINTENANCE = 181 const val ERROR_LOGIN_MOBIDZIENNIK_WEB_INVALID_LOGIN = 201 const val ERROR_LOGIN_MOBIDZIENNIK_WEB_OLD_PASSWORD = 202 diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/librus/data/LibrusApi.kt b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/librus/data/LibrusApi.kt index 4f8d12eb..837695d3 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/librus/data/LibrusApi.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/librus/data/LibrusApi.kt @@ -32,6 +32,13 @@ open class LibrusApi(open val data: DataLibrus) { val callback = object : JsonCallbackHandler() { override fun onSuccess(json: JsonObject?, response: Response?) { + if (response?.code() == HTTP_UNAVAILABLE) { + data.error(ApiError(tag, ERROR_LIBRUS_API_MAINTENANCE) + .withApiResponse(json) + .withResponse(response)) + return + } + if (json == null && response?.parserErrorBody == null) { data.error(ApiError(TAG, ERROR_RESPONSE_EMPTY) .withResponse(response)) @@ -104,6 +111,7 @@ open class LibrusApi(open val data: DataLibrus) { .allowErrorCode(HTTP_BAD_REQUEST) .allowErrorCode(HTTP_FORBIDDEN) .allowErrorCode(HTTP_UNAUTHORIZED) + .allowErrorCode(HTTP_UNAVAILABLE) .callback(callback) .build() .enqueue() diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/librus/data/LibrusMessages.kt b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/librus/data/LibrusMessages.kt index a94124b1..7de22502 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/librus/data/LibrusMessages.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/librus/data/LibrusMessages.kt @@ -15,7 +15,6 @@ import org.jsoup.parser.Parser import pl.szczodrzynski.edziennik.api.v2.* import pl.szczodrzynski.edziennik.api.v2.librus.DataLibrus import pl.szczodrzynski.edziennik.api.v2.models.ApiError -import pl.szczodrzynski.edziennik.get import pl.szczodrzynski.edziennik.utils.Utils.d import java.io.StringWriter import javax.xml.parsers.DocumentBuilderFactory @@ -43,19 +42,19 @@ open class LibrusMessages(open val data: DataLibrus) { val callback = object : TextCallbackHandler() { override fun onSuccess(text: String?, response: Response?) { if (text.isNullOrEmpty()) { - data.error(ApiError(LibrusSynergia.TAG, ERROR_RESPONSE_EMPTY) + data.error(ApiError(TAG, ERROR_RESPONSE_EMPTY) .withResponse(response)) return } - // TODO: Finish error handling - - if ("error" in text) { - when ("(.*)".toRegex().find(text)?.get(1)) { - "eAccessDeny" -> data.error(ApiError(tag, ERROR_LIBRUS_MESSAGES_ACCESS_DENIED) - .withResponse(response) - .withApiResponse(text)) - } + when { + text.contains("Niepoprawny login i/lub hasło.") -> data.error(TAG, ERROR_LOGIN_LIBRUS_MESSAGES_INVALID_LOGIN, response, text) + text.contains("stop.png") -> data.error(TAG, ERROR_LIBRUS_SYNERGIA_ACCESS_DENIED, response, text) + text.contains("eAccessDeny") -> data.error(TAG, ERROR_LIBRUS_MESSAGES_ACCESS_DENIED, response, text) + text.contains("OffLine") -> data.error(TAG, ERROR_LIBRUS_MESSAGES_MAINTENANCE, response, text) + text.contains("error") -> data.error(TAG, ERROR_LIBRUS_MESSAGES_ERROR, response, text) + text.contains("eVarWhitThisNameNotExists") -> data.error(TAG, ERROR_LIBRUS_MESSAGES_ACCESS_DENIED, response, text) + text.contains("") -> data.error(TAG, ERROR_LIBRUS_MESSAGES_OTHER, response, text) } try { diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/librus/data/LibrusSynergia.kt b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/librus/data/LibrusSynergia.kt index b45c0aa8..b112fa72 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/librus/data/LibrusSynergia.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/librus/data/LibrusSynergia.kt @@ -14,7 +14,7 @@ import pl.szczodrzynski.edziennik.utils.Utils.d open class LibrusSynergia(open val data: DataLibrus) { companion object { - const val TAG = "LibrusSynergia" + private const val TAG = "LibrusSynergia" } val profileId @@ -29,6 +29,15 @@ open class LibrusSynergia(open val data: DataLibrus) { val callback = object : TextCallbackHandler() { override fun onSuccess(text: String?, response: Response?) { + val location = response?.headers()?.get("Location") + if (location?.endsWith("przerwa_techniczna") == true) { + // double checking for maintenance? + data.error(ApiError(TAG, ERROR_LIBRUS_SYNERGIA_MAINTENANCE) + .withApiResponse(text) + .withResponse(response)) + return + } + if (text.isNullOrEmpty()) { data.error(ApiError(TAG, ERROR_RESPONSE_EMPTY) .withResponse(response)) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/librus/login/LibrusLoginApi.kt b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/librus/login/LibrusLoginApi.kt index fe8bd5cd..8b4e0542 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/librus/login/LibrusLoginApi.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/librus/login/LibrusLoginApi.kt @@ -16,8 +16,7 @@ import pl.szczodrzynski.edziennik.getInt import pl.szczodrzynski.edziennik.getString import pl.szczodrzynski.edziennik.getUnixDate import pl.szczodrzynski.edziennik.utils.Utils.d -import java.net.HttpURLConnection.HTTP_BAD_REQUEST -import java.net.HttpURLConnection.HTTP_UNAUTHORIZED +import java.net.HttpURLConnection.* class LibrusLoginApi { companion object { @@ -117,6 +116,13 @@ class LibrusLoginApi { private val tokenCallback = object : JsonCallbackHandler() { override fun onSuccess(json: JsonObject?, response: Response?) { + if (response?.code() == HTTP_UNAVAILABLE) { + data.error(ApiError(TAG, ERROR_LIBRUS_API_MAINTENANCE) + .withApiResponse(json) + .withResponse(response)) + return + } + if (json == null) { data.error(ApiError(TAG, ERROR_RESPONSE_EMPTY) .withResponse(response)) @@ -176,6 +182,7 @@ class LibrusLoginApi { .post() .allowErrorCode(HTTP_BAD_REQUEST) .allowErrorCode(HTTP_UNAUTHORIZED) + .allowErrorCode(HTTP_UNAVAILABLE) .callback(tokenCallback) .build() .enqueue() diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/librus/login/LibrusLoginMessages.kt b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/librus/login/LibrusLoginMessages.kt index 95503944..99381fcb 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/librus/login/LibrusLoginMessages.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/librus/login/LibrusLoginMessages.kt @@ -6,20 +6,57 @@ package pl.szczodrzynski.edziennik.api.v2.librus.login import im.wangchao.mhttp.Request import im.wangchao.mhttp.Response +import im.wangchao.mhttp.body.MediaTypeUtils import im.wangchao.mhttp.callback.TextCallbackHandler import okhttp3.Cookie import pl.szczodrzynski.edziennik.api.v2.* import pl.szczodrzynski.edziennik.api.v2.librus.DataLibrus import pl.szczodrzynski.edziennik.api.v2.models.ApiError import pl.szczodrzynski.edziennik.getUnixDate -import pl.szczodrzynski.edziennik.utils.Utils import pl.szczodrzynski.edziennik.utils.Utils.d +import java.io.StringWriter +import javax.xml.parsers.DocumentBuilderFactory +import javax.xml.transform.OutputKeys +import javax.xml.transform.TransformerFactory +import javax.xml.transform.dom.DOMSource +import javax.xml.transform.stream.StreamResult class LibrusLoginMessages(val data: DataLibrus, val onSuccess: () -> Unit) { companion object { private const val TAG = "LoginLibrusMessages" } + private val callback by lazy { object : TextCallbackHandler() { + override fun onSuccess(text: String?, response: Response?) { + val location = response?.headers()?.get("Location") + when { + location?.contains("MultiDomainLogon") == true -> loginWithSynergia(location) + location?.contains("AutoLogon") == true -> { + saveSessionId(response, text) + onSuccess() + } + + text?.contains("ok") == true -> { + saveSessionId(response, text) + onSuccess() + } + text?.contains("Niepoprawny login i/lub hasło.") == true -> data.error(TAG, ERROR_LOGIN_LIBRUS_MESSAGES_INVALID_LOGIN, response, text) + text?.contains("stop.png") == true -> data.error(TAG, ERROR_LIBRUS_SYNERGIA_ACCESS_DENIED, response, text) + text?.contains("eAccessDeny") == true -> data.error(TAG, ERROR_LIBRUS_MESSAGES_ACCESS_DENIED, response, text) + text?.contains("OffLine") == true -> data.error(TAG, ERROR_LIBRUS_MESSAGES_MAINTENANCE, response, text) + text?.contains("error") == true -> data.error(TAG, ERROR_LIBRUS_MESSAGES_ERROR, response, text) + text?.contains("eVarWhitThisNameNotExists") == true -> data.error(TAG, ERROR_LIBRUS_MESSAGES_ACCESS_DENIED, response, text) + text?.contains("") == true -> data.error(TAG, ERROR_LIBRUS_MESSAGES_OTHER, response, text) + } + } + + override fun onFailure(response: Response?, throwable: Throwable?) { + data.error(ApiError(TAG, ERROR_REQUEST_FAILURE) + .withResponse(response) + .withThrowable(throwable)) + } + }} + init { run { if (data.profile == null) { data.error(ApiError(TAG, ERROR_PROFILE_MISSING)) @@ -41,7 +78,7 @@ class LibrusLoginMessages(val data: DataLibrus, val onSuccess: () -> Unit) { if (data.loginMethods.contains(LOGIN_METHOD_LIBRUS_SYNERGIA)) { loginWithSynergia() } - else if (data.apiLogin != null && data.apiPassword != null && false) { + else if (data.apiLogin != null && data.apiPassword != null) { loginWithCredentials() } else { @@ -54,7 +91,44 @@ class LibrusLoginMessages(val data: DataLibrus, val onSuccess: () -> Unit) { * XML (Flash messages website) login method. Uses a Synergia login and password. */ private fun loginWithCredentials() { + d(TAG, "Request: Librus/Login/Messages - $LIBRUS_MESSAGES_URL/Login") + val docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder() + val doc = docBuilder.newDocument() + val serviceElement = doc.createElement("service") + val headerElement = doc.createElement("header") + val dataElement = doc.createElement("data") + val loginElement = doc.createElement("login") + loginElement.appendChild(doc.createTextNode(data.apiLogin)) + dataElement.appendChild(loginElement) + val passwordElement = doc.createElement("login") + passwordElement.appendChild(doc.createTextNode(data.apiPassword)) + dataElement.appendChild(passwordElement) + val keyStrokeElement = doc.createElement("KeyStroke") + val keysElement = doc.createElement("Keys") + val upElement = doc.createElement("Up") + keysElement.appendChild(upElement) + val downElement = doc.createElement("Down") + keysElement.appendChild(downElement) + keyStrokeElement.appendChild(keysElement) + dataElement.appendChild(keyStrokeElement) + serviceElement.appendChild(headerElement) + serviceElement.appendChild(dataElement) + doc.appendChild(serviceElement) + val transformer = TransformerFactory.newInstance().newTransformer() + transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes") + val stringWriter = StringWriter() + transformer.transform(DOMSource(doc), StreamResult(stringWriter)) + val requestXml = stringWriter.toString() + + Request.builder() + .url("$LIBRUS_MESSAGES_URL/Login") + .userAgent(SYNERGIA_USER_AGENT) + .setTextBody(requestXml, MediaTypeUtils.APPLICATION_XML) + .post() + .callback(callback) + .build() + .enqueue() } /** @@ -63,37 +137,6 @@ class LibrusLoginMessages(val data: DataLibrus, val onSuccess: () -> Unit) { private fun loginWithSynergia(url: String = "https://synergia.librus.pl/wiadomosci2") { d(TAG, "Request: Librus/Login/Messages - $url") - val callback = object : TextCallbackHandler() { - override fun onSuccess(text: String?, response: Response?) { - val location = response?.headers()?.get("Location") - when { - location?.contains("MultiDomainLogon") == true -> loginWithSynergia(location) - location?.contains("AutoLogon") == true -> { - var sessionId = data.app.cookieJar.getCookie("wiadomosci.librus.pl", "DZIENNIKSID") - sessionId = sessionId?.replace("-MAINT", "") - if (sessionId == null) { - data.error(ApiError(TAG, ERROR_LOGIN_LIBRUS_MESSAGES_NO_SESSION_ID) - .withResponse(response) - .withApiResponse(text)) - return - } - data.messagesSessionId = sessionId - data.messagesSessionIdExpiryTime = response.getUnixDate() + 45 * 60 /* 45min */ - onSuccess() - } - - text?.contains("eAccessDeny") == true -> data.error(TAG, ERROR_LIBRUS_MESSAGES_ACCESS_DENIED, response, text) - text?.contains("stop.png") == true -> data.error(TAG, ERROR_LIBRUS_SYNERGIA_ACCESS_DENIED, response, text) - } - } - - override fun onFailure(response: Response?, throwable: Throwable?) { - data.error(ApiError(TAG, ERROR_REQUEST_FAILURE) - .withResponse(response) - .withThrowable(throwable)) - } - } - Request.builder() .url(url) .userAgent(SYNERGIA_USER_AGENT) @@ -103,4 +146,17 @@ class LibrusLoginMessages(val data: DataLibrus, val onSuccess: () -> Unit) { .build() .enqueue() } + + private fun saveSessionId(response: Response?, text: String?) { + var sessionId = data.app.cookieJar.getCookie("wiadomosci.librus.pl", "DZIENNIKSID") + sessionId = sessionId?.replace("-MAINT", "") // dunno what's this + if (sessionId == null) { + data.error(ApiError(TAG, ERROR_LOGIN_LIBRUS_MESSAGES_NO_SESSION_ID) + .withResponse(response) + .withApiResponse(text)) + return + } + data.messagesSessionId = sessionId + data.messagesSessionIdExpiryTime = response.getUnixDate() + 45 * 60 /* 45min */ + } } \ No newline at end of file diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/librus/login/LibrusLoginPortal.kt b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/librus/login/LibrusLoginPortal.kt index dc129626..19ffef22 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/librus/login/LibrusLoginPortal.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/librus/login/LibrusLoginPortal.kt @@ -120,7 +120,7 @@ class LibrusLoginPortal(val data: DataLibrus, val onSuccess: () -> Unit) { override fun onFailure(response: Response, throwable: Throwable) { if (response.code() == 403 || response.code() == 401) { - data.error(ApiError(TAG, ERROR_LOGIN_DATA_INVALID) + data.error(ApiError(TAG, ERROR_LOGIN_LIBRUS_PORTAL_INVALID_LOGIN) .withResponse(response) .withThrowable(throwable)) return diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/librus/login/LibrusLoginSynergia.kt b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/librus/login/LibrusLoginSynergia.kt index 46fbfe2d..73f4ec9c 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/librus/login/LibrusLoginSynergia.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/librus/login/LibrusLoginSynergia.kt @@ -7,7 +7,6 @@ package pl.szczodrzynski.edziennik.api.v2.librus.login import com.google.gson.JsonObject import im.wangchao.mhttp.Request import im.wangchao.mhttp.Response -import im.wangchao.mhttp.callback.JsonCallbackHandler import im.wangchao.mhttp.callback.TextCallbackHandler import okhttp3.Cookie import pl.szczodrzynski.edziennik.api.v2.* @@ -16,7 +15,6 @@ import pl.szczodrzynski.edziennik.api.v2.librus.data.LibrusApi import pl.szczodrzynski.edziennik.api.v2.models.ApiError import pl.szczodrzynski.edziennik.getString import pl.szczodrzynski.edziennik.getUnixDate -import pl.szczodrzynski.edziennik.utils.Utils import pl.szczodrzynski.edziennik.utils.Utils.d import java.net.HttpURLConnection @@ -86,6 +84,13 @@ class LibrusLoginSynergia(override val data: DataLibrus, val onSuccess: () -> Un val callback = object : TextCallbackHandler() { override fun onSuccess(json: String?, response: Response?) { val location = response?.headers()?.get("Location") + if (location?.endsWith("przerwa_techniczna") == true) { + data.error(ApiError(TAG, ERROR_LIBRUS_SYNERGIA_MAINTENANCE) + .withApiResponse(json) + .withResponse(response)) + return + } + if (location?.endsWith("centrum_powiadomien") == true) { val sessionId = data.app.cookieJar.getCookie("synergia.librus.pl", "DZIENNIKSID") if (sessionId == null) { diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginLibrusFragment.java b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginLibrusFragment.java index d7abdc57..0008f133 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginLibrusFragment.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginLibrusFragment.java @@ -19,7 +19,7 @@ import pl.szczodrzynski.edziennik.api.v2.models.ApiError; import pl.szczodrzynski.edziennik.databinding.FragmentLoginLibrusBinding; import pl.szczodrzynski.edziennik.ui.modules.error.ErrorSnackbar; -import static pl.szczodrzynski.edziennik.api.v2.ErrorsKt.ERROR_LOGIN_DATA_INVALID; +import static pl.szczodrzynski.edziennik.api.v2.ErrorsKt.ERROR_LOGIN_LIBRUS_PORTAL_INVALID_LOGIN; import static pl.szczodrzynski.edziennik.api.v2.ErrorsKt.ERROR_LOGIN_LIBRUS_PORTAL_NOT_ACTIVATED; import static pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore.LOGIN_TYPE_LIBRUS; @@ -57,7 +57,7 @@ public class LoginLibrusFragment extends Fragment { ApiError error = LoginActivity.error; if (error != null) { switch (error.getErrorCode()) { - case ERROR_LOGIN_DATA_INVALID: + case ERROR_LOGIN_LIBRUS_PORTAL_INVALID_LOGIN: b.loginPasswordLayout.setError(getString(R.string.login_error_incorrect_login_or_password)); break; case ERROR_LOGIN_LIBRUS_PORTAL_NOT_ACTIVATED: diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/timetable/v2/TimetableFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/timetable/v2/TimetableFragment.kt index e97421fd..6ee0e6bd 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/timetable/v2/TimetableFragment.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/timetable/v2/TimetableFragment.kt @@ -5,7 +5,6 @@ import android.content.Context import android.content.Intent import android.content.IntentFilter import android.os.Bundle -import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -131,7 +130,6 @@ class TimetableFragment : Fragment(), CoroutineScope { b.viewPager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener { override fun onPageScrollStateChanged(state: Int) { if (b.refreshLayout != null) { - Log.d(TAG, "State $state") b.refreshLayout.isEnabled = state == ViewPager.SCROLL_STATE_IDLE } } diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/widgets/timetable/WidgetTimetableListProvider.java b/app/src/main/java/pl/szczodrzynski/edziennik/widgets/timetable/WidgetTimetableListProvider.java index 83881d8d..c8252537 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/widgets/timetable/WidgetTimetableListProvider.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/widgets/timetable/WidgetTimetableListProvider.java @@ -173,7 +173,8 @@ public class WidgetTimetableListProvider implements RemoteViewsService.RemoteVie intent.putExtra("endTime", lesson.endTime.getStringValue()); views.setOnClickFillInIntent(R.id.widgetTimetableRoot, intent); - views.setTextViewText(R.id.widgetTimetableTime, lesson.startTime.getStringHM() + " - " + lesson.endTime.getStringHM()); + if (lesson.startTime != null && lesson.endTime != null) + views.setTextViewText(R.id.widgetTimetableTime, lesson.startTime.getStringHM() + " - " + lesson.endTime.getStringHM()); views.setViewVisibility(R.id.widgetTimetableEvent1, View.GONE); views.setViewVisibility(R.id.widgetTimetableEvent2, View.GONE); diff --git a/app/src/main/res/values/errors.xml b/app/src/main/res/values/errors.xml index 1642ea4c..e6718985 100644 --- a/app/src/main/res/values/errors.xml +++ b/app/src/main/res/values/errors.xml @@ -72,6 +72,12 @@ ERROR_LOGIN_LIBRUS_PORTAL_REFRESH_REVOKED ERROR_LIBRUS_SYNERGIA_OTHER ERROR_LIBRUS_SYNERGIA_MAINTENANCE + ERROR_LIBRUS_MESSAGES_MAINTENANCE + ERROR_LIBRUS_MESSAGES_ERROR + ERROR_LIBRUS_MESSAGES_OTHER + ERROR_LOGIN_LIBRUS_MESSAGES_INVALID_LOGIN + ERROR_LOGIN_LIBRUS_PORTAL_INVALID_LOGIN + ERROR_LIBRUS_API_MAINTENANCE ERROR_LOGIN_MOBIDZIENNIK_WEB_INVALID_LOGIN ERROR_LOGIN_MOBIDZIENNIK_WEB_OLD_PASSWORD @@ -165,7 +171,7 @@ Wymagana akceptacja regulaminu Błąd zmiany hasła Wymagana zmiana hasła - Nieprawidłowe dane logowania + Librus API: nieprawidłowe dane logowania Inny błąd logowania do API Brak tokenu CSRF Konto LIBRUS nie zostało aktywowane @@ -206,7 +212,13 @@ ERROR_LOGIN_LIBRUS_PORTAL_REFRESH_INVALID ERROR_LOGIN_LIBRUS_PORTAL_REFRESH_REVOKED ERROR_LIBRUS_SYNERGIA_OTHER - ERROR_LIBRUS_SYNERGIA_MAINTENANCE + Librus Synergia: przerwa techniczna + Librus Wiadomości: przerwa techniczna + ERROR_LIBRUS_MESSAGES_ERROR + ERROR_LIBRUS_MESSAGES_OTHER + Librus Wiadomości: nieprawidłowe dane logowania + Librus Portal: nieprawidłowe dane logowania + Librus API: przerwa techniczna ERROR_LOGIN_MOBIDZIENNIK_WEB_INVALID_LOGIN ERROR_LOGIN_MOBIDZIENNIK_WEB_OLD_PASSWORD