diff --git a/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java b/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java index ec9fd2e..f1c53ca 100644 --- a/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java +++ b/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java @@ -645,13 +645,14 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule { * @return the desired user attribute */ @ReactMethod - public String getUserAttribute(String key) { + public void getUserAttribute(String key, Callback userAttributeCallback) { + String userAttribute; try { - return mInstabug.getUserAttribute(key); + userAttribute = mInstabug.getUserAttribute(key); } catch (Exception e) { e.printStackTrace(); - return null; } + userAttributeCallback.invoke(userAttribute); } /** diff --git a/index.js b/index.js index 6b3dd90..754e98a 100644 --- a/index.js +++ b/index.js @@ -610,11 +610,7 @@ module.exports = { * @param {userAttributeCallback} userAttributeCallback callback with argument as the desired user attribute value */ getUserAttribute: function (key, userAttributeCallback) { - if (Platform.OS === 'ios') { - return Instabug.getUserAttribute(key, userAttributeCallback); - } else if (Platform.OS === 'android') { - return Instabug.getUserAttribute(key); - } + Instabug.getUserAttribute(key, userAttributeCallback); }, /**