Compare commits

...

13 Commits

Author SHA1 Message Date
afb1863827 [Strings] Fix compilation problem. 2021-10-31 20:25:34 +01:00
d8228748e4 [4.11-rc.3] Update build.gradle, signing and changelog. 2021-10-31 20:16:12 +01:00
b0608c47c4 [Strings] Update English translation. (#117)
* Update translations

* Apply suggestions from code review

Co-authored-by: Kuba Szczodrzyński <kuba@szczodrzynski.pl>

* Update translations

* Update translations

Co-authored-by: Kuba Szczodrzyński <kuba@szczodrzynski.pl>
2021-10-31 20:15:24 +01:00
dda0d88f19 [API/Vulcan] Fix Web login with multiple student IDs. 2021-10-31 18:19:18 +01:00
a1b5560977 [API/Vulcan] Fix teachers endpoint last sync date. (#116) 2021-10-31 14:24:39 +01:00
86f5811bda [Login] Fix incorrect case mode validation. (#115) 2021-10-31 14:24:20 +01:00
3f11e75985 [Lab] Add Open Chucker button. (#114) 2021-10-31 14:23:59 +01:00
c39b5442c9 [API/Vulcan] Fix teacher list subjects retrieving. 2021-10-31 10:12:35 +01:00
3b80adf355 [4.11-rc.2] Update build.gradle, signing and changelog. 2021-10-30 22:04:13 +02:00
cae41d17b6 [Actions] Use Eclipse Temurin and gradle-build-action. 2021-10-30 22:02:59 +02:00
519d75d9d9 [API/Vulcan] Force presence of a TeamClass. 2021-10-30 21:55:47 +02:00
cb953ea8a8 [Config] Fix only notes card visible on new profiles. 2021-10-30 21:55:47 +02:00
52968cafad [Proguard] Add a rule for Note. 2021-10-30 21:55:47 +02:00
19 changed files with 215 additions and 83 deletions

View File

@ -54,9 +54,8 @@ jobs:
- name: Setup JDK 11
uses: actions/setup-java@v2
with:
distribution: 'zulu'
distribution: 'temurin'
java-version: '11'
cache: 'gradle'
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- name: Clean build artifacts
@ -65,7 +64,9 @@ jobs:
rm -rf app/build/outputs/apk/*
rm -rf app/build/outputs/bundle/*
- name: Assemble official release with Gradle
run: ./gradlew assembleOfficialRelease
uses: gradle/gradle-build-action@v2
with:
arguments: assembleOfficialRelease
sign:
name: Sign APK
runs-on: self-hosted

View File

@ -46,9 +46,8 @@ jobs:
- name: Setup JDK 11
uses: actions/setup-java@v2
with:
distribution: 'zulu'
distribution: 'temurin'
java-version: '11'
cache: 'gradle'
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- name: Clean build artifacts
@ -57,7 +56,9 @@ jobs:
rm -rf app/build/outputs/apk/*
rm -rf app/build/outputs/bundle/*
- name: Bundle play release with Gradle
run: ./gradlew bundlePlayRelease
uses: gradle/gradle-build-action@v2
with:
arguments: bundlePlayRelease
sign:
name: Sign App Bundle
runs-on: self-hosted

View File

@ -46,9 +46,8 @@ jobs:
- name: Setup JDK 11
uses: actions/setup-java@v2
with:
distribution: 'zulu'
distribution: 'temurin'
java-version: '11'
cache: 'gradle'
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- name: Clean build artifacts
@ -57,7 +56,9 @@ jobs:
rm -rf app/build/outputs/apk/*
rm -rf app/build/outputs/bundle/*
- name: Assemble official release with Gradle
run: ./gradlew assembleOfficialRelease
uses: gradle/gradle-build-action@v2
with:
arguments: assembleOfficialRelease
sign:
name: Sign APK
runs-on: self-hosted

View File

@ -25,6 +25,7 @@
-keep class pl.szczodrzynski.edziennik.data.db.entity.Event { *; }
-keep class pl.szczodrzynski.edziennik.data.db.full.EventFull { *; }
-keep class pl.szczodrzynski.edziennik.data.db.entity.FeedbackMessage { *; }
-keep class pl.szczodrzynski.edziennik.data.db.entity.Note { *; }
-keep class pl.szczodrzynski.edziennik.ui.home.HomeCardModel { *; }
-keepclassmembers class pl.szczodrzynski.edziennik.ui.widgets.WidgetConfig { public *; }
-keepnames class pl.szczodrzynski.edziennik.ui.widgets.timetable.WidgetTimetableProvider

View File

@ -1,4 +1,4 @@
<h3>Wersja 4.11-rc.1, 2021-10-29</h3>
<h3>Wersja 4.11-rc.3, 2021-10-31</h3>
<ul>
<li>Nowości w module Wiadomości:</li>
<li><b>Formatowanie tekstu</b> przy wysyłaniu wiadomości oraz dodawaniu wydarzeń.</li>

View File

@ -9,7 +9,7 @@
/*secret password - removed for source code publication*/
static toys AES_IV[16] = {
0xf3, 0x0e, 0xf9, 0x06, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
0x89, 0xe6, 0xba, 0x1c, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
unsigned char *agony(unsigned int laugh, unsigned char *box, unsigned char *heat);

View File

@ -37,8 +37,10 @@ class ProfileConfigMigration(config: ProfileConfig) {
}
if (dataVersion < 3) {
ui.homeCards = ui.homeCards.toMutableList().also {
it.add(HomeCardModel(config.profileId, HomeCard.CARD_NOTES))
if (ui.homeCards.isNotEmpty()) {
ui.homeCards = ui.homeCards.toMutableList().also {
it.add(HomeCardModel(config.profileId, HomeCard.CARD_NOTES))
}
}
dataVersion = 3

View File

@ -22,7 +22,6 @@ import pl.szczodrzynski.edziennik.data.api.models.ApiError
import pl.szczodrzynski.edziennik.data.db.entity.LessonRange
import pl.szczodrzynski.edziennik.data.db.entity.Subject
import pl.szczodrzynski.edziennik.data.db.entity.Teacher
import pl.szczodrzynski.edziennik.data.db.entity.Team
import pl.szczodrzynski.edziennik.ext.*
import pl.szczodrzynski.edziennik.utils.Utils.d
import pl.szczodrzynski.edziennik.utils.models.Date
@ -91,41 +90,31 @@ open class VulcanHebe(open val data: DataVulcan, open val lastSync: Long?) {
fun getTeamId(json: JsonObject?, key: String): Long? {
val team = json.getJsonObject(key)
val teamId = team.getLong("Id") ?: return null
if (data.teamList[teamId] == null) {
var name = team.getString("Shortcut")
?: team.getString("Name")
?: ""
name = "${profile?.studentClassName ?: ""} $name"
data.teamList[teamId] = Team(
data.profileId,
teamId,
name,
Team.TYPE_VIRTUAL,
"${data.schoolCode}:$name",
-1
)
}
return teamId
val teamId = team.getLong("Id")
var teamName = team.getString("Shortcut")
?: team.getString("Name")
?: ""
teamName = "${profile?.studentClassName ?: ""} $teamName"
return data.getTeam(
id = teamId,
name = teamName,
schoolCode = data.schoolCode ?: "",
isTeamClass = false,
).id
}
fun getClassId(json: JsonObject?, key: String): Long? {
val team = json.getJsonObject(key)
val teamId = team.getLong("Id") ?: return null
if (data.teamList[teamId] == null) {
val name = data.profile?.studentClassName
?: team.getString("Name")
?: ""
data.teamList[teamId] = Team(
data.profileId,
teamId,
name,
Team.TYPE_CLASS,
"${data.schoolCode}:$name",
-1
)
}
return teamId
val teamId = team.getLong("Id")
val teamName = data.profile?.studentClassName
?: team.getString("Name")
?: ""
return data.getTeam(
id = teamId,
name = teamName,
schoolCode = data.schoolCode ?: "",
isTeamClass = true,
).id
}
fun getLessonRange(json: JsonObject?, key: String): LessonRange? {

View File

@ -137,31 +137,6 @@ open class VulcanWebMain(open val data: DataVulcan, open val lastSync: Long?) {
}
}
data.webPermissions = data.webPermissions.toMutableMap().also { map ->
val permissions = Regexes.VULCAN_WEB_PERMISSIONS.find(text)?.let { it[1] }
if (permissions?.isNotBlank() == true) {
val studentId = permissions.split("|")
.getOrNull(0)
?.base64DecodeToString()
?.toJsonObject()
?.getJsonArray("AuthInfos")
?.asJsonObjectList()
?.flatMap { authInfo ->
authInfo.getJsonArray("UczenIds")
?.map { it.asInt }
?: listOf()
}
?.firstOrNull()
?.toString()
data.app.cookieJar.set(
data.webHost ?: "vulcan.net.pl",
"idBiezacyUczen",
studentId
)
}
map[symbol] = permissions
}
val schoolSymbols = mutableListOf<String>()
val clientUrl = "://uonetplus-uczen.${data.webHost}/$symbol/"
var clientIndex = text.indexOf(clientUrl)
@ -186,6 +161,42 @@ open class VulcanWebMain(open val data: DataVulcan, open val lastSync: Long?) {
return
}
data.webPermissions = data.webPermissions.toMutableMap().also { map ->
val permissions = Regexes.VULCAN_WEB_PERMISSIONS.find(text)?.let { it[1] }
if (permissions?.isNotBlank() == true) {
val json = permissions.split("|")
.getOrNull(0)
?.base64DecodeToString()
?.toJsonObject()
val unitIds = json
?.getJsonArray("Units")
?.asJsonObjectList()
?.filter { unit ->
unit.getString("Symbol") in schoolSymbols
}
?.mapNotNull { it.getInt("Id") } ?: emptyList()
val studentId = json
?.getJsonArray("AuthInfos")
?.asJsonObjectList()
?.filter { authInfo ->
authInfo.getInt("JednostkaSprawozdawczaId") in unitIds
}
?.flatMap { authInfo ->
authInfo.getJsonArray("UczenIds")
?.map { it.asInt }
?: listOf()
}
?.firstOrNull()
?.toString()
data.app.cookieJar.set(
data.webHost ?: "vulcan.net.pl",
"idBiezacyUczen",
studentId
)
}
map[symbol] = permissions
}
onSuccess(text, schoolSymbols)
}

View File

@ -151,6 +151,15 @@ class VulcanHebeMain(
studentData["senderAddressName"] = senderAddressName
studentData["senderAddressHash"] = senderAddressHash
studentData["hebeContext"] = hebeContext
// create the default TeamClass
data.getTeam(
id = null,
name = studentClassName,
schoolCode = schoolCode,
isTeamClass = true,
profileId = this.id,
)
}
dateSemester1Start?.let {
newProfile.dateSemester1Start = it

View File

@ -4,10 +4,12 @@
package pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.data.hebe
import androidx.room.OnConflictStrategy
import pl.szczodrzynski.edziennik.data.api.VULCAN_HEBE_ENDPOINT_TEACHERS
import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.DataVulcan
import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.ENDPOINT_VULCAN_HEBE_TEACHERS
import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.data.VulcanHebe
import pl.szczodrzynski.edziennik.data.db.entity.Teacher
import pl.szczodrzynski.edziennik.ext.DAY
import pl.szczodrzynski.edziennik.ext.getString
@ -25,20 +27,32 @@ class VulcanHebeTeachers(
TAG,
VULCAN_HEBE_ENDPOINT_TEACHERS,
HebeFilterType.BY_PERIOD,
lastSync = lastSync,
lastSync = 0L,
) { list, _ ->
list.forEach { person ->
val name = person.getString("Name")
val surname = person.getString("Surname")
val displayName = person.getString("DisplayName")
val subjectName = person.getString("Description") ?: return@apiGetList
val subjectName = person.getString("Description") ?: return@forEach
if (subjectName.isBlank()) {
return@forEach
}
val teacher = data.getTeacherByFirstLast(
name?.plus(" ")?.plus(surname) ?: displayName ?: return@forEach
)
teacher.addSubject(data.getSubject(null, subjectName).id)
when (subjectName) {
"Pedagog" -> teacher.setTeacherType(Teacher.TYPE_PEDAGOGUE)
else -> {
val subjectId = data.getSubject(null, subjectName).id
if (!teacher.subjects.contains(subjectId))
teacher.addSubject(subjectId)
}
}
}
data.teacherOnConflictStrategy = OnConflictStrategy.REPLACE
data.setSyncNext(ENDPOINT_VULCAN_HEBE_TEACHERS, 2 * DAY)
onSuccess(ENDPOINT_VULCAN_HEBE_TEACHERS)
}

View File

@ -406,7 +406,13 @@ abstract class Data(val app: App, val profile: Profile?, val loginStore: LoginSt
return subject
}
fun getTeam(id: Long?, name: String, schoolCode: String, isTeamClass: Boolean = false): Team {
fun getTeam(
id: Long?,
name: String,
schoolCode: String,
isTeamClass: Boolean = false,
profileId: Int? = null,
): Team {
if (isTeamClass && teamClass != null)
return teamClass as Team
var team = teamList.singleOrNull { it.id == id }
@ -417,7 +423,7 @@ abstract class Data(val app: App, val profile: Profile?, val loginStore: LoginSt
if (team == null) {
team = Team(
profileId,
profileId ?: this.profileId,
id ?: name.crc32(),
name,
if (isTeamClass) Team.TYPE_CLASS else Team.TYPE_VIRTUAL,
@ -425,6 +431,8 @@ abstract class Data(val app: App, val profile: Profile?, val loginStore: LoginSt
-1
)
teamList[team.id] = team
} else if (id != null) {
team.id = id
}
return team
}

View File

@ -46,6 +46,6 @@ object Signing {
/*fun provideKey(param1: String, param2: Long): ByteArray {*/
fun pleaseStopRightNow(param1: String, param2: Long): ByteArray {
return "$param1.MTIzNDU2Nzg5MDTSWXKh0v===.$param2".sha256()
return "$param1.MTIzNDU2Nzg5MDoLs15rw+===.$param2".sha256()
}
}

View File

@ -9,7 +9,10 @@ import android.os.Process
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.view.isVisible
import androidx.sqlite.db.SimpleSQLiteQuery
import com.chuckerteam.chucker.api.Chucker
import com.chuckerteam.chucker.api.Chucker.SCREEN_HTTP
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
@ -95,6 +98,13 @@ class LabPageFragment : LazyFragment(), CoroutineScope {
.show()
}
if (App.enableChucker) {
b.openChucker.isVisible = true
b.openChucker.onClick {
startActivity(Chucker.getLaunchIntent(activity, SCREEN_HTTP))
}
}
b.disableDebug.onClick {
app.config.devMode = false
App.devMode = false

View File

@ -262,7 +262,7 @@ class LoginFormFragment : Fragment(), CoroutineScope {
if (credential.caseMode == FormField.CaseMode.UPPER_CASE)
text = text.uppercase()
if (credential.caseMode == FormField.CaseMode.LOWER_CASE)
text = text.uppercase()
text = text.lowercase()
credential.stripTextRegex?.let {
text = text.replace(it.toRegex(), "")

View File

@ -47,6 +47,15 @@
android:layout_height="wrap_content"
android:text="Chucker" />
<Button
android:id="@+id/openChucker"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Open Chucker"
android:textAllCaps="false"
android:visibility="gone"
tools:visibility="visible" />
<Button
android:id="@+id/last10unseen"
android:layout_width="match_parent"

View File

@ -1287,7 +1287,7 @@
<string name="attendance_details_time">Time</string>
<string name="settings_about_github_subtext">Help with app development on GitHub</string>
<string name="build_platform">Distribution</string>
<string name="build_validate_progress">Build verification in progress...</string>
<string name="build_validate_progress">Build verification in progress</string>
<string name="attendance_tab_months">By months</string>
<string name="attendance_tab_summary">Summary</string>
<string name="attendance_details_type">Type</string>
@ -1307,7 +1307,7 @@
<string name="settings_about_homepage_subtext">Get help or support authors</string>
<string name="build_invalid_title">Information about application version</string>
<string name="home_archive_close_no_target_title">No current profile</string>
<string name="login_platform_list_loading">Loading e-registers list...</string>
<string name="login_platform_list_loading">Loading e-registers list</string>
<string name="login_mode_podlasie_api">Log in using token</string>
<string name="login_mode_podlasie_api_guide">Provide mobile app token.</string>
<string name="attendance_config_title">Attendance configuration</string>
@ -1321,10 +1321,10 @@
<string name="login_mode_vulcan_api">Use token, symbol and PIN code</string>
<string name="login_mode_vulcan_api_hint">Register device on journal VULCAN® page</string>
<string name="login_mode_vulcan_web">Use e-mail/username and password</string>
<string name="edziennik_progress_login_podlasie_api">Logging in to PPE...</string>
<string name="edziennik_progress_login_podlasie_api">Logging in to PPE</string>
<string name="login_type_podlasie">Podlaska Platforma Edukacyjna</string>
<string name="login_mode_edudziennik_web">Log in using e-mail and password</string>
<string name="edziennik_progress_login_vulcan_web_main">Logging in to VULCAN® register...</string>
<string name="edziennik_progress_login_vulcan_web_main">Logging in to VULCAN® register</string>
<string name="login_mode_librus_jst">Login via VULCAN® platform</string>
<string name="login_mode_librus_email">Log in using e-mail</string>
<string name="attendance_details_id">Attendance ID</string>
@ -1377,4 +1377,78 @@
<string name="menu_teachers">Teachers</string>
<string name="edziennik_progress_endpoint_addressbook">Syncing addressbook…</string>
<string name="send_message">Send message</string>
<string name="color_black">Black</string>
<string name="color_grey">Gray</string>
<string name="card_type_notes">Notes</string>
<string name="menu_notes">Notes</string>
<string name="notes_editor_dialog_title">Edit note</string>
<string name="notes_editor_color">Color</string>
<string name="color_brown">Brown</string>
<string name="color_pink">Pink</string>
<string name="color_dark_blue">Dark blue</string>
<string name="color_purple">Purple</string>
<string name="color_blue">Blue</string>
<string name="color_teal">Teal</string>
<string name="color_green">Green</string>
<string name="color_yellow">Yellow</string>
<string name="color_orange">Orange</string>
<string name="color_red">Red</string>
<string name="notes_action_add">Add note</string>
<string name="notes_type_grade">Grade</string>
<string name="privacy_policy_dialog_html"><![CDATA[By using the application, you confirm that you have <a href="https://szkolny.eu/privacy-policy">read the Privacy Policy</a> and accept its provisions.<br /><br />The authors of the application are not responsible for the use of the Szkolny.eu application.]]></string>
<string name="login_chooser_version_format">Szkolny.eu v%s\n%s</string>
<string name="agenda_config_appearance">Appearance</string>
<string name="agenda_config_elearning">Online learning</string>
<string name="event_type_elearning">online lesson</string>
<string name="menu_messages_config">Messages settings</string>
<string name="message_delete">Delete</string>
<string name="message_reply">Reply</string>
<string name="message_forward">Forward</string>
<string name="discard">Discard</string>
<string name="messages_compose_draft_saved">Draft message saved</string>
<string name="messages_tab_draft">Drafts</string>
<string name="messages_compose_send_long">Send a message</string>
<string name="notes_button">Notes</string>
<string name="notes_list_dialog_title">Notes</string>
<string name="notes_added_by_you_format">Added on %1$s</string>
<string name="notes_type_attendance">Attendance</string>
<string name="notes_type_behavior">Behavior</string>
<string name="notes_type_day">Day</string>
<string name="notes_type_event">Event</string>
<string name="notes_type_lesson">Lesson</string>
<string name="notes_type_message">Message</string>
<string name="notes_details_id">Note ID</string>
<string name="notes_details_owner_id">Owner ID</string>
<string name="notes_type_announcement">Announcement</string>
<string name="styled_text_dialog_title">Edit text</string>
<string name="login_qr_decoding_error">The QR code doesn\'t seem correct</string>
<string name="notes_no_data_hint">You can add notes and share them with your class using the Add button.</string>
<string name="legend_notes_added">{cmd-playlist-edit} notes added</string>
<string name="legend_notes_added_replaced">{cmd-playlist-edit} notes added\n{cmd-swap-horizontal} text replaced with a note</string>
<string name="notes_no_data">No notes added yet</string>
<string name="messages_compose_discard_draft_text">Do you want to discard the saved version of the message?\n\nThis will also cancel your changes and delete your message.</string>
<string name="messages_compose_discard_draft">Discard draft</string>
<string name="messages_compose_draft_discarded">Draft message deleted</string>
<string name="messages_compose_discard_draft_title">Discard draft</string>
<string name="notes_details_dialog_title">Note</string>
<string name="notes_editor_topic">Note title (optional)</string>
<string name="notes_editor_body">Note text</string>
<string name="notes_editor_share_hint">The classmates will see your note next to this item.</string>
<string name="notes_editor_replace_hint">The content of the note will be visible instead of the original content of the item.</string>
<string name="notes_editor_body_error">Enter the note text</string>
<string name="color_none">None</string>
<string name="notification_type_new_shared_note">Note shared</string>
<string name="notes_editor_confirmation_text">Do you want to delete this note?\n\nIt will be deleted on your device and on classmates\' devices.</string>
<string name="notes_editor_progress_unsharing">Deleting shared note…</string>
<string name="notes_editor_progress_sharing">Sharing the note…</string>
<string name="notes_editor_replace_text">Replace original content</string>
<string name="card_notes_header_title">Newest notes</string>
<string name="messages_compose_save_draft_title">Save changes</string>
<string name="messages_compose_save_draft_text">Do you want to save your changes as a draft?\n\nIt will be possible to edit and send the message later.</string>
<string name="messages_compose_body_load_failed">The original message could not be loaded.</string>
<string name="message_download">Download again</string>
<string name="hint_message_star">Mark with a star</string>
<string name="dialog_lesson_attendance_details">Details</string>
<string name="menu_agenda_config">Agenda settings</string>
<string name="registration_config_note_sharing_title">Share notes</string>
</resources>

View File

@ -1547,4 +1547,6 @@
<string name="color_black">Czarny</string>
<string name="card_type_notes">Notatki</string>
<string name="card_notes_header_title">Najnowsze notatki</string>
<string name="login_summary_account_child">(uczeń)</string>
<string name="login_summary_account_parent">(rodzic)</string>
</resources>

View File

@ -5,8 +5,8 @@ buildscript {
kotlin_version = '1.5.30'
release = [
versionName: "4.11-rc.1",
versionCode: 4110010
versionName: "4.11-rc.3",
versionCode: 4110030
]
setup = [