package com.yourorg.discordclone;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class VoiceNotificationReceiver extends BroadcastReceiver {

    public static final String ACTION_DISCONNECT = "com.yourorg.discordclone.VOICE_DISCONNECT";
    public static final String ACTION_TOGGLE_MUTE = "com.yourorg.discordclone.VOICE_TOGGLE_MUTE";
    public static final String ACTION_TOGGLE_DEAFEN = "com.yourorg.discordclone.VOICE_TOGGLE_DEAFEN";

    @Override
    public void onReceive(Context context, Intent intent) {
        if (intent == null || intent.getAction() == null) return;

        VoiceServicePlugin plugin = VoiceServicePlugin.getInstance();
        if (plugin == null) return;

        switch (intent.getAction()) {
            case ACTION_DISCONNECT:
                plugin.fireNotificationAction("disconnect");
                break;
            case ACTION_TOGGLE_MUTE:
                plugin.fireNotificationAction("toggleMute");
                break;
            case ACTION_TOGGLE_DEAFEN:
                plugin.fireNotificationAction("toggleDeafen");
                break;
        }
    }
}
