package br.com.trimsy.notify;

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

public class NotifyReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        if (context == null || intent == null) return;
        int id = intent.getIntExtra(NotifyHub.EXTRA_ID, 1);
        String title = intent.getStringExtra(NotifyHub.EXTRA_TITLE);
        String body = intent.getStringExtra(NotifyHub.EXTRA_BODY);
        String payload = intent.getStringExtra(NotifyHub.EXTRA_PAYLOAD);
        NotifyHub.show(context.getApplicationContext(), id, title, body, payload);
        NotifyHub.removePending(context.getApplicationContext(), id);
    }
}
