forked from github/szkolny
Merge branch 'develop'
This commit is contained in:
commit
b9e0d91220
@ -1,6 +1,8 @@
|
||||
<h3>Wersja 4.4, 2020-08-27</h3>
|
||||
<h3>Wersja 4.4.1, 2020-09-03</h3>
|
||||
<ul>
|
||||
<li>Poprawione komunikaty o aktualizacjach aplikacji.</li>
|
||||
<li>Mobidziennik: poprawione wyświetlanie przedmiotu w planie lekcji.</li>
|
||||
<li>Mobidziennik: naprawiony moduł frekwencji.</li>
|
||||
</ul>
|
||||
<br>
|
||||
<br>
|
||||
|
@ -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);
|
||||
|
||||
|
@ -80,6 +80,15 @@ object Regexes {
|
||||
val MOBIDZIENNIK_ATTENDANCE_ENTRIES by lazy {
|
||||
"""font-size:.+?class=".*?">(.*?)</td>""".toRegex(DOT_MATCHES_ALL)
|
||||
}
|
||||
val MOBIDZIENNIK_ATTENDANCE_COLUMNS by lazy {
|
||||
"""<tr><td class="border-right1".+?/td>(.+?)</tr>""".toRegex(DOT_MATCHES_ALL)
|
||||
}
|
||||
val MOBIDZIENNIK_ATTENDANCE_COLUMN by lazy {
|
||||
"""(<td.+?>)(.*?)</td>""".toRegex(DOT_MATCHES_ALL)
|
||||
}
|
||||
val MOBIDZIENNIK_ATTENDANCE_COLUMN_SPAN by lazy {
|
||||
"""colspan="(\d+)"""".toRegex()
|
||||
}
|
||||
val MOBIDZIENNIK_ATTENDANCE_RANGE by lazy {
|
||||
"""<span>([0-9:]+) - .+? (.+?)</span></a>""".toRegex(DOT_MATCHES_ALL)
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ class MobidziennikApiTimetable(val data: DataMobidziennik, rows: List<String>) {
|
||||
|
||||
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]
|
||||
|
@ -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<Date>()
|
||||
val entries = mutableListOf<String>()
|
||||
val ranges = mutableListOf<MatchResult?>()
|
||||
|
||||
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<String?, String?>?,
|
||||
typeSymbols: List<String>
|
||||
) {
|
||||
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
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
@ -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, _ ->
|
||||
|
@ -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)
|
||||
|
@ -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" />
|
||||
|
||||
|
@ -854,7 +854,7 @@
|
||||
<string name="settings_about_licenses_text">Open-Source-Lizenzen</string>
|
||||
<string name="settings_about_privacy_policy_text">Datenschutzrichtlinie</string>
|
||||
<string name="settings_about_register_title_text">E-Klassenbuch</string>
|
||||
<string name="settings_about_title_subtext">© Kuba Szczodrzyński && Kacper Ziubryniewicz\nSeptember 2018 - August 2020</string>
|
||||
<string name="settings_about_title_subtext">© Kuba Szczodrzyński && Kacper Ziubryniewicz\nSeptember 2018 - 2020</string>
|
||||
<string name="settings_about_update_subtext">Klicken Sie hier, um nach Aktualisierungen zu suchen</string>
|
||||
<string name="settings_about_update_text">Aktualisierung</string>
|
||||
<string name="settings_about_version_text">Version</string>
|
||||
|
@ -856,7 +856,7 @@
|
||||
<string name="settings_about_licenses_text">Open-source licenses</string>
|
||||
<string name="settings_about_privacy_policy_text">Privacy policy</string>
|
||||
<string name="settings_about_register_title_text">E-register</string>
|
||||
<string name="settings_about_title_subtext">© Kuba Szczodrzyński && Kacper Ziubryniewicz\nSeptember 2018 - August 2020</string>
|
||||
<string name="settings_about_title_subtext">© Kuba Szczodrzyński && Kacper Ziubryniewicz\nSeptember 2018 - 2020</string>
|
||||
<string name="settings_about_update_subtext">Click to check for updates</string>
|
||||
<string name="settings_about_update_text">Update</string>
|
||||
<string name="settings_about_version_text">Version</string>
|
||||
|
@ -919,7 +919,7 @@
|
||||
<string name="settings_about_licenses_text">Licencje open-source</string>
|
||||
<string name="settings_about_privacy_policy_text">Polityka prywatności</string>
|
||||
<string name="settings_about_register_title_text">E-dziennik</string>
|
||||
<string name="settings_about_title_subtext">© Kuba Szczodrzyński && Kacper Ziubryniewicz\nwrzesień 2018 - sierpień 2020</string>
|
||||
<string name="settings_about_title_subtext">© Kuba Szczodrzyński && Kacper Ziubryniewicz\nwrzesień 2018 - 2020</string>
|
||||
<string name="settings_about_update_subtext">Kliknij, aby sprawdzić aktualizacje</string>
|
||||
<string name="settings_about_update_text">Aktualizacja</string>
|
||||
<string name="settings_about_version_text">Wersja</string>
|
||||
|
@ -5,8 +5,8 @@ buildscript {
|
||||
kotlin_version = '1.3.61'
|
||||
|
||||
release = [
|
||||
versionName: "4.4",
|
||||
versionCode: 4040099
|
||||
versionName: "4.4.1",
|
||||
versionCode: 4040199
|
||||
]
|
||||
|
||||
setup = [
|
||||
|
Loading…
x
Reference in New Issue
Block a user