[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.last10unseen.isVisible = false
b.fullSync.isVisible = false b.fullSync.isVisible = false
b.clearProfile.isVisible = false b.clearProfile.isVisible = false
b.clearEndpointTimers.isVisible = false
b.rodo.isVisible = false b.rodo.isVisible = false
b.removeHomework.isVisible = false b.removeHomework.isVisible = false
b.unarchive.isVisible = false b.unarchive.isVisible = false
@ -83,14 +84,18 @@ class LabPageFragment : LazyFragment(), CoroutineScope {
} }
b.fullSync.onClick { b.fullSync.onClick {
app.db.query(SimpleSQLiteQuery("UPDATE profiles SET empty = 1 WHERE profileId = ${App.profileId}")) app.profile.empty = true
app.db.query(SimpleSQLiteQuery("DELETE FROM endpointTimers WHERE profileId = ${App.profileId}")) app.profileSave()
} }
b.clearProfile.onClick { b.clearProfile.onClick {
ProfileRemoveDialog(activity, App.profileId, "FAKE", noProfileRemoval = true).show() ProfileRemoveDialog(activity, App.profileId, "FAKE", noProfileRemoval = true).show()
} }
b.clearEndpointTimers.onClick {
app.db.endpointTimerDao().clear(app.profileId)
}
b.removeHomework.onClick { b.removeHomework.onClick {
app.db.eventDao().getRawNow("UPDATE events SET homeworkBody = NULL WHERE profileId = ${App.profileId}") app.db.eventDao().getRawNow("UPDATE events SET homeworkBody = NULL WHERE profileId = ${App.profileId}")
} }

View File

@ -75,10 +75,17 @@
android:id="@+id/clearProfile" android:id="@+id/clearProfile"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
android:text="Clear all profile data" android:text="Clear all profile data"
android:textAllCaps="false" /> 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 <Button
android:id="@+id/rodo" android:id="@+id/rodo"
android:layout_width="match_parent" android:layout_width="match_parent"