use of com.zoho.livechat.android.listeners.FAQCategoryListener in project SalesIQ-Mobilisten-ReactNative by zoho.
the class RNZohoSalesIQ method getCategories.
@ReactMethod
public void getCategories(@NonNull final Callback categoryCallback) {
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
public void run() {
ZohoSalesIQ.FAQ.getCategories(new FAQCategoryListener() {
@Override
public void onSuccess(ArrayList<SalesIQArticleCategory> categoryList) {
if (categoryList != null) {
WritableArray array = new WritableNativeArray();
for (int i = 0; i < categoryList.size(); i++) {
SalesIQArticleCategory category = categoryList.get(i);
WritableMap categoryMap = new WritableNativeMap();
// No I18N
categoryMap.putString("id", category.getCategoryid());
// No I18N
categoryMap.putString("name", category.getCategoryname());
// No I18N
categoryMap.putInt("articleCount", category.getCount());
array.pushMap(categoryMap);
}
categoryCallback.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);
categoryCallback.invoke(errorMap, null);
}
});
}
});
}
Aggregations