Merge branch 'release/1.7.5'

This commit is contained in:
Mikołaj Pich 2022-09-02 21:31:31 +02:00
commit afc16e3d17
5 changed files with 28 additions and 11 deletions

View File

@ -23,8 +23,8 @@ android {
testApplicationId "io.github.tests.wulkanowy" testApplicationId "io.github.tests.wulkanowy"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 32 targetSdkVersion 32
versionCode 113 versionCode 114
versionName "1.7.4" versionName "1.7.5"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
resValue "string", "app_name", "Wulkanowy" resValue "string", "app_name", "Wulkanowy"
@ -162,7 +162,7 @@ play {
track = 'production' track = 'production'
// releaseStatus = com.github.triplet.gradle.androidpublisher.ReleaseStatus.IN_PROGRESS // releaseStatus = com.github.triplet.gradle.androidpublisher.ReleaseStatus.IN_PROGRESS
// userFraction = 0.05d // userFraction = 0.05d
updatePriority = 5 updatePriority = 4
enabled.set(false) enabled.set(false)
} }
@ -186,7 +186,7 @@ ext {
} }
dependencies { dependencies {
implementation "io.github.wulkanowy:sdk:1.7.4" implementation "io.github.wulkanowy:sdk:1.7.5"
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.8' coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.8'

View File

@ -60,16 +60,18 @@ class MailboxRepository @Inject constructor(
} }
private fun String.normalizeStudentName(): String { private fun String.normalizeStudentName(): String {
return trim().split(" ").joinToString(" ") { part -> return trim().split(" ")
part.lowercase().replaceFirstChar { it.uppercase() } .filter { it.isNotBlank() }
} .joinToString(" ") { part ->
part.lowercase().replaceFirstChar { it.uppercase() }
}
} }
private fun String.getFirstAndLastPart(): String { private fun String.getFirstAndLastPart(): String {
val parts = normalizeStudentName().split(" ") val parts = normalizeStudentName().split(" ")
val endParts = parts.filterIndexed { i, _ -> val endParts = parts.filterIndexed { i, _ ->
i == 0 || parts.size == i - 1 i == 0 || parts.size - 1 == i
} }
return endParts.joinToString(" ") return endParts.joinToString(" ")
} }

View File

@ -8,7 +8,6 @@ import io.github.wulkanowy.data.db.entities.Student
import io.github.wulkanowy.data.pojos.GroupNotificationData import io.github.wulkanowy.data.pojos.GroupNotificationData
import io.github.wulkanowy.data.pojos.NotificationData import io.github.wulkanowy.data.pojos.NotificationData
import io.github.wulkanowy.ui.modules.Destination import io.github.wulkanowy.ui.modules.Destination
import io.github.wulkanowy.ui.modules.splash.SplashActivity
import io.github.wulkanowy.utils.descriptionRes import io.github.wulkanowy.utils.descriptionRes
import io.github.wulkanowy.utils.getPlural import io.github.wulkanowy.utils.getPlural
import io.github.wulkanowy.utils.toFormattedString import io.github.wulkanowy.utils.toFormattedString
@ -22,8 +21,9 @@ class NewAttendanceNotification @Inject constructor(
suspend fun notify(items: List<Attendance>, student: Student) { suspend fun notify(items: List<Attendance>, student: Student) {
val lines = items.filterNot { it.presence || it.name == "UNKNOWN" } val lines = items.filterNot { it.presence || it.name == "UNKNOWN" }
.map { .map {
val lesson = it.subject.ifBlank { "Lekcja ${it.number}" }
val description = context.getString(it.descriptionRes) val description = context.getString(it.descriptionRes)
"${it.date.toFormattedString("dd.MM")} - ${it.subject}: $description" "${it.date.toFormattedString("dd.MM")} - $lesson: $description"
} }
.ifEmpty { return } .ifEmpty { return }

View File

@ -1,6 +1,7 @@
Wersja 1.7.4 Wersja 1.7.5
- naprawiliśmy kilka błędów w obsłudze nowego modułu wiadomości - naprawiliśmy kilka błędów w obsłudze nowego modułu wiadomości
- naprawiliśmy wyświetlanie napisu "Brak ocen", jesli uczeń nie zdobył w danym semestrze jeszcze żadnych ocen - naprawiliśmy wyświetlanie napisu "Brak ocen", jesli uczeń nie zdobył w danym semestrze jeszcze żadnych ocen
- naprawiliśmy logowanie do aplikacji rodzicom będącym jednocześnie nauczycielami
Pełna lista zmian: https://github.com/wulkanowy/wulkanowy/releases Pełna lista zmian: https://github.com/wulkanowy/wulkanowy/releases

View File

@ -91,6 +91,20 @@ class MailboxRepositoryTest {
assertEquals(expectedMailbox, systemUnderTest.getMailbox(student)) assertEquals(expectedMailbox, systemUnderTest.getMailbox(student))
} }
@Test
fun `get mailbox for unique non-authorized student but with spaces`() = runTest {
val student = getStudentEntity(
userName = "Stanisław Kowalski",
studentName = "J** K*******",
)
val expectedMailbox = getMailboxEntity("Jan Kowalski")
coEvery { mailboxDao.loadAll(any()) } returns listOf(
expectedMailbox,
)
assertEquals(expectedMailbox, systemUnderTest.getMailbox(student))
}
@Test(expected = IllegalArgumentException::class) @Test(expected = IllegalArgumentException::class)
fun `get mailbox for not-unique non-authorized student`() = runTest { fun `get mailbox for not-unique non-authorized student`() = runTest {
val student = getStudentEntity( val student = getStudentEntity(