package com.nerdyfactory.notification;

import android.service.notification.NotificationListenerService;
import android.service.notification.StatusBarNotification;
import android.util.Log;

import com.facebook.react.bridge.WritableNativeMap;

import java.util.Arrays;

public class NotificationListener extends NotificationListenerService {
    private static final String TAG = "NotificationListener";
    private static final String[] apps = {
            "com.google.android.talk",      // TODO remove after testing
            "com.kakao.talk",
            "jp.naver.line.android",
            "com.facebook.katana",
            "com.twitter.android",
            "com.google.android.gm",
            "com.nhn.android.search",
            "com.korail.korail",
            "com.starbucks.co",
            "com.tencent.mm"
    };

    @Override
    public void onNotificationPosted(StatusBarNotification sbn) {
        Log.d(TAG, "Notification received: "+sbn.getPackageName()+":"+sbn.getNotification().tickerText);

        String app = sbn.getPackageName();

        if (!Arrays.asList(apps).contains(app) && !NotificationModule.SmsApp.equals(app)) {
            return;
        }

        final WritableNativeMap params = new WritableNativeMap();

        if (NotificationModule.SmsApp.equals(app)) {
            params.putString("app", "sms");
        } else {
            params.putString("app", app);
        }

        if (sbn.getNotification().tickerText == null) {
            params.putString("text", "");
        } else {
            params.putString("text", sbn.getNotification().tickerText.toString());
        }

        NotificationModule.sendEvent(params);
    }

    @Override
    public void onNotificationRemoved(StatusBarNotification sbn) {}
}
@@ -399,437 +399,8 @@
 er%22;
-%0A    private static final String%5B%5D apps = %7B%0A            %22com.google.android.talk%22,      // TODO remove after testing%0A            %22com.kakao.talk%22,%0A            %22jp.naver.line.android%22,%0A            %22com.facebook.katana%22,%0A            %22com.twitter.android%22,%0A            %22com.google.android.gm%22,%0A            %22com.nhn.android.search%22,%0A            %22com.korail.korail%22,%0A            %22com.starbucks.co%22,%0A            %22com.tencent.mm%22%0A    %7D;
 %0A%0A  
@@ -630,132 +630,8 @@
 ();%0A
-%0A        if (!Arrays.asList(apps).contains(app) && !NotificationModule.SmsApp.equals(app)) %7B%0A            return;%0A        %7D%0A%0A
     
@@ -704,16 +704,27 @@
      if 
+(app.equals
 (Notific
@@ -745,19 +745,8 @@
 sApp
-.equals(app
 )) %7B

remove hardcoded app names