package com.foxx.androidcast.receiver;

/*********************************************************************
 * ReceiverPrefs.java
 * Created at: Fri 15 May 2026 17:47:09 +0200
 * Updated at: Wed 20 May 2026 15:17:13 +0200 by Anton Afanasyeu <a.afanasieff@gmail.com>
 * Commit: 5d8e82d2e60a21fff3138d2a394ee4e8b4c6dcb8
 * class ReceiverPrefs
 * Contributors:
 *    - Anton Afanasyeu <a.afanasieff@gmail.com> (2 commits, 31 lines)
 *    - Cursor Agent (project assistant)
 * Digest: SHA256	bf8d517929f2ce54e581aaaa707310b6844ed26b12e1e2d38522c866cc803e1c
**********************************************************************/
import android.content.Context;
import android.content.SharedPreferences;

/** Receiver UI preferences (PIN is entered each session; audio choice is remembered). */
public final class ReceiverPrefs {
    private static final String PREFS = "receiver_prefs";
    private static final String KEY_ALLOW_AUDIO = "allow_audio";

    private ReceiverPrefs() {}

    public static boolean isAllowAudio(Context context) {
        return prefs(context).getBoolean(KEY_ALLOW_AUDIO, true);
    }

    public static void setAllowAudio(Context context, boolean allow) {
        prefs(context).edit().putBoolean(KEY_ALLOW_AUDIO, allow).apply();
    }

    private static SharedPreferences prefs(Context context) {
        return context.getApplicationContext().getSharedPreferences(PREFS, Context.MODE_PRIVATE);
    }
}
