[Lab] Fix full sync buttons.

This commit is contained in:
Kuba Szczodrzyński 2022-10-25 12:35:51 +02:00
parent 9535f53563
commit 158b69a8d3
No known key found for this signature in database
GPG Key ID: 70CB8A85BA1633CB
2 changed files with 16 additions and 4 deletions

View File

@ -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}")
}

View File

@ -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" />
<Button
android:id="@+id/clearEndpointTimers"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
android:text="Clear endpoint timers (force full sync)"
android:textAllCaps="false" />
<Button
android:id="@+id/rodo"
android:layout_width="match_parent"