From b5eec9ac7f109f809bb3c1d5539699888d77e83c Mon Sep 17 00:00:00 2001 From: Marvin Liu Date: Wed, 21 Dec 2022 15:05:38 -0800 Subject: [PATCH] feat: add boolean value to identify (#155) --- .../reactnative/AmplitudeReactNativeModule.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/android/src/main/java/com/amplitude/reactnative/AmplitudeReactNativeModule.java b/android/src/main/java/com/amplitude/reactnative/AmplitudeReactNativeModule.java index e72ef4d..7a53f1b 100644 --- a/android/src/main/java/com/amplitude/reactnative/AmplitudeReactNativeModule.java +++ b/android/src/main/java/com/amplitude/reactnative/AmplitudeReactNativeModule.java @@ -471,6 +471,8 @@ private Identify createIdentify(JSONObject userProperties) { identify.append(key, userPropertiesObj.getJSONObject(key)); } else if ((Object)userPropertiesObj.get(key) instanceof JSONArray) { identify.append(key, userPropertiesObj.getJSONArray(key)); + } else if ((Object)userPropertiesObj.get(key) instanceof Boolean) { + identify.append(key, userPropertiesObj.getBoolean(key)); } case "$prepend": if ((Object)userPropertiesObj.get(key) instanceof Double){ @@ -485,6 +487,8 @@ private Identify createIdentify(JSONObject userProperties) { identify.prepend(key, userPropertiesObj.getJSONObject(key)); } else if ((Object)userPropertiesObj.get(key) instanceof JSONArray) { identify.prepend(key, userPropertiesObj.getJSONArray(key)); + } else if ((Object)userPropertiesObj.get(key) instanceof Boolean) { + identify.prepend(key, userPropertiesObj.getBoolean(key)); } case "$preInsert": if ((Object)userPropertiesObj.get(key) instanceof Double){ @@ -499,6 +503,8 @@ private Identify createIdentify(JSONObject userProperties) { identify.preInsert(key, userPropertiesObj.getJSONObject(key)); } else if ((Object)userPropertiesObj.get(key) instanceof JSONArray) { identify.preInsert(key, userPropertiesObj.getJSONArray(key)); + } else if ((Object)userPropertiesObj.get(key) instanceof Boolean) { + identify.preInsert(key, userPropertiesObj.getBoolean(key)); } case "$postInsert": if ((Object)userPropertiesObj.get(key) instanceof Double){ @@ -513,6 +519,8 @@ private Identify createIdentify(JSONObject userProperties) { identify.postInsert(key, userPropertiesObj.getJSONObject(key)); } else if ((Object)userPropertiesObj.get(key) instanceof JSONArray) { identify.postInsert(key, userPropertiesObj.getJSONArray(key)); + } else if ((Object)userPropertiesObj.get(key) instanceof Boolean) { + identify.postInsert(key, userPropertiesObj.getBoolean(key)); } case "$set": if ((Object)userPropertiesObj.get(key) instanceof Double){ @@ -527,6 +535,8 @@ private Identify createIdentify(JSONObject userProperties) { identify.set(key, userPropertiesObj.getJSONObject(key)); } else if ((Object)userPropertiesObj.get(key) instanceof JSONArray) { identify.set(key, userPropertiesObj.getJSONArray(key)); + } else if ((Object)userPropertiesObj.get(key) instanceof Boolean) { + identify.set(key, userPropertiesObj.getBoolean(key)); } case "$setOnce": if ((Object)userPropertiesObj.get(key) instanceof Double){ @@ -541,6 +551,8 @@ private Identify createIdentify(JSONObject userProperties) { identify.setOnce(key, userPropertiesObj.getJSONObject(key)); } else if ((Object)userPropertiesObj.get(key) instanceof JSONArray) { identify.setOnce(key, userPropertiesObj.getJSONArray(key)); + } else if ((Object)userPropertiesObj.get(key) instanceof Boolean) { + identify.setOnce(key, userPropertiesObj.getBoolean(key)); } case "$unset": identify.unset(key); // value is default to `-`