Search in sources :

Example 1 with DeviceStatusMessage

use of com.fitpay.android.webview.events.DeviceStatusMessage in project fitpay-android-sdk by fitpay.

the class WebViewCommunicatorImpl method logout.

/**
 * send logout message to JS
 */
public void logout() {
    RxBus.getInstance().post(new RtmMessageResponse("logout"));
    RxBus.getInstance().post(new DeviceStatusMessage(activity.getString(R.string.fp_connecting), deviceId, DeviceStatusMessage.PENDING));
}
Also used : RtmMessageResponse(com.fitpay.android.webview.events.RtmMessageResponse) DeviceStatusMessage(com.fitpay.android.webview.events.DeviceStatusMessage)

Example 2 with DeviceStatusMessage

use of com.fitpay.android.webview.events.DeviceStatusMessage in project fitpay-android-sdk by fitpay.

the class WebViewCommunicatorImpl method onTaskError.

private void onTaskError(@EventCallback.Command String command, String callbackId, String errorMessage) {
    AppResponseModel failedResponse = new AppResponseModel.Builder().status(RESPONSE_FAILURE).reason(errorMessage).build();
    FPLog.w(TAG, errorMessage);
    if (null != callbackId) {
        sendMessageToJs(callbackId, false, gson.toJson(failedResponse));
    }
    RxBus.getInstance().post(new DeviceStatusMessage(activity.getString(R.string.fp_sync_failed, errorMessage), deviceId, DeviceStatusMessage.ERROR));
    EventCallback eventCallback = new EventCallback.Builder().setCommand(command).setStatus(EventCallback.STATUS_FAILED).setReason(errorMessage).build();
    eventCallback.send();
}
Also used : DeviceStatusMessage(com.fitpay.android.webview.events.DeviceStatusMessage) EventCallback(com.fitpay.android.utils.EventCallback)

Aggregations

DeviceStatusMessage (com.fitpay.android.webview.events.DeviceStatusMessage)2 EventCallback (com.fitpay.android.utils.EventCallback)1 RtmMessageResponse (com.fitpay.android.webview.events.RtmMessageResponse)1