use of run.wallet.iota.api.requests.ApiRequest in project run-wallet-android by runplay.
the class IotaRequestTask method doInBackground.
@Override
protected ApiResponse doInBackground(ApiRequest... params) {
Context context = this.context.get();
if (context != null) {
// SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
// String protocol = prefs.getString(Constants.PREFERENCE_NODE_PROTOCOL, Constants.PREFERENCE_NODE_DEFAULT_PROTOCOL);
// String host = prefs.getString(Constants.PREFERENCE_NODE_IP, Constants.PREFERENCE_NODE_DEFAULT_IP);
// int port = Integer.parseInt(prefs.getString(Constants.PREFERENCE_NODE_PORT, Constants.PREFERENCE_NODE_DEFAULT_PORT));
Nodes.Node node = Store.getNode();
// Log.e("NODE ON:",node.protocol+":"+node.ip+":"+node.port);
if (node != null) {
String protocol = node.protocol;
String host = node.ip;
int port = node.port;
if (IOTA.DEBUG) {
// Log.e("ApiRequest", params[0].toString());
start = new Date();
// Log.e("started req at", start.getTime() + "");
}
ApiRequest apiRequest = params[0];
tag = apiRequest.getClass().getCanonicalName();
ApiProvider apiProvider = new IotaApiProvider(protocol, host, port, context);
ApiResponse response = apiProvider.processRequest(apiRequest);
return response;
}
}
// TaskManager.removeTask(tag);
return null;
}
use of run.wallet.iota.api.requests.ApiRequest in project run-wallet-android by runplay.
the class MessageRequestTask method doInBackground.
@Override
protected ApiResponse doInBackground(ApiRequest... params) {
Context context = this.context.get();
if (context != null) {
// SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
// String protocol = prefs.getString(Constants.PREFERENCE_NODE_PROTOCOL, Constants.PREFERENCE_NODE_DEFAULT_PROTOCOL);
// String host = prefs.getString(Constants.PREFERENCE_NODE_IP, Constants.PREFERENCE_NODE_DEFAULT_IP);
// int port = Integer.parseInt(prefs.getString(Constants.PREFERENCE_NODE_PORT, Constants.PREFERENCE_NODE_DEFAULT_PORT));
Nodes.Node node = Store.getNode();
// Log.e("MESSAGE REQUEST NODE:",node.protocol+":"+node.ip+":"+node.port);
String protocol = node.protocol;
String host = node.ip;
int port = node.port;
// if (IOTA.DEBUG) {
// Log.e("ApiRequest", params[0].toString());
// start = new Date();
// Log.e("started at", start.getTime() + "");
// }
ApiRequest apiRequest = params[0];
tag = apiRequest.getClass().getCanonicalName();
ApiProvider apiProvider = new IotaMessageApiProvider(protocol, host, port, context);
ApiResponse response = apiProvider.processRequest(apiRequest);
return response;
}
TaskManager.removeTask(tag);
return null;
}
Aggregations