package kz.arta.synergy.workflow.mobile.android;

import android.util.Log;

import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;

import static kz.arta.synergy.workflow.mobile.android.common.utils.Logger.TAG;

public class MyFirebaseMessagingService extends FirebaseMessagingService {

    @Override
    public void onMessageReceived(RemoteMessage remoteMessage) {

        Log.d("My", remoteMessage.getNotification().getClickAction()+" click action ");
        Log.d("My", remoteMessage.getData()+" data ");

        if (remoteMessage.getNotification() != null) {
            RemoteMessage.Notification notification = remoteMessage.getNotification();


            new GcmIntentService(getApplicationContext()).sendNotification(remoteMessage.getNotification(), remoteMessage.getData().get("workID"));
            Log.d(TAG, "Message Notification Body: " + notification.getBody());
        }
    }

    @Override
    public void onNewToken(String s) {
        super.onNewToken(s);
        Log.e("newToken", s);
    }
}
