diff --git a/app/src/main/assets/pl-changelog.html b/app/src/main/assets/pl-changelog.html
index 70dd9bea..217e9cd2 100644
--- a/app/src/main/assets/pl-changelog.html
+++ b/app/src/main/assets/pl-changelog.html
@@ -1,6 +1,8 @@
-
Wersja 4.4, 2020-08-27
+Wersja 4.4.1, 2020-09-03
- Poprawione komunikaty o aktualizacjach aplikacji.
+ - Mobidziennik: poprawione wyświetlanie przedmiotu w planie lekcji.
+ - Mobidziennik: naprawiony moduł frekwencji.
diff --git a/app/src/main/cpp/szkolny-signing.cpp b/app/src/main/cpp/szkolny-signing.cpp
index a66cabf6..4d19eb33 100644
--- a/app/src/main/cpp/szkolny-signing.cpp
+++ b/app/src/main/cpp/szkolny-signing.cpp
@@ -9,7 +9,7 @@
/*secret password - removed for source code publication*/
static toys AES_IV[16] = {
- 0x85, 0xd2, 0x0d, 0x9e, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
+ 0x72, 0x4b, 0x61, 0x3a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
unsigned char *agony(unsigned int laugh, unsigned char *box, unsigned char *heat);
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Regexes.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Regexes.kt
index b21a38bb..894dfe7a 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Regexes.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Regexes.kt
@@ -80,6 +80,15 @@ object Regexes {
val MOBIDZIENNIK_ATTENDANCE_ENTRIES by lazy {
"""font-size:.+?class=".*?">(.*?)""".toRegex(DOT_MATCHES_ALL)
}
+ val MOBIDZIENNIK_ATTENDANCE_COLUMNS by lazy {
+ """(.+?) |
""".toRegex(DOT_MATCHES_ALL)
+ }
+ val MOBIDZIENNIK_ATTENDANCE_COLUMN by lazy {
+ """()(.*?)""".toRegex(DOT_MATCHES_ALL)
+ }
+ val MOBIDZIENNIK_ATTENDANCE_COLUMN_SPAN by lazy {
+ """colspan="(\d+)"""".toRegex()
+ }
val MOBIDZIENNIK_ATTENDANCE_RANGE by lazy {
"""([0-9:]+) - .+? (.+?)""".toRegex(DOT_MATCHES_ALL)
}
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/api/MobidziennikApiTimetable.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/api/MobidziennikApiTimetable.kt
index a82ab4ef..aa07b1c3 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/api/MobidziennikApiTimetable.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/api/MobidziennikApiTimetable.kt
@@ -44,7 +44,7 @@ class MobidziennikApiTimetable(val data: DataMobidziennik, rows: List) {
dataDays.remove(date.value)
- val subjectId = data.subjectList.singleOrNull { it.longName == lesson[5] }?.id ?: -1
+ val subjectId = data.subjectList.singleOrNull { it.longName == lesson[5].trim() }?.id ?: -1
val teacherId = data.teacherList.singleOrNull { it.fullNameLastFirst == (lesson[7]+" "+lesson[6]).fixName() }?.id ?: -1
val teamId = data.teamList.singleOrNull { it.name == lesson[8]+lesson[9] }?.id ?: -1
val classroom = lesson[11]
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebAttendance.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebAttendance.kt
index 36dbe1e9..349c2ea7 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebAttendance.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/web/MobidziennikWebAttendance.kt
@@ -91,8 +91,11 @@ class MobidziennikWebAttendance(override val data: DataMobidziennik,
Regexes.MOBIDZIENNIK_ATTENDANCE_TABLE.findAll(text).forEach { tableResult ->
val table = tableResult[1]
+
val lessonDates = mutableListOf()
val entries = mutableListOf()
+ val ranges = mutableListOf()
+
Regexes.MOBIDZIENNIK_ATTENDANCE_LESSON_COUNT.findAll(table).forEach {
val date = Date.fromY_m_d(it[1])
for (i in 0 until (it[2].toIntOrNull() ?: 0)) {
@@ -101,102 +104,52 @@ class MobidziennikWebAttendance(override val data: DataMobidziennik,
}
Regexes.MOBIDZIENNIK_ATTENDANCE_ENTRIES.findAll(table).mapTo(entries) { it[1] }
+ Regexes.MOBIDZIENNIK_ATTENDANCE_COLUMNS.findAll(table).forEach { columns ->
+ var index = 0
+ Regexes.MOBIDZIENNIK_ATTENDANCE_COLUMN.findAll(columns[1]).forEach { column ->
+ if (column[1].contains("colspan")) {
+ val colspan =
+ Regexes.MOBIDZIENNIK_ATTENDANCE_COLUMN_SPAN.find(column[1])
+ ?.get(1)
+ ?.toIntOrNull() ?: 0
+ entries.addAll(index, List(colspan) { "" })
+ ranges.addAll(List(colspan) { null })
+ index += colspan
+ }
+ else {
+ val range = Regexes.MOBIDZIENNIK_ATTENDANCE_RANGE.find(column[2])
+ ranges.add(range)
+ index++
+ }
+ }
+ }
+
val dateIterator = lessonDates.iterator()
val entriesIterator = entries.iterator()
- Regexes.MOBIDZIENNIK_ATTENDANCE_RANGE.findAll(table).let { ranges ->
- val count = ranges.count()
- // verify the lesson count is the same as dates & entries
- if (count != lessonDates.count() || count != entries.count())
+
+ val count = ranges.count()
+ // verify the lesson count is the same as dates & entries
+ if (count != lessonDates.count() || count != entries.count())
+ return@forEach
+ ranges.forEach { range ->
+ val lessonDate = dateIterator.next()
+ val entry = entriesIterator.next()
+ if (range == null || entry.isBlank())
return@forEach
- ranges.forEach { range ->
- val lessonDate = dateIterator.next()
- var entry = entriesIterator.next()
- if (entry.isBlank())
- return@forEach
- val startTime = Time.fromH_m(range[1])
+ val startTime = Time.fromH_m(range[1])
- range[2].split(" / ").mapNotNull { Regexes.MOBIDZIENNIK_ATTENDANCE_LESSON.find(it) }.forEachIndexed { index, lesson ->
- val topic = lesson[1].substringAfter(" - ", missingDelimiterValue = "").takeIf { it.isNotBlank() }
- if (topic?.startsWith("Lekcja odwołana: ") == true || entry.isEmpty())
- return@forEachIndexed
- val subjectName = lesson[1].substringBefore(" - ")
- //val team = lesson[3]
- val teacherName = lesson[3].fixName()
-
- val teacherId = data.teacherList.singleOrNull { it.fullNameLastFirst == teacherName }?.id ?: -1
- val subjectId = data.subjectList.singleOrNull { it.longName == subjectName }?.id ?: -1
-
- var typeSymbol = ""
- for (symbol in typeSymbols) {
- if (entry.startsWith(symbol) && symbol.length > typeSymbol.length)
- typeSymbol = symbol
- }
- entry = entry.removePrefix(typeSymbol)
-
- var isCounted = true
- val baseType = when (typeSymbol) {
- "." -> TYPE_PRESENT
- "|" -> TYPE_ABSENT
- "+" -> TYPE_ABSENT_EXCUSED
- "s" -> TYPE_BELATED
- "z" -> TYPE_RELEASED
- else -> {
- isCounted = false
- when (typeSymbol) {
- "e" -> TYPE_PRESENT_CUSTOM
- "en" -> TYPE_ABSENT
- "ep" -> TYPE_PRESENT_CUSTOM
- else -> TYPE_UNKNOWN
- }
- }
- }
- val typeName = types?.get(typeSymbol) ?: ""
- val typeColor = when (typeSymbol) {
- "e" -> 0xff673ab7
- "en" -> 0xffec407a
- "ep" -> 0xff4caf50
- else -> null
- }?.toInt()
-
- val typeShort = if (isCounted)
- data.app.attendanceManager.getTypeShort(baseType)
- else
- typeSymbol
-
- val semester = data.profile?.dateToSemester(lessonDate) ?: 1
-
- val id = lessonDate.combineWith(startTime) / 6L * 10L + (lesson[0].hashCode() and 0xFFFF) + index
-
- val attendanceObject = Attendance(
- profileId = profileId,
- id = id,
- baseType = baseType,
- typeName = typeName,
- typeShort = typeShort,
- typeSymbol = typeSymbol,
- typeColor = typeColor,
- date = lessonDate,
- startTime = startTime,
- semester = semester,
- teacherId = teacherId,
- subjectId = subjectId
- ).also {
- it.lessonTopic = topic
- it.isCounted = isCounted
- }
-
- data.attendanceList.add(attendanceObject)
- if (baseType != TYPE_PRESENT) {
- data.metadataList.add(
- Metadata(
- data.profileId,
- Metadata.TYPE_ATTENDANCE,
- id,
- data.profile?.empty ?: false || baseType == Attendance.TYPE_PRESENT_CUSTOM || baseType == TYPE_UNKNOWN,
- data.profile?.empty ?: false || baseType == Attendance.TYPE_PRESENT_CUSTOM || baseType == TYPE_UNKNOWN
- ))
- }
- }
+ range[2].split(" / ").mapNotNull {
+ Regexes.MOBIDZIENNIK_ATTENDANCE_LESSON.find(it)
+ }.forEachIndexed { index, lesson ->
+ processEntry(
+ index,
+ lesson,
+ lessonDate,
+ startTime,
+ entry,
+ types,
+ typeSymbols
+ )
}
}
}
@@ -206,4 +159,97 @@ class MobidziennikWebAttendance(override val data: DataMobidziennik,
onSuccess()
}
}
+
+ private fun processEntry(
+ index: Int,
+ lesson: MatchResult,
+ lessonDate: Date,
+ startTime: Time,
+ entry: String,
+ types: Map?,
+ typeSymbols: List
+ ) {
+ var entry = entry
+
+ val topic = lesson[1].substringAfter(" - ", missingDelimiterValue = "").takeIf { it.isNotBlank() }
+ if (topic?.startsWith("Lekcja odwołana: ") == true || entry.isEmpty())
+ return
+ val subjectName = lesson[1].substringBefore(" - ")
+ //val team = lesson[3]
+ val teacherName = lesson[3].fixName()
+
+ val teacherId = data.teacherList.singleOrNull { it.fullNameLastFirst == teacherName }?.id ?: -1
+ val subjectId = data.subjectList.singleOrNull { it.longName == subjectName }?.id ?: -1
+
+ var typeSymbol = ""
+ for (symbol in typeSymbols) {
+ if (entry.startsWith(symbol) && symbol.length > typeSymbol.length)
+ typeSymbol = symbol
+ }
+ entry = entry.removePrefix(typeSymbol)
+
+ var isCounted = true
+ val baseType = when (typeSymbol) {
+ "." -> TYPE_PRESENT
+ "|" -> TYPE_ABSENT
+ "+" -> TYPE_ABSENT_EXCUSED
+ "s" -> TYPE_BELATED
+ "z" -> TYPE_RELEASED
+ else -> {
+ isCounted = false
+ when (typeSymbol) {
+ "e" -> TYPE_PRESENT_CUSTOM
+ "en" -> TYPE_ABSENT
+ "ep" -> TYPE_PRESENT_CUSTOM
+ else -> TYPE_UNKNOWN
+ }
+ }
+ }
+ val typeName = types?.get(typeSymbol) ?: ""
+ val typeColor = when (typeSymbol) {
+ "e" -> 0xff673ab7
+ "en" -> 0xffec407a
+ "ep" -> 0xff4caf50
+ else -> null
+ }?.toInt()
+
+ val typeShort = if (isCounted)
+ data.app.attendanceManager.getTypeShort(baseType)
+ else
+ typeSymbol
+
+ val semester = data.profile?.dateToSemester(lessonDate) ?: 1
+
+ val id = lessonDate.combineWith(startTime) / 6L * 10L + (lesson[0].hashCode() and 0xFFFF) + index
+
+ val attendanceObject = Attendance(
+ profileId = profileId,
+ id = id,
+ baseType = baseType,
+ typeName = typeName,
+ typeShort = typeShort,
+ typeSymbol = typeSymbol,
+ typeColor = typeColor,
+ date = lessonDate,
+ startTime = startTime,
+ semester = semester,
+ teacherId = teacherId,
+ subjectId = subjectId
+ ).also {
+ it.lessonTopic = topic
+ it.isCounted = isCounted
+ }
+
+ data.attendanceList.add(attendanceObject)
+ if (baseType != TYPE_PRESENT) {
+ data.metadataList.add(
+ Metadata(
+ data.profileId,
+ Metadata.TYPE_ATTENDANCE,
+ id,
+ data.profile?.empty ?: false || baseType == Attendance.TYPE_PRESENT_CUSTOM || baseType == TYPE_UNKNOWN,
+ data.profile?.empty ?: false || baseType == Attendance.TYPE_PRESENT_CUSTOM || baseType == TYPE_UNKNOWN
+ ))
+ }
+ }
}
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/szkolny/interceptor/Signing.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/szkolny/interceptor/Signing.kt
index 67e8310a..76fc1193 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/szkolny/interceptor/Signing.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/szkolny/interceptor/Signing.kt
@@ -46,6 +46,6 @@ object Signing {
/*fun provideKey(param1: String, param2: Long): ByteArray {*/
fun pleaseStopRightNow(param1: String, param2: Long): ByteArray {
- return "$param1.MTIzNDU2Nzg5MDSA64wjse===.$param2".sha256()
+ return "$param1.MTIzNDU2Nzg5MDv1BTei5k===.$param2".sha256()
}
}
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/RegisterUnavailableDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/RegisterUnavailableDialog.kt
index de698c5a..e1e4b2b6 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/RegisterUnavailableDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/RegisterUnavailableDialog.kt
@@ -4,6 +4,7 @@
package pl.szczodrzynski.edziennik.ui.dialogs
+import android.text.method.LinkMovementMethod
import android.view.LayoutInflater
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
@@ -56,6 +57,7 @@ class RegisterUnavailableDialog(
Utils.openUrl(activity, status.message.url)
}
}
+ b.text.movementMethod = LinkMovementMethod.getInstance()
dialog = MaterialAlertDialogBuilder(activity)
.setView(b.root)
.setPositiveButton(R.string.close) { dialog, _ ->
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/cards/HomeAvailabilityCard.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/cards/HomeAvailabilityCard.kt
index 26c8d609..eefd4f6f 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/cards/HomeAvailabilityCard.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/cards/HomeAvailabilityCard.kt
@@ -4,6 +4,7 @@
package pl.szczodrzynski.edziennik.ui.modules.home.cards
+import android.text.Html
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@@ -58,8 +59,8 @@ class HomeAvailabilityCard(
var onInfoClick = { _: View -> }
if (status != null && !status.available && status.message != null) {
- b.homeAvailabilityTitle.text = status.message.title
- b.homeAvailabilityText.text = status.message.contentShort
+ b.homeAvailabilityTitle.text = Html.fromHtml(status.message.title)
+ b.homeAvailabilityText.text = Html.fromHtml(status.message.contentShort)
b.homeAvailabilityUpdate.isVisible = false
b.homeAvailabilityIcon.setImageResource(R.drawable.ic_sync)
if (status.message.icon != null)
diff --git a/app/src/main/res/layout/dialog_register_unavailable.xml b/app/src/main/res/layout/dialog_register_unavailable.xml
index 2d395494..da86a52b 100644
--- a/app/src/main/res/layout/dialog_register_unavailable.xml
+++ b/app/src/main/res/layout/dialog_register_unavailable.xml
@@ -45,7 +45,7 @@
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:text="@{message.title}"
+ android:text="@{Html.fromHtml(message.title)}"
android:textAppearance="@style/NavView.TextView.Title"
tools:text="Dziennik nie działa" />
diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml
index 92a260a7..461bdbd3 100644
--- a/app/src/main/res/values-de/strings.xml
+++ b/app/src/main/res/values-de/strings.xml
@@ -854,7 +854,7 @@
Open-Source-Lizenzen
Datenschutzrichtlinie
E-Klassenbuch
- © Kuba Szczodrzyński && Kacper Ziubryniewicz\nSeptember 2018 - August 2020
+ © Kuba Szczodrzyński && Kacper Ziubryniewicz\nSeptember 2018 - 2020
Klicken Sie hier, um nach Aktualisierungen zu suchen
Aktualisierung
Version
diff --git a/app/src/main/res/values-en/strings.xml b/app/src/main/res/values-en/strings.xml
index c9cfc0c6..58de31ae 100644
--- a/app/src/main/res/values-en/strings.xml
+++ b/app/src/main/res/values-en/strings.xml
@@ -856,7 +856,7 @@
Open-source licenses
Privacy policy
E-register
- © Kuba Szczodrzyński && Kacper Ziubryniewicz\nSeptember 2018 - August 2020
+ © Kuba Szczodrzyński && Kacper Ziubryniewicz\nSeptember 2018 - 2020
Click to check for updates
Update
Version
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index d3f1ba4e..f7536aaf 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -919,7 +919,7 @@
Licencje open-source
Polityka prywatności
E-dziennik
- © Kuba Szczodrzyński && Kacper Ziubryniewicz\nwrzesień 2018 - sierpień 2020
+ © Kuba Szczodrzyński && Kacper Ziubryniewicz\nwrzesień 2018 - 2020
Kliknij, aby sprawdzić aktualizacje
Aktualizacja
Wersja
diff --git a/build.gradle b/build.gradle
index ddc5183a..1f63c6ba 100644
--- a/build.gradle
+++ b/build.gradle
@@ -5,8 +5,8 @@ buildscript {
kotlin_version = '1.3.61'
release = [
- versionName: "4.4",
- versionCode: 4040099
+ versionName: "4.4.1",
+ versionCode: 4040199
]
setup = [