X-Git-Url: https://git.ktnx.net/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fasync%2FSendTransactionTask.java;h=f67e1844f052157d47e92f9e695c181646c43f2e;hb=4f8b4f8bf16aaef182e1aac31a34f88a2adf5fa8;hp=5170b9337a362dbcafc55cd6e66360056521157a;hpb=54002a662d97289a739d3cdb9888bbab58a8064f;p=mobile-ledger.git diff --git a/app/src/main/java/net/ktnx/mobileledger/async/SendTransactionTask.java b/app/src/main/java/net/ktnx/mobileledger/async/SendTransactionTask.java index 5170b933..f67e1844 100644 --- a/app/src/main/java/net/ktnx/mobileledger/async/SendTransactionTask.java +++ b/app/src/main/java/net/ktnx/mobileledger/async/SendTransactionTask.java @@ -1,5 +1,5 @@ /* - * Copyright © 2019 Damyan Ivanov. + * Copyright © 2020 Damyan Ivanov. * 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 @@ -32,6 +32,7 @@ import net.ktnx.mobileledger.model.MobileLedgerProfile; import net.ktnx.mobileledger.utils.Globals; import net.ktnx.mobileledger.utils.Logger; import net.ktnx.mobileledger.utils.NetworkUtil; +import net.ktnx.mobileledger.utils.SimpleDate; import net.ktnx.mobileledger.utils.UrlEncodedFormData; import java.io.BufferedReader; @@ -41,8 +42,6 @@ import java.io.InputStreamReader; import java.io.OutputStream; import java.net.HttpURLConnection; import java.nio.charset.StandardCharsets; -import java.util.Date; -import java.util.GregorianCalendar; import java.util.List; import java.util.Locale; import java.util.Map; @@ -52,12 +51,18 @@ import java.util.regex.Pattern; import static android.os.SystemClock.sleep; import static net.ktnx.mobileledger.utils.Logger.debug; +/* TODO: get rid of the custom session/cookie and auth code? + * (the last problem with the POST was the missing content-length header) + * This will resolve itself when hledger-web 1.14+ is released with Debian/stable, + * at which point the HTML form emulation can be dropped entirely + */ + public class SendTransactionTask extends AsyncTask { private final TaskCallback taskCallback; protected String error; private String token; private String session; - private LedgerTransaction ltr; + private LedgerTransaction transaction; private MobileLedgerProfile mProfile; private boolean simulate = false; @@ -79,7 +84,8 @@ public class SendTransactionTask extends AsyncTask= 2) - throw new IOException( - String.format("aborting after %d tries", tried)); + throw new IOException(String.format("aborting after %d tries", tried)); sleep(100); } }