use of com.zoho.livechat.android.listeners.FAQListener 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.zoho.livechat.android.listeners.FAQListener in project SalesIQ-Mobilisten-ReactNative by zoho.
the class RNZohoSalesIQ method getArticlesWithCategoryID.
@ReactMethod
public void getArticlesWithCategoryID(@NonNull final String categoryId, @NonNull final Callback articlesCallback) {
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
public void run() {
ZohoSalesIQ.FAQ.getArticles(categoryId, 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);
}
});
}
});
}
Aggregations