From 158b69a8d30eceac9a5df74b6fc140a19c4118f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Szczodrzy=C5=84ski?= Date: Tue, 25 Oct 2022 12:35:51 +0200 Subject: [PATCH] [Lab] Fix full sync buttons. --- .../edziennik/ui/debug/LabPageFragment.kt | 11 ++++++++--- app/src/main/res/layout/lab_fragment.xml | 9 ++++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/LabPageFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/LabPageFragment.kt index 1c580968..5aae3c11 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/LabPageFragment.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/debug/LabPageFragment.kt @@ -62,6 +62,7 @@ class LabPageFragment : LazyFragment(), CoroutineScope { b.last10unseen.isVisible = false b.fullSync.isVisible = false b.clearProfile.isVisible = false + b.clearEndpointTimers.isVisible = false b.rodo.isVisible = false b.removeHomework.isVisible = false b.unarchive.isVisible = false @@ -82,15 +83,19 @@ class LabPageFragment : LazyFragment(), CoroutineScope { app.db.teacherDao().query(SimpleSQLiteQuery("UPDATE teachers SET teacherSurname = \"\" WHERE profileId = ${App.profileId}")) } - b.fullSync.onClick { - app.db.query(SimpleSQLiteQuery("UPDATE profiles SET empty = 1 WHERE profileId = ${App.profileId}")) - app.db.query(SimpleSQLiteQuery("DELETE FROM endpointTimers WHERE profileId = ${App.profileId}")) + b.fullSync.onClick { + app.profile.empty = true + app.profileSave() } b.clearProfile.onClick { ProfileRemoveDialog(activity, App.profileId, "FAKE", noProfileRemoval = true).show() } + b.clearEndpointTimers.onClick { + app.db.endpointTimerDao().clear(app.profileId) + } + b.removeHomework.onClick { app.db.eventDao().getRawNow("UPDATE events SET homeworkBody = NULL WHERE profileId = ${App.profileId}") } diff --git a/app/src/main/res/layout/lab_fragment.xml b/app/src/main/res/layout/lab_fragment.xml index c1326fa3..d290525c 100644 --- a/app/src/main/res/layout/lab_fragment.xml +++ b/app/src/main/res/layout/lab_fragment.xml @@ -75,10 +75,17 @@ android:id="@+id/clearProfile" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginBottom="24dp" android:text="Clear all profile data" android:textAllCaps="false" /> +