From b47f26684b03c37a58564416d3694d3406ed62e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Pich?= Date: Mon, 6 Sep 2021 03:27:54 +0200 Subject: [PATCH 01/15] Change AppGallery deploy format to aab (#1483) --- .github/workflows/deploy-store.yml | 2 +- app/build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-store.yml b/.github/workflows/deploy-store.yml index e7ed6b49a..8015ef640 100644 --- a/.github/workflows/deploy-store.yml +++ b/.github/workflows/deploy-store.yml @@ -71,4 +71,4 @@ jobs: PLAY_KEY_ALIAS: ${{ secrets.PLAY_KEY_ALIAS }} PLAY_KEY_PASSWORD: ${{ secrets.PLAY_KEY_PASSWORD }} PLAY_STORE_PASSWORD: ${{ secrets.PLAY_STORE_PASSWORD }} - run: ./gradlew assembleHmsRelease --stacktrace && ./gradlew publishHuaweiAppGalleryHmsRelease --stacktrace + run: ./gradlew bundleHmsRelease --stacktrace && ./gradlew publishHuaweiAppGalleryHmsRelease --stacktrace diff --git a/app/build.gradle b/app/build.gradle index 695dc6399..2b0f01514 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -141,7 +141,7 @@ huaweiPublish { instances { hmsRelease { credentialsPath = "$rootDir/app/src/release/agconnect-credentials.json" - buildFormat = "apk" + buildFormat = "aab" deployType = "draft" } } From f5e9197f98c5952d71de02fd83da226262eb049f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Sep 2021 23:38:10 +0000 Subject: [PATCH 02/15] Bump work_manager from 2.5.0 to 2.6.0 (#1478) --- app/build.gradle | 2 +- app/src/main/AndroidManifest.xml | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 2b0f01514..dac488b23 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -148,7 +148,7 @@ huaweiPublish { } ext { - work_manager = "2.5.0" + work_manager = "2.6.0" android_hilt = "1.0.0" room = "2.3.0" chucker = "3.5.2" diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index a331c41f6..ad5adaf2e 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -119,11 +119,9 @@ - Date: Wed, 8 Sep 2021 09:13:52 +0200 Subject: [PATCH 03/15] Update material chips input (#1495) --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index dac488b23..d1975e1ab 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -177,7 +177,7 @@ dependencies { implementation "androidx.constraintlayout:constraintlayout:2.1.0" implementation "androidx.coordinatorlayout:coordinatorlayout:1.1.0" implementation "com.google.android.material:material:1.4.0" - implementation "com.github.wulkanowy:material-chips-input:2.2.0" + implementation "com.github.wulkanowy:material-chips-input:2.3.1" implementation "com.github.PhilJay:MPAndroidChart:v3.1.0" implementation 'com.github.lopspower:CircularImageView:4.2.0' From 16a5d88dfb39179565b12642c9f9f4a79a761d21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Borcz?= Date: Fri, 10 Sep 2021 00:25:23 +0200 Subject: [PATCH 04/15] Fix overlapping shadow in dashboard (#1494) --- .../ui/modules/dashboard/DashboardAdapter.kt | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/dashboard/DashboardAdapter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/dashboard/DashboardAdapter.kt index 56503d027..8c03e3644 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/dashboard/DashboardAdapter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/dashboard/DashboardAdapter.kt @@ -170,6 +170,8 @@ class DashboardAdapter @Inject constructor() : RecyclerView.Adapter { context.getThemeAttrColor(R.attr.colorOnSurface) @@ -199,13 +201,12 @@ class DashboardAdapter @Inject constructor() : RecyclerView.Adapter { @@ -220,7 +221,8 @@ class DashboardAdapter @Inject constructor() : RecyclerView.Adapter { matchConstraintPercentWidth = when { luckyNumber == null && unreadMessagesCount == null -> 1.0f @@ -232,7 +234,8 @@ class DashboardAdapter @Inject constructor() : RecyclerView.Adapter Date: Fri, 10 Sep 2021 00:27:48 +0200 Subject: [PATCH 05/15] Fix NPE in timetable dashboard tile (#1498) --- .../wulkanowy/ui/modules/dashboard/DashboardAdapter.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/dashboard/DashboardAdapter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/dashboard/DashboardAdapter.kt index 8c03e3644..0eda49326 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/dashboard/DashboardAdapter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/dashboard/DashboardAdapter.kt @@ -31,6 +31,7 @@ import io.github.wulkanowy.utils.getThemeAttrColor import io.github.wulkanowy.utils.left import io.github.wulkanowy.utils.nickOrName import io.github.wulkanowy.utils.toFormattedString +import timber.log.Timber import java.time.Duration import java.time.LocalDate import java.time.LocalDateTime @@ -429,7 +430,10 @@ class DashboardAdapter @Inject constructor() : RecyclerView.Adapter Date: Fri, 10 Sep 2021 00:36:44 +0200 Subject: [PATCH 06/15] Fix overlapping error view (#1493) --- .../wulkanowy/ui/modules/attendance/AttendancePresenter.kt | 1 + .../wulkanowy/ui/modules/message/tab/MessageTabPresenter.kt | 1 + .../ui/modules/schoolannouncement/SchoolAnnouncementPresenter.kt | 1 + .../github/wulkanowy/ui/modules/timetable/TimetablePresenter.kt | 1 + 4 files changed, 4 insertions(+) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendancePresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendancePresenter.kt index 9a1598128..fc37e50de 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendancePresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendancePresenter.kt @@ -234,6 +234,7 @@ class AttendancePresenter @Inject constructor( enableSwipe(true) showRefresh(true) showProgress(false) + showErrorView(false) showEmpty(filteredAttendance.isEmpty()) showContent(filteredAttendance.isNotEmpty()) updateData(filteredAttendance.sortedBy { item -> item.number }) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/message/tab/MessageTabPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/message/tab/MessageTabPresenter.kt index 3e5e09b48..a24f9b79f 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/message/tab/MessageTabPresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/message/tab/MessageTabPresenter.kt @@ -117,6 +117,7 @@ class MessageTabPresenter @Inject constructor( if (!it.data.isNullOrEmpty()) { view?.run { enableSwipe(true) + showErrorView(false) showRefresh(true) showProgress(false) showContent(true) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/schoolannouncement/SchoolAnnouncementPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/schoolannouncement/SchoolAnnouncementPresenter.kt index 88ad81465..d6a32e3cc 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/schoolannouncement/SchoolAnnouncementPresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/schoolannouncement/SchoolAnnouncementPresenter.kt @@ -64,6 +64,7 @@ class SchoolAnnouncementPresenter @Inject constructor( view?.run { enableSwipe(true) showRefresh(true) + showErrorView(false) showProgress(false) showContent(true) updateData(it.data) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetablePresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetablePresenter.kt index fa1bbfb28..86e993982 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetablePresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetablePresenter.kt @@ -149,6 +149,7 @@ class TimetablePresenter @Inject constructor( view?.run { enableSwipe(true) showRefresh(true) + showErrorView(false) showProgress(false) showContent(true) updateData(it.data!!.lessons) From e665a8f18b9a0bfea8629636b8501140912e1a42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Borcz?= Date: Fri, 10 Sep 2021 00:48:29 +0200 Subject: [PATCH 07/15] Fix error view in attendance summary (#1492) --- .../attendance/summary/AttendanceSummaryPresenter.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryPresenter.kt index e53cda749..8b603837b 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryPresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryPresenter.kt @@ -82,7 +82,13 @@ class AttendanceSummaryPresenter @Inject constructor( flowWithResourceIn { val student = studentRepository.getCurrentStudent() val semester = semesterRepository.getCurrentSemester(student) - attendanceSummaryRepository.getAttendanceSummary(student, semester, subjectId, forceRefresh) + + attendanceSummaryRepository.getAttendanceSummary( + student = student, + semester = semester, + subjectId = subjectId, + forceRefresh = forceRefresh + ) }.onEach { when (it.status) { Status.LOADING -> { @@ -92,6 +98,7 @@ class AttendanceSummaryPresenter @Inject constructor( showRefresh(true) showProgress(false) showContent(true) + showErrorView(false) updateDataSet(sortItems(it.data)) } } @@ -99,6 +106,7 @@ class AttendanceSummaryPresenter @Inject constructor( Status.SUCCESS -> { Timber.i("Loading attendance summary result: Success") view?.apply { + showErrorView(false) showEmpty(it.data!!.isEmpty()) showContent(it.data.isNotEmpty()) updateDataSet(sortItems(it.data)) From 8528e0beff83ea39c678005879ffef77294d8451 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Borcz?= Date: Fri, 10 Sep 2021 11:49:22 +0200 Subject: [PATCH 08/15] Fix crash in school info when dialer is unavailable (#1500) --- .../main/java/io/github/wulkanowy/utils/ContextExtension.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/github/wulkanowy/utils/ContextExtension.kt b/app/src/main/java/io/github/wulkanowy/utils/ContextExtension.kt index 68d3afe83..2cd4459eb 100644 --- a/app/src/main/java/io/github/wulkanowy/utils/ContextExtension.kt +++ b/app/src/main/java/io/github/wulkanowy/utils/ContextExtension.kt @@ -102,7 +102,9 @@ fun Context.openNavigation(location: String) { fun Context.openDialer(phone: String) { val intentUri = Uri.parse("tel:$phone") val intent = Intent(Intent.ACTION_DIAL, intentUri) - startActivity(intent) + if (intent.resolveActivity(packageManager) != null) { + startActivity(intent) + } } fun Context.shareText(text: String, subject: String?) { From 0389642543f909a4fab31bbf6bf00b9d847bbdc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Borcz?= Date: Sat, 11 Sep 2021 19:40:09 +0200 Subject: [PATCH 09/15] Fix empty list on excuse submit (#1501) --- .../wulkanowy/ui/modules/attendance/AttendancePresenter.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendancePresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendancePresenter.kt index fc37e50de..03545b25b 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendancePresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendancePresenter.kt @@ -152,6 +152,8 @@ class AttendancePresenter @Inject constructor( fun onExcuseDialogSubmit(reason: String) { view?.finishActionMode() + if (attendanceToExcuseList.isEmpty()) return + if (isVulcanExcusedFunctionEnabled) { excuseAbsence( reason = reason.takeIf { it.isNotBlank() }, From 91f631089273c98eed453e581c2bc12cdacf3b77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Borcz?= Date: Sat, 11 Sep 2021 19:43:05 +0200 Subject: [PATCH 10/15] Restore lucky number in more view (#1504) --- .../io/github/wulkanowy/ui/modules/more/MoreFragment.kt | 8 ++++++++ .../io/github/wulkanowy/ui/modules/more/MorePresenter.kt | 2 ++ .../java/io/github/wulkanowy/ui/modules/more/MoreView.kt | 4 ++++ 3 files changed, 14 insertions(+) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/more/MoreFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/more/MoreFragment.kt index 2f0957c46..145b12a35 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/more/MoreFragment.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/more/MoreFragment.kt @@ -11,6 +11,7 @@ import io.github.wulkanowy.ui.base.BaseFragment import io.github.wulkanowy.ui.modules.conference.ConferenceFragment import io.github.wulkanowy.ui.modules.exam.ExamFragment import io.github.wulkanowy.ui.modules.homework.HomeworkFragment +import io.github.wulkanowy.ui.modules.luckynumber.LuckyNumberFragment import io.github.wulkanowy.ui.modules.main.MainActivity import io.github.wulkanowy.ui.modules.main.MainView import io.github.wulkanowy.ui.modules.message.MessageFragment @@ -66,6 +67,9 @@ class MoreFragment : BaseFragment(R.layout.fragment_more), override val examRes: Pair? get() = context?.run { getString(R.string.exam_title) to getCompatDrawable(R.drawable.ic_main_exam) } + override val luckyNumberRes: Pair? + get() = context?.run { getString(R.string.lucky_number_title) to getCompatDrawable(R.drawable.ic_more_lucky_number) } + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) binding = FragmentMoreBinding.bind(view) @@ -128,6 +132,10 @@ class MoreFragment : BaseFragment(R.layout.fragment_more), (activity as? MainActivity)?.pushView(ExamFragment.newInstance()) } + override fun openLuckyNumberView() { + (activity as? MainActivity)?.pushView(LuckyNumberFragment.newInstance()) + } + override fun popView(depth: Int) { (activity as? MainActivity)?.popView(depth) } diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/more/MorePresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/more/MorePresenter.kt index a2b7f204e..92551d6e9 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/more/MorePresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/more/MorePresenter.kt @@ -31,6 +31,7 @@ class MorePresenter @Inject constructor( schoolAndTeachersRes?.first -> openSchoolAndTeachersView() mobileDevicesRes?.first -> openMobileDevicesView() settingsRes?.first -> openSettingsView() + luckyNumberRes?.first -> openLuckyNumberView() } } } @@ -48,6 +49,7 @@ class MorePresenter @Inject constructor( examRes, homeworkRes, noteRes, + luckyNumberRes, conferencesRes, schoolAnnouncementRes, schoolAndTeachersRes, diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/more/MoreView.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/more/MoreView.kt index c4a07bdcc..cb895de28 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/more/MoreView.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/more/MoreView.kt @@ -23,6 +23,8 @@ interface MoreView : BaseView { val examRes: Pair? + val luckyNumberRes: Pair? + fun initView() fun updateData(data: List>) @@ -46,4 +48,6 @@ interface MoreView : BaseView { fun openMobileDevicesView() fun openExamView() + + fun openLuckyNumberView() } From dddeff802ffd348958cebf6508ff0eb13ffd829b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Borcz?= Date: Sun, 12 Sep 2021 17:29:46 +0200 Subject: [PATCH 11/15] Fix date picker crash after saved state (#1502) --- .../wulkanowy/ui/modules/attendance/AttendanceFragment.kt | 4 +++- .../modules/luckynumber/history/LuckyNumberHistoryFragment.kt | 4 +++- .../wulkanowy/ui/modules/timetable/TimetableFragment.kt | 4 +++- .../modules/timetable/additional/AdditionalLessonsFragment.kt | 4 +++- .../modules/timetable/completed/CompletedLessonsFragment.kt | 4 +++- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceFragment.kt index 058946796..3fbdaec5a 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceFragment.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendanceFragment.kt @@ -245,7 +245,9 @@ class AttendanceFragment : BaseFragment(R.layout.frag presenter.onDateSet(date.year, date.monthValue, date.dayOfMonth) } - datePicker.show(this@AttendanceFragment.parentFragmentManager, null) + if (!parentFragmentManager.isStateSaved) { + datePicker.show(parentFragmentManager, null) + } } override fun showExcuseDialog() { diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/luckynumber/history/LuckyNumberHistoryFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/luckynumber/history/LuckyNumberHistoryFragment.kt index dc141f8d3..3a84b2dd5 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/luckynumber/history/LuckyNumberHistoryFragment.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/luckynumber/history/LuckyNumberHistoryFragment.kt @@ -131,7 +131,9 @@ class LuckyNumberHistoryFragment : presenter.onDateSet(date.year, date.monthValue, date.dayOfMonth) } - datePicker.show(this@LuckyNumberHistoryFragment.parentFragmentManager, null) + if (!parentFragmentManager.isStateSaved) { + datePicker.show(parentFragmentManager, null) + } } override fun showContent(show: Boolean) { diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableFragment.kt index 1e1084a8d..83218a0da 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableFragment.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableFragment.kt @@ -202,7 +202,9 @@ class TimetableFragment : BaseFragment(R.layout.fragme presenter.onDateSet(date.year, date.monthValue, date.dayOfMonth) } - datePicker.show(this@TimetableFragment.parentFragmentManager, null) + if (!parentFragmentManager.isStateSaved) { + datePicker.show(parentFragmentManager, null) + } } override fun openAdditionalLessonsView() { diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/additional/AdditionalLessonsFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/additional/AdditionalLessonsFragment.kt index a4e1f0fc0..47bee1e39 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/additional/AdditionalLessonsFragment.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/additional/AdditionalLessonsFragment.kt @@ -152,7 +152,9 @@ class AdditionalLessonsFragment : presenter.onDateSet(date.year, date.monthValue, date.dayOfMonth) } - datePicker.show(this@AdditionalLessonsFragment.parentFragmentManager, null) + if (!parentFragmentManager.isStateSaved) { + datePicker.show(parentFragmentManager, null) + } } override fun onSaveInstanceState(outState: Bundle) { diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/completed/CompletedLessonsFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/completed/CompletedLessonsFragment.kt index ad698c1cf..b8da1c0fd 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/completed/CompletedLessonsFragment.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/completed/CompletedLessonsFragment.kt @@ -173,7 +173,9 @@ class CompletedLessonsFragment : presenter.onDateSet(date.year, date.monthValue, date.dayOfMonth) } - datePicker.show(this@CompletedLessonsFragment.parentFragmentManager, null) + if (!parentFragmentManager.isStateSaved) { + datePicker.show(parentFragmentManager, null) + } } override fun onSaveInstanceState(outState: Bundle) { From 5a7f52c773aad5aba85b5086a78e5cd458ad7732 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Pich?= Date: Mon, 13 Sep 2021 14:19:24 +0200 Subject: [PATCH 12/15] Update help email pre-filled content (#1507) --- app/src/main/res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index cf8a07604..295d83193 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -69,7 +69,7 @@ Discord Send email Zgłoszenie: Problemy z logowaniem - Informacje o aplikacji:\n\nUrządzenie: %1$s\nWersja SDK: %2$s\nWersja aplikacji: %3$s\nDodatkowe informacje: %4$s\nOstatni błąd: %5$s\n\nOpis problemu: + Informacje o aplikacji:\n\nUrządzenie: %1$s\nWersja SDK: %2$s\nWersja aplikacji: %3$s\nDodatkowe informacje: %4$s\nOstatni błąd: %5$s\n\nOpis problemu (pełna nazwa szkoły, klasa ucznia): Make sure you select the correct UONET+ register variation! I forgot my password Recover your account From 19c96ee83ff7f6e5685ec41543c6f5d2460eb890 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Pich?= Date: Mon, 13 Sep 2021 14:19:46 +0200 Subject: [PATCH 13/15] Unlock sunday in navigation datepicker (#1506) --- .../java/io/github/wulkanowy/utils/SchooldaysValidator.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/io/github/wulkanowy/utils/SchooldaysValidator.kt b/app/src/main/java/io/github/wulkanowy/utils/SchooldaysValidator.kt index 00fccfc8d..b6dd528f5 100644 --- a/app/src/main/java/io/github/wulkanowy/utils/SchooldaysValidator.kt +++ b/app/src/main/java/io/github/wulkanowy/utils/SchooldaysValidator.kt @@ -2,7 +2,6 @@ package io.github.wulkanowy.utils import com.google.android.material.datepicker.CalendarConstraints import kotlinx.parcelize.Parcelize -import java.time.DayOfWeek import java.time.temporal.ChronoUnit @Parcelize @@ -12,7 +11,6 @@ class SchoolDaysValidator(val start: Long, val end: Long) : CalendarConstraints. val date = dateLong.toLocalDateTime() return date.until(end.toLocalDateTime(), ChronoUnit.DAYS) >= 0 && - date.until(start.toLocalDateTime(), ChronoUnit.DAYS) <= 0 && - date.dayOfWeek != DayOfWeek.SUNDAY + date.until(start.toLocalDateTime(), ChronoUnit.DAYS) <= 0 } -} \ No newline at end of file +} From 827fb33eeb382ceb0ddaa6d54807cb48a455c471 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Borcz?= Date: Mon, 13 Sep 2021 14:36:31 +0200 Subject: [PATCH 14/15] Fix login process after was interrupted (#1505) --- .../wulkanowy/data/db/dao/StudentDao.kt | 26 ++++---- .../data/repositories/StudentRepository.kt | 24 +++++--- .../modules/login/form/LoginFormPresenter.kt | 8 +-- .../LoginStudentSelectPresenter.kt | 60 ++++++++++--------- .../data/repositories/StudentTest.kt | 3 +- .../LoginStudentSelectPresenterTest.kt | 31 +++------- 6 files changed, 76 insertions(+), 76 deletions(-) diff --git a/app/src/main/java/io/github/wulkanowy/data/db/dao/StudentDao.kt b/app/src/main/java/io/github/wulkanowy/data/db/dao/StudentDao.kt index 0ad2ee590..3dda8a44b 100644 --- a/app/src/main/java/io/github/wulkanowy/data/db/dao/StudentDao.kt +++ b/app/src/main/java/io/github/wulkanowy/data/db/dao/StudentDao.kt @@ -14,33 +14,39 @@ import javax.inject.Singleton @Singleton @Dao -interface StudentDao { +abstract class StudentDao { @Insert(onConflict = ABORT) - suspend fun insertAll(student: List): List + abstract suspend fun insertAll(student: List): List @Delete - suspend fun delete(student: Student) + abstract suspend fun delete(student: Student) @Update(entity = Student::class) - suspend fun update(studentNickAndAvatar: StudentNickAndAvatar) + abstract suspend fun update(studentNickAndAvatar: StudentNickAndAvatar) @Query("SELECT * FROM Students WHERE is_current = 1") - suspend fun loadCurrent(): Student? + abstract suspend fun loadCurrent(): Student? @Query("SELECT * FROM Students WHERE id = :id") - suspend fun loadById(id: Long): Student? + abstract suspend fun loadById(id: Long): Student? @Query("SELECT * FROM Students") - suspend fun loadAll(): List + abstract suspend fun loadAll(): List @Transaction @Query("SELECT * FROM Students") - suspend fun loadStudentsWithSemesters(): List + abstract suspend fun loadStudentsWithSemesters(): List @Query("UPDATE Students SET is_current = 1 WHERE id = :id") - suspend fun updateCurrent(id: Long) + abstract suspend fun updateCurrent(id: Long) @Query("UPDATE Students SET is_current = 0") - suspend fun resetCurrent() + abstract suspend fun resetCurrent() + + @Transaction + open suspend fun switchCurrent(id: Long) { + resetCurrent() + updateCurrent(id) + } } diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/StudentRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/StudentRepository.kt index c2f364b3d..2ac892d01 100644 --- a/app/src/main/java/io/github/wulkanowy/data/repositories/StudentRepository.kt +++ b/app/src/main/java/io/github/wulkanowy/data/repositories/StudentRepository.kt @@ -1,7 +1,9 @@ package io.github.wulkanowy.data.repositories import android.content.Context +import androidx.room.withTransaction import dagger.hilt.android.qualifiers.ApplicationContext +import io.github.wulkanowy.data.db.AppDatabase import io.github.wulkanowy.data.db.dao.SemesterDao import io.github.wulkanowy.data.db.dao.StudentDao import io.github.wulkanowy.data.db.entities.Student @@ -25,7 +27,8 @@ class StudentRepository @Inject constructor( private val studentDb: StudentDao, private val semesterDb: SemesterDao, private val sdk: Sdk, - private val appInfo: AppInfo + private val appInfo: AppInfo, + private val appDatabase: AppDatabase ) { suspend fun isStudentSaved() = getSavedStudents(false).isNotEmpty() @@ -92,7 +95,7 @@ class StudentRepository @Inject constructor( return student } - suspend fun saveStudents(studentsWithSemesters: List): List { + suspend fun saveStudents(studentsWithSemesters: List) { val semesters = studentsWithSemesters.flatMap { it.semesters } val students = studentsWithSemesters.map { it.student } .map { @@ -104,16 +107,21 @@ class StudentRepository @Inject constructor( } } } + .mapIndexed { index, student -> + if (index == 0) { + student.copy(isCurrent = true).apply { avatarColor = student.avatarColor } + } else student + } - semesterDb.insertSemesters(semesters) - return studentDb.insertAll(students) + appDatabase.withTransaction { + studentDb.resetCurrent() + semesterDb.insertSemesters(semesters) + studentDb.insertAll(students) + } } suspend fun switchStudent(studentWithSemesters: StudentWithSemesters) { - with(studentDb) { - resetCurrent() - updateCurrent(studentWithSemesters.student.id) - } + studentDb.switchCurrent(studentWithSemesters.student.id) } suspend fun logoutStudent(student: Student) = studentDb.delete(student) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/login/form/LoginFormPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/login/form/LoginFormPresenter.kt index 99dcf1bb3..d79c422d4 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/login/form/LoginFormPresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/login/form/LoginFormPresenter.kt @@ -90,10 +90,10 @@ class LoginFormPresenter @Inject constructor( flowWithResource { studentRepository.getStudentsScrapper( - email, - password, - host, - symbol + email = email, + password = password, + scrapperBaseUrl = host, + symbol = symbol ) }.onEach { when (it.status) { diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/login/studentselect/LoginStudentSelectPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/login/studentselect/LoginStudentSelectPresenter.kt index c344bf441..f0f5586cc 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/login/studentselect/LoginStudentSelectPresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/login/studentselect/LoginStudentSelectPresenter.kt @@ -78,7 +78,9 @@ class LoginStudentSelectPresenter @Inject constructor( when (it.status) { Status.LOADING -> Timber.d("Login student select students load started") Status.SUCCESS -> view?.updateData(studentsWithSemesters.map { studentWithSemesters -> - studentWithSemesters to it.data!!.any { item -> compareStudents(studentWithSemesters.student, item.student) } + studentWithSemesters to it.data!!.any { item -> + compareStudents(studentWithSemesters.student, item.student) + } }) Status.ERROR -> { errorHandler.dispatch(it.error!!) @@ -95,35 +97,32 @@ class LoginStudentSelectPresenter @Inject constructor( } private fun registerStudents(studentsWithSemesters: List) { - flowWithResource { - val savedStudents = studentRepository.saveStudents(studentsWithSemesters) - val firstRegistered = studentsWithSemesters.first().apply { student.id = savedStudents.first() } - studentRepository.switchStudent(firstRegistered) - }.onEach { - when (it.status) { - Status.LOADING -> view?.run { - Timber.i("Registration started") - showProgress(true) - showContent(false) - } - Status.SUCCESS -> { - Timber.i("Registration result: Success") - view?.openMainView() - logRegisterEvent(studentsWithSemesters) - } - Status.ERROR -> { - Timber.i("Registration result: An exception occurred ") - view?.apply { - showProgress(false) - showContent(true) - showContact(true) + flowWithResource { studentRepository.saveStudents(studentsWithSemesters) } + .onEach { + when (it.status) { + Status.LOADING -> view?.run { + Timber.i("Registration started") + showProgress(true) + showContent(false) + } + Status.SUCCESS -> { + Timber.i("Registration result: Success") + view?.openMainView() + logRegisterEvent(studentsWithSemesters) + } + Status.ERROR -> { + Timber.i("Registration result: An exception occurred ") + view?.apply { + showProgress(false) + showContent(true) + showContact(true) + } + lastError = it.error + loginErrorHandler.dispatch(it.error!!) + logRegisterEvent(studentsWithSemesters, it.error) } - lastError = it.error - loginErrorHandler.dispatch(it.error!!) - logRegisterEvent(studentsWithSemesters, it.error) } - } - }.launch("register") + }.launch("register") } fun onDiscordClick() { @@ -134,7 +133,10 @@ class LoginStudentSelectPresenter @Inject constructor( view?.openEmail(lastError?.message.ifNullOrBlank { "empty" }) } - private fun logRegisterEvent(studentsWithSemesters: List, error: Throwable? = null) { + private fun logRegisterEvent( + studentsWithSemesters: List, + error: Throwable? = null + ) { studentsWithSemesters.forEach { student -> analytics.logEvent( "registration_student_select", diff --git a/app/src/test/java/io/github/wulkanowy/data/repositories/StudentTest.kt b/app/src/test/java/io/github/wulkanowy/data/repositories/StudentTest.kt index 402b22723..b34bbf1b2 100644 --- a/app/src/test/java/io/github/wulkanowy/data/repositories/StudentTest.kt +++ b/app/src/test/java/io/github/wulkanowy/data/repositories/StudentTest.kt @@ -37,7 +37,8 @@ class StudentTest { studentDb, semesterDb, mockSdk, - AppInfo() + AppInfo(), + mockk() ) } diff --git a/app/src/test/java/io/github/wulkanowy/ui/modules/login/studentselect/LoginStudentSelectPresenterTest.kt b/app/src/test/java/io/github/wulkanowy/ui/modules/login/studentselect/LoginStudentSelectPresenterTest.kt index 9e34235e7..c79d739e8 100644 --- a/app/src/test/java/io/github/wulkanowy/ui/modules/login/studentselect/LoginStudentSelectPresenterTest.kt +++ b/app/src/test/java/io/github/wulkanowy/ui/modules/login/studentselect/LoginStudentSelectPresenterTest.kt @@ -89,24 +89,11 @@ class LoginStudentSelectPresenterTest { @Test fun onSelectedStudentTest() { coEvery { - studentRepository.saveStudents( - listOf( - StudentWithSemesters( - testStudent, - emptyList() - ) - ) - ) - } returns listOf(1L) - coEvery { - studentRepository.switchStudent( - StudentWithSemesters( - testStudent, - emptyList() - ) - ) + studentRepository.saveStudents(listOf(StudentWithSemesters(testStudent, emptyList()))) } just Runs + every { loginStudentSelectView.openMainView() } just Runs + presenter.onItemSelected(StudentWithSemesters(testStudent, emptyList()), false) presenter.onSignIn() @@ -118,18 +105,14 @@ class LoginStudentSelectPresenterTest { @Test fun onSelectedStudentErrorTest() { coEvery { - studentRepository.saveStudents( - listOf( - StudentWithSemesters( - testStudent, - emptyList() - ) - ) - ) + studentRepository.saveStudents(listOf(StudentWithSemesters(testStudent, emptyList()))) } throws testException + coEvery { studentRepository.logoutStudent(testStudent) } just Runs + presenter.onItemSelected(StudentWithSemesters(testStudent, emptyList()), false) presenter.onSignIn() + verify { loginStudentSelectView.showContent(false) } verify { loginStudentSelectView.showProgress(true) } verify { errorHandler.dispatch(match { testException.message == it.message }) } From 957adaf6ee2708c71dcc624bfce9409e3ff5e0db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Pich?= Date: Mon, 13 Sep 2021 14:53:27 +0200 Subject: [PATCH 15/15] Version 1.2.2 --- app/build.gradle | 6 +++--- app/src/main/play/release-notes/pl-PL/default.txt | 9 +++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index d1975e1ab..745859988 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -21,8 +21,8 @@ android { testApplicationId "io.github.tests.wulkanowy" minSdkVersion 21 targetSdkVersion 30 - versionCode 94 - versionName "1.2.1" + versionCode 95 + versionName "1.2.2" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true @@ -157,7 +157,7 @@ ext { } dependencies { - implementation "io.github.wulkanowy:sdk:1.2.1" + implementation "io.github.wulkanowy:sdk:1.2.2" coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5' 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 aeef2a77e..3456c3d03 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,8 @@ -Wersja 1.2.1 +Wersja 1.2.2 -- dodaliśmy brakujące okienka z podglądem szczegółów ogłoszeń szkolnych -- naprawiliśmy rzucające się w oczy błędy na ekranie startowym -- naprawiliśmy też inne drobne błędy w wyglądzie i stabilności aplikacji +- naprawiliśmy problem z widocznością zadań w aplikacji gdy widoczne są one na stronie www dziennika (nadal pozostaje błąd z zadaniami widocznymi tylko w oficjalnej aplikacji - czekamy na poprawkę po stronie VULCANa) +- odblokowaliśmy niedzielę w wyborze daty w planie lekcji i innych zakładkach +- przywróciliśmy odnośnik do szczęśliwego numerka w menu Więcej +- naprawiliśmy drobne błędy ze stabilnością i wyglądem Pełna lista zmian: https://github.com/wulkanowy/wulkanowy/releases