use of com.fanap.podchat.model.OutPutMapRout in project pod-chat-android-sdk by FanapSoft.
the class ChatCore method mapRouting.
public String mapRouting(RequestMapRouting request) {
String origin = request.getOrigin();
String destination = request.getDestination();
String uniqueId;
RetrofitHelperMap retrofitHelperMap = new RetrofitHelperMap("https://api.neshan.org/");
MapApi mapApi = retrofitHelperMap.getService(MapApi.class);
uniqueId = generateUniqueId();
Observable<Response<MapRout>> responseObservable = mapApi.mapRouting("8b77db18704aa646ee5aaea13e7370f4f88b9e8c", origin, destination, true);
String finalUniqueId = uniqueId;
responseObservable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(mapRoutResponse -> {
if (mapRoutResponse.isSuccessful()) {
MapRout mapRout = mapRoutResponse.body();
OutPutMapRout outPutMapRout = new OutPutMapRout();
outPutMapRout.setResult(mapRout);
String jsonMapRout = gson.toJson(outPutMapRout);
listenerManager.callOnMapRouting(jsonMapRout);
showLog("RECEIVE_MAP_ROUTING", jsonMapRout);
} else {
captureError(mapRoutResponse.message(), mapRoutResponse.code(), finalUniqueId);
}
}, (Throwable throwable) -> captureError(throwable.getMessage(), ChatConstant.ERROR_CODE_UNKNOWN_EXCEPTION, finalUniqueId, throwable));
return uniqueId;
}
use of com.fanap.podchat.model.OutPutMapRout in project pod-chat-android-sdk by FanapSoft.
the class ChatCore method mapRouting.
public String mapRouting(String origin, String destination) {
String uniqueId = generateUniqueId();
if (chatReady) {
RetrofitHelperMap retrofitHelperMap = new RetrofitHelperMap("https://api.neshan.org/");
MapApi mapApi = retrofitHelperMap.getService(MapApi.class);
Observable<Response<MapRout>> responseObservable = mapApi.mapRouting("8b77db18704aa646ee5aaea13e7370f4f88b9e8c", origin, destination, true);
responseObservable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(mapRoutResponse -> {
if (mapRoutResponse.isSuccessful()) {
MapRout mapRout = mapRoutResponse.body();
OutPutMapRout outPutMapRout = new OutPutMapRout();
outPutMapRout.setResult(mapRout);
String jsonMapRout = gson.toJson(outPutMapRout);
listenerManager.callOnMapRouting(jsonMapRout);
showLog("RECEIVE_MAP_ROUTING", jsonMapRout);
}
}, (Throwable throwable) -> captureError(ChatConstant.ERROR_CHAT_READY, ChatConstant.ERROR_CODE_CHAT_READY, uniqueId, throwable));
} else {
captureError(ChatConstant.ERROR_CHAT_READY, ChatConstant.ERROR_CODE_CHAT_READY, uniqueId);
}
return uniqueId;
}
Aggregations