package net.squanchy.support.debug;

import android.content.Context;
import android.content.SharedPreferences;

public class DebugPreferences {

    private static final String PREFERENCES_NAME_DEBUG = "debug";
    private static final String KEY_CONTEST_TESTING_ENABLED = "contest.testing_enabled";

    private final SharedPreferences preferences;

    public DebugPreferences(Context context) {
        this.preferences = context.getSharedPreferences(DebugPreferences.PREFERENCES_NAME_DEBUG, Context.MODE_PRIVATE);
    }

    public boolean contestTestingEnabled() {
        return preferences.getBoolean(KEY_CONTEST_TESTING_ENABLED, false);
    }

    public void enableContestTesting() {
        storePreference(KEY_CONTEST_TESTING_ENABLED, true);
    }

    public void disableContestTesting() {
        storePreference(KEY_CONTEST_TESTING_ENABLED, false);
    }

    private void storePreference(String key, boolean value) {
        preferences.edit()
                .putBoolean(key, value)
                .apply();
    }
}

@@ -105,16 +105,50 @@
 ences;%0A%0A
+import net.squanchy.BuildConfig;%0A%0A
 public c
@@ -326,16 +326,79 @@
 nabled%22;
+%0A    private static final boolean IS_DEBUG = BuildConfig.DEBUG;
 %0A%0A    pr
@@ -674,16 +674,28 @@
   return
+ IS_DEBUG &&
  prefere
@@ -800,32 +800,37 @@
  %7B%0A        store
+Debug
 Preference(KEY_C
@@ -918,24 +918,29 @@
        store
+Debug
 Preference(K
@@ -1004,16 +1004,21 @@
 id store
+Debug
 Preferen
@@ -1045,24 +1045,79 @@
 an value) %7B%0A
+        if (!IS_DEBUG) %7B%0A            return;%0A        %7D%0A
         pref

Make DebugPreferences a no-op for non-debug builds