mirror of
https://github.com/status-im/instabug-reactnative.git
synced 2025-03-03 14:40:54 +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.ReactMethod;
|
||||||
import com.facebook.react.bridge.ReadableArray;
|
import com.facebook.react.bridge.ReadableArray;
|
||||||
import com.facebook.react.bridge.ReadableMap;
|
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.facebook.react.bridge.Callback;
|
||||||
|
|
||||||
import com.instabug.library.Instabug;
|
import com.instabug.library.Instabug;
|
||||||
@ -348,14 +350,18 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
|
|||||||
* @see #resetTags()
|
* @see #resetTags()
|
||||||
*/
|
*/
|
||||||
@ReactMethod
|
@ReactMethod
|
||||||
public ArrayList<String> getTags() {
|
public void getTags(Callback tagsCallback) {
|
||||||
ArrayList<String> tags = new ArrayList<String>();
|
private WritableArray tagsArray;
|
||||||
try {
|
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) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return tags;
|
tagsCallback.invoke(tagsArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
4
index.js
4
index.js
@ -346,11 +346,7 @@ module.exports = {
|
|||||||
* @param {tagsCallback} tagsCallback callback with argument tags of reported feedback, bug or crash.
|
* @param {tagsCallback} tagsCallback callback with argument tags of reported feedback, bug or crash.
|
||||||
*/
|
*/
|
||||||
getTags: function (tagsCallback) {
|
getTags: function (tagsCallback) {
|
||||||
if (Platform.OS === 'ios') {
|
|
||||||
Instabug.getTags(tagsCallback);
|
Instabug.getTags(tagsCallback);
|
||||||
} else if (Platform.OS === 'android') {
|
|
||||||
Instabug.getTags();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user