mirror of
https://github.com/szkolny-eu/szkolny-android.git
synced 2024-11-24 10:54:36 -06:00
[Gradle] Migrate JCenter dependencies to JitPack. (#97)
* [Gradle] Replace JCenter-based dependencies with JitPack. * [API] Fix Jsoup usage after dependency update.
This commit is contained in:
parent
fa318d4509
commit
7e0f69d95d
@ -126,7 +126,7 @@ dependencies {
|
|||||||
// Android Jetpack
|
// Android Jetpack
|
||||||
implementation "androidx.appcompat:appcompat:1.3.1"
|
implementation "androidx.appcompat:appcompat:1.3.1"
|
||||||
implementation "androidx.cardview:cardview:1.0.0"
|
implementation "androidx.cardview:cardview:1.0.0"
|
||||||
implementation "androidx.constraintlayout:constraintlayout:2.1.0"
|
implementation "androidx.constraintlayout:constraintlayout:2.1.1"
|
||||||
implementation "androidx.core:core-ktx:1.6.0"
|
implementation "androidx.core:core-ktx:1.6.0"
|
||||||
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
|
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
|
||||||
implementation "androidx.navigation:navigation-fragment-ktx:2.3.5"
|
implementation "androidx.navigation:navigation-fragment-ktx:2.3.5"
|
||||||
@ -137,12 +137,12 @@ dependencies {
|
|||||||
|
|
||||||
// Google design libs
|
// Google design libs
|
||||||
implementation "com.google.android.material:material:1.4.0"
|
implementation "com.google.android.material:material:1.4.0"
|
||||||
implementation "com.google.android:flexbox:2.0.1"
|
implementation "com.google.android.flexbox:flexbox:3.0.0"
|
||||||
|
|
||||||
// Play Services/Firebase
|
// Play Services/Firebase
|
||||||
implementation "com.google.android.gms:play-services-wearable:17.1.0"
|
implementation "com.google.android.gms:play-services-wearable:17.1.0"
|
||||||
implementation "com.google.firebase:firebase-core:19.0.1"
|
implementation "com.google.firebase:firebase-core:19.0.2"
|
||||||
implementation "com.google.firebase:firebase-crashlytics:18.2.1"
|
implementation "com.google.firebase:firebase-crashlytics:18.2.3"
|
||||||
implementation("com.google.firebase:firebase-messaging") { version { strictly "20.1.3" } }
|
implementation("com.google.firebase:firebase-messaging") { version { strictly "20.1.3" } }
|
||||||
|
|
||||||
// OkHttp, Retrofit, Gson, Jsoup
|
// OkHttp, Retrofit, Gson, Jsoup
|
||||||
@ -150,14 +150,14 @@ dependencies {
|
|||||||
implementation "com.squareup.retrofit2:retrofit:2.9.0"
|
implementation "com.squareup.retrofit2:retrofit:2.9.0"
|
||||||
implementation "com.squareup.retrofit2:converter-gson:2.9.0"
|
implementation "com.squareup.retrofit2:converter-gson:2.9.0"
|
||||||
implementation "com.squareup.retrofit2:converter-scalars:2.9.0"
|
implementation "com.squareup.retrofit2:converter-scalars:2.9.0"
|
||||||
implementation 'com.google.code.gson:gson:2.8.6'
|
implementation 'com.google.code.gson:gson:2.8.8'
|
||||||
implementation "org.jsoup:jsoup:1.13.1"
|
implementation 'org.jsoup:jsoup:1.14.3'
|
||||||
implementation "pl.droidsonroids:jspoon:1.3.2"
|
implementation "pl.droidsonroids:jspoon:1.3.2"
|
||||||
implementation "pl.droidsonroids.retrofit2:converter-jspoon:1.3.2"
|
implementation "pl.droidsonroids.retrofit2:converter-jspoon:1.3.2"
|
||||||
|
|
||||||
// Szkolny.eu libraries/forks
|
// Szkolny.eu libraries/forks
|
||||||
implementation "eu.szkolny:android-snowfall:1ca9ea2da3"
|
implementation "eu.szkolny:android-snowfall:1ca9ea2da3"
|
||||||
implementation "eu.szkolny:agendacalendarview:ac0f3dcf42"
|
implementation "eu.szkolny:agendacalendarview:1.0.4"
|
||||||
implementation "eu.szkolny:cafebar:5bf0c618de"
|
implementation "eu.szkolny:cafebar:5bf0c618de"
|
||||||
implementation "eu.szkolny.fslogin:lib:2.0.0"
|
implementation "eu.szkolny.fslogin:lib:2.0.0"
|
||||||
implementation "eu.szkolny:material-about-library:1d5ebaf47c"
|
implementation "eu.szkolny:material-about-library:1d5ebaf47c"
|
||||||
@ -179,26 +179,27 @@ dependencies {
|
|||||||
|
|
||||||
// Other dependencies
|
// Other dependencies
|
||||||
implementation "cat.ereza:customactivityoncrash:2.3.0"
|
implementation "cat.ereza:customactivityoncrash:2.3.0"
|
||||||
implementation "com.applandeo:material-calendar-view:1.5.0"
|
implementation "com.android.volley:volley:1.2.1"
|
||||||
implementation "com.daimajia.swipelayout:library:1.2.0@aar"
|
implementation "com.daimajia.swipelayout:library:1.2.0@aar"
|
||||||
implementation "com.github.antonKozyriatskyi:CircularProgressIndicator:1.2.2"
|
implementation "com.github.Applandeo:Material-Calendar-View:15de569cbc" // https://github.com/Applandeo/Material-Calendar-View
|
||||||
implementation "com.github.bassaer:chatmessageview:2.0.1"
|
implementation "com.github.CanHub:Android-Image-Cropper:2.2.2" // https://github.com/CanHub/Android-Image-Cropper
|
||||||
implementation "com.github.CanHub:Android-Image-Cropper:2.2.2"
|
implementation "com.github.ChuckerTeam.Chucker:library:3.0.1" // https://github.com/ChuckerTeam/chucker
|
||||||
implementation "com.github.ChuckerTeam.Chucker:library:3.0.1"
|
implementation "com.github.antonKozyriatskyi:CircularProgressIndicator:1.2.2" // https://github.com/antonKozyriatskyi/CircularProgressIndicator
|
||||||
implementation "com.github.wulkanowy.uonet-request-signer:hebe-jvm:a99ca50a31"
|
implementation "com.github.bassaer:chatmessageview:2.0.1" // https://github.com/bassaer/ChatMessageView
|
||||||
implementation("com.heinrichreimersoftware:material-intro") { version { strictly "1.5.8" } }
|
implementation "com.github.hypertrack:hyperlog-android:0.0.10" // https://github.com/hypertrack/hyperlog-android
|
||||||
implementation "com.hypertrack:hyperlog:0.0.10"
|
implementation "com.github.smuyyh:JsonViewer:V1.0.6" // https://github.com/smuyyh/JsonViewer
|
||||||
|
implementation "com.github.underwindfall.PowerPermission:powerpermission-coroutines:1.4.0" // https://github.com/underwindfall/PowerPermission
|
||||||
|
implementation "com.github.underwindfall.PowerPermission:powerpermission:1.4.0" // https://github.com/underwindfall/PowerPermission
|
||||||
|
implementation "com.github.wulkanowy.uonet-request-signer:hebe-jvm:a99ca50a31" // https://github.com/wulkanowy/uonet-request-signer
|
||||||
implementation "com.jaredrummler:colorpicker:1.1.0"
|
implementation "com.jaredrummler:colorpicker:1.1.0"
|
||||||
implementation "com.qifan.powerpermission:powerpermission-coroutines:1.3.0"
|
|
||||||
implementation "com.qifan.powerpermission:powerpermission:1.3.0"
|
|
||||||
implementation "com.yuyh.json:jsonviewer:1.0.6"
|
|
||||||
implementation "io.coil-kt:coil:1.1.1"
|
implementation "io.coil-kt:coil:1.1.1"
|
||||||
implementation "me.dm7.barcodescanner:zxing:1.9.8"
|
implementation "me.dm7.barcodescanner:zxing:1.9.8"
|
||||||
implementation "me.grantland:autofittextview:0.2.1"
|
implementation "me.grantland:autofittextview:0.2.1"
|
||||||
implementation "me.leolin:ShortcutBadger:1.1.22@aar"
|
implementation "me.leolin:ShortcutBadger:1.1.22@aar"
|
||||||
implementation "org.greenrobot:eventbus:3.2.0"
|
implementation "org.greenrobot:eventbus:3.2.0"
|
||||||
|
implementation("com.heinrichreimersoftware:material-intro") { version { strictly "1.5.8" } }
|
||||||
implementation("pl.droidsonroids.gif:android-gif-drawable") { version { strictly "1.2.15" } }
|
implementation("pl.droidsonroids.gif:android-gif-drawable") { version { strictly "1.2.15" } }
|
||||||
|
|
||||||
// Debug-only dependencies
|
// Debug-only dependencies
|
||||||
debugImplementation "com.amitshekhar.android:debug-db:1.0.5"
|
debugImplementation "com.github.amitshekhariitbhu.Android-Debug-Database:debug-db:v1.0.6"
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ class EdudziennikWebAnnouncements(override val data: DataEdudziennik,
|
|||||||
val teacherName = announcementElement.child(1).text()
|
val teacherName = announcementElement.child(1).text()
|
||||||
val teacher = data.getTeacherByFirstLast(teacherName)
|
val teacher = data.getTeacherByFirstLast(teacherName)
|
||||||
|
|
||||||
val dateString = announcementElement.getElementsByClass("datetime").first().text()
|
val dateString = announcementElement.getElementsByClass("datetime").first()?.text()
|
||||||
val startDate = Date.fromY_m_d(dateString)
|
val startDate = Date.fromY_m_d(dateString)
|
||||||
val addedDate = Date.fromIsoHm(dateString)
|
val addedDate = Date.fromIsoHm(dateString)
|
||||||
|
|
||||||
|
@ -67,13 +67,13 @@ class EdudziennikWebGrades(override val data: DataEdudziennik,
|
|||||||
|
|
||||||
val gradeValues = if (grades.isNotEmpty()) {
|
val gradeValues = if (grades.isNotEmpty()) {
|
||||||
subjects.select(".avg-$subjectId .grade-tip > p").first()
|
subjects.select(".avg-$subjectId .grade-tip > p").first()
|
||||||
.text().split('+').map {
|
?.text()?.split('+')?.map {
|
||||||
val split = it.split('*')
|
val split = it.split('*')
|
||||||
val value = split[1].trim().toFloatOrNull()
|
val value = split[1].trim().toFloatOrNull()
|
||||||
val weight = value?.let { split[0].trim().toFloatOrNull() } ?: 0f
|
val weight = value?.let { split[0].trim().toFloatOrNull() } ?: 0f
|
||||||
|
|
||||||
Pair(value ?: 0f, weight)
|
Pair(value ?: 0f, weight)
|
||||||
}
|
} ?: emptyList()
|
||||||
} else emptyList()
|
} else emptyList()
|
||||||
|
|
||||||
grades.forEachIndexed { index, gradeElement ->
|
grades.forEachIndexed { index, gradeElement ->
|
||||||
|
@ -32,7 +32,7 @@ class EdudziennikWebHomework(override val data: DataEdudziennik,
|
|||||||
|
|
||||||
if (doc.getElementsByClass("message").text().trim() != "Brak prac domowych") {
|
if (doc.getElementsByClass("message").text().trim() != "Brak prac domowych") {
|
||||||
doc.getElementsByTag("tr").forEach { homeworkElement ->
|
doc.getElementsByTag("tr").forEach { homeworkElement ->
|
||||||
val dateElement = homeworkElement.getElementsByClass("date").first().child(0)
|
val dateElement = homeworkElement.getElementsByClass("date").first()?.child(0) ?: return@forEach
|
||||||
val idStr = EDUDZIENNIK_HOMEWORK_ID.find(dateElement.attr("href"))?.get(1) ?: return@forEach
|
val idStr = EDUDZIENNIK_HOMEWORK_ID.find(dateElement.attr("href"))?.get(1) ?: return@forEach
|
||||||
val id = idStr.crc32()
|
val id = idStr.crc32()
|
||||||
val date = Date.fromY_m_d(dateElement.text())
|
val date = Date.fromY_m_d(dateElement.text())
|
||||||
|
@ -29,7 +29,7 @@ class EdudziennikWebNotes(override val data: DataEdudziennik,
|
|||||||
val doc = Jsoup.parseBodyFragment("<table>" + text.trim() + "</table>")
|
val doc = Jsoup.parseBodyFragment("<table>" + text.trim() + "</table>")
|
||||||
|
|
||||||
doc.getElementsByTag("tr").forEach { noteElement ->
|
doc.getElementsByTag("tr").forEach { noteElement ->
|
||||||
val dateElement = noteElement.getElementsByClass("date").first().child(0)
|
val dateElement = noteElement.getElementsByClass("date").first()?.child(0) ?: return@forEach
|
||||||
val addedDate = Date.fromY_m_d(dateElement.text()).inMillis
|
val addedDate = Date.fromY_m_d(dateElement.text()).inMillis
|
||||||
|
|
||||||
val id = EDUDZIENNIK_NOTE_ID.find(dateElement.attr("href"))?.get(0)?.crc32()
|
val id = EDUDZIENNIK_NOTE_ID.find(dateElement.attr("href"))?.get(0)?.crc32()
|
||||||
|
@ -57,7 +57,7 @@ class EdudziennikWebTimetable(override val data: DataEdudziennik,
|
|||||||
|
|
||||||
val table = doc.select("#Schedule tbody").first()
|
val table = doc.select("#Schedule tbody").first()
|
||||||
|
|
||||||
if (!table.text().contains("Brak planu lekcji.")) {
|
if (table?.text()?.contains("Brak planu lekcji.") == false) {
|
||||||
table.children().forEach { row ->
|
table.children().forEach { row ->
|
||||||
val rowElements = row.children()
|
val rowElements = row.children()
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ class LibrusMessagesGetMessage(override val data: DataLibrus,
|
|||||||
"messageId" to messageObject.id,
|
"messageId" to messageObject.id,
|
||||||
"archive" to 0
|
"archive" to 0
|
||||||
)) { doc ->
|
)) { doc ->
|
||||||
val message = doc.select("response GetMessage data").first()
|
val message = doc.select("response GetMessage data").first() ?: return@messagesGet
|
||||||
|
|
||||||
val body = Base64.decode(message.select("Message").text(), Base64.DEFAULT)
|
val body = Base64.decode(message.select("Message").text(), Base64.DEFAULT)
|
||||||
.toString(Charset.defaultCharset())
|
.toString(Charset.defaultCharset())
|
||||||
|
@ -87,7 +87,7 @@ class LibrusSynergiaGetMessage(override val data: DataLibrus,
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
val readDateText = readElement.select(".left").text()
|
val readDateText = readElement?.select(".left")?.text()
|
||||||
val readDate = when (readDateText.isNotNullNorEmpty()) {
|
val readDate = when (readDateText.isNotNullNorEmpty()) {
|
||||||
true -> Date.fromIso(readDateText)
|
true -> Date.fromIso(readDateText)
|
||||||
else -> 0
|
else -> 0
|
||||||
@ -108,7 +108,7 @@ class LibrusSynergiaGetMessage(override val data: DataLibrus,
|
|||||||
|
|
||||||
Message.TYPE_SENT -> {
|
Message.TYPE_SENT -> {
|
||||||
|
|
||||||
readElement.select("tr").forEachIndexed { i, receiver ->
|
readElement?.select("tr")?.forEachIndexed { i, receiver ->
|
||||||
if (i == 0) return@forEachIndexed // Skip the header
|
if (i == 0) return@forEachIndexed // Skip the header
|
||||||
|
|
||||||
val receiverFullName = receiver.child(0).text()
|
val receiverFullName = receiver.child(0).text()
|
||||||
|
@ -36,19 +36,19 @@ class LibrusSynergiaGetMessages(override val data: DataLibrus,
|
|||||||
|
|
||||||
fun getRecipientId(name: String): Long = data.teacherList.singleOrNull {
|
fun getRecipientId(name: String): Long = data.teacherList.singleOrNull {
|
||||||
it.fullNameLastFirst == name
|
it.fullNameLastFirst == name
|
||||||
}?.id ?: {
|
}?.id ?: run {
|
||||||
val teacherObject = Teacher(
|
val teacherObject = Teacher(
|
||||||
profileId,
|
profileId,
|
||||||
-1 * Utils.crc16(name.swapFirstLastName().toByteArray()).toLong(),
|
-1 * Utils.crc16(name.swapFirstLastName().toByteArray()).toLong(),
|
||||||
name.splitName()?.second!!,
|
name.splitName()?.second!!,
|
||||||
name.splitName()?.first!!
|
name.splitName()?.first!!
|
||||||
)
|
)
|
||||||
data.teacherList.put(teacherObject.id, teacherObject)
|
data.teacherList.put(teacherObject.id, teacherObject)
|
||||||
teacherObject.id
|
teacherObject.id
|
||||||
}.invoke()
|
}
|
||||||
|
|
||||||
doc.select(".decorated.stretch tbody > tr").forEach { messageElement ->
|
doc.select(".decorated.stretch tbody > tr").forEach { messageElement ->
|
||||||
val url = messageElement.select("a").first().attr("href")
|
val url = messageElement.select("a").first()?.attr("href") ?: return@forEach
|
||||||
val id = Regexes.LIBRUS_MESSAGE_ID.find(url)?.get(1)?.toLong() ?: return@forEach
|
val id = Regexes.LIBRUS_MESSAGE_ID.find(url)?.get(1)?.toLong() ?: return@forEach
|
||||||
val subject = messageElement.child(3).text()
|
val subject = messageElement.child(3).text()
|
||||||
val sentDate = Date.fromIso(messageElement.child(4).text())
|
val sentDate = Date.fromIso(messageElement.child(4).text())
|
||||||
|
@ -40,13 +40,14 @@ class MobidziennikWebGetMessage(override val data: DataMobidziennik,
|
|||||||
|
|
||||||
val doc = Jsoup.parse(text)
|
val doc = Jsoup.parse(text)
|
||||||
|
|
||||||
val content = doc.select("#content").first()
|
val content = doc.select("#content").first() ?: return@webGet
|
||||||
|
|
||||||
val body = content.select(".wiadomosc_tresc").first()
|
val body = content.select(".wiadomosc_tresc").first()
|
||||||
|
val bodyHtml = body?.html() ?: ""
|
||||||
|
|
||||||
if (message.isReceived) {
|
if (message.isReceived) {
|
||||||
var readDate = System.currentTimeMillis()
|
var readDate = System.currentTimeMillis()
|
||||||
Regexes.MOBIDZIENNIK_MESSAGE_READ_DATE.find(body.html())?.let {
|
Regexes.MOBIDZIENNIK_MESSAGE_READ_DATE.find(bodyHtml)?.let {
|
||||||
val date = Date(
|
val date = Date(
|
||||||
it[3].toIntOrNull() ?: 2019,
|
it[3].toIntOrNull() ?: 2019,
|
||||||
monthFromName(it[2]),
|
monthFromName(it[2]),
|
||||||
@ -71,35 +72,35 @@ class MobidziennikWebGetMessage(override val data: DataMobidziennik,
|
|||||||
} else {
|
} else {
|
||||||
message.senderId = null
|
message.senderId = null
|
||||||
|
|
||||||
content.select("table.spis tr:has(td)")?.forEach { recipientEl ->
|
content.select("table.spis tr:has(td)").forEach { recipientEl ->
|
||||||
val senderEl = recipientEl.select("td:eq(1)")?.first() ?: return@forEach
|
val senderEl = recipientEl.select("td:eq(1)").first() ?: return@forEach
|
||||||
val senderName = senderEl.text().fixName()
|
val senderName = senderEl.text().fixName()
|
||||||
|
|
||||||
val teacher = data.teacherList.singleOrNull { it.fullNameLastFirst == senderName }
|
val teacher = data.teacherList.singleOrNull { it.fullNameLastFirst == senderName }
|
||||||
val receiverId = teacher?.id ?: -1
|
val receiverId = teacher?.id ?: -1
|
||||||
|
|
||||||
var readDate = 0L
|
var readDate = 0L
|
||||||
val isReadEl = recipientEl.select("td:eq(4)")?.first() ?: return@forEach
|
val isReadEl = recipientEl.select("td:eq(4)").first() ?: return@forEach
|
||||||
if (isReadEl.html().contains("tak")) {
|
if (isReadEl.html().contains("tak")) {
|
||||||
val readDateEl = recipientEl.select("td:eq(5) small")?.first() ?: return@forEach
|
val readDateEl = recipientEl.select("td:eq(5) small").first() ?: return@forEach
|
||||||
Regexes.MOBIDZIENNIK_MESSAGE_SENT_READ_DATE.find(readDateEl.ownText())?.let {
|
Regexes.MOBIDZIENNIK_MESSAGE_SENT_READ_DATE.find(readDateEl.ownText())?.let {
|
||||||
val date = Date(
|
val date = Date(
|
||||||
it[3].toIntOrNull() ?: 2019,
|
it[3].toIntOrNull() ?: 2019,
|
||||||
monthFromName(it[2]),
|
monthFromName(it[2]),
|
||||||
it[1].toIntOrNull() ?: 1
|
it[1].toIntOrNull() ?: 1
|
||||||
)
|
)
|
||||||
val time = Time.fromH_m_s(
|
val time = Time.fromH_m_s(
|
||||||
it[4] // TODO blank string safety
|
it[4] // TODO blank string safety
|
||||||
)
|
)
|
||||||
readDate = date.combineWith(time)
|
readDate = date.combineWith(time)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val recipient = MessageRecipientFull(
|
val recipient = MessageRecipientFull(
|
||||||
profileId = profileId,
|
profileId = profileId,
|
||||||
id = receiverId,
|
id = receiverId,
|
||||||
messageId = message.id,
|
messageId = message.id,
|
||||||
readDate = readDate
|
readDate = readDate
|
||||||
)
|
)
|
||||||
|
|
||||||
recipient.fullName = teacher?.fullName ?: "?"
|
recipient.fullName = teacher?.fullName ?: "?"
|
||||||
@ -109,11 +110,11 @@ class MobidziennikWebGetMessage(override val data: DataMobidziennik,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// this line removes the sender and read date details
|
// this line removes the sender and read date details
|
||||||
body.select("div").remove()
|
body?.select("div")?.remove()
|
||||||
|
|
||||||
// this needs to be at the end
|
// this needs to be at the end
|
||||||
message.apply {
|
message.apply {
|
||||||
this.body = body.html()
|
this.body = body?.html()
|
||||||
|
|
||||||
clearAttachments()
|
clearAttachments()
|
||||||
Regexes.MOBIDZIENNIK_WEB_ATTACHMENT.findAll(text).forEach { match ->
|
Regexes.MOBIDZIENNIK_WEB_ATTACHMENT.findAll(text).forEach { match ->
|
||||||
|
@ -34,25 +34,25 @@ class MobidziennikWebMessagesAll(override val data: DataMobidziennik,
|
|||||||
|
|
||||||
val doc = Jsoup.parse(text)
|
val doc = Jsoup.parse(text)
|
||||||
|
|
||||||
val listElement = doc.getElementsByClass("spis")?.first()
|
val listElement = doc.getElementsByClass("spis").first()
|
||||||
if (listElement == null) {
|
if (listElement == null) {
|
||||||
data.setSyncNext(ENDPOINT_MOBIDZIENNIK_WEB_MESSAGES_ALL, 7*DAY)
|
data.setSyncNext(ENDPOINT_MOBIDZIENNIK_WEB_MESSAGES_ALL, 7*DAY)
|
||||||
onSuccess(ENDPOINT_MOBIDZIENNIK_WEB_MESSAGES_ALL)
|
onSuccess(ENDPOINT_MOBIDZIENNIK_WEB_MESSAGES_ALL)
|
||||||
return@webGet
|
return@webGet
|
||||||
}
|
}
|
||||||
val list = listElement.getElementsByClass("podswietl")
|
val list = listElement.getElementsByClass("podswietl")
|
||||||
list?.forEach { item ->
|
list.forEach { item ->
|
||||||
val id = item.attr("rel").replace("[^\\d]".toRegex(), "").toLongOrNull() ?: return@forEach
|
val id = item.attr("rel").replace("[^\\d]".toRegex(), "").toLongOrNull() ?: return@forEach
|
||||||
|
|
||||||
val subjectEl = item.select("td:eq(0) div").first()
|
val subjectEl = item.select("td:eq(0) div").first()
|
||||||
val subject = subjectEl.text()
|
val subject = subjectEl?.text() ?: ""
|
||||||
|
|
||||||
val addedDateEl = item.select("td:eq(1)").first()
|
val addedDateEl = item.select("td:eq(1)").first()
|
||||||
val addedDate = Date.fromIsoHm(addedDateEl.text())
|
val addedDate = Date.fromIsoHm(addedDateEl?.text())
|
||||||
|
|
||||||
val typeEl = item.select("td:eq(2) img").first()
|
val typeEl = item.select("td:eq(2) img").first()
|
||||||
var type = TYPE_RECEIVED
|
var type = TYPE_RECEIVED
|
||||||
if (typeEl.outerHtml().contains("mail_send.png"))
|
if (typeEl?.outerHtml()?.contains("mail_send.png") == true)
|
||||||
type = TYPE_SENT
|
type = TYPE_SENT
|
||||||
|
|
||||||
val senderEl = item.select("td:eq(3) div").first()
|
val senderEl = item.select("td:eq(3) div").first()
|
||||||
@ -60,13 +60,13 @@ class MobidziennikWebMessagesAll(override val data: DataMobidziennik,
|
|||||||
|
|
||||||
if (type == TYPE_RECEIVED) {
|
if (type == TYPE_RECEIVED) {
|
||||||
// search sender teacher
|
// search sender teacher
|
||||||
val senderName = senderEl.text().fixName()
|
val senderName = senderEl?.text().fixName()
|
||||||
senderId = data.teacherList.singleOrNull { it.fullNameLastFirst == senderName }?.id
|
senderId = data.teacherList.singleOrNull { it.fullNameLastFirst == senderName }?.id
|
||||||
data.messageRecipientList.add(MessageRecipient(profileId, -1, id))
|
data.messageRecipientList.add(MessageRecipient(profileId, -1, id))
|
||||||
} else {
|
} else {
|
||||||
// TYPE_SENT, so multiple recipients possible
|
// TYPE_SENT, so multiple recipients possible
|
||||||
val recipientNames = senderEl.text().split(", ")
|
val recipientNames = senderEl?.text()?.split(", ")
|
||||||
for (recipientName in recipientNames) {
|
recipientNames?.forEach { recipientName ->
|
||||||
val name = recipientName.fixName()
|
val name = recipientName.fixName()
|
||||||
val recipientId = data.teacherList.singleOrNull { it.fullNameLastFirst == name }?.id ?: -1
|
val recipientId = data.teacherList.singleOrNull { it.fullNameLastFirst == name }?.id ?: -1
|
||||||
data.messageRecipientIgnoreList.add(MessageRecipient(profileId, recipientId, id))
|
data.messageRecipientIgnoreList.add(MessageRecipient(profileId, recipientId, id))
|
||||||
@ -74,13 +74,13 @@ class MobidziennikWebMessagesAll(override val data: DataMobidziennik,
|
|||||||
}
|
}
|
||||||
|
|
||||||
val message = Message(
|
val message = Message(
|
||||||
profileId = profileId,
|
profileId = profileId,
|
||||||
id = id,
|
id = id,
|
||||||
type = type,
|
type = type,
|
||||||
subject = subject,
|
subject = subject,
|
||||||
body = null,
|
body = null,
|
||||||
senderId = senderId,
|
senderId = senderId,
|
||||||
addedDate = addedDate
|
addedDate = addedDate
|
||||||
)
|
)
|
||||||
|
|
||||||
data.messageList.add(message)
|
data.messageList.add(message)
|
||||||
|
@ -36,26 +36,26 @@ class MobidziennikWebMessagesInbox(override val data: DataMobidziennik,
|
|||||||
|
|
||||||
val doc = Jsoup.parse(text)
|
val doc = Jsoup.parse(text)
|
||||||
|
|
||||||
val list = doc.getElementsByClass("spis")?.first()?.getElementsByClass("podswietl")
|
val list = doc.getElementsByClass("spis").first()?.getElementsByClass("podswietl")
|
||||||
list?.forEach { item ->
|
list?.forEach { item ->
|
||||||
val id = item.attr("rel").toLongOrNull() ?: return@forEach
|
val id = item.attr("rel").toLongOrNull() ?: return@forEach
|
||||||
|
|
||||||
val subjectEl = item.select("td:eq(0)").first()
|
val subjectEl = item.select("td:eq(0)").first()
|
||||||
var hasAttachments = false
|
var hasAttachments = false
|
||||||
if (subjectEl.getElementsByTag("a").size != 0) {
|
if (subjectEl?.getElementsByTag("a")?.size ?: 0 > 0) {
|
||||||
hasAttachments = true
|
hasAttachments = true
|
||||||
}
|
}
|
||||||
val subject = subjectEl.ownText()
|
val subject = subjectEl?.ownText() ?: ""
|
||||||
|
|
||||||
val addedDateEl = item.select("td:eq(1) small").first()
|
val addedDateEl = item.select("td:eq(1) small").first()
|
||||||
val addedDate = Date.fromIsoHm(addedDateEl.text())
|
val addedDate = Date.fromIsoHm(addedDateEl?.text())
|
||||||
|
|
||||||
val senderEl = item.select("td:eq(2)").first()
|
val senderEl = item.select("td:eq(2)").first()
|
||||||
val senderName = senderEl.ownText().fixName()
|
val senderName = senderEl?.ownText().fixName()
|
||||||
val senderId = data.teacherList.singleOrNull { it.fullNameLastFirst == senderName }?.id
|
val senderId = data.teacherList.singleOrNull { it.fullNameLastFirst == senderName }?.id
|
||||||
data.messageRecipientIgnoreList.add(MessageRecipient(profileId, -1, id))
|
data.messageRecipientIgnoreList.add(MessageRecipient(profileId, -1, id))
|
||||||
|
|
||||||
val isRead = item.select("td:eq(3) span").first().hasClass("wiadomosc_przeczytana")
|
val isRead = item.select("td:eq(3) span").first()?.hasClass("wiadomosc_przeczytana") == true
|
||||||
|
|
||||||
val message = Message(
|
val message = Message(
|
||||||
profileId = profileId,
|
profileId = profileId,
|
||||||
|
@ -40,37 +40,37 @@ class MobidziennikWebMessagesSent(override val data: DataMobidziennik,
|
|||||||
|
|
||||||
val doc = Jsoup.parse(text)
|
val doc = Jsoup.parse(text)
|
||||||
|
|
||||||
val list = doc.getElementsByClass("spis")?.first()?.getElementsByClass("podswietl")
|
val list = doc.getElementsByClass("spis").first()?.getElementsByClass("podswietl")
|
||||||
list?.forEach { item ->
|
list?.forEach { item ->
|
||||||
val id = item.attr("rel").toLongOrNull() ?: return@forEach
|
val id = item.attr("rel").toLongOrNull() ?: return@forEach
|
||||||
|
|
||||||
val subjectEl = item.select("td:eq(0)").first()
|
val subjectEl = item.select("td:eq(0)").first()
|
||||||
var hasAttachments = false
|
var hasAttachments = false
|
||||||
if (subjectEl.getElementsByTag("a").size != 0) {
|
if (subjectEl?.getElementsByTag("a")?.size ?: 0 > 0) {
|
||||||
hasAttachments = true
|
hasAttachments = true
|
||||||
}
|
}
|
||||||
val subject = subjectEl.ownText()
|
val subject = subjectEl?.ownText() ?: ""
|
||||||
|
|
||||||
val readByString = item.select("td:eq(2)").first().text()
|
val readByString = item.select("td:eq(2)").first()?.text() ?: ""
|
||||||
val (readBy, sentTo) = Regexes.MOBIDZIENNIK_MESSAGE_SENT_READ_BY.find(readByString).let {
|
val (readBy, sentTo) = Regexes.MOBIDZIENNIK_MESSAGE_SENT_READ_BY.find(readByString).let {
|
||||||
(it?.get(1)?.toIntOrNull() ?: 0) to (it?.get(2)?.toIntOrNull() ?: 0)
|
(it?.get(1)?.toIntOrNull() ?: 0) to (it?.get(2)?.toIntOrNull() ?: 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
val recipientEl = item.select("td:eq(1) a span").first()
|
val recipientEl = item.select("td:eq(1) a span").first()
|
||||||
val recipientNames = recipientEl.ownText().split(", ")
|
val recipientNames = recipientEl?.ownText()?.split(", ")
|
||||||
val readState = when (readBy) {
|
val readState = when (readBy) {
|
||||||
0 -> 0
|
0 -> 0
|
||||||
sentTo -> 1
|
sentTo -> 1
|
||||||
else -> -1
|
else -> -1
|
||||||
}.toLong()
|
}.toLong()
|
||||||
for (recipientName in recipientNames) {
|
recipientNames?.forEach { recipientName ->
|
||||||
val name = recipientName.fixName()
|
val name = recipientName.fixName()
|
||||||
val recipientId = data.teacherList.singleOrNull { it.fullNameLastFirst == name }?.id ?: -1
|
val recipientId = data.teacherList.singleOrNull { it.fullNameLastFirst == name }?.id ?: -1
|
||||||
data.messageRecipientIgnoreList.add(MessageRecipient(profileId, recipientId, -1, readState, id))
|
data.messageRecipientIgnoreList.add(MessageRecipient(profileId, recipientId, -1, readState, id))
|
||||||
}
|
}
|
||||||
|
|
||||||
val addedDateEl = item.select("td:eq(3) small").first()
|
val addedDateEl = item.select("td:eq(3) small").first()
|
||||||
val addedDate = Date.fromIsoHm(addedDateEl.text())
|
val addedDate = Date.fromIsoHm(addedDateEl?.text())
|
||||||
|
|
||||||
val message = Message(
|
val message = Message(
|
||||||
profileId = profileId,
|
profileId = profileId,
|
||||||
|
11
build.gradle
11
build.gradle
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext {
|
ext {
|
||||||
kotlin_version = '1.5.20'
|
kotlin_version = '1.5.30'
|
||||||
|
|
||||||
release = [
|
release = [
|
||||||
versionName: "4.10",
|
versionName: "4.10",
|
||||||
@ -18,10 +18,10 @@ buildscript {
|
|||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
jcenter()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:7.0.2'
|
classpath 'com.android.tools.build:gradle:7.0.3'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
classpath 'com.google.gms:google-services:4.3.10'
|
classpath 'com.google.gms:google-services:4.3.10'
|
||||||
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
|
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
|
||||||
@ -37,11 +37,8 @@ allprojects {
|
|||||||
}
|
}
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
jcenter()
|
mavenCentral()
|
||||||
maven { url 'https://jitpack.io' }
|
maven { url 'https://jitpack.io' }
|
||||||
maven { url "https://kotlin.bintray.com/kotlinx/" }
|
|
||||||
maven { url "https://dl.bintray.com/wulkanowy/wulkanowy" }
|
|
||||||
maven { url "https://dl.bintray.com/undervoid/PowerPermission" }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +1,6 @@
|
|||||||
#Wed Feb 17 14:04:38 CET 2021
|
#Wed Feb 17 14:04:38 CET 2021
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
Loading…
Reference in New Issue
Block a user