Updated on 2026-08-14

This commit is contained in:
Tangem 2019-02-07 14:39:57 +03:00
parent 42b6efa391
commit c670ecdb15
26 changed files with 322 additions and 391 deletions

View file

@ -1,106 +0,0 @@
package com.tangem;
import android.app.Application;
import androidx.appcompat.app.AppCompatDelegate;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.tangem.tangemserver.android.data.LocalStorage;
import com.tangem.di.DaggerNavigatorComponent;
import com.tangem.di.DaggerNetworkComponent;
import com.tangem.di.NavigatorComponent;
import com.tangem.di.NetworkComponent;
import com.tangem.tangemcard.data.Issuer;
import com.tangem.tangemcard.android.data.Firmwares;
import com.tangem.tangemcard.android.data.PINStorage;
import com.tangem.tangemcard.data.external.FirmwaresDigestsProvider;
import com.tangem.tangemcard.data.external.PINsProvider;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.reflect.Type;
import java.nio.charset.StandardCharsets;
import java.util.List;
public class App extends Application {
/**
* A singleton instance of the application class for easy access in other places
*/
private static App sInstance;
public App() {
super();
}
static {
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
}
private static NetworkComponent networkComponent;
private static NavigatorComponent navigatorComponent;
public static NavigatorComponent getNavigatorComponent() {
return navigatorComponent;
}
public static LocalStorage localStorage;
public static PINsProvider pinStorage;
public static FirmwaresDigestsProvider firmwaresStorage;
@Override
public void onCreate() {
super.onCreate();
// initialize the singleton
sInstance = this;
networkComponent = DaggerNetworkComponent.create();
navigatorComponent = buildNavigatorComponent();
// common init
if (PINStorage.needInit())
PINStorage.init(getApplicationContext());
initIssuers();
firmwaresStorage = new Firmwares(getApplicationContext());
localStorage = new LocalStorage(getApplicationContext());
pinStorage = new PINStorage();
}
/**
* @return singleton instance
*/
public static synchronized App getInstance() {
return sInstance;
}
public static NetworkComponent getNetworkComponent() {
return networkComponent;
}
protected NavigatorComponent buildNavigatorComponent() {
return DaggerNavigatorComponent.builder()
.build();
}
public void initIssuers() {
try {
try (InputStream is = getApplicationContext().getAssets().open("issuers.json")) {
try (InputStreamReader reader = new InputStreamReader(is, StandardCharsets.UTF_8)) {
Type listType = new TypeToken<List<Issuer>>() {
}.getType();
Issuer.fillIssuers(new Gson().fromJson(reader, listType));
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

View file

@ -0,0 +1,81 @@
package com.tangem
import android.app.Application
import androidx.appcompat.app.AppCompatDelegate
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import com.tangem.di.DaggerNavigatorComponent
import com.tangem.di.DaggerNetworkComponent
import com.tangem.di.NavigatorComponent
import com.tangem.di.NetworkComponent
import com.tangem.tangemcard.android.data.Firmwares
import com.tangem.tangemcard.android.data.PINStorage
import com.tangem.tangemcard.data.Issuer
import com.tangem.tangemcard.data.external.FirmwaresDigestsProvider
import com.tangem.tangemcard.data.external.PINsProvider
import com.tangem.tangemserver.android.data.LocalStorage
import java.io.InputStreamReader
import java.nio.charset.StandardCharsets
class App : Application() {
companion object {
@get:Synchronized
var instance: App? = null
private set
init {
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true)
}
var networkComponent: NetworkComponent? = null
private set
var navigatorComponent: NavigatorComponent? = null
private set
lateinit var firmwaresStorage: FirmwaresDigestsProvider
lateinit var localStorage: LocalStorage
lateinit var pinStorage: PINsProvider
}
override fun onCreate() {
super.onCreate()
// initialize the singleton
instance = this
networkComponent = DaggerNetworkComponent.create()
navigatorComponent = buildNavigatorComponent()
// common init
if (PINStorage.needInit())
PINStorage.init(applicationContext)
initIssuers()
firmwaresStorage = Firmwares(applicationContext)
localStorage = LocalStorage(applicationContext)
pinStorage = PINStorage()
}
private fun buildNavigatorComponent(): NavigatorComponent {
return DaggerNavigatorComponent.builder()
.build()
}
private fun initIssuers() {
try {
applicationContext.assets.open("issuers.json").use { `is` ->
InputStreamReader(`is`, StandardCharsets.UTF_8).use { reader ->
val listType = object : TypeToken<List<Issuer>>() {
}.type
Issuer.fillIssuers(Gson().fromJson(reader, listType))
}
}
} catch (e: Exception) {
e.printStackTrace()
}
}
}

View file

@ -36,7 +36,7 @@ public class ServerApiCommon {
}
public void requestBtcEstimatedFee(int blockCount) {
EstimatefeeApi estimatefeeApi = App.getNetworkComponent().getRetrofitEstimatefee().create(EstimatefeeApi.class);
EstimatefeeApi estimatefeeApi = App.Companion.getNetworkComponent().getRetrofitEstimatefee().create(EstimatefeeApi.class);
Call<String> call;
switch (blockCount) {
@ -91,7 +91,7 @@ public class ServerApiCommon {
@SuppressLint("CheckResult")
public void requestRateInfo(String cryptoId) {
CoinmarketApi coinmarketApi = App.getNetworkComponent().getRetrofitCoinmarketcap().create(CoinmarketApi.class);
CoinmarketApi coinmarketApi = App.Companion.getNetworkComponent().getRetrofitCoinmarketcap().create(CoinmarketApi.class);
coinmarketApi.getRateInfoList()
.subscribeOn(Schedulers.io())
@ -126,7 +126,7 @@ public class ServerApiCommon {
}
public void requestLastVersion() {
UpdateVersionApi updateVersionApi = App.getNetworkComponent().getRetrofitGithubusercontent().create(UpdateVersionApi.class);
UpdateVersionApi updateVersionApi = App.Companion.getNetworkComponent().getRetrofitGitHubUserContent().create(UpdateVersionApi.class);
Call<ResponseBody> call = updateVersionApi.getLastVersion();
call.enqueue(new Callback<ResponseBody>() {

View file

@ -230,7 +230,7 @@ public class ServerApiElectrum {
private void doElectrumRequestTcp(ElectrumRequest electrumRequest, String host, int port) {
try {
Socket socket = App.getNetworkComponent().getSocket();
Socket socket = App.Companion.getNetworkComponent().getSocket();
socket.setSoTimeout(3000);
Log.i(TAG, "Start process "+electrumRequest.getMethod()+" @ "+host + ":" + port);
socket.connect(new InetSocketAddress(InetAddress.getByName(host), port));
@ -252,18 +252,18 @@ public class ServerApiElectrum {
if( (electrumRequest.getError()!=null && electrumRequest.getError().startsWith(ERROR_STARTS_WITH_CODE_32601)) )
{
// method unknown error???
electrumRequest.setError(App.getInstance().getString(R.string.cannot_obtain_data_from_blockchain));
electrumRequest.setError(App.Companion.getInstance().getString(R.string.cannot_obtain_data_from_blockchain));
electrumRequest.answerData=null;
}
} else {
electrumRequest.setError(App.getInstance().getString(R.string.cannot_obtain_data_from_blockchain_no_answer));
electrumRequest.setError(App.Companion.getInstance().getString(R.string.cannot_obtain_data_from_blockchain_no_answer));
Log.i(TAG, ">> <NULL>");
}
} catch (ConnectException e) {
//e.printStackTrace();
//responseListener.onFail(e.getMessage());
electrumRequest.setError(App.getInstance().getString(R.string.cannot_obtain_data_from_blockchain_no_connection));
electrumRequest.setError(App.Companion.getInstance().getString(R.string.cannot_obtain_data_from_blockchain_no_connection));
Log.e(TAG, "doElectrumRequestTcp " + electrumRequest.getMethod() + " ConnectException " + e.getMessage());
} finally {
Log.i(TAG, "doElectrumRequestTcp " + electrumRequest.getMethod() + " socket.close");
@ -274,13 +274,13 @@ public class ServerApiElectrum {
{
e.printStackTrace();
Log.e(TAG,"Can't close socket");
electrumRequest.setError(App.getInstance().getString(R.string.cannot_obtain_data_from_blockchain_communication_error));
electrumRequest.setError(App.Companion.getInstance().getString(R.string.cannot_obtain_data_from_blockchain_communication_error));
}
}
} catch (IOException e) {
//e.printStackTrace();
//responseListener.onFail(e.getMessage());
electrumRequest.setError(App.getInstance().getString(R.string.cannot_obtain_data_from_blockchain_communication_error));
electrumRequest.setError(App.Companion.getInstance().getString(R.string.cannot_obtain_data_from_blockchain_communication_error));
Log.e(TAG, "doElectrumRequestTcp " + electrumRequest.getMethod() + " IOException " + e.getMessage());
}
}
@ -341,17 +341,17 @@ public class ServerApiElectrum {
if( (electrumRequest.getError()!=null && electrumRequest.getError().startsWith(ERROR_STARTS_WITH_CODE_32601)) )
{
// method unknown error???
electrumRequest.setError(App.getInstance().getString(R.string.cannot_obtain_data_from_blockchain));
electrumRequest.setError(App.Companion.getInstance().getString(R.string.cannot_obtain_data_from_blockchain));
electrumRequest.answerData=null;
}
} else {
electrumRequest.setError(App.getInstance().getString(R.string.cannot_obtain_data_from_blockchain_no_answer));
electrumRequest.setError(App.Companion.getInstance().getString(R.string.cannot_obtain_data_from_blockchain_no_answer));
Log.i(TAG, ">> <NULL>");
}
} catch (ConnectException e) {
e.printStackTrace();
electrumRequest.setError(App.getInstance().getString(R.string.cannot_obtain_data_from_blockchain_no_connection));
electrumRequest.setError(App.Companion.getInstance().getString(R.string.cannot_obtain_data_from_blockchain_no_connection));
Log.e(TAG, "doElectrumRequestSsl " + electrumRequest.getMethod() + " ConnectException " + e.getMessage());
} finally {
Log.i(TAG, "doElectrumRequestSsl " + electrumRequest.getMethod() + " socket.close");
@ -360,7 +360,7 @@ public class ServerApiElectrum {
}
catch (Exception e)
{
electrumRequest.setError(App.getInstance().getString(R.string.cannot_obtain_data_from_blockchain_communication_error));
electrumRequest.setError(App.Companion.getInstance().getString(R.string.cannot_obtain_data_from_blockchain_communication_error));
e.printStackTrace();
Log.e(TAG, "Can't close ssl socket");
}
@ -368,11 +368,11 @@ public class ServerApiElectrum {
} catch (IOException e) {
e.printStackTrace();
electrumRequest.setError(App.getInstance().getString(R.string.cannot_obtain_data_from_blockchain_communication_error));
electrumRequest.setError(App.Companion.getInstance().getString(R.string.cannot_obtain_data_from_blockchain_communication_error));
Log.e(TAG, "doElectrumRequestSsl " + electrumRequest.getMethod() + " IOException " + e.getMessage());
}
} catch (NoSuchAlgorithmException | KeyManagementException e) {
electrumRequest.setError(App.getInstance().getString(R.string.cannot_obtain_data_from_blockchain));
electrumRequest.setError(App.Companion.getInstance().getString(R.string.cannot_obtain_data_from_blockchain));
Log.e(TAG, e.getMessage());
}
}

View file

@ -52,7 +52,7 @@ public class ServerApiInfura {
public void requestData(String method, int id, String wallet, String contract, String tx) {
requestsCount++;
InfuraApi infuraApi = App.getNetworkComponent().getRetrofitInfura().create(InfuraApi.class);
InfuraApi infuraApi = App.Companion.getNetworkComponent().getRetrofitInfura().create(InfuraApi.class);
InfuraBody infuraBody;
switch (method) {

View file

@ -52,7 +52,7 @@ public class ServerApiRootstock {
public void requestData(String method, int id, String wallet, String contract, String tx) {
requestsCount++;
RootstockApi rootstockApi = App.getNetworkComponent().getRetrofitRootstock().create(RootstockApi.class);
RootstockApi rootstockApi = App.Companion.getNetworkComponent().getRetrofitRootstock().create(RootstockApi.class);
InfuraBody infuraBody;
switch (method) {

View file

@ -1,39 +0,0 @@
package com.tangem.di;
import com.tangem.presentation.activity.EmptyWalletActivity;
import com.tangem.presentation.activity.LoadedWalletActivity;
import com.tangem.presentation.activity.LogoActivity;
import com.tangem.presentation.activity.MainActivity;
import com.tangem.presentation.activity.PrepareCryptonitOtherApiWithdrawalActivity;
import com.tangem.presentation.activity.PrepareKrakenWithdrawalActivity;
import com.tangem.presentation.activity.PrepareTransactionActivity;
import com.tangem.presentation.activity.PurgeActivity;
import com.tangem.presentation.activity.VerifyCardActivity;
import javax.inject.Singleton;
import dagger.Component;
@Singleton
@Component(modules = {NavigatorModule.class})
public interface NavigatorComponent {
void inject(LogoActivity activity);
void inject(MainActivity activity);
void inject(PurgeActivity activity);
void inject(PrepareTransactionActivity activity);
void inject(PrepareCryptonitOtherApiWithdrawalActivity activity);
void inject(PrepareKrakenWithdrawalActivity activity);
void inject(LoadedWalletActivity activity);
void inject(VerifyCardActivity activity);
void inject(EmptyWalletActivity activity);
}

View file

@ -0,0 +1,39 @@
package com.tangem.di
import com.tangem.presentation.activity.EmptyWalletActivity
import com.tangem.presentation.activity.LoadedWalletActivity
import com.tangem.presentation.activity.LogoActivity
import com.tangem.presentation.activity.MainActivity
import com.tangem.presentation.activity.PrepareCryptonitOtherApiWithdrawalActivity
import com.tangem.presentation.activity.PrepareKrakenWithdrawalActivity
import com.tangem.presentation.activity.PrepareTransactionActivity
import com.tangem.presentation.activity.PurgeActivity
import com.tangem.presentation.activity.VerifyCardActivity
import javax.inject.Singleton
import dagger.Component
@Singleton
@Component(modules = [NavigatorModule::class])
interface NavigatorComponent {
fun inject(activity: LogoActivity)
fun inject(activity: MainActivity)
fun inject(activity: PurgeActivity)
fun inject(activity: PrepareTransactionActivity)
fun inject(activity: PrepareCryptonitOtherApiWithdrawalActivity)
fun inject(activity: PrepareKrakenWithdrawalActivity)
fun inject(activity: LoadedWalletActivity)
fun inject(activity: VerifyCardActivity)
fun inject(activity: EmptyWalletActivity)
}

View file

@ -1,25 +0,0 @@
package com.tangem.di;
import com.tangem.presentation.dialog.WaitSecurityDelayDialogNew;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
@Module
class NavigatorModule {
@Singleton
@Provides
Navigator provideNavigator() {
return new Navigator();
}
@Singleton
@Provides
WaitSecurityDelayDialogNew provideWaitSecurityDelayDialogNew() {
return new WaitSecurityDelayDialogNew();
}
}

View file

@ -0,0 +1,25 @@
package com.tangem.di
import com.tangem.presentation.dialog.WaitSecurityDelayDialogNew
import javax.inject.Singleton
import dagger.Module
import dagger.Provides
@Module
internal class NavigatorModule {
@Singleton
@Provides
fun provideNavigator(): Navigator {
return Navigator()
}
@Singleton
@Provides
fun provideWaitSecurityDelayDialogNew(): WaitSecurityDelayDialogNew {
return WaitSecurityDelayDialogNew()
}
}

View file

@ -1,35 +0,0 @@
package com.tangem.di;
import com.tangem.data.network.Server;
import java.net.Socket;
import javax.inject.Named;
import javax.inject.Singleton;
import dagger.Component;
import retrofit2.Retrofit;
@Singleton
@Component(modules = {NetworkModule.class})
public interface NetworkComponent {
@Named(Server.ApiInfura.URL_INFURA)
Retrofit getRetrofitInfura();
@Named(Server.ApiEstimatefee.URL_ESTIMATEFEE)
Retrofit getRetrofitEstimatefee();
@Named(Server.ApiCoinmarket.URL_COINMARKET)
Retrofit getRetrofitCoinmarketcap();
@Named(Server.ApiUpdateVersion.URL_UPDATE_VERSION)
Retrofit getRetrofitGithubusercontent();
@Named(Server.ApiRootstock.URL_ROOTSTOCK)
Retrofit getRetrofitRootstock();
@Named("socket")
Socket getSocket();
}

View file

@ -0,0 +1,35 @@
package com.tangem.di
import com.tangem.data.network.Server
import java.net.Socket
import javax.inject.Named
import javax.inject.Singleton
import dagger.Component
import retrofit2.Retrofit
@Singleton
@Component(modules = [NetworkModule::class])
interface NetworkComponent {
@get:Named(Server.ApiInfura.URL_INFURA)
val retrofitInfura: Retrofit
@get:Named(Server.ApiEstimatefee.URL_ESTIMATEFEE)
val retrofitEstimatefee: Retrofit
@get:Named(Server.ApiCoinmarket.URL_COINMARKET)
val retrofitCoinmarketcap: Retrofit
@get:Named(Server.ApiUpdateVersion.URL_UPDATE_VERSION)
val retrofitGitHubUserContent: Retrofit
@get:Named(Server.ApiRootstock.URL_ROOTSTOCK)
val retrofitRootstock: Retrofit
@get:Named("socket")
val socket: Socket
}

View file

@ -1,106 +0,0 @@
package com.tangem.di;
import com.jakewharton.retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import com.tangem.data.network.Server;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketException;
import javax.inject.Named;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
@Module
class NetworkModule {
@Singleton
@Provides
@Named(Server.ApiInfura.URL_INFURA)
Retrofit provideRetrofitInfura() {
return new Retrofit.Builder()
.baseUrl(Server.ApiInfura.URL_INFURA)
.addConverterFactory(GsonConverterFactory.create())
.build();
}
@Singleton
@Provides
@Named(Server.ApiRootstock.URL_ROOTSTOCK)
Retrofit provideRetrofitRootstock() {
return new Retrofit.Builder()
.baseUrl(Server.ApiRootstock.URL_ROOTSTOCK)
.addConverterFactory(GsonConverterFactory.create())
.build();
}
@Singleton
@Provides
@Named(Server.ApiEstimatefee.URL_ESTIMATEFEE)
Retrofit provideRetrofitEstimatefee() {
return new Retrofit.Builder()
.baseUrl(Server.ApiEstimatefee.URL_ESTIMATEFEE)
.addConverterFactory(GsonConverterFactory.create())
.build();
}
@Singleton
@Provides
@Named(Server.ApiUpdateVersion.URL_UPDATE_VERSION)
Retrofit provideGithubusercontent() {
return new Retrofit.Builder()
.baseUrl(Server.ApiUpdateVersion.URL_UPDATE_VERSION)
.addConverterFactory(GsonConverterFactory.create())
.client(createOkHttpClient())
.build();
}
@Singleton
@Provides
@Named(Server.ApiCoinmarket.URL_COINMARKET)
Retrofit provideRetrofitCoinmarketcap() {
return new Retrofit.Builder()
.baseUrl(Server.ApiCoinmarket.URL_COINMARKET)
.addConverterFactory(GsonConverterFactory.create())
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.build();
}
private OkHttpClient createOkHttpClient() {
return new OkHttpClient.Builder().
addInterceptor(createHttpLoggingInterceptor()).
build();
}
private HttpLoggingInterceptor createHttpLoggingInterceptor() {
HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
logging.setLevel(HttpLoggingInterceptor.Level.BODY);
return logging;
}
@Provides
@Named("socket")
Socket provideSocket() {
Socket socket = new Socket();
try {
socket.setSoTimeout(2000);
try {
socket.bind(new InetSocketAddress(0));
} catch (IOException e) {
e.printStackTrace();
}
} catch (SocketException e) {
e.printStackTrace();
}
return socket;
}
}

View file

@ -0,0 +1,105 @@
package com.tangem.di
import com.jakewharton.retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
import com.tangem.data.network.Server
import java.io.IOException
import java.net.InetSocketAddress
import java.net.Socket
import java.net.SocketException
import javax.inject.Named
import javax.inject.Singleton
import dagger.Module
import dagger.Provides
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
@Module
internal class NetworkModule {
@Singleton
@Provides
@Named(Server.ApiInfura.URL_INFURA)
fun provideRetrofitInfura(): Retrofit {
return Retrofit.Builder()
.baseUrl(Server.ApiInfura.URL_INFURA)
.addConverterFactory(GsonConverterFactory.create())
.build()
}
@Singleton
@Provides
@Named(Server.ApiRootstock.URL_ROOTSTOCK)
fun provideRetrofitRootstock(): Retrofit {
return Retrofit.Builder()
.baseUrl(Server.ApiRootstock.URL_ROOTSTOCK)
.addConverterFactory(GsonConverterFactory.create())
.build()
}
@Singleton
@Provides
@Named(Server.ApiEstimatefee.URL_ESTIMATEFEE)
fun provideRetrofitEstimatefee(): Retrofit {
return Retrofit.Builder()
.baseUrl(Server.ApiEstimatefee.URL_ESTIMATEFEE)
.addConverterFactory(GsonConverterFactory.create())
.build()
}
@Singleton
@Provides
@Named(Server.ApiUpdateVersion.URL_UPDATE_VERSION)
fun provideGithubusercontent(): Retrofit {
return Retrofit.Builder()
.baseUrl(Server.ApiUpdateVersion.URL_UPDATE_VERSION)
.addConverterFactory(GsonConverterFactory.create())
.client(createOkHttpClient())
.build()
}
@Singleton
@Provides
@Named(Server.ApiCoinmarket.URL_COINMARKET)
fun provideRetrofitCoinmarketcap(): Retrofit {
return Retrofit.Builder()
.baseUrl(Server.ApiCoinmarket.URL_COINMARKET)
.addConverterFactory(GsonConverterFactory.create())
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.build()
}
private fun createOkHttpClient(): OkHttpClient {
return OkHttpClient.Builder().addInterceptor(createHttpLoggingInterceptor()).build()
}
private fun createHttpLoggingInterceptor(): HttpLoggingInterceptor {
val logging = HttpLoggingInterceptor()
logging.level = HttpLoggingInterceptor.Level.BODY
return logging
}
@Provides
@Named("socket")
fun provideSocket(): Socket {
val socket = Socket()
try {
socket.soTimeout = 2000
try {
socket.bind(InetSocketAddress(0))
} catch (e: IOException) {
e.printStackTrace()
}
} catch (e: SocketException) {
e.printStackTrace()
}
return socket
}
}

View file

@ -62,7 +62,7 @@ class EmptyWalletActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, Card
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_empty_wallet)
App.getNavigatorComponent().inject(this)
App.navigatorComponent?.inject(this)
nfcManager = NfcManager(this, this)
lifecycle.addObserver(NfcLifecycleObserver(nfcManager))

View file

@ -32,7 +32,7 @@ class LoadedWalletActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_loaded_wallet)
App.getNavigatorComponent().inject(this)
App.navigatorComponent?.inject(this)
if (intent.extras!!.containsKey(NfcAdapter.EXTRA_TAG)) {
val tag = intent.getParcelableExtra<Tag>(NfcAdapter.EXTRA_TAG)

View file

@ -31,7 +31,7 @@ class LogoActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_logo)
App.getNavigatorComponent().inject(this)
App.navigatorComponent?.inject(this)
ivLogo.setOnClickListener { hide() }
}

View file

@ -82,7 +82,7 @@ class MainActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, CardProtoco
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
App.getNavigatorComponent().inject(this)
App.navigatorComponent?.inject(this)
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT

View file

@ -42,7 +42,7 @@ class PrepareCryptonitOtherApiWithdrawalActivity : AppCompatActivity(), NfcAdapt
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_prepare_cryptonit_other_api_withdrawal)
App.getNavigatorComponent().inject(this)
App.navigatorComponent?.inject(this)
nfcManager = NfcManager(this, this)
lifecycle.addObserver(NfcLifecycleObserver(nfcManager))

View file

@ -52,7 +52,7 @@ class PrepareKrakenWithdrawalActivity : AppCompatActivity(), NfcAdapter.ReaderCa
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_prepare_kraken_withdrawal)
App.getNavigatorComponent().inject(this)
App.navigatorComponent?.inject(this)
ctx = TangemContext.loadFromBundle(this, intent.extras)

View file

@ -47,7 +47,7 @@ class PrepareTransactionActivity : AppCompatActivity(), NfcAdapter.ReaderCallbac
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_prepare_transaction)
App.getNavigatorComponent().inject(this)
App.navigatorComponent?.inject(this)
nfcManager = NfcManager(this, this)
lifecycle.addObserver(NfcLifecycleObserver(nfcManager))

View file

@ -61,7 +61,7 @@ class PurgeActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, CardProtoc
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_purge)
App.getNavigatorComponent().inject(this)
App.navigatorComponent?.inject(this)
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT

View file

@ -29,7 +29,7 @@ class VerifyCardActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_verify_card)
App.getNavigatorComponent().inject(this)
App.navigatorComponent?.inject(this)
}
override fun onBackPressed() {