use of jota.dto.response.RunReplayBundleResponse in project run-wallet-android by runplay.
the class ReplayBundleRequestHandler method handle.
@Override
public ApiResponse handle(ApiRequest request) {
ApiResponse response;
int notificationId = Utils.createNewID();
// NotificationHelper.requestNotification(context, R.drawable.send_white, context.getString(R.string.notification_replay_bundle_request_title), notificationId);
if (Store.getNodeInfo() == null) {
NodeInfoRequestHandler.getNodeInfo(apiProxy, context);
}
try {
RunReplayBundleResponse jresponse = apiProxy.replayBundle(((ReplayBundleRequest) request).getHash(), ((ReplayBundleRequest) request).getDepth(), ((ReplayBundleRequest) request).getMinWeightMagnitude());
response = new ReplayBundleResponse(context, ((ReplayBundleRequest) request).getSeed(), jresponse);
} catch (ArgumentException e) {
NetworkError error = new NetworkError();
error.setErrorType(NetworkErrorType.INVALID_HASH_ERROR);
response = error;
}
if (!AppService.isAppStarted()) {
if (response instanceof ReplayBundleResponse && Arrays.asList(((ReplayBundleResponse) response).getSuccessfully()).contains(true)) {
NotificationHelper.responseNotification(context, R.drawable.ic_replay, context.getString(R.string.notification_replay_bundle_response_succeeded_title), notificationId);
} else if (response instanceof NetworkError) {
NotificationHelper.responseNotification(context, R.drawable.ic_replay, context.getString(R.string.notification_replay_bundle_response_failed_title), notificationId);
}
} else {
NotificationHelper.vibrate(context);
}
return response;
}
Aggregations