Updated on 2026-08-14

This commit is contained in:
Tangem 2020-09-22 10:52:52 +03:00
parent cc468b2d0d
commit d96086f448
3 changed files with 16 additions and 6 deletions

View file

@ -110,15 +110,20 @@ class DetailsMiddleware {
}
is DetailsAction.ManageSecurity.ConfirmSelection -> {
if (action.option != store.state.detailsState.securityScreenState?.currentOption) {
store.dispatch(NavigationAction.NavigateTo(AppScreen.DetailsConfirm))
if (action.option == SecurityOption.LongTap) {
store.dispatch(DetailsAction.ManageSecurity.SaveChanges)
} else {
store.dispatch(NavigationAction.NavigateTo(AppScreen.DetailsConfirm))
}
} else {
store.dispatch(DetailsAction.ManageSecurity.ConfirmSelection.AlreadySet)
}
}
is DetailsAction.ManageSecurity.SaveChanges -> {
val cardId = store.state.detailsState.card?.cardId
val selectedOption = store.state.detailsState.securityScreenState?.selectedOption
scope.launch {
val result = when (store.state.detailsState.securityScreenState?.selectedOption) {
val result = when (selectedOption) {
SecurityOption.LongTap -> tangemSdkManager.setLongTap(cardId)
SecurityOption.PassCode -> tangemSdkManager.setPasscode(cardId)
SecurityOption.AccessCode -> tangemSdkManager.setAccessCode(cardId)
@ -127,7 +132,9 @@ class DetailsMiddleware {
withContext(Dispatchers.Main) {
when (result) {
is CompletionResult.Success -> {
store.dispatch(NavigationAction.PopBackTo())
if (selectedOption != SecurityOption.LongTap) {
store.dispatch(NavigationAction.PopBackTo())
}
store.dispatch(DetailsAction.ManageSecurity.SaveChanges.Success)
}
is CompletionResult.Failure, null ->

View file

@ -64,7 +64,7 @@
android:paddingEnd="60dp"
android:textColor="@color/darkGray1"
app:layout_constraintTop_toBottomOf="@id/tv_long_tap_title"
android:text="Caution: When having the switch on, all data will be encrypted and kept from being stolen."
android:text="@string/details_manage_security_long_tap_description"
android:textSize="13sp"
/>
@ -109,7 +109,7 @@
android:paddingEnd="60dp"
android:textColor="@color/darkGray1"
app:layout_constraintTop_toBottomOf="@id/tv_passcode_title"
android:text="Caution: When having the switch on, all data will be encrypted and kept from being stolen."
android:text="@string/details_manage_security_passcode_description"
android:textSize="13sp"
/>
@ -155,7 +155,7 @@
android:paddingEnd="60dp"
android:textColor="@color/darkGray1"
app:layout_constraintTop_toBottomOf="@id/tv_access_code_title"
android:text="Caution: When having the switch on, all data will be encrypted and kept from being stolen."
android:text="@string/details_manage_security_access_code_description"
android:textSize="13sp"
/>

View file

@ -100,6 +100,9 @@
<string name="details_manage_security_long_tap">Long Tap</string>
<string name="details_manage_security_passcode">Passcode</string>
<string name="details_manage_security_access_code">Access Code</string>
<string name="details_manage_security_long_tap_description">This mechanism protects against proximity attack on a card. It will enforce a delay between reception and execution of a command. After the first signed transaction this phone will be linked with the card and transactions will be signed immediately.</string>
<string name="details_manage_security_passcode_description">Before execution of any command entailing a change of the card state you will have to enter the passcode.</string>
<string name="details_manage_security_access_code_description">You will have to submit the correct access code before scanning the card.</string>
<string name="details_erase_wallet_warning">This action is irreversible. If, after deleting the wallet, someone sends funds to it, then you will not be able to withdraw them.</string>
<string name="details_manage_security_warning">If you forget the code, you will lose the ability to use the card. There is no way to recover or change your code if you lose it.
</string>