use of com.fitpay.android.webview.models.RtmVersion in project fitpay-android-sdk by fitpay.
the class RtmParserV2 method parseMessage.
public void parseMessage(RtmMessage msg) {
String callbackId = msg.getCallbackId();
switch(msg.getType()) {
case RtmType.USER_DATA:
String deviceId = null;
String token = null;
String userId = null;
try {
JSONObject obj = new JSONObject(msg.getData());
deviceId = obj.getString("deviceId");
token = obj.getString("token");
userId = obj.getString("userId");
} catch (Exception e) {
FPLog.e(WV_DATA, e);
throwException("missing required message data");
}
impl.sendUserData(callbackId, deviceId, token, userId);
break;
case RtmType.SYNC:
SyncInfo syncInfo = Constants.getGson().fromJson(msg.getData(), SyncInfo.class);
if (null != syncInfo && null != syncInfo.getSyncId()) {
syncInfo.setInitiator(SyncInitiator.WEB_VIEW);
impl.sync(callbackId, syncInfo);
} else {
impl.sync(callbackId);
}
break;
case RtmType.VERSION:
try {
RtmVersion webAppRtmVersion = Constants.getGson().fromJson(msg.getJsonData(), RtmVersion.class);
if (webAppRtmVersion != null) {
impl.setWebAppRtmVersion(webAppRtmVersion);
} else {
throw new NullPointerException("RtmVersion is empty");
}
} catch (Exception e) {
FPLog.e(WV_DATA, e);
throwException("missing required message data");
}
break;
case RtmType.NO_HISTORY:
impl.onNoHistory();
break;
default:
super.parseMessage(msg);
}
}
Aggregations