Updated on 2026-08-14
This commit is contained in:
parent
61c4f7047d
commit
52ce16bb09
86 changed files with 9207 additions and 9295 deletions
|
|
@ -10,8 +10,8 @@ import android.support.v7.app.AppCompatActivity;
|
|||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import com.tangem.domain.wallet.TangemCard;
|
||||
import com.tangem.wallet.R;
|
||||
import com.tangem.wallet.Tangem_Card;
|
||||
import com.tangem.presentation.fragment.WalletInfoFragment;
|
||||
|
||||
public class CardInfoActivity extends AppCompatActivity implements WalletInfoFragment.OnFragmentInteractionListener {
|
||||
|
|
@ -32,7 +32,7 @@ public class CardInfoActivity extends AppCompatActivity implements WalletInfoFra
|
|||
private ViewPager mViewPager;
|
||||
|
||||
|
||||
private Tangem_Card mCard;
|
||||
private TangemCard mCard;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
|
@ -51,7 +51,7 @@ public class CardInfoActivity extends AppCompatActivity implements WalletInfoFra
|
|||
tabLayout.setupWithViewPager(mViewPager);
|
||||
|
||||
String UID = getIntent().getStringExtra("UID");
|
||||
mCard = new Tangem_Card(UID);
|
||||
mCard = new TangemCard(UID);
|
||||
mCard.LoadFromBundle(getIntent().getBundleExtra("Card"));
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,25 +22,25 @@ import android.widget.RadioGroup;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.tangem.data.network.request.ElectrumRequest;
|
||||
import com.tangem.domain.cardReader.NfcManager;
|
||||
import com.tangem.domain.cardReader.Util;
|
||||
import com.tangem.wallet.BTCUtils;
|
||||
import com.tangem.wallet.Blockchain;
|
||||
import com.tangem.wallet.CoinEngine;
|
||||
import com.tangem.wallet.CoinEngineFactory;
|
||||
import com.tangem.wallet.DerEncodingUtil;
|
||||
import com.tangem.data.network.request.Electrum_Request;
|
||||
import com.tangem.data.network.task.Electrum_Task;
|
||||
import com.tangem.wallet.Fee_Request;
|
||||
import com.tangem.data.network.task.Fee_Task;
|
||||
import com.tangem.wallet.FormatUtil;
|
||||
import com.tangem.wallet.Infura_Request;
|
||||
import com.tangem.data.network.task.Infura_Task;
|
||||
import com.tangem.domain.wallet.TangemCard;
|
||||
import com.tangem.util.Util;
|
||||
import com.tangem.domain.wallet.BTCUtils;
|
||||
import com.tangem.domain.wallet.Blockchain;
|
||||
import com.tangem.domain.wallet.CoinEngine;
|
||||
import com.tangem.domain.wallet.CoinEngineFactory;
|
||||
import com.tangem.domain.wallet.DerEncodingUtil;
|
||||
import com.tangem.data.network.task.ElectrumTask;
|
||||
import com.tangem.data.network.request.FeeRequest;
|
||||
import com.tangem.data.network.task.FeeTask;
|
||||
import com.tangem.domain.wallet.FormatUtil;
|
||||
import com.tangem.domain.wallet.Infura_Request;
|
||||
import com.tangem.data.network.task.InfuraTask;
|
||||
import com.tangem.wallet.R;
|
||||
import com.tangem.wallet.SharedData;
|
||||
import com.tangem.wallet.Tangem_Card;
|
||||
import com.tangem.wallet.Transaction;
|
||||
import com.tangem.wallet.UnspentOutputInfo;
|
||||
import com.tangem.domain.wallet.SharedData;
|
||||
import com.tangem.domain.wallet.Transaction;
|
||||
import com.tangem.domain.wallet.UnspentOutputInfo;
|
||||
|
||||
import org.json.JSONException;
|
||||
|
||||
|
|
@ -65,7 +65,7 @@ public class ConfirmPaymentActivity extends AppCompatActivity implements NfcAdap
|
|||
EditText etAmount;
|
||||
EditText etFee;
|
||||
ImageView ivCamera;
|
||||
Tangem_Card mCard;
|
||||
TangemCard mCard;
|
||||
RadioGroup rgFee;
|
||||
String minFee = null, maxFee = null, normalFee = null;
|
||||
Long minFeeInInternalUnits = 0L;
|
||||
|
|
@ -83,7 +83,7 @@ public class ConfirmPaymentActivity extends AppCompatActivity implements NfcAdap
|
|||
MainActivity.commonInit(getApplicationContext());
|
||||
mNfcManager = new NfcManager(this, this);
|
||||
|
||||
mCard = new Tangem_Card(getIntent().getStringExtra("UID"));
|
||||
mCard = new TangemCard(getIntent().getStringExtra("UID"));
|
||||
mCard.LoadFromBundle(getIntent().getExtras().getBundle("Card"));
|
||||
|
||||
progressBar = findViewById(R.id.progressBar);
|
||||
|
|
@ -269,8 +269,8 @@ public class ConfirmPaymentActivity extends AppCompatActivity implements NfcAdap
|
|||
//ConnectTask connectTaskEx = new ConnectTask(Blockchain.getNextServiceHost(mCard), Blockchain.getNextServicePort(mCard), data);
|
||||
ConnectTask connectTaskEx = new ConnectTask(nodeAddress, nodePort, data);
|
||||
|
||||
//connectTaskEx.execute(Electrum_Request.CheckBalance(mCard.getWallet()));
|
||||
connectTaskEx.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, Electrum_Request.CheckBalance(mCard.getWallet()));
|
||||
//connectTaskEx.execute(ElectrumRequest.CheckBalance(mCard.getWallet()));
|
||||
connectTaskEx.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, ElectrumRequest.CheckBalance(mCard.getWallet()));
|
||||
}
|
||||
|
||||
String nodeAddress = engineCoin.GetNode(mCard);
|
||||
|
|
@ -279,7 +279,7 @@ public class ConfirmPaymentActivity extends AppCompatActivity implements NfcAdap
|
|||
|
||||
//ConnectTask connectTask = new ConnectTask(Blockchain.getServiceHost(mCard), Blockchain.getServicePort(mCard));
|
||||
|
||||
connectTask.execute(/*Electrum_Request.CheckBalance(mCard.getWallet()), */Electrum_Request.GetFee(mCard.getWallet()));
|
||||
connectTask.execute(/*ElectrumRequest.CheckBalance(mCard.getWallet()), */ElectrumRequest.GetFee(mCard.getWallet()));
|
||||
|
||||
int calcSize = 256;
|
||||
try {
|
||||
|
|
@ -295,9 +295,9 @@ public class ConfirmPaymentActivity extends AppCompatActivity implements NfcAdap
|
|||
|
||||
ConnectFeeTask feeTask = new ConnectFeeTask(sharedFee);
|
||||
|
||||
feeTask.execute(Fee_Request.GetFee(mCard.getWallet(), calcSize, Fee_Request.NORMAL),
|
||||
Fee_Request.GetFee(mCard.getWallet(), calcSize, Fee_Request.MINIMAL),
|
||||
Fee_Request.GetFee(mCard.getWallet(), calcSize, Fee_Request.PRIORITY));
|
||||
feeTask.execute(FeeRequest.GetFee(mCard.getWallet(), calcSize, FeeRequest.NORMAL),
|
||||
FeeRequest.GetFee(mCard.getWallet(), calcSize, FeeRequest.MINIMAL),
|
||||
FeeRequest.GetFee(mCard.getWallet(), calcSize, FeeRequest.PRIORITY));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -322,7 +322,7 @@ public class ConfirmPaymentActivity extends AppCompatActivity implements NfcAdap
|
|||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == REQUEST_CODE_SIGN_PAYMENT) {
|
||||
if (data != null && data.getExtras().containsKey("UID") && data.getExtras().containsKey("Card")) {
|
||||
Tangem_Card updatedCard = new Tangem_Card(data.getStringExtra("UID"));
|
||||
TangemCard updatedCard = new TangemCard(data.getStringExtra("UID"));
|
||||
updatedCard.LoadFromBundle(data.getBundleExtra("Card"));
|
||||
mCard = updatedCard;
|
||||
}
|
||||
|
|
@ -377,7 +377,7 @@ public class ConfirmPaymentActivity extends AppCompatActivity implements NfcAdap
|
|||
byte[] pbComprKey = mCard.getWalletPublicKeyRar();
|
||||
|
||||
// Build script for our address
|
||||
List<Tangem_Card.UnspentTransaction> rawTxList = mCard.getUnspentTransactions();
|
||||
List<TangemCard.UnspentTransaction> rawTxList = mCard.getUnspentTransactions();
|
||||
byte[] outputScriptWeAreAbleToSpend = Transaction.Script.buildOutput(myAddress).bytes;
|
||||
|
||||
// Collect unspent
|
||||
|
|
@ -437,7 +437,7 @@ public class ConfirmPaymentActivity extends AppCompatActivity implements NfcAdap
|
|||
return realTX.length;
|
||||
}
|
||||
|
||||
private class ConnectTask extends Electrum_Task {
|
||||
private class ConnectTask extends ElectrumTask {
|
||||
public ConnectTask(String host, int port) {
|
||||
super(host, port);
|
||||
}
|
||||
|
|
@ -452,12 +452,12 @@ public class ConfirmPaymentActivity extends AppCompatActivity implements NfcAdap
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(List<Electrum_Request> requests) {
|
||||
protected void onPostExecute(List<ElectrumRequest> requests) {
|
||||
super.onPostExecute(requests);
|
||||
for (Electrum_Request request : requests) {
|
||||
for (ElectrumRequest request : requests) {
|
||||
try {
|
||||
if (request.error == null) {
|
||||
if (request.isMethod(Electrum_Request.METHOD_GetBalance)) {
|
||||
if (request.isMethod(ElectrumRequest.METHOD_GetBalance)) {
|
||||
try {
|
||||
etFee.setText("--");
|
||||
|
||||
|
|
@ -490,7 +490,7 @@ public class ConfirmPaymentActivity extends AppCompatActivity implements NfcAdap
|
|||
FinishActivityWithError(Activity.RESULT_CANCELED, "Cannot check balance! No connection with blockchain nodes");
|
||||
}
|
||||
}
|
||||
} else if (request.isMethod(Electrum_Request.METHOD_GetFee)) {
|
||||
} else if (request.isMethod(ElectrumRequest.METHOD_GetFee)) {
|
||||
if (request.getResultString() == "-1") {
|
||||
etFee.setText("3");
|
||||
}
|
||||
|
|
@ -526,7 +526,7 @@ public class ConfirmPaymentActivity extends AppCompatActivity implements NfcAdap
|
|||
}
|
||||
}
|
||||
|
||||
private class ETHRequestTask extends Infura_Task {
|
||||
private class ETHRequestTask extends InfuraTask {
|
||||
ETHRequestTask(Blockchain blockchain) {
|
||||
super(blockchain);
|
||||
}
|
||||
|
|
@ -577,15 +577,15 @@ public class ConfirmPaymentActivity extends AppCompatActivity implements NfcAdap
|
|||
}
|
||||
}
|
||||
|
||||
private class ConnectFeeTask extends Fee_Task {
|
||||
private class ConnectFeeTask extends FeeTask {
|
||||
public ConnectFeeTask(SharedData sharedData) {
|
||||
super(sharedData);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(List<Fee_Request> requests) {
|
||||
protected void onPostExecute(List<FeeRequest> requests) {
|
||||
super.onPostExecute(requests);
|
||||
for (Fee_Request request : requests) {
|
||||
for (FeeRequest request : requests) {
|
||||
if (request.error == null) {
|
||||
long minFeeRate = 0;
|
||||
|
||||
|
|
@ -651,12 +651,12 @@ public class ConfirmPaymentActivity extends AppCompatActivity implements NfcAdap
|
|||
|
||||
finalFee = Math.round(finalFee) / (float) 10000;
|
||||
|
||||
if (request.getBlockCount() == Fee_Request.MINIMAL) {
|
||||
if (request.getBlockCount() == FeeRequest.MINIMAL) {
|
||||
minFee = String.valueOf(finalFee);
|
||||
minFeeInInternalUnits = mCard.InternalUnitsFromString(String.valueOf(finalFee));
|
||||
} else if (request.getBlockCount() == Fee_Request.NORMAL) {
|
||||
} else if (request.getBlockCount() == FeeRequest.NORMAL) {
|
||||
normalFee = String.valueOf(finalFee);
|
||||
} else if (request.getBlockCount() == Fee_Request.PRIORITY) {
|
||||
} else if (request.getBlockCount() == FeeRequest.PRIORITY) {
|
||||
maxFee = String.valueOf(finalFee);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,17 +17,17 @@ import android.widget.Toast;
|
|||
|
||||
import com.tangem.domain.cardReader.CardProtocol;
|
||||
import com.tangem.domain.cardReader.NfcManager;
|
||||
import com.tangem.domain.cardReader.Util;
|
||||
import com.tangem.domain.wallet.TangemCard;
|
||||
import com.tangem.util.Util;
|
||||
import com.tangem.presentation.dialog.NoExtendedLengthSupportDialog;
|
||||
import com.tangem.wallet.PINStorage;
|
||||
import com.tangem.domain.wallet.PINStorage;
|
||||
import com.tangem.wallet.R;
|
||||
import com.tangem.wallet.Tangem_Card;
|
||||
import com.tangem.presentation.dialog.WaitSecurityDelayDialog;
|
||||
|
||||
public class CreateNewWalletActivity extends AppCompatActivity implements NfcAdapter.ReaderCallback, CardProtocol.Notifications {
|
||||
|
||||
public static final int RESULT_INVALID_PIN = Activity.RESULT_FIRST_USER;
|
||||
private Tangem_Card mCard;
|
||||
private TangemCard mCard;
|
||||
private TextView tvCardID;
|
||||
private NfcManager mNfcManager;
|
||||
private static final String logTag = "CreateNewActivity";
|
||||
|
|
@ -41,7 +41,7 @@ public class CreateNewWalletActivity extends AppCompatActivity implements NfcAda
|
|||
setContentView(R.layout.activity_create_new_wallet);
|
||||
|
||||
MainActivity.commonInit(getApplicationContext());
|
||||
mCard = new Tangem_Card(getIntent().getStringExtra("UID"));
|
||||
mCard = new TangemCard(getIntent().getStringExtra("UID"));
|
||||
mCard.LoadFromBundle(getIntent().getExtras().getBundle("Card"));
|
||||
|
||||
tvCardID = (TextView) findViewById(R.id.tvCardID);
|
||||
|
|
|
|||
|
|
@ -19,11 +19,11 @@ import android.widget.Toast;
|
|||
|
||||
import com.tangem.domain.cardReader.CardProtocol;
|
||||
import com.tangem.domain.cardReader.NfcManager;
|
||||
import com.tangem.domain.cardReader.Util;
|
||||
import com.tangem.domain.wallet.TangemCard;
|
||||
import com.tangem.util.Util;
|
||||
import com.tangem.presentation.dialog.NoExtendedLengthSupportDialog;
|
||||
import com.tangem.wallet.R;
|
||||
import com.tangem.wallet.Tangem_Card;
|
||||
import com.tangem.wallet.VerifyCardTask;
|
||||
import com.tangem.data.network.task.VerifyCardTask;
|
||||
import com.tangem.presentation.dialog.WaitSecurityDelayDialog;
|
||||
|
||||
public class EmptyWalletActivity extends AppCompatActivity implements NfcAdapter.ReaderCallback, CardProtocol.Notifications {
|
||||
|
|
@ -31,7 +31,7 @@ public class EmptyWalletActivity extends AppCompatActivity implements NfcAdapter
|
|||
private static final int REQUEST_CODE_CREATE_NEW_WALLET_ACTIVITY = 2;
|
||||
private static final int REQUEST_CODE_REQUEST_PIN2 = 3;
|
||||
private static final int REQUEST_CODE_VERIFY_CARD = 4;
|
||||
Tangem_Card mCard;
|
||||
TangemCard mCard;
|
||||
TextView tvCardID, tvIssuer, tvIssuerData, tvBlockchain;
|
||||
ProgressBar progressBar;
|
||||
ImageView ivBlockchain, ivPIN, ivPIN2orSecurityDelay, ivDeveloperVersion;
|
||||
|
|
@ -51,7 +51,7 @@ public class EmptyWalletActivity extends AppCompatActivity implements NfcAdapter
|
|||
MainActivity.commonInit(getApplicationContext());
|
||||
mNfcManager = new NfcManager(this, this);
|
||||
|
||||
mCard = new Tangem_Card(getIntent().getStringExtra("UID"));
|
||||
mCard = new TangemCard(getIntent().getStringExtra("UID"));
|
||||
mCard.LoadFromBundle(getIntent().getExtras().getBundle("Card"));
|
||||
|
||||
tvCardID = findViewById(R.id.tvCardID);
|
||||
|
|
@ -181,7 +181,7 @@ public class EmptyWalletActivity extends AppCompatActivity implements NfcAdapter
|
|||
finish();
|
||||
} else {
|
||||
if (data != null && data.getExtras().containsKey("UID") && data.getExtras().containsKey("Card")) {
|
||||
Tangem_Card updatedCard = new Tangem_Card(data.getStringExtra("UID"));
|
||||
TangemCard updatedCard = new TangemCard(data.getStringExtra("UID"));
|
||||
updatedCard.LoadFromBundle(data.getBundleExtra("Card"));
|
||||
mCard = updatedCard;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import android.nfc.Tag;
|
|||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
|
||||
import com.tangem.presentation.fragment.LoadedWalletActivityFragment;
|
||||
import com.tangem.presentation.fragment.LoadedWalletFragment;
|
||||
import com.tangem.wallet.R;
|
||||
|
||||
|
||||
|
|
@ -23,7 +23,7 @@ public class LoadedWalletActivity extends AppCompatActivity {
|
|||
{
|
||||
Tag tag=getIntent().getParcelableExtra(NfcAdapter.EXTRA_TAG);
|
||||
if (tag != null ) {
|
||||
LoadedWalletActivityFragment fragment=(LoadedWalletActivityFragment)(getSupportFragmentManager().findFragmentById(R.id.loaded_wallet_fragment));
|
||||
LoadedWalletFragment fragment=(LoadedWalletFragment)(getSupportFragmentManager().findFragmentById(R.id.loaded_wallet_fragment));
|
||||
fragment.onTagDiscovered(tag);
|
||||
}
|
||||
}
|
||||
|
|
@ -31,8 +31,8 @@ public class LoadedWalletActivity extends AppCompatActivity {
|
|||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
LoadedWalletActivityFragment loadedWalletActivityFragment=(LoadedWalletActivityFragment) getSupportFragmentManager().findFragmentById(R.id.loaded_wallet_fragment);
|
||||
Intent data= loadedWalletActivityFragment.prepareResultIntent();
|
||||
LoadedWalletFragment loadedWalletFragment =(LoadedWalletFragment) getSupportFragmentManager().findFragmentById(R.id.loaded_wallet_fragment);
|
||||
Intent data= loadedWalletFragment.prepareResultIntent();
|
||||
data.putExtra("modification", "update");
|
||||
setResult(Activity.RESULT_OK, data);
|
||||
finish();
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package com.tangem.presentation.activity;
|
|||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
|
@ -23,39 +22,33 @@ public class LogoActivity extends AppCompatActivity {
|
|||
}
|
||||
};
|
||||
|
||||
ImageView imgLogo;
|
||||
private ImageView imgLogo;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.activity_logo);
|
||||
|
||||
imgLogo= (ImageView) findViewById(R.id.imgLogo);
|
||||
// Set up the user interaction to manually show or hide the system UI.
|
||||
imgLogo.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {hide();
|
||||
}
|
||||
});
|
||||
imgLogo = findViewById(R.id.imgLogo);
|
||||
|
||||
// set up the user interaction to manually show or hide the system UI.
|
||||
imgLogo.setOnClickListener(view -> hide());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostCreate(Bundle savedInstanceState) {
|
||||
super.onPostCreate(savedInstanceState);
|
||||
|
||||
// Trigger the initial hide() shortly after the activity has been
|
||||
// created, to briefly hint to the user that UI controls
|
||||
// are available.
|
||||
TextView AppVersion = (TextView) findViewById(R.id.AppVersion);
|
||||
// trigger the initial hide() shortly after the activity has been created, to briefly hint to the user that UI controls are available.
|
||||
TextView AppVersion = findViewById(R.id.AppVersion);
|
||||
AppVersion.setText("BETA v." + BuildConfig.VERSION_NAME);
|
||||
if( !getIntent().getBooleanExtra("skipAutoHide",false)) {
|
||||
if (!getIntent().getBooleanExtra("skipAutoHide", false)) {
|
||||
delayedHide(1000);
|
||||
}
|
||||
}
|
||||
|
||||
private void hide() {
|
||||
Intent intent=new Intent(getBaseContext(),MainActivity.class);
|
||||
Intent intent = new Intent(getBaseContext(), MainActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,14 +30,14 @@ import android.widget.TextView;
|
|||
|
||||
import com.scottyab.rootbeer.RootBeer;
|
||||
import com.skyfishjy.library.RippleBackground;
|
||||
import com.tangem.LogFileProvider;
|
||||
import com.tangem.domain.wallet.DeviceNFCAntennaLocation;
|
||||
import com.tangem.domain.wallet.LastSignStorage;
|
||||
import com.tangem.domain.wallet.Logger;
|
||||
import com.tangem.domain.wallet.PINStorage;
|
||||
import com.tangem.util.PhoneUtility;
|
||||
import com.tangem.presentation.fragment.MainFragment;
|
||||
import com.tangem.wallet.BuildConfig;
|
||||
import com.tangem.wallet.DeviceNFCAntennaLocation;
|
||||
import com.tangem.wallet.LastSignStorage;
|
||||
import com.tangem.wallet.LogFileProvider;
|
||||
import com.tangem.wallet.Logger;
|
||||
import com.tangem.presentation.fragment.MainActivityFragment;
|
||||
import com.tangem.wallet.PINStorage;
|
||||
import com.tangem.wallet.PhoneUtility;
|
||||
import com.tangem.wallet.R;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
|
|
@ -165,8 +165,8 @@ public class MainActivity extends AppCompatActivity implements PopupMenu.OnMenuI
|
|||
}
|
||||
});
|
||||
|
||||
MainActivityFragment mainActivityFragment=(MainActivityFragment)getSupportFragmentManager().findFragmentById(R.id.fragmentMain);
|
||||
if( mainActivityFragment.getCardListAdapter().getItemCount()>0 )
|
||||
MainFragment mainFragment =(MainFragment)getSupportFragmentManager().findFragmentById(R.id.fragmentMain);
|
||||
if( mainFragment.getCardListAdapter().getItemCount()>0 )
|
||||
{
|
||||
showCleanButton();
|
||||
}else {
|
||||
|
|
|
|||
|
|
@ -18,12 +18,12 @@ import android.widget.ImageView;
|
|||
import android.widget.TextView;
|
||||
|
||||
import com.tangem.domain.cardReader.NfcManager;
|
||||
import com.tangem.wallet.Blockchain;
|
||||
import com.tangem.wallet.CoinEngine;
|
||||
import com.tangem.wallet.CoinEngineFactory;
|
||||
import com.tangem.wallet.FormatUtil;
|
||||
import com.tangem.domain.wallet.Blockchain;
|
||||
import com.tangem.domain.wallet.CoinEngine;
|
||||
import com.tangem.domain.wallet.CoinEngineFactory;
|
||||
import com.tangem.domain.wallet.FormatUtil;
|
||||
import com.tangem.domain.wallet.TangemCard;
|
||||
import com.tangem.wallet.R;
|
||||
import com.tangem.wallet.Tangem_Card;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ public class PreparePaymentActivity extends AppCompatActivity implements NfcAdap
|
|||
TextView tvCardId, tvBalance, tvBalanceEquivalent, tvAmountEquivalent;
|
||||
ImageView ivCamera;
|
||||
boolean use_mCurrency;
|
||||
Tangem_Card mCard;
|
||||
TangemCard mCard;
|
||||
private NfcManager mNfcManager;
|
||||
|
||||
@Override
|
||||
|
|
@ -50,7 +50,7 @@ public class PreparePaymentActivity extends AppCompatActivity implements NfcAdap
|
|||
|
||||
mNfcManager = new NfcManager(this, this);
|
||||
|
||||
mCard = new Tangem_Card(getIntent().getStringExtra("UID"));
|
||||
mCard = new TangemCard(getIntent().getStringExtra("UID"));
|
||||
mCard.LoadFromBundle(getIntent().getExtras().getBundle("Card"));
|
||||
|
||||
btnVerify = (Button) findViewById(R.id.btnVerify);
|
||||
|
|
|
|||
|
|
@ -17,18 +17,18 @@ import android.widget.Toast;
|
|||
|
||||
import com.tangem.domain.cardReader.CardProtocol;
|
||||
import com.tangem.domain.cardReader.NfcManager;
|
||||
import com.tangem.domain.cardReader.Util;
|
||||
import com.tangem.domain.wallet.TangemCard;
|
||||
import com.tangem.util.Util;
|
||||
import com.tangem.presentation.dialog.NoExtendedLengthSupportDialog;
|
||||
import com.tangem.wallet.PINStorage;
|
||||
import com.tangem.domain.wallet.PINStorage;
|
||||
import com.tangem.wallet.R;
|
||||
import com.tangem.wallet.Tangem_Card;
|
||||
import com.tangem.presentation.dialog.WaitSecurityDelayDialog;
|
||||
|
||||
public class PurgeActivity extends AppCompatActivity implements NfcAdapter.ReaderCallback, CardProtocol.Notifications {
|
||||
|
||||
public static final int RESULT_INVALID_PIN = Activity.RESULT_FIRST_USER;
|
||||
|
||||
private Tangem_Card mCard;
|
||||
private TangemCard mCard;
|
||||
private TextView tvCardID;
|
||||
private NfcManager mNfcManager;
|
||||
private static final String logTag = "Purge";
|
||||
|
|
@ -42,7 +42,7 @@ public class PurgeActivity extends AppCompatActivity implements NfcAdapter.Reade
|
|||
|
||||
MainActivity.commonInit(getApplicationContext());
|
||||
|
||||
mCard = new Tangem_Card(getIntent().getStringExtra("UID"));
|
||||
mCard = new TangemCard(getIntent().getStringExtra("UID"));
|
||||
mCard.LoadFromBundle(getIntent().getExtras().getBundle("Card"));
|
||||
|
||||
tvCardID = (TextView) findViewById(R.id.tvCardID);
|
||||
|
|
|
|||
|
|
@ -27,10 +27,10 @@ import android.widget.ImageView;
|
|||
import android.widget.TextView;
|
||||
|
||||
import com.tangem.domain.cardReader.NfcManager;
|
||||
import com.tangem.wallet.FingerprintHelper;
|
||||
import com.tangem.wallet.PINStorage;
|
||||
import com.tangem.domain.wallet.FingerprintHelper;
|
||||
import com.tangem.domain.wallet.PINStorage;
|
||||
import com.tangem.domain.wallet.TangemCard;
|
||||
import com.tangem.wallet.R;
|
||||
import com.tangem.wallet.Tangem_Card;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.KeyStore;
|
||||
|
|
@ -149,10 +149,10 @@ public class RequestPINActivity extends AppCompatActivity implements NfcAdapter.
|
|||
tvPrompt.setText("Confirm new PIN2");
|
||||
} else if (mode == Mode.RequestPIN2) {
|
||||
String UID = getIntent().getStringExtra("UID");
|
||||
Tangem_Card mCard = new Tangem_Card(UID);
|
||||
TangemCard mCard = new TangemCard(UID);
|
||||
mCard.LoadFromBundle(getIntent().getBundleExtra("Card"));
|
||||
|
||||
if (mCard.PIN2 == Tangem_Card.PIN2_Mode.DefaultPIN2 || mCard.PIN2 == Tangem_Card.PIN2_Mode.Unchecked) {
|
||||
if (mCard.PIN2 == TangemCard.PIN2_Mode.DefaultPIN2 || mCard.PIN2 == TangemCard.PIN2_Mode.Unchecked) {
|
||||
// if we know PIN2 or not try default previously - use it
|
||||
PINStorage.setPIN2(PINStorage.getDefaultPIN2());
|
||||
setResult(Activity.RESULT_OK);
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ import android.widget.CheckBox;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.tangem.wallet.FingerprintHelper;
|
||||
import com.tangem.wallet.PINStorage;
|
||||
import com.tangem.domain.wallet.FingerprintHelper;
|
||||
import com.tangem.domain.wallet.PINStorage;
|
||||
import com.tangem.wallet.R;
|
||||
|
||||
import java.io.IOException;
|
||||
|
|
|
|||
|
|
@ -8,17 +8,17 @@ import android.view.KeyEvent;
|
|||
import android.widget.ProgressBar;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.tangem.wallet.Blockchain;
|
||||
import com.tangem.wallet.CoinEngine;
|
||||
import com.tangem.wallet.CoinEngineFactory;
|
||||
import com.tangem.data.network.request.Electrum_Request;
|
||||
import com.tangem.data.network.task.Electrum_Task;
|
||||
import com.tangem.wallet.Infura_Request;
|
||||
import com.tangem.data.network.task.Infura_Task;
|
||||
import com.tangem.wallet.LastSignStorage;
|
||||
import com.tangem.domain.wallet.Blockchain;
|
||||
import com.tangem.domain.wallet.CoinEngine;
|
||||
import com.tangem.domain.wallet.CoinEngineFactory;
|
||||
import com.tangem.data.network.request.ElectrumRequest;
|
||||
import com.tangem.data.network.task.ElectrumTask;
|
||||
import com.tangem.domain.wallet.Infura_Request;
|
||||
import com.tangem.data.network.task.InfuraTask;
|
||||
import com.tangem.domain.wallet.LastSignStorage;
|
||||
import com.tangem.domain.wallet.TangemCard;
|
||||
import com.tangem.wallet.R;
|
||||
import com.tangem.wallet.SharedData;
|
||||
import com.tangem.wallet.Tangem_Card;
|
||||
import com.tangem.domain.wallet.SharedData;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
|
@ -29,7 +29,7 @@ import java.util.List;
|
|||
public class SendTransactionActivity extends AppCompatActivity {
|
||||
|
||||
ProgressBar progressBar;
|
||||
private Tangem_Card mCard;
|
||||
private TangemCard mCard;
|
||||
private String tx;
|
||||
|
||||
@Override
|
||||
|
|
@ -42,7 +42,7 @@ public class SendTransactionActivity extends AppCompatActivity {
|
|||
progressBar = findViewById(R.id.progressBar);
|
||||
|
||||
Intent intent = getIntent();
|
||||
mCard = new Tangem_Card(getIntent().getStringExtra("UID"));
|
||||
mCard = new TangemCard(getIntent().getStringExtra("UID"));
|
||||
mCard.LoadFromBundle(intent.getExtras().getBundle("Card"));
|
||||
tx = intent.getStringExtra("TX");
|
||||
|
||||
|
|
@ -57,13 +57,13 @@ public class SendTransactionActivity extends AppCompatActivity {
|
|||
String nodeAddress = engine.GetNode(mCard);
|
||||
int nodePort = engine.GetNodePort(mCard);
|
||||
ConnectTask connectTask = new ConnectTask(nodeAddress, nodePort);
|
||||
connectTask.execute(Electrum_Request.Broadcast(mCard.getWallet(), tx));
|
||||
connectTask.execute(ElectrumRequest.Broadcast(mCard.getWallet(), tx));
|
||||
}
|
||||
else if (mCard.getBlockchain() == Blockchain.BitcoinCash || mCard.getBlockchain() == Blockchain.BitcoinCashTestNet ) {
|
||||
String nodeAddress = engine.GetNode(mCard);
|
||||
int nodePort = engine.GetNodePort(mCard);
|
||||
ConnectTask connectTask = new ConnectTask(nodeAddress, nodePort);
|
||||
connectTask.execute(Electrum_Request.Broadcast(mCard.getWallet(), tx));
|
||||
connectTask.execute(ElectrumRequest.Broadcast(mCard.getWallet(), tx));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -93,7 +93,7 @@ public class SendTransactionActivity extends AppCompatActivity {
|
|||
finish();
|
||||
}
|
||||
|
||||
private class ETHRequestTask extends Infura_Task {
|
||||
private class ETHRequestTask extends InfuraTask {
|
||||
ETHRequestTask(Blockchain blockchain){
|
||||
super(blockchain);
|
||||
}
|
||||
|
|
@ -152,7 +152,7 @@ public class SendTransactionActivity extends AppCompatActivity {
|
|||
}
|
||||
}
|
||||
|
||||
private class ConnectTask extends Electrum_Task {
|
||||
private class ConnectTask extends ElectrumTask {
|
||||
public ConnectTask(String host, int port) {
|
||||
super(host, port);
|
||||
}
|
||||
|
|
@ -167,14 +167,14 @@ public class SendTransactionActivity extends AppCompatActivity {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(List<Electrum_Request> requests) {
|
||||
protected void onPostExecute(List<ElectrumRequest> requests) {
|
||||
super.onPostExecute(requests);
|
||||
CoinEngine engine = CoinEngineFactory.Create(Blockchain.Bitcoin);
|
||||
|
||||
for (Electrum_Request request : requests) {
|
||||
for (ElectrumRequest request : requests) {
|
||||
try {
|
||||
if (request.error == null) {
|
||||
if (request.isMethod(Electrum_Request.METHOD_SendTransaction)) {
|
||||
if (request.isMethod(ElectrumRequest.METHOD_SendTransaction)) {
|
||||
try {
|
||||
String hashTX = request.getResultString();
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -17,17 +17,17 @@ import android.widget.Toast;
|
|||
|
||||
import com.tangem.domain.cardReader.CardProtocol;
|
||||
import com.tangem.domain.cardReader.NfcManager;
|
||||
import com.tangem.domain.cardReader.Util;
|
||||
import com.tangem.domain.wallet.TangemCard;
|
||||
import com.tangem.util.Util;
|
||||
import com.tangem.presentation.dialog.NoExtendedLengthSupportDialog;
|
||||
import com.tangem.wallet.PINStorage;
|
||||
import com.tangem.domain.wallet.PINStorage;
|
||||
import com.tangem.wallet.R;
|
||||
import com.tangem.wallet.Tangem_Card;
|
||||
import com.tangem.presentation.dialog.WaitSecurityDelayDialog;
|
||||
|
||||
public class SwapPINActivity extends AppCompatActivity implements NfcAdapter.ReaderCallback, CardProtocol.Notifications {
|
||||
|
||||
public static final int RESULT_INVALID_PIN = Activity.RESULT_FIRST_USER;
|
||||
private Tangem_Card mCard;
|
||||
private TangemCard mCard;
|
||||
private NfcManager mNfcManager;
|
||||
private static final String logTag = "SwapPIN";
|
||||
private ProgressBar progressBar;
|
||||
|
|
@ -42,7 +42,7 @@ public class SwapPINActivity extends AppCompatActivity implements NfcAdapter.Rea
|
|||
|
||||
MainActivity.commonInit(getApplicationContext());
|
||||
|
||||
mCard = new Tangem_Card(getIntent().getStringExtra("UID"));
|
||||
mCard = new TangemCard(getIntent().getStringExtra("UID"));
|
||||
mCard.LoadFromBundle(getIntent().getExtras().getBundle("Card"));
|
||||
|
||||
newPIN = getIntent().getStringExtra("newPIN");
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import android.os.Bundle;
|
|||
import android.support.v7.app.AppCompatActivity;
|
||||
|
||||
import com.tangem.wallet.R;
|
||||
import com.tangem.presentation.fragment.VerifyCardActivityFragment;
|
||||
import com.tangem.presentation.fragment.VerifyCardFragment;
|
||||
|
||||
public class VerifyCardActivity extends AppCompatActivity {
|
||||
|
||||
|
|
@ -21,8 +21,8 @@ public class VerifyCardActivity extends AppCompatActivity {
|
|||
@Override
|
||||
public void onBackPressed() {
|
||||
//super.onBackPressed();
|
||||
VerifyCardActivityFragment verifyCardActivityFragment = (VerifyCardActivityFragment) getSupportFragmentManager().findFragmentById(R.id.verify_card_fragment);
|
||||
Intent data = verifyCardActivityFragment.prepareResultIntent();
|
||||
VerifyCardFragment verifyCardFragment = (VerifyCardFragment) getSupportFragmentManager().findFragmentById(R.id.verify_card_fragment);
|
||||
Intent data = verifyCardFragment.prepareResultIntent();
|
||||
data.putExtra("modification", "update");
|
||||
setResult(Activity.RESULT_OK, data);
|
||||
finish();
|
||||
|
|
|
|||
|
|
@ -12,11 +12,11 @@ import android.view.ViewGroup;
|
|||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.tangem.wallet.Blockchain;
|
||||
import com.tangem.wallet.CoinEngine;
|
||||
import com.tangem.wallet.CoinEngineFactory;
|
||||
import com.tangem.domain.wallet.Blockchain;
|
||||
import com.tangem.domain.wallet.CoinEngine;
|
||||
import com.tangem.domain.wallet.CoinEngineFactory;
|
||||
import com.tangem.domain.wallet.TangemCard;
|
||||
import com.tangem.wallet.R;
|
||||
import com.tangem.wallet.Tangem_Card;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
|
|
@ -27,7 +27,7 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static com.tangem.wallet.Tangem_Card.CountOurTx;
|
||||
import static com.tangem.domain.wallet.TangemCard.CountOurTx;
|
||||
|
||||
public class CardListAdapter extends RecyclerView.Adapter<CardListAdapter.CardViewHolder> {
|
||||
|
||||
|
|
@ -81,7 +81,7 @@ public class CardListAdapter extends RecyclerView.Adapter<CardListAdapter.CardVi
|
|||
private LayoutInflater mLayoutInflater;
|
||||
private Context mContext;
|
||||
private UiCallbacks mUiCallbacks;
|
||||
private List<Tangem_Card> mCards = new ArrayList<>(100);
|
||||
private List<TangemCard> mCards = new ArrayList<>(100);
|
||||
|
||||
public CardListAdapter(LayoutInflater layoutInflater, Bundle instate, UiCallbacks uiCallbacks) {
|
||||
mLayoutInflater = layoutInflater;
|
||||
|
|
@ -94,7 +94,7 @@ public class CardListAdapter extends RecyclerView.Adapter<CardListAdapter.CardVi
|
|||
|
||||
if( UIDs!=null ) {
|
||||
for (String UID : UIDs) {
|
||||
Tangem_Card card = new Tangem_Card(UID);
|
||||
TangemCard card = new TangemCard(UID);
|
||||
card.LoadFromBundle(instate.getBundle(String.format("card_%s", UID)));
|
||||
mCards.add(card);
|
||||
}
|
||||
|
|
@ -105,7 +105,7 @@ public class CardListAdapter extends RecyclerView.Adapter<CardListAdapter.CardVi
|
|||
|
||||
public void onSaveInstanceState(Bundle outstate) {
|
||||
ArrayList<String> UIDs = new ArrayList<String>(mCards.size());
|
||||
for (Tangem_Card card : mCards) {
|
||||
for (TangemCard card : mCards) {
|
||||
Bundle B = new Bundle();
|
||||
card.SaveToBundle(B);
|
||||
outstate.putBundle(String.format("card_%s", card.getUID()), B);
|
||||
|
|
@ -119,12 +119,12 @@ public class CardListAdapter extends RecyclerView.Adapter<CardListAdapter.CardVi
|
|||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public Tangem_Card getCard(int cardIndex) {
|
||||
public TangemCard getCard(int cardIndex) {
|
||||
return mCards.get(cardIndex);
|
||||
}
|
||||
|
||||
public Tangem_Card getCardByWallet(String walletAddress) {
|
||||
for (Tangem_Card c : mCards) {
|
||||
public TangemCard getCardByWallet(String walletAddress) {
|
||||
for (TangemCard c : mCards) {
|
||||
if (c.getWallet().equals(walletAddress)) {
|
||||
return c;
|
||||
}
|
||||
|
|
@ -132,7 +132,7 @@ public class CardListAdapter extends RecyclerView.Adapter<CardListAdapter.CardVi
|
|||
return null;
|
||||
}
|
||||
|
||||
public void addCard(Tangem_Card card) {
|
||||
public void addCard(TangemCard card) {
|
||||
mCards.add(0,card);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
|
@ -142,7 +142,7 @@ public class CardListAdapter extends RecyclerView.Adapter<CardListAdapter.CardVi
|
|||
notifyItemRemoved(cardIndex);
|
||||
}
|
||||
|
||||
public void removeCard(Tangem_Card card) {
|
||||
public void removeCard(TangemCard card) {
|
||||
int i;
|
||||
for (i = 0; i < mCards.size(); i++) {
|
||||
if (Arrays.equals(mCards.get(i).getCID(), card.getCID())) {
|
||||
|
|
@ -156,7 +156,7 @@ public class CardListAdapter extends RecyclerView.Adapter<CardListAdapter.CardVi
|
|||
}
|
||||
|
||||
|
||||
public void updateCard(Tangem_Card card) {
|
||||
public void updateCard(TangemCard card) {
|
||||
int i;
|
||||
for (i = 0; i < mCards.size(); i++) {
|
||||
if (Arrays.equals(mCards.get(i).getCID(), card.getCID())) {
|
||||
|
|
@ -174,7 +174,7 @@ public class CardListAdapter extends RecyclerView.Adapter<CardListAdapter.CardVi
|
|||
}
|
||||
|
||||
public void UpdateWalletBalance(String walletAddress, Long balanceConfirmed, Long balanceUnconfirmed, String validationNodeDescription) {
|
||||
for (Tangem_Card c : mCards) {
|
||||
for (TangemCard c : mCards) {
|
||||
if (c.getWallet().equals(walletAddress)) {
|
||||
c.setBalanceConfirmed(balanceConfirmed);
|
||||
c.setBalanceUnconfirmed(balanceUnconfirmed);
|
||||
|
|
@ -188,7 +188,7 @@ public class CardListAdapter extends RecyclerView.Adapter<CardListAdapter.CardVi
|
|||
|
||||
|
||||
public void UpdateWalletCoutConfirmTx(String walletAddress, BigInteger nonce) {
|
||||
for (Tangem_Card c : mCards) {
|
||||
for (TangemCard c : mCards) {
|
||||
if (c.getWallet().equals(walletAddress)) {
|
||||
c.SetConfirmTXCount(nonce);
|
||||
notifyDataSetChanged();
|
||||
|
|
@ -198,7 +198,7 @@ public class CardListAdapter extends RecyclerView.Adapter<CardListAdapter.CardVi
|
|||
}
|
||||
|
||||
public void UpdateWalletBlockchain(String walletAddress, Blockchain blockchain) {
|
||||
for (Tangem_Card c : mCards) {
|
||||
for (TangemCard c : mCards) {
|
||||
if (c.getWallet().equals(walletAddress)) {
|
||||
c.setBlockchainID(blockchain.getID());
|
||||
notifyDataSetChanged();
|
||||
|
|
@ -208,7 +208,7 @@ public class CardListAdapter extends RecyclerView.Adapter<CardListAdapter.CardVi
|
|||
}
|
||||
|
||||
public void AddWalletBlockchainNameToken(String walletAddress) {
|
||||
for (Tangem_Card c : mCards) {
|
||||
for (TangemCard c : mCards) {
|
||||
if (c.getWallet().equals(walletAddress)) {
|
||||
c.addTokenToBlockchainName();
|
||||
notifyDataSetChanged();
|
||||
|
|
@ -218,7 +218,7 @@ public class CardListAdapter extends RecyclerView.Adapter<CardListAdapter.CardVi
|
|||
}
|
||||
|
||||
public void UpdateWalletBalance(String walletAddress, Long balanceConfirmed, String balanceString, String validationNodeDescription) {
|
||||
for (Tangem_Card c : mCards) {
|
||||
for (TangemCard c : mCards) {
|
||||
if (c.getWallet().equals(walletAddress)) {
|
||||
c.setBalanceConfirmed(balanceConfirmed);
|
||||
c.setBalanceUnconfirmed(0L);
|
||||
|
|
@ -231,7 +231,7 @@ public class CardListAdapter extends RecyclerView.Adapter<CardListAdapter.CardVi
|
|||
}
|
||||
|
||||
public void UpdateWalletBalanceOnlyAlter(String walletAddress, String balanceAlter) {
|
||||
for (Tangem_Card c : mCards) {
|
||||
for (TangemCard c : mCards) {
|
||||
if (c.getWallet().equals(walletAddress)) {
|
||||
c.setDecimalBalanceAlter(balanceAlter);
|
||||
notifyDataSetChanged();
|
||||
|
|
@ -241,13 +241,13 @@ public class CardListAdapter extends RecyclerView.Adapter<CardListAdapter.CardVi
|
|||
}
|
||||
|
||||
public void UpdateWalletUnspent(String walletAddress, JSONArray jsUnspentArray) {
|
||||
for (Tangem_Card c : mCards) {
|
||||
for (TangemCard c : mCards) {
|
||||
if (c.getWallet().equals(walletAddress)) {
|
||||
try {
|
||||
c.getUnspentTransactions().clear();
|
||||
for (int i = 0; i < jsUnspentArray.length(); i++) {
|
||||
JSONObject jsUnspent = jsUnspentArray.getJSONObject(i);
|
||||
Tangem_Card.UnspentTransaction trUnspent = new Tangem_Card.UnspentTransaction();
|
||||
TangemCard.UnspentTransaction trUnspent = new TangemCard.UnspentTransaction();
|
||||
trUnspent.txID = jsUnspent.getString("tx_hash");
|
||||
trUnspent.Amount = jsUnspent.getInt("value");
|
||||
trUnspent.Height = jsUnspent.getInt("height");
|
||||
|
|
@ -263,13 +263,13 @@ public class CardListAdapter extends RecyclerView.Adapter<CardListAdapter.CardVi
|
|||
}
|
||||
|
||||
public void UpdateWalletHistory(String walletAddress, JSONArray jsHistoryArray) {
|
||||
for (Tangem_Card c : mCards) {
|
||||
for (TangemCard c : mCards) {
|
||||
if (c.getWallet().equals(walletAddress)) {
|
||||
try {
|
||||
c.getHistoryTransactions().clear();
|
||||
for (int i = 0; i < jsHistoryArray.length(); i++) {
|
||||
JSONObject jsUnspent = jsHistoryArray.getJSONObject(i);
|
||||
Tangem_Card.HistoryTransaction trHistory = new Tangem_Card.HistoryTransaction();
|
||||
TangemCard.HistoryTransaction trHistory = new TangemCard.HistoryTransaction();
|
||||
trHistory.txID = jsUnspent.getString("tx_hash");
|
||||
trHistory.Height = jsUnspent.getInt("height");
|
||||
c.getHistoryTransactions().add(trHistory);
|
||||
|
|
@ -284,11 +284,11 @@ public class CardListAdapter extends RecyclerView.Adapter<CardListAdapter.CardVi
|
|||
}
|
||||
|
||||
public void UpdateWalletHeader(String walletAddress, JSONObject jsHeader) {
|
||||
for (Tangem_Card c : mCards) {
|
||||
for (TangemCard c : mCards) {
|
||||
if (c.getWallet().equals(walletAddress)) {
|
||||
try {
|
||||
c.getHaedersInfo();
|
||||
c.UpdateHeaderInfo(new Tangem_Card.HeaderInfo(
|
||||
c.UpdateHeaderInfo(new TangemCard.HeaderInfo(
|
||||
jsHeader.getInt("block_height"),
|
||||
jsHeader.getInt("timestamp")));
|
||||
} catch (JSONException e) {
|
||||
|
|
@ -301,7 +301,7 @@ public class CardListAdapter extends RecyclerView.Adapter<CardListAdapter.CardVi
|
|||
}
|
||||
|
||||
public void UpdateRate(String walletAddress, float rate) {
|
||||
for (Tangem_Card c : mCards) {
|
||||
for (TangemCard c : mCards) {
|
||||
if (c.getWallet().equals(walletAddress)) {
|
||||
c.setRate(rate);
|
||||
notifyDataSetChanged();
|
||||
|
|
@ -311,7 +311,7 @@ public class CardListAdapter extends RecyclerView.Adapter<CardListAdapter.CardVi
|
|||
}
|
||||
|
||||
public void UpdateRateAlter(String walletAddress, float rate) {
|
||||
for (Tangem_Card c : mCards) {
|
||||
for (TangemCard c : mCards) {
|
||||
if (c.getWallet().equals(walletAddress)) {
|
||||
c.setRateAlter(rate);
|
||||
notifyDataSetChanged();
|
||||
|
|
@ -321,18 +321,18 @@ public class CardListAdapter extends RecyclerView.Adapter<CardListAdapter.CardVi
|
|||
}
|
||||
|
||||
public void UpdateTransaction(String walletAddress, String txHash, String raw) {
|
||||
for (Tangem_Card c : mCards) {
|
||||
for (TangemCard c : mCards) {
|
||||
if (c.getWallet().equals(walletAddress)) {
|
||||
|
||||
List<Tangem_Card.UnspentTransaction> listTx = c.getUnspentTransactions();
|
||||
for (Tangem_Card.UnspentTransaction tx : listTx) {
|
||||
List<TangemCard.UnspentTransaction> listTx = c.getUnspentTransactions();
|
||||
for (TangemCard.UnspentTransaction tx : listTx) {
|
||||
if (tx.txID.equals(txHash)) {
|
||||
tx.Raw = raw;
|
||||
}
|
||||
}
|
||||
|
||||
List<Tangem_Card.HistoryTransaction> listHTx = c.getHistoryTransactions();
|
||||
for (Tangem_Card.HistoryTransaction tx : listHTx) {
|
||||
List<TangemCard.HistoryTransaction> listHTx = c.getHistoryTransactions();
|
||||
for (TangemCard.HistoryTransaction tx : listHTx) {
|
||||
if (tx.txID.equals(txHash)) {
|
||||
tx.Raw = raw;
|
||||
CountOurTx(listHTx);
|
||||
|
|
@ -345,7 +345,7 @@ public class CardListAdapter extends RecyclerView.Adapter<CardListAdapter.CardVi
|
|||
}
|
||||
|
||||
public void UpdateWalletError(String walletAddress, String error) {
|
||||
for (Tangem_Card c : mCards) {
|
||||
for (TangemCard c : mCards) {
|
||||
if (c.getWallet().equals(walletAddress)) {
|
||||
c.setError(error);
|
||||
notifyDataSetChanged();
|
||||
|
|
@ -370,7 +370,7 @@ public class CardListAdapter extends RecyclerView.Adapter<CardListAdapter.CardVi
|
|||
public void onBindViewHolder(CardViewHolder holder, int position) {
|
||||
|
||||
try {
|
||||
Tangem_Card card = mCards.get(position);
|
||||
TangemCard card = mCards.get(position);
|
||||
CoinEngine engine = CoinEngineFactory.Create(card.getBlockchain());
|
||||
|
||||
int color = android.R.color.black;
|
||||
|
|
@ -583,7 +583,7 @@ public class CardListAdapter extends RecyclerView.Adapter<CardListAdapter.CardVi
|
|||
}
|
||||
|
||||
private class CardClickListener implements View.OnClickListener {
|
||||
Tangem_Card card;
|
||||
TangemCard card;
|
||||
int pos;
|
||||
|
||||
CardClickListener(int position) {
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ import android.view.ViewGroup;
|
|||
import android.widget.BaseAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.tangem.domain.wallet.TangemCard;
|
||||
import com.tangem.wallet.R;
|
||||
import com.tangem.wallet.Tangem_Card;
|
||||
|
||||
import static android.text.Html.FROM_HTML_MODE_COMPACT;
|
||||
|
||||
|
|
@ -21,9 +21,9 @@ import static android.text.Html.FROM_HTML_MODE_COMPACT;
|
|||
public class CardUnspentListAdapter extends BaseAdapter {
|
||||
private LayoutInflater mLayoutInflater;
|
||||
private Context mContext;
|
||||
private Tangem_Card mCard;
|
||||
private TangemCard mCard;
|
||||
|
||||
public CardUnspentListAdapter(LayoutInflater layoutInflater, Tangem_Card card) {
|
||||
public CardUnspentListAdapter(LayoutInflater layoutInflater, TangemCard card) {
|
||||
mLayoutInflater = layoutInflater;
|
||||
mContext = layoutInflater.getContext();
|
||||
mCard = card;
|
||||
|
|
@ -58,7 +58,7 @@ public class CardUnspentListAdapter extends BaseAdapter {
|
|||
}
|
||||
TextView tvItem = (TextView) convertView.findViewById(R.id.tvItem);
|
||||
|
||||
Tangem_Card.UnspentTransaction unspentTransaction = (Tangem_Card.UnspentTransaction) getItem(position);
|
||||
TangemCard.UnspentTransaction unspentTransaction = (TangemCard.UnspentTransaction) getItem(position);
|
||||
|
||||
String html=String.format("<b>%d mBTC</b><br>%s", unspentTransaction.Amount, unspentTransaction.txID);
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ public class CardUnspentListAdapter extends BaseAdapter {
|
|||
}
|
||||
|
||||
public void UpdateUnspent(String tx_hash, int value, int height) {
|
||||
Tangem_Card.UnspentTransaction newUT=new Tangem_Card.UnspentTransaction();
|
||||
TangemCard.UnspentTransaction newUT=new TangemCard.UnspentTransaction();
|
||||
newUT.txID=tx_hash;
|
||||
newUT.Amount=value;
|
||||
newUT.Height=height;
|
||||
|
|
|
|||
|
|
@ -39,33 +39,33 @@ import com.google.zxing.WriterException;
|
|||
import com.google.zxing.common.BitMatrix;
|
||||
import com.google.zxing.qrcode.QRCodeWriter;
|
||||
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
|
||||
import com.tangem.data.network.request.ElectrumRequest;
|
||||
import com.tangem.domain.cardReader.CardProtocol;
|
||||
import com.tangem.domain.cardReader.NfcManager;
|
||||
import com.tangem.domain.cardReader.Util;
|
||||
import com.tangem.domain.wallet.TangemCard;
|
||||
import com.tangem.util.Util;
|
||||
import com.tangem.presentation.activity.CreateNewWalletActivity;
|
||||
import com.tangem.presentation.activity.PreparePaymentActivity;
|
||||
import com.tangem.presentation.activity.PurgeActivity;
|
||||
import com.tangem.presentation.activity.RequestPINActivity;
|
||||
import com.tangem.presentation.activity.SwapPINActivity;
|
||||
import com.tangem.presentation.activity.VerifyCardActivity;
|
||||
import com.tangem.wallet.BTCUtils;
|
||||
import com.tangem.wallet.BitcoinException;
|
||||
import com.tangem.wallet.Blockchain;
|
||||
import com.tangem.wallet.CoinEngine;
|
||||
import com.tangem.wallet.CoinEngineFactory;
|
||||
import com.tangem.data.network.request.Electrum_Request;
|
||||
import com.tangem.data.network.task.Electrum_Task;
|
||||
import com.tangem.domain.wallet.BTCUtils;
|
||||
import com.tangem.domain.wallet.BitcoinException;
|
||||
import com.tangem.domain.wallet.Blockchain;
|
||||
import com.tangem.domain.wallet.CoinEngine;
|
||||
import com.tangem.domain.wallet.CoinEngineFactory;
|
||||
import com.tangem.data.network.task.ElectrumTask;
|
||||
import com.tangem.data.network.request.ExchangeRequest;
|
||||
import com.tangem.data.network.task.ExchangeTask;
|
||||
import com.tangem.wallet.Infura_Request;
|
||||
import com.tangem.data.network.task.Infura_Task;
|
||||
import com.tangem.wallet.LastSignStorage;
|
||||
import com.tangem.domain.wallet.Infura_Request;
|
||||
import com.tangem.data.network.task.InfuraTask;
|
||||
import com.tangem.domain.wallet.LastSignStorage;
|
||||
import com.tangem.presentation.dialog.NoExtendedLengthSupportDialog;
|
||||
import com.tangem.wallet.PINStorage;
|
||||
import com.tangem.domain.wallet.PINStorage;
|
||||
import com.tangem.wallet.R;
|
||||
import com.tangem.wallet.SharedData;
|
||||
import com.tangem.wallet.Tangem_Card;
|
||||
import com.tangem.wallet.VerifyCardTask;
|
||||
import com.tangem.domain.wallet.SharedData;
|
||||
import com.tangem.data.network.task.VerifyCardTask;
|
||||
import com.tangem.presentation.dialog.WaitSecurityDelayDialog;
|
||||
|
||||
import org.json.JSONArray;
|
||||
|
|
@ -84,7 +84,7 @@ import static android.content.Context.CLIPBOARD_SERVICE;
|
|||
/**
|
||||
* A placeholder fragment containing a simple view.
|
||||
*/
|
||||
public class LoadedWalletActivityFragment extends Fragment implements SwipeRefreshLayout.OnRefreshListener, NfcAdapter.ReaderCallback, CardProtocol.Notifications {
|
||||
public class LoadedWalletFragment extends Fragment implements SwipeRefreshLayout.OnRefreshListener, NfcAdapter.ReaderCallback, CardProtocol.Notifications {
|
||||
|
||||
|
||||
private static final int REQUEST_CODE_SEND_PAYMENT = 1;
|
||||
|
|
@ -95,7 +95,7 @@ public class LoadedWalletActivityFragment extends Fragment implements SwipeRefre
|
|||
private static final int REQUEST_CODE_ENTER_NEW_PIN2 = 6;
|
||||
private static final int REQUEST_CODE_REQUEST_PIN2_FOR_SWAP_PIN = 7;
|
||||
private static final int REQUEST_CODE_SWAP_PIN = 8;
|
||||
Tangem_Card mCard;
|
||||
TangemCard mCard;
|
||||
TextView tvCardID, tvBalance, tvOffline, tvBalanceEquivalent, tvWallet, tvInputs, lbInputs, tvOutputs, tvSend, tvPurge, tvError, tvMessage, tvIssuer, tvIssuerData, tvBlockchain, tvLastInput, tvLastOutput, lbLastOutput, tvValidationNode;
|
||||
TextView tvHeader, tvCaution;
|
||||
ImageView imgLookup;
|
||||
|
|
@ -110,7 +110,7 @@ public class LoadedWalletActivityFragment extends Fragment implements SwipeRefre
|
|||
private VerifyCardTask verifyCardTask = null;
|
||||
private int requestPIN2Count = 0;
|
||||
|
||||
public LoadedWalletActivityFragment() {
|
||||
public LoadedWalletFragment() {
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -136,14 +136,14 @@ public class LoadedWalletActivityFragment extends Fragment implements SwipeRefre
|
|||
String nodeAddress = engine.GetNextNode(mCard);
|
||||
int nodePort = engine.GetNextNodePort(mCard);
|
||||
UpdateWalletInfoTask connectTaskEx = new UpdateWalletInfoTask(nodeAddress, nodePort, data);
|
||||
connectTaskEx.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, Electrum_Request.CheckBalance(mCard.getWallet()));
|
||||
connectTaskEx.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, ElectrumRequest.CheckBalance(mCard.getWallet()));
|
||||
}
|
||||
|
||||
String nodeAddress = engine.GetNode(mCard);
|
||||
int nodePort = engine.GetNodePort(mCard);
|
||||
UpdateWalletInfoTask updateWalletInfoTask = new UpdateWalletInfoTask(nodeAddress, nodePort, data);
|
||||
updateTasks.add(updateWalletInfoTask);
|
||||
updateWalletInfoTask.execute(Electrum_Request.ListUnspent(mCard.getWallet()), Electrum_Request.ListHistory(mCard.getWallet()));
|
||||
updateWalletInfoTask.execute(ElectrumRequest.ListUnspent(mCard.getWallet()), ElectrumRequest.ListHistory(mCard.getWallet()));
|
||||
|
||||
RateInfoTask taskRate = new RateInfoTask();
|
||||
ExchangeRequest rate = ExchangeRequest.GetRate(mCard.getWallet(), "bitcoin", "bitcoin");
|
||||
|
|
@ -156,7 +156,7 @@ public class LoadedWalletActivityFragment extends Fragment implements SwipeRefre
|
|||
String nodeAddress = engine.GetNextNode(mCard);
|
||||
int nodePort = engine.GetNextNodePort(mCard);
|
||||
UpdateWalletInfoTask connectTaskEx = new UpdateWalletInfoTask(nodeAddress, nodePort, data);
|
||||
connectTaskEx.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, Electrum_Request.CheckBalance(mCard.getWallet()));
|
||||
connectTaskEx.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, ElectrumRequest.CheckBalance(mCard.getWallet()));
|
||||
}
|
||||
|
||||
String nodeAddress = engine.GetNode(mCard);
|
||||
|
|
@ -164,7 +164,7 @@ public class LoadedWalletActivityFragment extends Fragment implements SwipeRefre
|
|||
UpdateWalletInfoTask updateWalletInfoTask = new UpdateWalletInfoTask(nodeAddress, nodePort, data);
|
||||
|
||||
updateTasks.add(updateWalletInfoTask);
|
||||
updateWalletInfoTask.execute(Electrum_Request.ListUnspent(mCard.getWallet()), Electrum_Request.ListHistory(mCard.getWallet()));
|
||||
updateWalletInfoTask.execute(ElectrumRequest.ListUnspent(mCard.getWallet()), ElectrumRequest.ListHistory(mCard.getWallet()));
|
||||
|
||||
RateInfoTask taskRate = new RateInfoTask();
|
||||
ExchangeRequest rate = ExchangeRequest.GetRate(mCard.getWallet(), "bitcoin-cash", "bitcoin-cash");
|
||||
|
|
@ -263,7 +263,7 @@ public class LoadedWalletActivityFragment extends Fragment implements SwipeRefre
|
|||
mSwipeRefreshLayout = v.findViewById(R.id.swipe_container);
|
||||
mSwipeRefreshLayout.setOnRefreshListener(this);
|
||||
|
||||
mCard = new Tangem_Card(getActivity().getIntent().getStringExtra("UID"));
|
||||
mCard = new TangemCard(getActivity().getIntent().getStringExtra("UID"));
|
||||
mCard.LoadFromBundle(getActivity().getIntent().getExtras().getBundle("Card"));
|
||||
tvCardID = v.findViewById(R.id.tvCardID);
|
||||
|
||||
|
|
@ -784,14 +784,14 @@ public class LoadedWalletActivityFragment extends Fragment implements SwipeRefre
|
|||
int nodePort = engine.GetNodePort(mCard);
|
||||
|
||||
UpdateWalletInfoTask connectTask = new UpdateWalletInfoTask(nodeAddress, nodePort);
|
||||
connectTask.execute(Electrum_Request.Broadcast(mCard.getWallet(), tx));
|
||||
connectTask.execute(ElectrumRequest.Broadcast(mCard.getWallet(), tx));
|
||||
}
|
||||
else if (mCard.getBlockchain() == Blockchain.BitcoinCash ||mCard.getBlockchain() == Blockchain.BitcoinCashTestNet) {
|
||||
String nodeAddress = engine.GetNode(mCard);
|
||||
int nodePort = engine.GetNodePort(mCard);
|
||||
|
||||
UpdateWalletInfoTask connectTask = new UpdateWalletInfoTask(nodeAddress, nodePort);
|
||||
connectTask.execute(Electrum_Request.Broadcast(mCard.getWallet(), tx));
|
||||
connectTask.execute(ElectrumRequest.Broadcast(mCard.getWallet(), tx));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -872,7 +872,7 @@ public class LoadedWalletActivityFragment extends Fragment implements SwipeRefre
|
|||
getActivity().finish();
|
||||
} else {
|
||||
if (data != null && data.getExtras().containsKey("UID") && data.getExtras().containsKey("Card")) {
|
||||
Tangem_Card updatedCard = new Tangem_Card(data.getStringExtra("UID"));
|
||||
TangemCard updatedCard = new TangemCard(data.getStringExtra("UID"));
|
||||
updatedCard.LoadFromBundle(data.getBundleExtra("Card"));
|
||||
mCard = updatedCard;
|
||||
}
|
||||
|
|
@ -914,7 +914,7 @@ public class LoadedWalletActivityFragment extends Fragment implements SwipeRefre
|
|||
getActivity().finish();
|
||||
} else {
|
||||
if (data != null && data.getExtras().containsKey("UID") && data.getExtras().containsKey("Card")) {
|
||||
Tangem_Card updatedCard = new Tangem_Card(data.getStringExtra("UID"));
|
||||
TangemCard updatedCard = new TangemCard(data.getStringExtra("UID"));
|
||||
updatedCard.LoadFromBundle(data.getBundleExtra("Card"));
|
||||
mCard = updatedCard;
|
||||
}
|
||||
|
|
@ -949,7 +949,7 @@ public class LoadedWalletActivityFragment extends Fragment implements SwipeRefre
|
|||
|
||||
if (data != null) {
|
||||
if (data.getExtras().containsKey("UID") && data.getExtras().containsKey("Card")) {
|
||||
Tangem_Card updatedCard = new Tangem_Card(data.getStringExtra("UID"));
|
||||
TangemCard updatedCard = new TangemCard(data.getStringExtra("UID"));
|
||||
updatedCard.LoadFromBundle(data.getBundleExtra("Card"));
|
||||
mCard = updatedCard;
|
||||
}
|
||||
|
|
@ -1054,7 +1054,7 @@ public class LoadedWalletActivityFragment extends Fragment implements SwipeRefre
|
|||
UpdateViews();
|
||||
}
|
||||
|
||||
private class ETHRequestTask extends Infura_Task {
|
||||
private class ETHRequestTask extends InfuraTask {
|
||||
ETHRequestTask(Blockchain blockchain) {
|
||||
super(blockchain);
|
||||
}
|
||||
|
|
@ -1316,7 +1316,7 @@ public class LoadedWalletActivityFragment extends Fragment implements SwipeRefre
|
|||
}
|
||||
}
|
||||
|
||||
private class UpdateWalletInfoTask extends Electrum_Task {
|
||||
private class UpdateWalletInfoTask extends ElectrumTask {
|
||||
public UpdateWalletInfoTask(String host, int port) {
|
||||
super(host, port);
|
||||
}
|
||||
|
|
@ -1339,17 +1339,17 @@ public class LoadedWalletActivityFragment extends Fragment implements SwipeRefre
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(List<Electrum_Request> requests) {
|
||||
protected void onPostExecute(List<ElectrumRequest> requests) {
|
||||
super.onPostExecute(requests);
|
||||
Log.i("RequestWalletInfoTask", "onPostExecute[" + String.valueOf(updateTasks.size()) + "]");
|
||||
updateTasks.remove(this);
|
||||
|
||||
CoinEngine engine = CoinEngineFactory.Create(mCard.getBlockchain());
|
||||
|
||||
for (Electrum_Request request : requests) {
|
||||
for (ElectrumRequest request : requests) {
|
||||
try {
|
||||
if (request.error == null) {
|
||||
if (request.isMethod(Electrum_Request.METHOD_GetBalance)) {
|
||||
if (request.isMethod(ElectrumRequest.METHOD_GetBalance)) {
|
||||
try {
|
||||
String mWalletAddress = request.getParams().getString(0);
|
||||
Long confBalance = request.getResult().getLong("confirmed");
|
||||
|
|
@ -1379,7 +1379,7 @@ public class LoadedWalletActivityFragment extends Fragment implements SwipeRefre
|
|||
engine.SwitchNode(mCard);
|
||||
}
|
||||
}
|
||||
} else if (request.isMethod(Electrum_Request.METHOD_SendTransaction)) {
|
||||
} else if (request.isMethod(ElectrumRequest.METHOD_SendTransaction)) {
|
||||
try {
|
||||
String hashTX = request.getResultString();
|
||||
|
||||
|
|
@ -1403,7 +1403,7 @@ public class LoadedWalletActivityFragment extends Fragment implements SwipeRefre
|
|||
ErrorOnUpdate("Failed to send transaction. Try again.");
|
||||
engine.SwitchNode(mCard);
|
||||
}
|
||||
} else if (request.isMethod(Electrum_Request.METHOD_ListUnspent)) {
|
||||
} else if (request.isMethod(ElectrumRequest.METHOD_ListUnspent)) {
|
||||
try {
|
||||
String mWalletAddress = request.getParams().getString(0);
|
||||
|
||||
|
|
@ -1412,7 +1412,7 @@ public class LoadedWalletActivityFragment extends Fragment implements SwipeRefre
|
|||
mCard.getUnspentTransactions().clear();
|
||||
for (int i = 0; i < jsUnspentArray.length(); i++) {
|
||||
JSONObject jsUnspent = jsUnspentArray.getJSONObject(i);
|
||||
Tangem_Card.UnspentTransaction trUnspent = new Tangem_Card.UnspentTransaction();
|
||||
TangemCard.UnspentTransaction trUnspent = new TangemCard.UnspentTransaction();
|
||||
trUnspent.txID = jsUnspent.getString("tx_hash");
|
||||
trUnspent.Amount = jsUnspent.getInt("value");
|
||||
trUnspent.Height = jsUnspent.getInt("height");
|
||||
|
|
@ -1435,8 +1435,8 @@ public class LoadedWalletActivityFragment extends Fragment implements SwipeRefre
|
|||
|
||||
updateTasks.add(updateWalletInfoTask);
|
||||
|
||||
updateWalletInfoTask.execute(Electrum_Request.GetHeader(mWalletAddress, String.valueOf(height)),
|
||||
Electrum_Request.GetTransaction(mWalletAddress, hash));
|
||||
updateWalletInfoTask.execute(ElectrumRequest.GetHeader(mWalletAddress, String.valueOf(height)),
|
||||
ElectrumRequest.GetTransaction(mWalletAddress, hash));
|
||||
}
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
|
|
@ -1444,7 +1444,7 @@ public class LoadedWalletActivityFragment extends Fragment implements SwipeRefre
|
|||
ErrorOnUpdate(e.toString());
|
||||
engine.SwitchNode(mCard);
|
||||
}
|
||||
} else if (request.isMethod(Electrum_Request.METHOD_GetHistory)) {
|
||||
} else if (request.isMethod(ElectrumRequest.METHOD_GetHistory)) {
|
||||
try {
|
||||
String mWalletAddress = request.getParams().getString(0);
|
||||
|
||||
|
|
@ -1453,7 +1453,7 @@ public class LoadedWalletActivityFragment extends Fragment implements SwipeRefre
|
|||
mCard.getHistoryTransactions().clear();
|
||||
for (int i = 0; i < jsHistoryArray.length(); i++) {
|
||||
JSONObject jsUnspent = jsHistoryArray.getJSONObject(i);
|
||||
Tangem_Card.HistoryTransaction trHistory = new Tangem_Card.HistoryTransaction();
|
||||
TangemCard.HistoryTransaction trHistory = new TangemCard.HistoryTransaction();
|
||||
trHistory.txID = jsUnspent.getString("tx_hash");
|
||||
trHistory.Height = jsUnspent.getInt("height");
|
||||
mCard.getHistoryTransactions().add(trHistory);
|
||||
|
|
@ -1475,8 +1475,8 @@ public class LoadedWalletActivityFragment extends Fragment implements SwipeRefre
|
|||
UpdateWalletInfoTask updateWalletInfoTask = new UpdateWalletInfoTask(nodeAddress, nodePort);
|
||||
updateTasks.add(updateWalletInfoTask);
|
||||
|
||||
updateWalletInfoTask.execute(Electrum_Request.GetHeader(mWalletAddress, String.valueOf(height)),
|
||||
Electrum_Request.GetTransaction(mWalletAddress, hash));
|
||||
updateWalletInfoTask.execute(ElectrumRequest.GetHeader(mWalletAddress, String.valueOf(height)),
|
||||
ElectrumRequest.GetTransaction(mWalletAddress, hash));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1485,12 +1485,12 @@ public class LoadedWalletActivityFragment extends Fragment implements SwipeRefre
|
|||
ErrorOnUpdate(e.toString());
|
||||
engine.SwitchNode(mCard);
|
||||
}
|
||||
} else if (request.isMethod(Electrum_Request.METHOD_GetHeader)) {
|
||||
} else if (request.isMethod(ElectrumRequest.METHOD_GetHeader)) {
|
||||
try {
|
||||
JSONObject jsHeader = request.getResult();
|
||||
try {
|
||||
mCard.getHaedersInfo();
|
||||
mCard.UpdateHeaderInfo(new Tangem_Card.HeaderInfo(
|
||||
mCard.UpdateHeaderInfo(new TangemCard.HeaderInfo(
|
||||
jsHeader.getInt("block_height"),
|
||||
jsHeader.getInt("timestamp")));
|
||||
} catch (JSONException e) {
|
||||
|
|
@ -1506,21 +1506,21 @@ public class LoadedWalletActivityFragment extends Fragment implements SwipeRefre
|
|||
engine.SwitchNode(mCard);
|
||||
|
||||
}
|
||||
} else if (request.isMethod(Electrum_Request.METHOD_GetTransaction)) {
|
||||
} else if (request.isMethod(ElectrumRequest.METHOD_GetTransaction)) {
|
||||
try {
|
||||
|
||||
String txHash = request.TxHash;
|
||||
String raw = request.getResultString();
|
||||
|
||||
List<Tangem_Card.UnspentTransaction> listTx = mCard.getUnspentTransactions();
|
||||
for (Tangem_Card.UnspentTransaction tx : listTx) {
|
||||
List<TangemCard.UnspentTransaction> listTx = mCard.getUnspentTransactions();
|
||||
for (TangemCard.UnspentTransaction tx : listTx) {
|
||||
if (tx.txID.equals(txHash)) {
|
||||
tx.Raw = raw;
|
||||
}
|
||||
}
|
||||
|
||||
List<Tangem_Card.HistoryTransaction> listHTx = mCard.getHistoryTransactions();
|
||||
for (Tangem_Card.HistoryTransaction tx : listHTx) {
|
||||
List<TangemCard.HistoryTransaction> listHTx = mCard.getHistoryTransactions();
|
||||
for (TangemCard.HistoryTransaction tx : listHTx) {
|
||||
if (tx.txID.equals(txHash)) {
|
||||
tx.Raw = raw;
|
||||
try {
|
||||
|
|
@ -1529,7 +1529,7 @@ public class LoadedWalletActivityFragment extends Fragment implements SwipeRefre
|
|||
boolean isOur = false;
|
||||
for (byte[] hash : prevHashes) {
|
||||
String checkID = BTCUtils.toHex(hash);
|
||||
for (Tangem_Card.HistoryTransaction txForCheck : listHTx) {
|
||||
for (TangemCard.HistoryTransaction txForCheck : listHTx) {
|
||||
if (txForCheck.txID == checkID) {
|
||||
isOur = true;
|
||||
}
|
||||
|
|
@ -1587,7 +1587,7 @@ public class LoadedWalletActivityFragment extends Fragment implements SwipeRefre
|
|||
|
||||
public static class PINSwapWarningDialog extends DialogFragment {
|
||||
|
||||
LoadedWalletActivityFragment activityFragment = null;
|
||||
LoadedWalletFragment activityFragment = null;
|
||||
String message;
|
||||
|
||||
@Override
|
||||
|
|
@ -24,28 +24,28 @@ import android.view.ViewGroup;
|
|||
import android.widget.ProgressBar;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.tangem.data.network.request.ElectrumRequest;
|
||||
import com.tangem.domain.cardReader.CardProtocol;
|
||||
import com.tangem.domain.cardReader.NfcManager;
|
||||
import com.tangem.domain.cardReader.Util;
|
||||
import com.tangem.domain.wallet.TangemCard;
|
||||
import com.tangem.util.Util;
|
||||
import com.tangem.presentation.activity.EmptyWalletActivity;
|
||||
import com.tangem.presentation.activity.LoadedWalletActivity;
|
||||
import com.tangem.presentation.activity.MainActivity;
|
||||
import com.tangem.presentation.activity.RequestPINActivity;
|
||||
import com.tangem.wallet.Blockchain;
|
||||
import com.tangem.domain.wallet.Blockchain;
|
||||
import com.tangem.presentation.adapter.CardListAdapter;
|
||||
import com.tangem.wallet.CoinEngine;
|
||||
import com.tangem.wallet.CoinEngineFactory;
|
||||
import com.tangem.data.network.request.Electrum_Request;
|
||||
import com.tangem.data.network.task.Electrum_Task;
|
||||
import com.tangem.domain.wallet.CoinEngine;
|
||||
import com.tangem.domain.wallet.CoinEngineFactory;
|
||||
import com.tangem.data.network.task.ElectrumTask;
|
||||
import com.tangem.data.network.request.ExchangeRequest;
|
||||
import com.tangem.data.network.task.ExchangeTask;
|
||||
import com.tangem.wallet.Infura_Request;
|
||||
import com.tangem.data.network.task.Infura_Task;
|
||||
import com.tangem.domain.wallet.Infura_Request;
|
||||
import com.tangem.data.network.task.InfuraTask;
|
||||
import com.tangem.presentation.dialog.NoExtendedLengthSupportDialog;
|
||||
import com.tangem.wallet.PINStorage;
|
||||
import com.tangem.domain.wallet.PINStorage;
|
||||
import com.tangem.wallet.R;
|
||||
import com.tangem.wallet.SharedData;
|
||||
import com.tangem.wallet.Tangem_Card;
|
||||
import com.tangem.domain.wallet.SharedData;
|
||||
import com.tangem.presentation.dialog.WaitSecurityDelayDialog;
|
||||
|
||||
import org.json.JSONArray;
|
||||
|
|
@ -60,14 +60,14 @@ import java.util.List;
|
|||
/**
|
||||
* A placeholder fragment containing a simple view.
|
||||
*/
|
||||
public class MainActivityFragment extends Fragment implements NfcAdapter.ReaderCallback, CardListAdapter.UiCallbacks, CardProtocol.Notifications, MainActivity.OnCardsClean {
|
||||
public class MainFragment extends Fragment implements NfcAdapter.ReaderCallback, CardListAdapter.UiCallbacks, CardProtocol.Notifications, MainActivity.OnCardsClean {
|
||||
|
||||
private static final int REQUEST_CODE_SHOW_CARD_ACTIVITY = 1;
|
||||
private static final int REQUEST_CODE_ENTER_PIN_ACTIVITY = 2;
|
||||
private static final int REQUEST_CODE_REQUEST_CAMERA_PERMISSIONS = 3;
|
||||
private NfcManager mNfcManager;
|
||||
private ArrayList<String> slCardUIDs = new ArrayList<>();
|
||||
private static final String logTag = "MainActivityFragment";
|
||||
private static final String logTag = "MainFragment";
|
||||
private ProgressBar progressBar;
|
||||
|
||||
private CardListAdapter mCardListAdapter;
|
||||
|
|
@ -80,7 +80,7 @@ public class MainActivityFragment extends Fragment implements NfcAdapter.ReaderC
|
|||
private SwipeRefreshLayout mSwipeRefreshLayout; //TODO: tmp
|
||||
List<RequestWalletInfoTask> requestTasks = new ArrayList<>();
|
||||
|
||||
public MainActivityFragment() {
|
||||
public MainFragment() {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -237,7 +237,7 @@ public class MainActivityFragment extends Fragment implements NfcAdapter.ReaderC
|
|||
super.onStop();
|
||||
}
|
||||
|
||||
public void refreshCard(Tangem_Card card) {
|
||||
public void refreshCard(TangemCard card) {
|
||||
CoinEngine engine = CoinEngineFactory.Create(card.getBlockchain());
|
||||
if (card.getBlockchain() == Blockchain.Ethereum || card.getBlockchain() == Blockchain.EthereumTestNet) {
|
||||
ETHRequestTask task = new ETHRequestTask(card.getBlockchain());
|
||||
|
|
@ -261,7 +261,7 @@ public class MainActivityFragment extends Fragment implements NfcAdapter.ReaderC
|
|||
String nodeAddress = engine.GetNextNode(card);
|
||||
int nodePort = engine.GetNextNodePort(card);
|
||||
RequestWalletInfoTask connectTaskEx = new RequestWalletInfoTask(nodeAddress, nodePort, data);
|
||||
connectTaskEx.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, Electrum_Request.CheckBalance(card.getWallet()));
|
||||
connectTaskEx.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, ElectrumRequest.CheckBalance(card.getWallet()));
|
||||
}
|
||||
|
||||
String nodeAddress = engine.GetNode(card);
|
||||
|
|
@ -269,7 +269,7 @@ public class MainActivityFragment extends Fragment implements NfcAdapter.ReaderC
|
|||
RequestWalletInfoTask task = new RequestWalletInfoTask(nodeAddress, nodePort);
|
||||
if( mSwipeRefreshLayout!=null ) mSwipeRefreshLayout.setRefreshing(true); //TODO: tmp
|
||||
requestTasks.add(task);
|
||||
task.execute(Electrum_Request.ListUnspent(card.getWallet()), Electrum_Request.ListHistory(card.getWallet()));
|
||||
task.execute(ElectrumRequest.ListUnspent(card.getWallet()), ElectrumRequest.ListHistory(card.getWallet()));
|
||||
RateInfoTask taskRate = new RateInfoTask();
|
||||
ExchangeRequest rate = ExchangeRequest.GetRate(card.getWallet(), "bitcoin", "bitcoin");
|
||||
taskRate.execute(rate);
|
||||
|
|
@ -282,7 +282,7 @@ public class MainActivityFragment extends Fragment implements NfcAdapter.ReaderC
|
|||
String nodeAddress = engine.GetNextNode(card);
|
||||
int nodePort = engine.GetNextNodePort(card);
|
||||
RequestWalletInfoTask connectTaskEx = new RequestWalletInfoTask(nodeAddress, nodePort, data);
|
||||
connectTaskEx.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, Electrum_Request.CheckBalance(card.getWallet()));
|
||||
connectTaskEx.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, ElectrumRequest.CheckBalance(card.getWallet()));
|
||||
}
|
||||
|
||||
String nodeAddress = engine.GetNode(card);
|
||||
|
|
@ -290,7 +290,7 @@ public class MainActivityFragment extends Fragment implements NfcAdapter.ReaderC
|
|||
RequestWalletInfoTask task = new RequestWalletInfoTask(nodeAddress, nodePort);
|
||||
if( mSwipeRefreshLayout!=null ) mSwipeRefreshLayout.setRefreshing(true); //TODO: tmp
|
||||
requestTasks.add(task);
|
||||
task.execute(Electrum_Request.ListUnspent(card.getWallet()), Electrum_Request.ListHistory(card.getWallet()));
|
||||
task.execute(ElectrumRequest.ListUnspent(card.getWallet()), ElectrumRequest.ListHistory(card.getWallet()));
|
||||
RateInfoTask taskRate = new RateInfoTask();
|
||||
ExchangeRequest rate = ExchangeRequest.GetRate(card.getWallet(), "bitcoin-cash", "bitcoin-cash");
|
||||
taskRate.execute(rate);
|
||||
|
|
@ -319,7 +319,7 @@ public class MainActivityFragment extends Fragment implements NfcAdapter.ReaderC
|
|||
}
|
||||
}
|
||||
|
||||
public void addCard(final Tangem_Card card) {
|
||||
public void addCard(final TangemCard card) {
|
||||
if (mCardListAdapter != null) {
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
|
|
@ -330,7 +330,7 @@ public class MainActivityFragment extends Fragment implements NfcAdapter.ReaderC
|
|||
|
||||
CoinEngine engine = CoinEngineFactory.Create(card.getBlockchain());
|
||||
|
||||
if (card.getStatus() == Tangem_Card.Status.Loaded) {
|
||||
if (card.getStatus() == TangemCard.Status.Loaded) {
|
||||
|
||||
if (card.getBlockchain() == Blockchain.Ethereum || card.getBlockchain() == Blockchain.EthereumTestNet) {
|
||||
ETHRequestTask task = new ETHRequestTask(card.getBlockchain());
|
||||
|
|
@ -355,7 +355,7 @@ public class MainActivityFragment extends Fragment implements NfcAdapter.ReaderC
|
|||
int nodePort = engine.GetNextNodePort(card);
|
||||
|
||||
RequestWalletInfoTask connectTaskEx = new RequestWalletInfoTask(nodeAddress, nodePort, data);
|
||||
connectTaskEx.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, Electrum_Request.CheckBalance(card.getWallet()));
|
||||
connectTaskEx.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, ElectrumRequest.CheckBalance(card.getWallet()));
|
||||
}
|
||||
|
||||
String nodeAddress = engine.GetNode(card);
|
||||
|
|
@ -365,7 +365,7 @@ public class MainActivityFragment extends Fragment implements NfcAdapter.ReaderC
|
|||
if( mSwipeRefreshLayout!=null ) mSwipeRefreshLayout.setRefreshing(true); //TODO: tmp
|
||||
|
||||
requestTasks.add(task);
|
||||
task.execute(Electrum_Request.ListUnspent(card.getWallet()), Electrum_Request.ListHistory(card.getWallet()));
|
||||
task.execute(ElectrumRequest.ListUnspent(card.getWallet()), ElectrumRequest.ListHistory(card.getWallet()));
|
||||
RateInfoTask taskRate = new RateInfoTask();
|
||||
ExchangeRequest rate = ExchangeRequest.GetRate(card.getWallet(), "bitcoin", "bitcoin");
|
||||
taskRate.execute(rate);
|
||||
|
|
@ -378,7 +378,7 @@ public class MainActivityFragment extends Fragment implements NfcAdapter.ReaderC
|
|||
int nodePort = engine.GetNextNodePort(card);
|
||||
|
||||
RequestWalletInfoTask connectTaskEx = new RequestWalletInfoTask(nodeAddress, nodePort, data);
|
||||
connectTaskEx.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, Electrum_Request.CheckBalance(card.getWallet()));
|
||||
connectTaskEx.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, ElectrumRequest.CheckBalance(card.getWallet()));
|
||||
}
|
||||
|
||||
String nodeAddress = engine.GetNode(card);
|
||||
|
|
@ -388,7 +388,7 @@ public class MainActivityFragment extends Fragment implements NfcAdapter.ReaderC
|
|||
if( mSwipeRefreshLayout!=null ) mSwipeRefreshLayout.setRefreshing(true); //TODO: tmp
|
||||
|
||||
requestTasks.add(task);
|
||||
task.execute(Electrum_Request.ListUnspent(card.getWallet()), Electrum_Request.ListHistory(card.getWallet()));
|
||||
task.execute(ElectrumRequest.ListUnspent(card.getWallet()), ElectrumRequest.ListHistory(card.getWallet()));
|
||||
RateInfoTask taskRate = new RateInfoTask();
|
||||
ExchangeRequest rate = ExchangeRequest.GetRate(card.getWallet(), "bitcoin-cash", "bitcoin-cash");
|
||||
taskRate.execute(rate);
|
||||
|
|
@ -431,17 +431,17 @@ public class MainActivityFragment extends Fragment implements NfcAdapter.ReaderC
|
|||
if( mSwipeRefreshLayout!=null ) mSwipeRefreshLayout.setRefreshing(false); //TODO: tmp
|
||||
|
||||
String UID = cardInfo.getString("UID");
|
||||
Tangem_Card card = new Tangem_Card(UID);
|
||||
TangemCard card = new TangemCard(UID);
|
||||
card.LoadFromBundle(cardInfo.getBundle("Card"));
|
||||
|
||||
|
||||
Intent intent;
|
||||
|
||||
if (card.getStatus() == Tangem_Card.Status.Empty) {
|
||||
if (card.getStatus() == TangemCard.Status.Empty) {
|
||||
intent = new Intent(getActivity(), EmptyWalletActivity.class);
|
||||
} else if (card.getStatus() == Tangem_Card.Status.Loaded) {
|
||||
} else if (card.getStatus() == TangemCard.Status.Loaded) {
|
||||
intent = new Intent(getActivity(), LoadedWalletActivity.class);
|
||||
} else if (card.getStatus() == Tangem_Card.Status.NotPersonalized || card.getStatus() == Tangem_Card.Status.Purged) {
|
||||
} else if (card.getStatus() == TangemCard.Status.NotPersonalized || card.getStatus() == TangemCard.Status.Purged) {
|
||||
return;
|
||||
} else {
|
||||
intent = new Intent(getActivity(), LoadedWalletActivity.class);
|
||||
|
|
@ -457,7 +457,7 @@ public class MainActivityFragment extends Fragment implements NfcAdapter.ReaderC
|
|||
// если пришло ОК
|
||||
if (resultCode == Activity.RESULT_OK && requestCode == REQUEST_CODE_SHOW_CARD_ACTIVITY) {
|
||||
if (data != null && data.getExtras().containsKey("UID")) {
|
||||
final Tangem_Card card = new Tangem_Card(data.getStringExtra("UID"));
|
||||
final TangemCard card = new TangemCard(data.getStringExtra("UID"));
|
||||
card.LoadFromBundle(data.getBundleExtra("Card"));
|
||||
if (data.getStringExtra("modification").equals("delete")) {
|
||||
mCardListAdapter.removeCard(card);
|
||||
|
|
@ -501,7 +501,7 @@ public class MainActivityFragment extends Fragment implements NfcAdapter.ReaderC
|
|||
|
||||
private static String lastRead_UID = "";
|
||||
private static ArrayList<String> lastRead_UnsuccessfullPINs = new ArrayList<>();
|
||||
private static Tangem_Card.EncryptionMode lastRead_Encryption = null;
|
||||
private static TangemCard.EncryptionMode lastRead_Encryption = null;
|
||||
|
||||
private class ReadCardInfoTask extends Thread {
|
||||
|
||||
|
|
@ -569,7 +569,7 @@ public class MainActivityFragment extends Fragment implements NfcAdapter.ReaderC
|
|||
if (lastRead_Encryption == null) {
|
||||
// we try get supported encryption on this time
|
||||
lastRead_Encryption = protocol.getCard().encryptionMode;
|
||||
if (protocol.getCard().encryptionMode == Tangem_Card.EncryptionMode.None) {
|
||||
if (protocol.getCard().encryptionMode == TangemCard.EncryptionMode.None) {
|
||||
// default pin not accepted
|
||||
lastRead_UnsuccessfullPINs.add(PINStorage.getDefaultPIN());
|
||||
}
|
||||
|
|
@ -594,7 +594,7 @@ public class MainActivityFragment extends Fragment implements NfcAdapter.ReaderC
|
|||
|
||||
try {
|
||||
protocol.setPIN(PIN);
|
||||
if (protocol.getCard().encryptionMode != Tangem_Card.EncryptionMode.None) {
|
||||
if (protocol.getCard().encryptionMode != TangemCard.EncryptionMode.None) {
|
||||
protocol.CreateProtocolKey();
|
||||
}
|
||||
protocol.run_Read();
|
||||
|
|
@ -752,7 +752,7 @@ public class MainActivityFragment extends Fragment implements NfcAdapter.ReaderC
|
|||
WaitSecurityDelayDialog.onReadAfterRequest(getActivity());
|
||||
}
|
||||
|
||||
private class RequestWalletInfoTask extends Electrum_Task {
|
||||
private class RequestWalletInfoTask extends ElectrumTask {
|
||||
public RequestWalletInfoTask(String host, int port) {
|
||||
super(host, port);
|
||||
}
|
||||
|
|
@ -780,18 +780,18 @@ public class MainActivityFragment extends Fragment implements NfcAdapter.ReaderC
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(List<Electrum_Request> requests) {
|
||||
protected void onPostExecute(List<ElectrumRequest> requests) {
|
||||
super.onPostExecute(requests);
|
||||
requestTasks.remove(this);
|
||||
Log.i("RequestWalletInfoTask", "onPostExecute[" + String.valueOf(requests.size()) + "]");
|
||||
|
||||
CoinEngine engine = CoinEngineFactory.Create(Blockchain.Bitcoin);
|
||||
|
||||
for (Electrum_Request request : requests) {
|
||||
for (ElectrumRequest request : requests) {
|
||||
try {
|
||||
|
||||
if (request.error == null) {
|
||||
if (request.isMethod(Electrum_Request.METHOD_GetBalance)) {
|
||||
if (request.isMethod(ElectrumRequest.METHOD_GetBalance)) {
|
||||
try {
|
||||
Long conf = request.getResult().getLong("confirmed");
|
||||
Long unconf = request.getResult().getLong("unconfirmed");
|
||||
|
|
@ -817,7 +817,7 @@ public class MainActivityFragment extends Fragment implements NfcAdapter.ReaderC
|
|||
engine.SwitchNode(null);
|
||||
}
|
||||
}
|
||||
} else if (request.isMethod(Electrum_Request.METHOD_ListUnspent)) {
|
||||
} else if (request.isMethod(ElectrumRequest.METHOD_ListUnspent)) {
|
||||
try {
|
||||
String mWalletAddress = request.getParams().getString(0);
|
||||
mCardListAdapter.UpdateWalletUnspent(mWalletAddress, request.getResultArray());
|
||||
|
|
@ -831,8 +831,8 @@ public class MainActivityFragment extends Fragment implements NfcAdapter.ReaderC
|
|||
if (height != -1) {
|
||||
RequestWalletInfoTask task = new RequestWalletInfoTask(request.Host, request.Port);
|
||||
requestTasks.add(task);
|
||||
task.execute(Electrum_Request.GetHeader(mWalletAddress, String.valueOf(height)),
|
||||
Electrum_Request.GetTransaction(mWalletAddress, hash));
|
||||
task.execute(ElectrumRequest.GetHeader(mWalletAddress, String.valueOf(height)),
|
||||
ElectrumRequest.GetTransaction(mWalletAddress, hash));
|
||||
}
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
|
|
@ -840,7 +840,7 @@ public class MainActivityFragment extends Fragment implements NfcAdapter.ReaderC
|
|||
FinishWithError(request.WalletAddress, e.toString());
|
||||
engine.SwitchNode(null);
|
||||
}
|
||||
} else if (request.isMethod(Electrum_Request.METHOD_GetHistory)) {
|
||||
} else if (request.isMethod(ElectrumRequest.METHOD_GetHistory)) {
|
||||
try {
|
||||
String mWalletAddress = request.getParams().getString(0);
|
||||
mCardListAdapter.UpdateWalletHistory(mWalletAddress, request.getResultArray());
|
||||
|
|
@ -855,8 +855,8 @@ public class MainActivityFragment extends Fragment implements NfcAdapter.ReaderC
|
|||
RequestWalletInfoTask task = new RequestWalletInfoTask(request.Host, request.Port);
|
||||
requestTasks.add(task);
|
||||
|
||||
task.execute(Electrum_Request.GetHeader(mWalletAddress, String.valueOf(height)),
|
||||
Electrum_Request.GetTransaction(mWalletAddress, hash));
|
||||
task.execute(ElectrumRequest.GetHeader(mWalletAddress, String.valueOf(height)),
|
||||
ElectrumRequest.GetTransaction(mWalletAddress, hash));
|
||||
}
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
|
|
@ -864,7 +864,7 @@ public class MainActivityFragment extends Fragment implements NfcAdapter.ReaderC
|
|||
FinishWithError(request.WalletAddress, e.toString());
|
||||
engine.SwitchNode(null);
|
||||
}
|
||||
} else if (request.isMethod(Electrum_Request.METHOD_GetHeader)) {
|
||||
} else if (request.isMethod(ElectrumRequest.METHOD_GetHeader)) {
|
||||
try {
|
||||
String mWalletAddress = request.WalletAddress;
|
||||
|
||||
|
|
@ -875,7 +875,7 @@ public class MainActivityFragment extends Fragment implements NfcAdapter.ReaderC
|
|||
FinishWithError(request.WalletAddress, e.toString());
|
||||
engine.SwitchNode(null);
|
||||
}
|
||||
} else if (request.isMethod(Electrum_Request.METHOD_GetTransaction)) {
|
||||
} else if (request.isMethod(ElectrumRequest.METHOD_GetTransaction)) {
|
||||
try {
|
||||
Log.e("MainActivityFragment_TX", request.TxHash);
|
||||
String mWalletAddress = request.WalletAddress;
|
||||
|
|
@ -926,7 +926,7 @@ public class MainActivityFragment extends Fragment implements NfcAdapter.ReaderC
|
|||
|
||||
}
|
||||
|
||||
private class ETHRequestTask extends Infura_Task {
|
||||
private class ETHRequestTask extends InfuraTask {
|
||||
ETHRequestTask(Blockchain blockchain) {
|
||||
super(blockchain);
|
||||
}
|
||||
|
|
@ -969,7 +969,7 @@ public class MainActivityFragment extends Fragment implements NfcAdapter.ReaderC
|
|||
if (l.compareTo(BigInteger.ZERO) == 0) {
|
||||
mCardListAdapter.UpdateWalletBlockchain(mWalletAddress, Blockchain.Ethereum);
|
||||
mCardListAdapter.AddWalletBlockchainNameToken(mWalletAddress);
|
||||
Tangem_Card card = mCardListAdapter.getCardByWallet(request.WalletAddress);
|
||||
TangemCard card = mCardListAdapter.getCardByWallet(request.WalletAddress);
|
||||
if (card != null) {
|
||||
refreshCard(card);
|
||||
}
|
||||
|
|
@ -16,23 +16,23 @@ import android.widget.TextView;
|
|||
import android.widget.Toast;
|
||||
|
||||
import com.tangem.domain.cardReader.NfcManager;
|
||||
import com.tangem.domain.wallet.TangemCard;
|
||||
import com.tangem.wallet.R;
|
||||
import com.tangem.wallet.Tangem_Card;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
public class VerifyCardActivityFragment extends Fragment implements SwipeRefreshLayout.OnRefreshListener, NfcAdapter.ReaderCallback {
|
||||
public class VerifyCardFragment extends Fragment implements SwipeRefreshLayout.OnRefreshListener, NfcAdapter.ReaderCallback {
|
||||
|
||||
Tangem_Card mCard;
|
||||
TangemCard mCard;
|
||||
TextView tvCardID, tvManufacturer, tvRegistrationDate, tvCardIdentity, tvLastSigned, tvRemainingSignatures, tvReusable, tvOk, tvError, tvMessage,
|
||||
tvIssuer, tvIssuerData, tvFeatures, tvBlockchain, tvSignedTx, tvSigningMethod, tvFirmware, tvWalletIdentity, tvWallet;
|
||||
ImageView ivBlockchain, ivPIN, ivPIN2orSecurityDelay, ivDeveloperVersion;
|
||||
SwipeRefreshLayout mSwipeRefreshLayout;
|
||||
private NfcManager mNfcManager;
|
||||
|
||||
public VerifyCardActivityFragment() {
|
||||
public VerifyCardFragment() {
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -53,7 +53,7 @@ public class VerifyCardActivityFragment extends Fragment implements SwipeRefresh
|
|||
mSwipeRefreshLayout = v.findViewById(R.id.swipe_container);
|
||||
mSwipeRefreshLayout.setOnRefreshListener(this);
|
||||
|
||||
mCard = new Tangem_Card(getActivity().getIntent().getStringExtra("UID"));
|
||||
mCard = new TangemCard(getActivity().getIntent().getStringExtra("UID"));
|
||||
mCard.LoadFromBundle(getActivity().getIntent().getExtras().getBundle("Card"));
|
||||
tvCardID = v.findViewById(R.id.tvCardID);
|
||||
|
||||
|
|
@ -166,7 +166,7 @@ public class VerifyCardActivityFragment extends Fragment implements SwipeRefresh
|
|||
|
||||
tvSigningMethod.setText(mCard.getSigningMethod().getDescription());
|
||||
|
||||
if (mCard.getStatus() == Tangem_Card.Status.Loaded || mCard.getStatus() == Tangem_Card.Status.Purged) {
|
||||
if (mCard.getStatus() == TangemCard.Status.Loaded || mCard.getStatus() == TangemCard.Status.Purged) {
|
||||
|
||||
tvLastSigned.setText(mCard.getLastSignedDescription());
|
||||
if (mCard.getRemainingSignatures() == 0) {
|
||||
|
|
@ -285,7 +285,7 @@ public class VerifyCardActivityFragment extends Fragment implements SwipeRefresh
|
|||
ivDeveloperVersion.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
if (mCard.getStatus() == Tangem_Card.Status.Loaded) {
|
||||
if (mCard.getStatus() == TangemCard.Status.Loaded) {
|
||||
tvWallet.setText(mCard.getShortWalletString());
|
||||
if (mCard.isWalletPublicKeyValid()) {
|
||||
tvWalletIdentity.setText("Possession proved");
|
||||
|
|
@ -21,7 +21,7 @@ import com.google.zxing.common.BitMatrix;
|
|||
import com.google.zxing.qrcode.QRCodeWriter;
|
||||
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
|
||||
import com.tangem.wallet.R;
|
||||
import com.tangem.wallet.Tangem_Card;
|
||||
import com.tangem.domain.wallet.TangemCard;
|
||||
|
||||
import java.util.Hashtable;
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ import static android.content.Context.CLIPBOARD_SERVICE;
|
|||
public class WalletInfoFragment extends Fragment {
|
||||
|
||||
// TODO: Rename and change types of parameters
|
||||
private Tangem_Card mCard;
|
||||
private TangemCard mCard;
|
||||
|
||||
private OnFragmentInteractionListener mListener;
|
||||
|
||||
|
|
@ -53,7 +53,7 @@ public class WalletInfoFragment extends Fragment {
|
|||
* @return A new instance of fragment WalletInfoFragment.
|
||||
*/
|
||||
// TODO: Rename and change types and number of parameters
|
||||
public static WalletInfoFragment newInstance(Tangem_Card card) {
|
||||
public static WalletInfoFragment newInstance(TangemCard card) {
|
||||
WalletInfoFragment fragment = new WalletInfoFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString("UID",card.getUID());
|
||||
|
|
@ -66,7 +66,7 @@ public class WalletInfoFragment extends Fragment {
|
|||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (getArguments() != null) {
|
||||
mCard = new Tangem_Card(getArguments().getString("UID"));
|
||||
mCard = new TangemCard(getArguments().getString("UID"));
|
||||
mCard.LoadFromBundle(getArguments());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue