use of com.facebook.react.bridge.WritableNativeArray in project SalesIQ-Mobilisten-ReactNative by zoho.
the class RNZohoSalesIQ method getArticles.
@ReactMethod
public void getArticles(@NonNull final Callback articlesCallback) {
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
public void run() {
ZohoSalesIQ.FAQ.getArticles(new FAQListener() {
@Override
public void onSuccess(ArrayList<SalesIQArticle> articlesList) {
if (articlesList != null) {
WritableArray array = new WritableNativeArray();
for (int i = 0; i < articlesList.size(); i++) {
SalesIQArticle article = articlesList.get(i);
WritableMap articleMap = getArticleMapObject(article);
array.pushMap(articleMap);
}
articlesCallback.invoke(null, array);
}
}
@Override
public void onFailure(int code, String message) {
WritableMap errorMap = new WritableNativeMap();
// No I18N
errorMap.putInt("code", code);
// No I18N
errorMap.putString("message", message);
articlesCallback.invoke(errorMap, null);
}
});
}
});
}
use of com.facebook.react.bridge.WritableNativeArray in project SalesIQ-Mobilisten-ReactNative by zoho.
the class RNZohoSalesIQ method getChatsWithFilter.
@ReactMethod
public void getChatsWithFilter(@NonNull final String filter, @NonNull final Callback listCallback) {
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
public void run() {
try {
if (isValidFilterName(filter)) {
ConversationType filterName = getFilterName(filter);
ZohoSalesIQ.Chat.getList(filterName, new ConversationListener() {
@Override
public void onSuccess(ArrayList<VisitorChat> arrayList) {
if (arrayList != null) {
WritableArray array = new WritableNativeArray();
for (int i = 0; i < arrayList.size(); i++) {
VisitorChat chat = arrayList.get(i);
WritableMap visitorMap = getChatMapObject(chat);
array.pushMap(visitorMap);
}
listCallback.invoke(null, array);
}
}
@Override
public void onFailure(int code, String message) {
WritableMap errorMap = new WritableNativeMap();
// No I18N
errorMap.putInt("code", code);
// No I18N
errorMap.putString("message", message);
listCallback.invoke(errorMap, null);
}
});
} else {
WritableMap errorMap = new WritableNativeMap();
// No I18N
errorMap.putInt("code", INVALID_FILTER_CODE);
// No I18N
errorMap.putString("message", INVALID_FILTER_TYPE);
listCallback.invoke(errorMap, null);
}
} catch (Exception e) {
LiveChatUtil.log(e);
}
}
});
}
use of com.facebook.react.bridge.WritableNativeArray in project SalesIQ-Mobilisten-ReactNative by zoho.
the class RNZohoSalesIQ method getChats.
@ReactMethod
public void getChats(@NonNull final Callback listCallback) {
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
public void run() {
ZohoSalesIQ.Chat.getList(new ConversationListener() {
@Override
public void onSuccess(ArrayList<VisitorChat> arrayList) {
if (arrayList != null) {
WritableArray array = new WritableNativeArray();
for (int i = 0; i < arrayList.size(); i++) {
VisitorChat chat = arrayList.get(i);
WritableMap visitorMap = getChatMapObject(chat);
array.pushMap(visitorMap);
}
listCallback.invoke(null, array);
}
}
@Override
public void onFailure(int code, String message) {
WritableMap errorMap = new WritableNativeMap();
// No I18N
errorMap.putInt("code", code);
// No I18N
errorMap.putString("message", message);
listCallback.invoke(errorMap, null);
}
});
}
});
}
use of com.facebook.react.bridge.WritableNativeArray in project react-native-callkeep by react-native-webrtc.
the class RNCallKeepModule method startObserving.
public void startObserving() {
int count = delayedEvents.size();
Log.d(TAG, "[RNCallKeepModule] startObserving, event count: " + count);
if (count > 0) {
this.reactContext.getJSModule(RCTDeviceEventEmitter.class).emit("RNCallKeepDidLoadWithEvents", delayedEvents);
delayedEvents = new WritableNativeArray();
}
}
use of com.facebook.react.bridge.WritableNativeArray in project maps by rnmapbox.
the class GeoJSONUtils method fromLatLng.
public static WritableArray fromLatLng(LatLng latLng) {
double[] coords = new double[] { latLng.getLongitude(), latLng.getLatitude() };
WritableArray writableCoords = new WritableNativeArray();
writableCoords.pushDouble(coords[0]);
writableCoords.pushDouble(coords[1]);
return writableCoords;
}
Aggregations