Add mapping for getUserAttribute API

This commit is contained in:
Hossam Hassan 2017-02-03 20:33:00 +02:00
parent 5ecfa5612e
commit 4d61214abc
2 changed files with 29 additions and 0 deletions

View File

@ -548,6 +548,22 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
}
}
/**
* Gets specific user attribute.
*
* @param key the attribute key as string
* @return the desired user attribute
*/
@ReactMethod
public static String getUserAttribute(String key) {
try {
return mInstabug.getUserAttribute(key);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
private Locale getLocaleByKey(String instabugLocale) {
String localeInLowerCase = instabugLocale.toLowerCase();
switch (localeInLowerCase) {

View File

@ -635,6 +635,19 @@ module.exports = {
}
},
/**
* Gets specific user attribute.
*
* @param key the attribute key as string
* @return the desired user attribute
*/
getUserAttribute(key){
if (!key) throw new TypeError("Invalid param type, Expected String");
if (Platform.OS === 'android') {
return Instabug.getUserAttribute(key);
}
},
/**
* The event used to invoke the feedback form
* @readonly