/*
- * Copyright © 2018 Damyan Ivanov.
+ * Copyright © 2019 Damyan Ivanov.
* This file is part of Mobile-Ledger.
* Mobile-Ledger is free software: you can distribute it and/or modify it
* under the term of the GNU General Public License as published by
package net.ktnx.mobileledger.async;
-import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.util.Log;
+import net.ktnx.mobileledger.model.Data;
import net.ktnx.mobileledger.model.LedgerTransaction;
import net.ktnx.mobileledger.model.LedgerTransactionAccount;
import net.ktnx.mobileledger.utils.NetworkUtil;
private LedgerTransaction ltr;
protected String error;
- private SharedPreferences pref;
- public void setPref(SharedPreferences pref) {
- this.pref = pref;
- }
-
public SaveTransactionTask(TaskCallback callback) {
task_callback = callback;
}
private boolean send_ok() throws IOException {
- HttpURLConnection http = NetworkUtil.prepare_connection(pref, "add");
+ HttpURLConnection http = NetworkUtil.prepare_connection("add");
http.setRequestMethod("POST");
http.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
http.setRequestProperty("Accept", "*/*");
protected Void doInBackground(LedgerTransaction... ledgerTransactions) {
error = null;
try {
- backend_url = pref.getString("backend_url", "");
+ backend_url = Data.profile.get().getUrl();
ltr = ledgerTransactions[0];
int tried = 0;