/*
- * 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
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;
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;
try {
transaction = ledgerTransactions[0];
- final API profileApiVersion = mProfile.getApiVersion();
+ final API profileApiVersion = API.valueOf(mProfile.getApiVersion());
switch (profileApiVersion) {
case auto:
boolean sendOK = false;
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
- taskCallback.done(error);
+ taskCallback.onTransactionSaveDone(error, transaction);
}
}
\ No newline at end of file