package com.dieam.reactnativepushnotification.modules;

import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.util.Log;

class RNPushNotificationConfig {
    private static final String KEY_CHANNEL_NAME = "com.dieam.reactnativepushnotification.notification_channel_name";
    private static final String KEY_CHANNEL_DESCRIPTION = "com.dieam.reactnativepushnotification.notification_channel_description";
    private static final String KEY_NOTIFICATION_ICON = "com.dieam.reactnativepushnotification.notification_color";

    private static Bundle metadata;

    public RNPushNotificationConfig(Context context) {
        if (metadata == null) {
            try {
                ApplicationInfo applicationInfo = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA);
                metadata = applicationInfo.metaData;
            } catch (PackageManager.NameNotFoundException e) {
                e.printStackTrace();
                Log.e(RNPushNotification.LOG_TAG, "Error reading application meta, falling back to defaults");
                metadata = new Bundle();
            }
        }
    }

    public String getChannelName() {
        try {
            return metadata.getString(KEY_CHANNEL_NAME);
        } catch (Exception e) {
            Log.e(RNPushNotification.LOG_TAG, "Unable to find " + KEY_CHANNEL_NAME + " in manifest. Falling back to default");
        }
        // Default
        return "rn-push-notification-channel";
    }
    public String getChannelDescription() {
        try {
            return metadata.getString(KEY_CHANNEL_DESCRIPTION);
        } catch (Exception e) {
            Log.e(RNPushNotification.LOG_TAG, "Unable to find " + KEY_CHANNEL_DESCRIPTION + " in manifest. Falling back to default");
        }
        // Default
        return "";
    }
    public int getNotificationColor() {
        try {
            return metadata.getInt(KEY_NOTIFICATION_ICON);
        } catch (Exception e) {
            Log.e(RNPushNotification.LOG_TAG, "Unable to find " + KEY_NOTIFICATION_ICON + " in manifest. Falling back to default");
        }
        // Default
        return -1;
    }
}

@@ -166,16 +166,71 @@
 anager;%0A
+import android.support.v4.content.res.ResourcesCompat;%0A
 import a
@@ -708,16 +708,45 @@
 etadata;
+%0A    private Context context;
 %0A%0A    pu
@@ -790,24 +790,56 @@
  context) %7B%0A
+        this.context = context;%0A
         if (
@@ -2115,38 +2115,48 @@
 y %7B%0A            
-return
+int resourceId =
  metadata.getInt
@@ -2176,24 +2176,111 @@
 TION_ICON);%0A
+            return ResourcesCompat.getColor(context.getResources(), resourceId, null);%0A
         %7D ca

Convert resource id to color id