Debug: Hide drop table in non-debug builds

This commit is contained in:
José Rebelo
2026-02-08 15:59:01 +00:00
parent 95cc7a409c
commit 8fb7231efa
2 changed files with 8 additions and 2 deletions
@@ -18,6 +18,7 @@ import androidx.preference.PreferenceViewHolder
import com.google.android.material.datepicker.CalendarConstraints
import com.google.android.material.datepicker.MaterialDatePicker
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import nodomain.freeyourgadget.gadgetbridge.BuildConfig
import nodomain.freeyourgadget.gadgetbridge.GBApplication
import nodomain.freeyourgadget.gadgetbridge.R
import nodomain.freeyourgadget.gadgetbridge.util.DateTimeUtils
@@ -65,7 +66,10 @@ class DatabaseTableDebugFragment : AbstractDebugFragment() {
onClick(PREF_DEBUG_CLEAR_TABLE) { clearTable(tableName) }
onClick(PREF_DEBUG_DROP_TABLE) { dropTable(tableName) }
if (BuildConfig.DEBUG) {
findPreference<Preference>(PREF_DEBUG_DROP_TABLE)?.isVisible = true
onClick(PREF_DEBUG_DROP_TABLE) { dropTable(tableName) }
}
val ddl = getTableDdl(tableName)
@@ -36,13 +36,15 @@
android:summary="Warning! By pushing this button all data from the table will be deleted."
android:title="Clear table" />
<!-- only in debug builds -->
<Preference
android:dependency="dangerous_actions"
android:icon="@drawable/ic_delete_forever"
android:key="pref_debug_drop_table"
android:persistent="false"
android:summary="Warning! By pushing this button the table will be dropped to the database and must be re-created."
android:title="Drop table" />
android:title="Drop table"
app:isPreferenceVisible="false" />
</PreferenceCategory>
<PreferenceCategory