Updated on 2026-08-14
This commit is contained in:
commit
9eaa7b883f
91 changed files with 1336 additions and 917 deletions
|
|
@ -43,7 +43,7 @@ public class ConfirmWithFingerprintTask extends AsyncTask<Void, Void, Boolean> {
|
|||
onCancelled();
|
||||
|
||||
if (!success) {
|
||||
Toast.makeText(pinSaveFragment.getContext(), R.string.pin_save_fail, Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(pinSaveFragment.getContext(), R.string.pin_save_notification_failed, Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
pinSaveFragment.getFingerprintHelper().startAuth(pinSaveFragment.getFingerprintManager(), pinSaveFragment.getCryptoObject());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,13 +2,14 @@ package com.tangem.data.network;
|
|||
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.tangem.data.network.model.AdaliteBody;
|
||||
import com.tangem.data.network.model.AdaliteResponse;
|
||||
import com.tangem.data.network.model.AdaliteResponseUtxo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
|
@ -26,7 +27,14 @@ public class ServerApiAdalite {
|
|||
|
||||
private int requestsCount = 0;
|
||||
|
||||
public static String lastNode;
|
||||
private final String adaliteURL1 = "https://explorer2.adalite.io"; //TODO: make random selection, add more?, move
|
||||
private final String adaliteURL2 = "https://nodes.southeastasia.cloudapp.azure.com";
|
||||
|
||||
private String currentURL = adaliteURL1;
|
||||
|
||||
public String getCurrentURL() {
|
||||
return currentURL;
|
||||
}
|
||||
|
||||
public boolean isRequestsSequenceCompleted() {
|
||||
Log.i(TAG, String.format("isRequestsSequenceCompleted: %s (%d requests left)", String.valueOf(requestsCount <= 0), requestsCount));
|
||||
|
|
@ -50,12 +58,14 @@ public class ServerApiAdalite {
|
|||
}
|
||||
|
||||
public void requestData(String method, String wallet, String tx) {
|
||||
requestData(method, wallet, tx, false);
|
||||
}
|
||||
|
||||
public void requestData(String method, String wallet, String tx, boolean isRetry) {
|
||||
requestsCount++;
|
||||
String adaliteURL = "https://explorer2.adalite.io"; //TODO: make random selection
|
||||
this.lastNode = adaliteURL; //TODO: show node instead of URL
|
||||
|
||||
Retrofit retrofitAdalite = new Retrofit.Builder()
|
||||
.baseUrl(adaliteURL)
|
||||
.baseUrl(currentURL)
|
||||
.addConverterFactory(ScalarsConverterFactory.create())
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.build();
|
||||
|
|
@ -69,20 +79,32 @@ public class ServerApiAdalite {
|
|||
addressCall.enqueue(new Callback<AdaliteResponse>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<AdaliteResponse> call, @NonNull Response<AdaliteResponse> response) {
|
||||
requestsCount--;
|
||||
|
||||
if (response.code() == 200) {
|
||||
requestsCount--;
|
||||
responseListener.onSuccess(method, response.body());
|
||||
Log.i(TAG, "requestData " + method + " onResponse " + response.code());
|
||||
} else {
|
||||
responseListener.onFail(method, String.valueOf(response.code()));
|
||||
Log.e(TAG, "requestData " + method + " onResponse " + response.code());
|
||||
|
||||
if (!isRetry) {
|
||||
retryRequest(method, wallet, tx);
|
||||
} else {
|
||||
responseListener.onFail(method, String.valueOf(response.code()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<AdaliteResponse> call, @NonNull Throwable t) {
|
||||
responseListener.onFail(method, String.valueOf(t.getMessage()));
|
||||
Log.e(TAG, "requestData " + method + " onFailure " + t.getMessage());
|
||||
requestsCount--;
|
||||
|
||||
if (!isRetry) {
|
||||
retryRequest(method, wallet, tx);
|
||||
} else {
|
||||
responseListener.onFail(method, String.valueOf(t.getMessage()));
|
||||
}
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
|
@ -92,20 +114,32 @@ public class ServerApiAdalite {
|
|||
outputsCall.enqueue(new Callback<AdaliteResponseUtxo>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<AdaliteResponseUtxo> call, @NonNull Response<AdaliteResponseUtxo> response) {
|
||||
requestsCount--;
|
||||
|
||||
if (response.code() == 200) {
|
||||
requestsCount--;
|
||||
responseListener.onSuccess(method, response.body());
|
||||
Log.i(TAG, "requestData " + method + " onResponse " + response.code());
|
||||
} else {
|
||||
responseListener.onFail(method, String.valueOf(response.code()));
|
||||
Log.e(TAG, "requestData " + method + " onResponse " + response.code());
|
||||
|
||||
if (!isRetry) {
|
||||
retryRequest(method, wallet, tx);
|
||||
} else {
|
||||
responseListener.onFail(method, String.valueOf(response.code()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<AdaliteResponseUtxo> call, @NonNull Throwable t) {
|
||||
responseListener.onFail(method, String.valueOf(t.getMessage()));
|
||||
Log.e(TAG, "requestData " + method + " onFailure " + t.getMessage());
|
||||
requestsCount--;
|
||||
|
||||
if (!isRetry) {
|
||||
retryRequest(method, wallet, tx);
|
||||
} else {
|
||||
responseListener.onFail(method, String.valueOf(t.getMessage()));
|
||||
}
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
|
@ -115,30 +149,48 @@ public class ServerApiAdalite {
|
|||
sendCall.enqueue(new Callback<List>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<List> call, @NonNull Response<List> response) {
|
||||
requestsCount--;
|
||||
|
||||
if (response.code() == 200) {
|
||||
requestsCount--;
|
||||
responseListener.onSuccess(method, response.body());
|
||||
Log.i(TAG, "requestData " + method + " onResponse " + response.code());
|
||||
} else {
|
||||
responseListener.onFail(method, String.valueOf(response.code()));
|
||||
Log.e(TAG, "requestData " + method + " onResponse " + response.code());
|
||||
|
||||
if (!isRetry) {
|
||||
retryRequest(method, wallet, tx);
|
||||
} else {
|
||||
responseListener.onFail(method, String.valueOf(response.code()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List> call, @NonNull Throwable t) {
|
||||
responseListener.onFail(method, String.valueOf(t.getMessage()));
|
||||
Log.e(TAG, "requestData " + method + " onFailure " + t.getMessage());
|
||||
requestsCount--;
|
||||
|
||||
if (!isRetry) {
|
||||
retryRequest(method, wallet, tx);
|
||||
} else {
|
||||
responseListener.onFail(method, String.valueOf(t.getMessage()));
|
||||
}
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
||||
default:
|
||||
requestsCount--;
|
||||
responseListener.onFail(method, "undeclared method");
|
||||
Log.e(TAG, "requestData " + method + " onFailure - undeclared method");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void retryRequest(String method, String wallet, String tx) {
|
||||
currentURL = adaliteURL2;
|
||||
requestData(method, wallet, tx, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@ package com.tangem.data.network;
|
|||
import android.util.Log;
|
||||
|
||||
import com.tangem.App;
|
||||
import com.tangem.wallet.TangemContext;
|
||||
import com.tangem.data.Blockchain;
|
||||
import com.tangem.wallet.R;
|
||||
import com.tangem.wallet.TangemContext;
|
||||
import com.tangem.wallet.bch.BitcoinCashNode;
|
||||
import com.tangem.wallet.btc.BitcoinNode;
|
||||
import com.tangem.wallet.btc.BitcoinNodeTestNet;
|
||||
import com.tangem.wallet.ltc.LitecoinNode;
|
||||
import com.tangem.wallet.R;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
|
|
@ -32,7 +32,6 @@ import java.util.Random;
|
|||
import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.SSLSocket;
|
||||
import javax.net.ssl.SSLSocketFactory;
|
||||
import javax.net.ssl.TrustManager;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
|
|
@ -139,7 +138,7 @@ public class ServerApiElectrum {
|
|||
requestsCount--;
|
||||
Log.e(TAG, "requestData " + electrumRequest.getMethod() + " onError " + e.getMessage());
|
||||
Log.e(TAG, String.format("%d requests left in processing",requestsCount));
|
||||
electrumRequest.setError(ctx.getString(R.string.cannot_obtain_data_from_blockchain));
|
||||
electrumRequest.setError(ctx.getString(R.string.loaded_wallet_error_obtaining_blockchain_data));
|
||||
//setErrorOccurred(e.getMessage());//;
|
||||
responseListener.onFail(electrumRequest);
|
||||
}
|
||||
|
|
@ -252,18 +251,18 @@ public class ServerApiElectrum {
|
|||
if( (electrumRequest.getError()!=null && electrumRequest.getError().startsWith(ERROR_STARTS_WITH_CODE_32601)) )
|
||||
{
|
||||
// method unknown error???
|
||||
electrumRequest.setError(App.Companion.getInstance().getString(R.string.cannot_obtain_data_from_blockchain));
|
||||
electrumRequest.setError(App.Companion.getInstance().getString(R.string.loaded_wallet_error_obtaining_blockchain_data));
|
||||
electrumRequest.answerData=null;
|
||||
}
|
||||
} else {
|
||||
electrumRequest.setError(App.Companion.getInstance().getString(R.string.cannot_obtain_data_from_blockchain_no_answer));
|
||||
electrumRequest.setError(App.Companion.getInstance().getString(R.string.loaded_wallet_error_blockchain_empty_answer));
|
||||
Log.i(TAG, ">> <NULL>");
|
||||
}
|
||||
|
||||
} catch (ConnectException e) {
|
||||
//e.printStackTrace();
|
||||
//responseListener.onFail(e.getMessage());
|
||||
electrumRequest.setError(App.Companion.getInstance().getString(R.string.cannot_obtain_data_from_blockchain_no_connection));
|
||||
electrumRequest.setError(App.Companion.getInstance().getString(R.string.loaded_wallet_error_blockchain_connection_refused));
|
||||
Log.e(TAG, "doElectrumRequestTcp " + electrumRequest.getMethod() + " ConnectException " + e.getMessage());
|
||||
} finally {
|
||||
Log.i(TAG, "doElectrumRequestTcp " + electrumRequest.getMethod() + " socket.close");
|
||||
|
|
@ -274,13 +273,13 @@ public class ServerApiElectrum {
|
|||
{
|
||||
e.printStackTrace();
|
||||
Log.e(TAG,"Can't close socket");
|
||||
electrumRequest.setError(App.Companion.getInstance().getString(R.string.cannot_obtain_data_from_blockchain_communication_error));
|
||||
electrumRequest.setError(App.Companion.getInstance().getString(R.string.loaded_wallet_error_blockchain_communication_error));
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
//e.printStackTrace();
|
||||
//responseListener.onFail(e.getMessage());
|
||||
electrumRequest.setError(App.Companion.getInstance().getString(R.string.cannot_obtain_data_from_blockchain_communication_error));
|
||||
electrumRequest.setError(App.Companion.getInstance().getString(R.string.loaded_wallet_error_blockchain_communication_error));
|
||||
Log.e(TAG, "doElectrumRequestTcp " + electrumRequest.getMethod() + " IOException " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
|
@ -343,17 +342,17 @@ public class ServerApiElectrum {
|
|||
if( (electrumRequest.getError()!=null && electrumRequest.getError().startsWith(ERROR_STARTS_WITH_CODE_32601)) )
|
||||
{
|
||||
// method unknown error???
|
||||
electrumRequest.setError(App.Companion.getInstance().getString(R.string.cannot_obtain_data_from_blockchain));
|
||||
electrumRequest.setError(App.Companion.getInstance().getString(R.string.loaded_wallet_error_obtaining_blockchain_data));
|
||||
electrumRequest.answerData=null;
|
||||
}
|
||||
} else {
|
||||
electrumRequest.setError(App.Companion.getInstance().getString(R.string.cannot_obtain_data_from_blockchain_no_answer));
|
||||
electrumRequest.setError(App.Companion.getInstance().getString(R.string.loaded_wallet_error_blockchain_empty_answer));
|
||||
Log.i(TAG, ">> <NULL>");
|
||||
}
|
||||
|
||||
} catch (ConnectException e) {
|
||||
e.printStackTrace();
|
||||
electrumRequest.setError(App.Companion.getInstance().getString(R.string.cannot_obtain_data_from_blockchain_no_connection));
|
||||
electrumRequest.setError(App.Companion.getInstance().getString(R.string.loaded_wallet_error_blockchain_connection_refused));
|
||||
Log.e(TAG, "doElectrumRequestSsl " + electrumRequest.getMethod() + " ConnectException " + e.getMessage());
|
||||
} finally {
|
||||
Log.i(TAG, "doElectrumRequestSsl " + electrumRequest.getMethod() + " socket.close");
|
||||
|
|
@ -362,7 +361,7 @@ public class ServerApiElectrum {
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
electrumRequest.setError(App.Companion.getInstance().getString(R.string.cannot_obtain_data_from_blockchain_communication_error));
|
||||
electrumRequest.setError(App.Companion.getInstance().getString(R.string.loaded_wallet_error_blockchain_communication_error));
|
||||
e.printStackTrace();
|
||||
Log.e(TAG, "Can't close ssl socket");
|
||||
}
|
||||
|
|
@ -370,11 +369,11 @@ public class ServerApiElectrum {
|
|||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
electrumRequest.setError(App.Companion.getInstance().getString(R.string.cannot_obtain_data_from_blockchain_communication_error));
|
||||
electrumRequest.setError(App.Companion.getInstance().getString(R.string.loaded_wallet_error_blockchain_communication_error));
|
||||
Log.e(TAG, "doElectrumRequestSsl " + electrumRequest.getMethod() + " IOException " + e.getMessage());
|
||||
}
|
||||
} catch (NoSuchAlgorithmException | KeyManagementException e) {
|
||||
electrumRequest.setError(App.Companion.getInstance().getString(R.string.cannot_obtain_data_from_blockchain));
|
||||
electrumRequest.setError(App.Companion.getInstance().getString(R.string.loaded_wallet_error_obtaining_blockchain_data));
|
||||
Log.e(TAG, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
package com.tangem.data.network;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.tangem.App;
|
||||
import com.tangem.data.network.model.InfuraBody;
|
||||
import com.tangem.data.network.model.InfuraResponse;
|
||||
|
|
@ -84,8 +85,9 @@ public class ServerApiInfura {
|
|||
call.enqueue(new Callback<InfuraResponse>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<InfuraResponse> call, @NonNull Response<InfuraResponse> response) {
|
||||
requestsCount--;
|
||||
|
||||
if (response.code() == 200) {
|
||||
requestsCount--;
|
||||
responseListener.onSuccess(method, response.body());
|
||||
Log.i(TAG, "requestData " + method + " onResponse " + response.code());
|
||||
} else {
|
||||
|
|
@ -96,6 +98,7 @@ public class ServerApiInfura {
|
|||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<InfuraResponse> call, @NonNull Throwable t) {
|
||||
requestsCount--;
|
||||
responseListener.onFail(method, String.valueOf(t.getMessage()));
|
||||
Log.e(TAG, "requestData " + method + " onFailure " + t.getMessage());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,12 +2,13 @@ package com.tangem.data.network;
|
|||
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.tangem.data.network.model.InsightBody;
|
||||
import com.tangem.data.network.model.InsightResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
|
@ -64,8 +65,9 @@ public class ServerApiInsight {
|
|||
call.enqueue(new Callback<List<InsightResponse>>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<List<InsightResponse>> call, @NonNull Response<List<InsightResponse>> response) {
|
||||
requestsCount--;
|
||||
|
||||
if (response.code() == 200) {
|
||||
requestsCount--;
|
||||
responseListener.onSuccess(method, response.body());
|
||||
Log.i(TAG, "requestData " + method + " onResponse " + response.code());
|
||||
} else {
|
||||
|
|
@ -76,6 +78,7 @@ public class ServerApiInsight {
|
|||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<InsightResponse>> call, @NonNull Throwable t) {
|
||||
requestsCount--;
|
||||
responseListener.onFail(method, String.valueOf(t.getMessage()));
|
||||
Log.e(TAG, "requestData " + method + " onFailure " + t.getMessage());
|
||||
}
|
||||
|
|
@ -108,8 +111,9 @@ public class ServerApiInsight {
|
|||
call.enqueue(new Callback<InsightResponse>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<InsightResponse> call, @NonNull Response<InsightResponse> response) {
|
||||
requestsCount--;
|
||||
|
||||
if (response.code() == 200) {
|
||||
requestsCount--;
|
||||
responseListener.onSuccess(method, response.body());
|
||||
Log.i(TAG, "requestData " + method + " onResponse " + response.code());
|
||||
} else {
|
||||
|
|
@ -120,6 +124,7 @@ public class ServerApiInsight {
|
|||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<InsightResponse> call, @NonNull Throwable t) {
|
||||
requestsCount--;
|
||||
responseListener.onFail(method, String.valueOf(t.getMessage()));
|
||||
Log.e(TAG, "requestData " + method + " onFailure " + t.getMessage());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
package com.tangem.data.network;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.tangem.App;
|
||||
import com.tangem.data.network.model.InfuraBody;
|
||||
import com.tangem.data.network.model.InfuraResponse;
|
||||
|
|
@ -84,8 +85,9 @@ public class ServerApiMatic {
|
|||
call.enqueue(new Callback<InfuraResponse>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<InfuraResponse> call, @NonNull Response<InfuraResponse> response) {
|
||||
requestsCount--;
|
||||
|
||||
if (response.code() == 200) {
|
||||
requestsCount--;
|
||||
responseListener.onSuccess(method, response.body());
|
||||
Log.i(TAG, "requestData " + method + " onResponse " + response.code());
|
||||
} else {
|
||||
|
|
@ -96,6 +98,7 @@ public class ServerApiMatic {
|
|||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<InfuraResponse> call, @NonNull Throwable t) {
|
||||
requestsCount--;
|
||||
responseListener.onFail(method, String.valueOf(t.getMessage()));
|
||||
Log.e(TAG, "requestData " + method + " onFailure " + t.getMessage());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,8 +135,9 @@ public class ServerApiRipple {
|
|||
call.enqueue(new Callback<RippleResponse>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<RippleResponse> call, @NonNull Response<RippleResponse> response) {
|
||||
requestsCount--;
|
||||
|
||||
if (response.code() == 200) {
|
||||
requestsCount--;
|
||||
responseListener.onSuccess(method, response.body());
|
||||
Log.i(TAG, "requestData " + method + " onResponse " + response.code());
|
||||
} else {
|
||||
|
|
@ -147,6 +148,7 @@ public class ServerApiRipple {
|
|||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<RippleResponse> call, @NonNull Throwable t) {
|
||||
requestsCount--;
|
||||
responseListener.onFail(method, String.valueOf(t.getMessage()));
|
||||
Log.e(TAG, "requestData " + method + " onFailure " + t.getMessage());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
package com.tangem.data.network;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.tangem.App;
|
||||
import com.tangem.data.network.model.InfuraBody;
|
||||
import com.tangem.data.network.model.InfuraResponse;
|
||||
|
|
@ -84,8 +85,9 @@ public class ServerApiRootstock {
|
|||
call.enqueue(new Callback<InfuraResponse>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<InfuraResponse> call, @NonNull Response<InfuraResponse> response) {
|
||||
requestsCount--;
|
||||
|
||||
if (response.code() == 200) {
|
||||
requestsCount--;
|
||||
responseListener.onSuccess(method, response.body());
|
||||
Log.i(TAG, "requestData " + method + " onResponse " + response.code());
|
||||
} else {
|
||||
|
|
@ -96,6 +98,7 @@ public class ServerApiRootstock {
|
|||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<InfuraResponse> call, @NonNull Throwable t) {
|
||||
requestsCount--;
|
||||
responseListener.onFail(method, String.valueOf(t.getMessage()));
|
||||
Log.e(TAG, "requestData " + method + " onFailure " + t.getMessage());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,11 +2,12 @@ package com.tangem.data.network;
|
|||
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.tangem.App;
|
||||
import com.tangem.data.Blockchain;
|
||||
import com.tangem.data.network.model.SoChain;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
|
@ -164,9 +165,9 @@ public class ServerApiSoChain {
|
|||
call.enqueue(new Callback<SoChain.Response.GetTx>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<SoChain.Response.GetTx> call, @NonNull Response<SoChain.Response.GetTx> response) {
|
||||
requestsCount--;
|
||||
Log.i(TAG, "requestAddressBalance onResponse " + response.code());
|
||||
if (response.code() == 200) {
|
||||
requestsCount--;
|
||||
txInfoListener.onSuccess(response.body());
|
||||
} else {
|
||||
txInfoListener.onFail(String.valueOf(response.code()));
|
||||
|
|
@ -175,6 +176,7 @@ public class ServerApiSoChain {
|
|||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<SoChain.Response.GetTx> call, @NonNull Throwable t) {
|
||||
requestsCount--;
|
||||
Log.e(TAG, "requestAddressBalance onFailure " + t.getMessage());
|
||||
txInfoListener.onFail(String.valueOf(t.getMessage()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ public class ServerApiStellar {
|
|||
requestsCount--;
|
||||
LOG.e(TAG, "requestData " + stellarRequest.getClass().getSimpleName() + " onError " + e.getMessage());
|
||||
LOG.e(TAG, String.format("%d requests left in processing", requestsCount));
|
||||
stellarRequest.setError(ctx.getString(R.string.cannot_obtain_data_from_blockchain));
|
||||
stellarRequest.setError(ctx.getString(R.string.loaded_wallet_error_obtaining_blockchain_data));
|
||||
//setErrorOccurred(e.getMessage());//;
|
||||
listener.onFail(stellarRequest);
|
||||
}
|
||||
|
|
@ -161,7 +161,7 @@ public class ServerApiStellar {
|
|||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
stellarRequest.setError(App.Companion.getInstance().getString(R.string.cannot_obtain_data_from_blockchain_communication_error));
|
||||
stellarRequest.setError(App.Companion.getInstance().getString(R.string.loaded_wallet_error_blockchain_communication_error));
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue