Add mapping for setUserAttribute API

This commit is contained in:
Hossam Hassan 2017-02-03 19:47:26 +02:00
parent 527394412d
commit 5ecfa5612e
2 changed files with 28 additions and 0 deletions

View File

@ -533,6 +533,21 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
}
}
/**
* Sets user attribute to overwrite it's value or create a new one if it doesn't exist.
*
* @param key the attribute
* @param value the value
*/
@ReactMethod
public static void setUserAttribute(String key, String value) {
try {
mInstabug.setUserAttribute(key, value);
} catch (Exception e) {
e.printStackTrace();
}
}
private Locale getLocaleByKey(String instabugLocale) {
String localeInLowerCase = instabugLocale.toLowerCase();
switch (localeInLowerCase) {

View File

@ -622,6 +622,19 @@ module.exports = {
}
},
/**
* Sets user attribute to overwrite it's value or create a new one if it doesn't exist.
*
* @param key the attribute
* @param value the value
*/
setUserAttribute(key, value){
if (!key || !value)return;
if (Platform.OS === 'android') {
Instabug.setUserAttribute(key, value);
}
},
/**
* The event used to invoke the feedback form
* @readonly