Updated on 2026-08-14
This commit is contained in:
parent
d1a826c61c
commit
0198b79106
6 changed files with 45 additions and 29 deletions
|
|
@ -1,21 +0,0 @@
|
|||
package com.tangem.di;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
@Singleton
|
||||
public class AppModule {
|
||||
private Context appContext;
|
||||
|
||||
public AppModule(@NotNull Context context) {
|
||||
appContext = context;
|
||||
}
|
||||
|
||||
Context provideContext() {
|
||||
return appContext;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -7,6 +7,7 @@ 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;
|
||||
|
|
@ -14,15 +15,15 @@ import javax.inject.Singleton;
|
|||
import dagger.Component;
|
||||
|
||||
@Singleton
|
||||
@Component(modules = {
|
||||
// AppModule.class,
|
||||
NavigatorModule.class})
|
||||
@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);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.tangem.di;
|
||||
|
||||
import com.tangem.presentation.dialog.WaitSecurityDelayDialogNew;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import dagger.Module;
|
||||
|
|
@ -14,4 +16,10 @@ class NavigatorModule {
|
|||
return new Navigator();
|
||||
}
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
WaitSecurityDelayDialogNew provideWaitSecurityDelayDialogNew() {
|
||||
return new WaitSecurityDelayDialogNew();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -34,6 +34,7 @@ import com.tangem.domain.wallet.TangemContext
|
|||
import com.tangem.presentation.dialog.NoExtendedLengthSupportDialog
|
||||
import com.tangem.presentation.dialog.RootFoundDialog
|
||||
import com.tangem.presentation.dialog.WaitSecurityDelayDialog
|
||||
import com.tangem.presentation.dialog.WaitSecurityDelayDialogNew
|
||||
import com.tangem.tangemcard.android.nfc.DeviceNFCAntennaLocation
|
||||
import com.tangem.tangemcard.android.reader.NfcManager
|
||||
import com.tangem.tangemcard.android.reader.NfcReader
|
||||
|
|
|
|||
|
|
@ -24,7 +24,11 @@ import com.tangem.tangemcard.android.reader.NfcManager
|
|||
import com.tangem.domain.wallet.TangemContext
|
||||
import com.tangem.presentation.dialog.NoExtendedLengthSupportDialog
|
||||
import com.tangem.presentation.dialog.WaitSecurityDelayDialog
|
||||
import com.tangem.presentation.dialog.WaitSecurityDelayDialogNew
|
||||
import com.tangem.presentation.event.DeletingWalletFinish
|
||||
import com.tangem.presentation.event.ReadAfterRequest
|
||||
import com.tangem.presentation.event.ReadBeforeRequest
|
||||
import com.tangem.presentation.event.ReadWait
|
||||
import com.tangem.tangemcard.android.nfc.DeviceNFCAntennaLocation
|
||||
import com.tangem.tangemcard.android.reader.NfcReader
|
||||
import com.tangem.tangemcard.data.asBundle
|
||||
|
|
@ -34,6 +38,7 @@ import com.tangem.wallet.R
|
|||
import kotlinx.android.synthetic.main.activity_purge.*
|
||||
import kotlinx.android.synthetic.main.layout_touch_card.*
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import javax.inject.Inject
|
||||
|
||||
class PurgeActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, CardProtocol.Notifications {
|
||||
companion object {
|
||||
|
|
@ -48,6 +53,9 @@ class PurgeActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, CardProtoc
|
|||
const val RESULT_INVALID_PIN = Activity.RESULT_FIRST_USER
|
||||
}
|
||||
|
||||
@Inject
|
||||
internal lateinit var waitSecurityDelayDialogNew: WaitSecurityDelayDialogNew
|
||||
|
||||
private lateinit var nfcManager: NfcManager
|
||||
private lateinit var ctx: TangemContext
|
||||
|
||||
|
|
@ -59,6 +67,8 @@ class PurgeActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, CardProtoc
|
|||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_purge)
|
||||
|
||||
App.getNavigatorComponent().inject(this)
|
||||
|
||||
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
|
||||
|
||||
nfcManager = NfcManager(this, this)
|
||||
|
|
@ -137,14 +147,29 @@ class PurgeActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, CardProtoc
|
|||
|
||||
override fun onReadWait(msec: Int) {
|
||||
WaitSecurityDelayDialog.onReadWait(this, msec)
|
||||
|
||||
// val readWait = ReadWait()
|
||||
// readWait.msec = msec
|
||||
// EventBus.getDefault().post(readWait)
|
||||
}
|
||||
|
||||
override fun onReadBeforeRequest(timeout: Int) {
|
||||
WaitSecurityDelayDialog.onReadBeforeRequest(this, timeout)
|
||||
|
||||
// if (!waitSecurityDelayDialogNew.isAdded)
|
||||
// waitSecurityDelayDialogNew.show(supportFragmentManager, WaitSecurityDelayDialogNew.TAG)
|
||||
//
|
||||
//
|
||||
// val readBeforeRequest = ReadBeforeRequest()
|
||||
// readBeforeRequest.timeout = timeout
|
||||
// EventBus.getDefault().post(readBeforeRequest)
|
||||
}
|
||||
|
||||
override fun onReadAfterRequest() {
|
||||
WaitSecurityDelayDialog.onReadAfterRequest(this)
|
||||
|
||||
// val readAfterRequest = ReadAfterRequest()
|
||||
// EventBus.getDefault().post(readAfterRequest)
|
||||
}
|
||||
|
||||
override fun onReadStart(cardProtocol: CardProtocol) {
|
||||
|
|
|
|||
|
|
@ -83,10 +83,11 @@ class WaitSecurityDelayDialogNew : AppCompatDialogFragment() {
|
|||
setup(readBeforeRequest.timeout!!, DELAY_BEFORE_SHOW_DIALOG)
|
||||
isCancelable = false
|
||||
|
||||
|
||||
|
||||
// if (!isAdded)
|
||||
// show(activity?.supportFragmentManager, TAG)
|
||||
show(activity!!.supportFragmentManager, TAG)
|
||||
|
||||
// if (isHidden)
|
||||
// activity?.supportFragmentManager?.let { show(it, TAG) }
|
||||
}
|
||||
}, DELAY_BEFORE_SHOW_DIALOG.toLong())
|
||||
}
|
||||
|
|
@ -120,8 +121,9 @@ class WaitSecurityDelayDialogNew : AppCompatDialogFragment() {
|
|||
// 1000ms - card delay notification interval
|
||||
setup(readWait.msec!! + 1000, 1000)
|
||||
isCancelable = false
|
||||
// if (!isAdded)
|
||||
// show(activity?.supportFragmentManager, TAG)
|
||||
|
||||
if (isHidden)
|
||||
activity?.supportFragmentManager?.let { show(it, TAG) }
|
||||
|
||||
} else
|
||||
setRemainingTimeout(readWait.msec!!)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue