mirror of
https://github.com/status-im/instabug-reactnative.git
synced 2025-03-03 06:30:41 +00:00
Add mapping for removeUserAttribute API
This commit is contained in:
parent
ab7188ac13
commit
d0844de778
@ -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) {
|
||||
|
14
index.js
14
index.js
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user