* This file is part of MoLe.
* MoLe is free software: you can distribute it and/or modify it
* under the term of the GNU General Public License as published by
* This file is part of MoLe.
* MoLe is free software: you can distribute it and/or modify it
* under the term of the GNU General Public License as published by
import net.ktnx.mobileledger.json.Gateway;
import net.ktnx.mobileledger.model.LedgerTransaction;
import net.ktnx.mobileledger.model.LedgerTransactionAccount;
import net.ktnx.mobileledger.json.Gateway;
import net.ktnx.mobileledger.model.LedgerTransaction;
import net.ktnx.mobileledger.model.LedgerTransactionAccount;
import net.ktnx.mobileledger.utils.Globals;
import net.ktnx.mobileledger.utils.Logger;
import net.ktnx.mobileledger.utils.NetworkUtil;
import net.ktnx.mobileledger.utils.Globals;
import net.ktnx.mobileledger.utils.Logger;
import net.ktnx.mobileledger.utils.NetworkUtil;
public class SendTransactionTask extends AsyncTask<LedgerTransaction, Void, Void> {
private final TaskCallback taskCallback;
public class SendTransactionTask extends AsyncTask<LedgerTransaction, Void, Void> {
private final TaskCallback taskCallback;
HttpURLConnection http = NetworkUtil.prepareConnection(mProfile, "add");
http.setRequestMethod("PUT");
http.setRequestProperty("Content-Type", "application/json");
HttpURLConnection http = NetworkUtil.prepareConnection(mProfile, "add");
http.setRequestMethod("PUT");
http.setRequestProperty("Content-Type", "application/json");
Gateway gateway = Gateway.forApiVersion(apiVersion);
String body = gateway.transactionSaveRequest(transaction);
Gateway gateway = Gateway.forApiVersion(apiVersion);
String body = gateway.transactionSaveRequest(transaction);
- return sendRequest(http, body);
+ Logger.debug("network", "Sending using API " + apiVersion);
+ sendRequest(http, body);
- private boolean sendRequest(HttpURLConnection http, String body) throws IOException {
+ private void sendRequest(HttpURLConnection http, String body)
+ throws IOException, ApiNotSupportedException {
}
private boolean legacySendOK() throws IOException {
HttpURLConnection http = NetworkUtil.prepareConnection(mProfile, "add");
}
private boolean legacySendOK() throws IOException {
HttpURLConnection http = NetworkUtil.prepareConnection(mProfile, "add");
switch (profileApiVersion) {
case auto:
boolean sendOK = false;
for (API ver : API.allVersions) {
Logger.debug("network", "Trying version " + ver);
switch (profileApiVersion) {
case auto:
boolean sendOK = false;
for (API ver : API.allVersions) {
Logger.debug("network", "Trying version " + ver);