From d96086f4485e58650ffc8b7f75e6b8c6f73f591d Mon Sep 17 00:00:00 2001 From: Tangem Date: Tue, 22 Sep 2020 10:52:52 +0300 Subject: [PATCH] Updated on 2026-08-14 --- .../tap/features/details/redux/DetailsMiddleware.kt | 13 ++++++++++--- .../main/res/layout/fragment_details_security.xml | 6 +++--- app/src/main/res/values/strings.xml | 3 +++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/features/details/redux/DetailsMiddleware.kt b/app/src/main/java/com/tangem/tap/features/details/redux/DetailsMiddleware.kt index 1376dd5398..b70f14c6d5 100644 --- a/app/src/main/java/com/tangem/tap/features/details/redux/DetailsMiddleware.kt +++ b/app/src/main/java/com/tangem/tap/features/details/redux/DetailsMiddleware.kt @@ -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 -> diff --git a/app/src/main/res/layout/fragment_details_security.xml b/app/src/main/res/layout/fragment_details_security.xml index e645ea6b3b..11d1ea1b4c 100644 --- a/app/src/main/res/layout/fragment_details_security.xml +++ b/app/src/main/res/layout/fragment_details_security.xml @@ -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" /> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 5ebb9b3051..b75584ec73 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -100,6 +100,9 @@ Long Tap Passcode Access Code + 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. + Before execution of any command entailing a change of the card state you will have to enter the passcode. + You will have to submit the correct access code before scanning the card. This action is irreversible. If, after deleting the wallet, someone sends funds to it, then you will not be able to withdraw them. 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.