@customerglu/react-native-customerglu 1.0.8 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -16,7 +16,7 @@ Supports API 21 and above. Please ensure the minSDKVersion in the app's build.gr
16
16
  ### Option 1
17
17
  Add the CustomerGlu React Native plugin in package.json file
18
18
  ```
19
- "@customerglu/react-native-customerglu": "^1.0.8"
19
+ "@customerglu/react-native-customerglu": "^1.0.9"
20
20
  ```
21
21
 
22
22
  ### Option 2
@@ -1,5 +1,6 @@
1
1
  package com.reactnativerncustomerglu;
2
2
 
3
+ import static com.customerglu.sdk.Utils.Comman.printDebugLogs;
3
4
  import static com.facebook.react.bridge.UiThreadUtil.runOnUiThread;
4
5
 
5
6
  import android.content.BroadcastReceiver;
@@ -9,13 +10,14 @@ import android.content.IntentFilter;
9
10
  import android.content.pm.ApplicationInfo;
10
11
  import android.content.pm.PackageManager;
11
12
  import android.net.Uri;
13
+ import android.os.Bundle;
12
14
  import android.util.Log;
13
15
 
14
16
  import androidx.annotation.NonNull;
15
17
 
16
18
  import com.customerglu.sdk.Modal.NudgeConfiguration;
19
+ import com.customerglu.sdk.Utils.Comman;
17
20
  import com.facebook.react.bridge.LifecycleEventListener;
18
- import com.facebook.react.bridge.NativeMap;
19
21
  import com.facebook.react.bridge.WritableArray;
20
22
  import com.facebook.react.bridge.WritableNativeArray;
21
23
  import com.facebook.react.bridge.WritableNativeMap;
@@ -396,9 +398,37 @@ public class RncustomergluModule extends ReactContextBaseJavaModule implements L
396
398
  @ReactMethod
397
399
  public void DisplayCGNotification(ReadableMap data,Boolean autoclosewebview) {
398
400
  JSONObject jsonObject=convertMapToJson(data);
399
- CustomerGlu.getInstance().displayCustomerGluNotification(getReactApplicationContext(),jsonObject,R.drawable.notification,0.5, autoclosewebview);
401
+ if(getAppIcon(getReactApplicationContext())!=0) {
402
+ CustomerGlu.getInstance().displayCustomerGluNotification(getReactApplicationContext(), jsonObject, getAppIcon(getReactApplicationContext()), 0.5, autoclosewebview);
403
+ }else{
404
+ CustomerGlu.getInstance().displayCustomerGluNotification(getReactApplicationContext(), jsonObject, R.drawable.notification, 0.5, autoclosewebview);
405
+
406
+ }
407
+ }
408
+
409
+ private static int getAppIcon(Context context) {
400
410
 
411
+ try {
412
+ ApplicationInfo ai = context.getPackageManager().getApplicationInfo(
413
+ context.getPackageName(), PackageManager.GET_META_DATA);
414
+ Bundle bundle = ai.metaData;
415
+ int myAPIKey = bundle.getInt("CUSTOMERGLU_NOTIFICATION_ICON");
416
+ printDebugLogs("API KEY : " + myAPIKey);
417
+ return myAPIKey;
418
+ } catch (Exception e) {
419
+ Comman.printErrorLogs(e.toString());
420
+ return 0;
421
+ }
401
422
  }
423
+
424
+
425
+
426
+
427
+
428
+
429
+
430
+
431
+
402
432
  @ReactMethod
403
433
  public void DisplayCGBackgroundNotification(ReadableMap data,Boolean autoclosewebview) {
404
434
  JSONObject jsonObject=convertMapToJson(data);
@@ -408,6 +438,8 @@ public class RncustomergluModule extends ReactContextBaseJavaModule implements L
408
438
  }
409
439
 
410
440
 
441
+
442
+
411
443
  @ReactMethod
412
444
  public void CGApplication() {
413
445
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@customerglu/react-native-customerglu",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "CustomerGlu React Native plugin",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",