]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/async/SendTransactionTask.java
rename a method to better reflect its function
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / async / SendTransactionTask.java
index dbe4bc88647d87b129315d3d3edaff076028ba37..e7a26beb852f443073c3fcf58022335a467189b6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2020 Damyan Ivanov.
+ * Copyright © 2021 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
@@ -20,12 +20,12 @@ package net.ktnx.mobileledger.async;
 import android.os.AsyncTask;
 import android.util.Log;
 
+import net.ktnx.mobileledger.db.Profile;
 import net.ktnx.mobileledger.json.API;
 import net.ktnx.mobileledger.json.ApiNotSupportedException;
 import net.ktnx.mobileledger.json.Gateway;
 import net.ktnx.mobileledger.model.LedgerTransaction;
 import net.ktnx.mobileledger.model.LedgerTransactionAccount;
-import net.ktnx.mobileledger.model.MobileLedgerProfile;
 import net.ktnx.mobileledger.utils.Globals;
 import net.ktnx.mobileledger.utils.Logger;
 import net.ktnx.mobileledger.utils.NetworkUtil;
@@ -56,20 +56,20 @@ import static net.ktnx.mobileledger.utils.Logger.debug;
 
 public class SendTransactionTask extends AsyncTask<LedgerTransaction, Void, Void> {
     private final TaskCallback taskCallback;
-    private final MobileLedgerProfile mProfile;
+    private final Profile mProfile;
     private final boolean simulate;
     protected String error;
     private String token;
     private String session;
     private LedgerTransaction transaction;
 
-    public SendTransactionTask(TaskCallback callback, MobileLedgerProfile profile,
+    public SendTransactionTask(TaskCallback callback, Profile profile,
                                boolean simulate) {
         taskCallback = callback;
         mProfile = profile;
         this.simulate = simulate;
     }
-    public SendTransactionTask(TaskCallback callback, MobileLedgerProfile profile) {
+    public SendTransactionTask(TaskCallback callback, Profile profile) {
         taskCallback = callback;
         mProfile = profile;
         simulate = false;
@@ -253,7 +253,7 @@ public class SendTransactionTask extends AsyncTask<LedgerTransaction, Void, Void
         try {
             transaction = ledgerTransactions[0];
 
-            final API profileApiVersion = mProfile.getApiVersion();
+            final API profileApiVersion = API.valueOf(mProfile.getApiVersion());
             switch (profileApiVersion) {
                 case auto:
                     boolean sendOK = false;
@@ -307,7 +307,7 @@ public class SendTransactionTask extends AsyncTask<LedgerTransaction, Void, Void
     @Override
     protected void onPostExecute(Void aVoid) {
         super.onPostExecute(aVoid);
-        taskCallback.done(error);
+        taskCallback.onTransactionSaveDone(error, transaction);
     }
 
 }
\ No newline at end of file