mirror of
https://github.com/status-im/instabug-reactnative.git
synced 2025-03-02 14:10:40 +00:00
Use Callbacks in getTags
API
This commit is contained in:
parent
1365d040ca
commit
cae5a8910f
@ -8,6 +8,8 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.WritableArray;
|
||||
import com.facebook.react.bridge.WritableNativeArray;
|
||||
import com.facebook.react.bridge.Callback;
|
||||
|
||||
import com.instabug.library.Instabug;
|
||||
@ -348,14 +350,18 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
|
||||
* @see #resetTags()
|
||||
*/
|
||||
@ReactMethod
|
||||
public ArrayList<String> getTags() {
|
||||
ArrayList<String> tags = new ArrayList<String>();
|
||||
public void getTags(Callback tagsCallback) {
|
||||
private WritableArray tagsArray;
|
||||
try {
|
||||
tags = mInstabug.getTags();
|
||||
ArrayList<String> tags = mInstabug.getTags();
|
||||
tagsArray = new WritableNativeArray();
|
||||
for (int i = 0; i < tags.size(); i++) {
|
||||
tagsArray.pushString(tags.get(i));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return tags;
|
||||
tagsCallback.invoke(tagsArray);
|
||||
}
|
||||
|
||||
/**
|
||||
|
6
index.js
6
index.js
@ -346,11 +346,7 @@ module.exports = {
|
||||
* @param {tagsCallback} tagsCallback callback with argument tags of reported feedback, bug or crash.
|
||||
*/
|
||||
getTags: function (tagsCallback) {
|
||||
if (Platform.OS === 'ios') {
|
||||
Instabug.getTags(tagsCallback);
|
||||
} else if (Platform.OS === 'android') {
|
||||
Instabug.getTags();
|
||||
}
|
||||
Instabug.getTags(tagsCallback);
|
||||
},
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user