From 6ded83d1327ce7a0ddb5b3be0e90f0c4c776b790 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Pich?= Date: Thu, 3 Sep 2020 20:52:24 +0200 Subject: [PATCH 1/4] Fix attendance item description (#943) --- .../ui/modules/attendance/AttendanceAdapter.kt | 3 ++- .../ui/modules/attendance/AttendanceDialog.kt | 3 ++- .../wulkanowy/utils/AttendanceExtension.kt | 16 +++++++++++++++- app/src/main/res/values-pl/strings.xml | 2 ++ app/src/main/res/values/strings.xml | 2 ++ 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceAdapter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceAdapter.kt index a63d5045a..8e8a6149d 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceAdapter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceAdapter.kt @@ -9,6 +9,7 @@ import io.github.wulkanowy.R import io.github.wulkanowy.data.db.entities.Attendance import io.github.wulkanowy.data.repositories.attendance.SentExcuseStatus import io.github.wulkanowy.databinding.ItemAttendanceBinding +import io.github.wulkanowy.utils.description import javax.inject.Inject class AttendanceAdapter @Inject constructor() : @@ -34,7 +35,7 @@ class AttendanceAdapter @Inject constructor() : with(holder.binding) { attendanceItemNumber.text = item.number.toString() attendanceItemSubject.text = item.subject - attendanceItemDescription.text = item.name + attendanceItemDescription.setText(item.description) attendanceItemAlert.visibility = item.run { if (absence && !excused) View.VISIBLE else View.INVISIBLE } attendanceItemNumber.visibility = View.GONE attendanceItemExcuseInfo.visibility = View.GONE diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceDialog.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceDialog.kt index 97b76e812..d5e2fe122 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceDialog.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceDialog.kt @@ -7,6 +7,7 @@ import android.view.ViewGroup import androidx.fragment.app.DialogFragment import io.github.wulkanowy.data.db.entities.Attendance import io.github.wulkanowy.databinding.DialogAttendanceBinding +import io.github.wulkanowy.utils.description import io.github.wulkanowy.utils.lifecycleAwareVariable import io.github.wulkanowy.utils.toFormattedString @@ -43,7 +44,7 @@ class AttendanceDialog : DialogFragment() { with(binding) { attendanceDialogSubject.text = attendance.subject - attendanceDialogDescription.text = attendance.name + attendanceDialogDescription.setText(attendance.description) attendanceDialogDate.text = attendance.date.toFormattedString() attendanceDialogNumber.text = attendance.number.toString() attendanceDialogClose.setOnClickListener { dismiss() } diff --git a/app/src/main/java/io/github/wulkanowy/utils/AttendanceExtension.kt b/app/src/main/java/io/github/wulkanowy/utils/AttendanceExtension.kt index c2b1efaa8..92e8661fe 100644 --- a/app/src/main/java/io/github/wulkanowy/utils/AttendanceExtension.kt +++ b/app/src/main/java/io/github/wulkanowy/utils/AttendanceExtension.kt @@ -1,6 +1,9 @@ package io.github.wulkanowy.utils +import io.github.wulkanowy.R +import io.github.wulkanowy.data.db.entities.Attendance import io.github.wulkanowy.data.db.entities.AttendanceSummary +import io.github.wulkanowy.sdk.scrapper.attendance.AttendanceCategory /** * [UONET+ - Zasady tworzenia podsumowań liczb uczniów obecnych i nieobecnych w tabeli frekwencji] @@ -23,4 +26,15 @@ private fun calculatePercentage(presence: Double, absence: Double): Double { return if ((presence + absence) == 0.0) 0.0 else (presence / (presence + absence)) * 100 } - +inline val Attendance.description + get() = when (AttendanceCategory.valueOf(name)) { + AttendanceCategory.PRESENCE -> R.string.attendance_present + AttendanceCategory.ABSENCE_UNEXCUSED -> R.string.attendance_absence_unexcused + AttendanceCategory.ABSENCE_EXCUSED -> R.string.attendance_absence_excused + AttendanceCategory.UNEXCUSED_LATENESS -> R.string.attendance_unexcused_lateness + AttendanceCategory.EXCUSED_LATENESS -> R.string.attendance_excused_lateness + AttendanceCategory.ABSENCE_FOR_SCHOOL_REASONS -> R.string.attendance_absence_school + AttendanceCategory.EXEMPTION -> R.string.attendance_exemption + AttendanceCategory.DELETED -> R.string.attendance_deleted + else -> R.string.attendance_unknown + } diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index e4d3e9029..ebc145423 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -168,6 +168,8 @@ Spóźnienie usprawiedliwione Spóźnienie nieusprawiedliwione Obecność + Usunięty + Nieznany Numer lekcji Brak wpisów diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 1eaebf284..963c70478 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -170,6 +170,8 @@ Excused lateness Unexcused lateness Present + Deleted + Unknown Number of lesson No entries From 18b9bf42e115ebf24885e6a4e4cb2e73c7e562ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Pich?= Date: Thu, 3 Sep 2020 20:54:28 +0200 Subject: [PATCH 2/4] Fix crash in flowWithResourceIn() (#944) --- app/src/main/java/io/github/wulkanowy/ui/base/BasePresenter.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/github/wulkanowy/ui/base/BasePresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/base/BasePresenter.kt index aec524259..ba8bfd85f 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/base/BasePresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/base/BasePresenter.kt @@ -7,6 +7,7 @@ import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Job import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.catch import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach import timber.log.Timber @@ -63,7 +64,7 @@ open class BasePresenter( fun Flow.launch(individualJobTag: String = "load"): Job { jobs[individualJobTag]?.cancel() - val job = launchIn(this@BasePresenter) + val job = catch { errorHandler.dispatch(it) }.launchIn(this@BasePresenter) jobs[individualJobTag] = job Timber.d("Job $individualJobTag launched in ${this@BasePresenter.javaClass.simpleName}: $job") return job From debb21f5f9945502ddf470c09aecd96ec05f8594 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Pich?= Date: Thu, 3 Sep 2020 21:10:39 +0200 Subject: [PATCH 3/4] Add full stacktrace to errors list in sync now (#945) --- .../java/io/github/wulkanowy/services/sync/SyncWorker.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/github/wulkanowy/services/sync/SyncWorker.kt b/app/src/main/java/io/github/wulkanowy/services/sync/SyncWorker.kt index 2ba0435b4..13326ca06 100644 --- a/app/src/main/java/io/github/wulkanowy/services/sync/SyncWorker.kt +++ b/app/src/main/java/io/github/wulkanowy/services/sync/SyncWorker.kt @@ -50,13 +50,16 @@ class SyncWorker @WorkerInject constructor( } catch (e: Throwable) { Timber.w("${work::class.java.simpleName} result: An exception ${e.message} occurred") if (e is FeatureDisabledException || e is FeatureNotAvailableException) null - else e + else { + Timber.e(e) + e + } } } val result = when { exceptions.isNotEmpty() && inputData.getBoolean("one_time", false) -> { Result.failure(Data.Builder() - .putString("error", exceptions.toString()) + .putString("error", exceptions.map { it.stackTraceToString() }.toString()) .build() ) } From 9a7c04fe7b590f1661b0c25387d6b4a5f9f7f71e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Pich?= Date: Fri, 4 Sep 2020 23:42:01 +0200 Subject: [PATCH 4/4] Version 0.20.3 --- .travis.yml | 2 +- app/build.gradle | 6 +++--- app/src/main/play/release-notes/pl-PL/default.txt | 7 ++----- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 688dd0006..1c1038b82 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,7 @@ cache: branches: only: - develop - - 0.20.2 + - 0.20.3 android: licenses: diff --git a/app/build.gradle b/app/build.gradle index b046834a6..2d608f973 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -18,8 +18,8 @@ android { testApplicationId "io.github.tests.wulkanowy" minSdkVersion 17 targetSdkVersion 29 - versionCode 66 - versionName "0.20.2" + versionCode 67 + versionName "0.20.3" multiDexEnabled true resValue "string", "app_name", "Wulkanowy" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" @@ -126,7 +126,7 @@ configurations.all { } dependencies { - implementation "io.github.wulkanowy:sdk:0.20.2" + implementation "io.github.wulkanowy:sdk:0.20.3" coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.10' diff --git a/app/src/main/play/release-notes/pl-PL/default.txt b/app/src/main/play/release-notes/pl-PL/default.txt index d0e2c8233..47df9980f 100644 --- a/app/src/main/play/release-notes/pl-PL/default.txt +++ b/app/src/main/play/release-notes/pl-PL/default.txt @@ -1,7 +1,4 @@ -Wersja 0.20.2 -- naprawiliśmy powiadomienie o szczęśliwym numerku -- naprawiliśmy przełączanie na nowy rok szkolny -- naprawiliśmy funkcję resetowania hasła -- dodaliśmy dziennik e-Skarżysko +Wersja 0.20.3 +- naprawiliśmy opisy wpisów frekwencyjnych, które teraz będą już w całości po polsku Pełna lista zmian: https://github.com/wulkanowy/wulkanowy/releases