Add mapping for removeUserAttribute API

This commit is contained in:
Hossam Hassan 2017-02-04 06:10:26 +02:00
parent ab7188ac13
commit d0844de778
2 changed files with 31 additions and 2 deletions

View File

@ -540,7 +540,7 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
* @param value the value
*/
@ReactMethod
public static void setUserAttribute(String key, String value) {
public void setUserAttribute(String key, String value) {
try {
mInstabug.setUserAttribute(key, value);
} catch (Exception e) {
@ -555,7 +555,7 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
* @return the desired user attribute
*/
@ReactMethod
public static String getUserAttribute(String key) {
public String getUserAttribute(String key) {
try {
return mInstabug.getUserAttribute(key);
} catch (Exception e) {
@ -564,6 +564,21 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
}
}
/**
* Removes user attribute if exists.
*
* @param key the attribute key as string
* @see #setUserAttribute(String, String)
*/
@ReactMethod
public void removeUserAttribute(String key) {
try {
mInstabug.removeUserAttribute(key);
} catch (Exception e) {
e.printStackTrace();
}
}
private Locale getLocaleByKey(String instabugLocale) {
String localeInLowerCase = instabugLocale.toLowerCase();
switch (localeInLowerCase) {

View File

@ -650,6 +650,20 @@ module.exports = {
}
},
/**
* Removes user attribute if exists.
*
* @param key the attribute key as string
* @see #setUserAttribute(String, String)
*/
removeUserAttribute(key){
if (!key || typeof key !== "string")
throw new TypeError("Invalid param, Expected String");
if (Platform.OS === 'android') {
Instabug.removeUserAttribute(key);
}
},
/**
* The event used to invoke the feedback form
* @readonly