Updated on 2026-08-14
This commit is contained in:
parent
da84942643
commit
7c4c1e82a1
6 changed files with 36 additions and 19 deletions
|
|
@ -60,7 +60,6 @@ import com.tangem.tap.features.addBackPressHandler
|
|||
import com.tangem.tap.features.onboarding.OnboardingMenuProvider
|
||||
import com.tangem.tap.features.onboarding.products.wallet.redux.*
|
||||
import com.tangem.tap.features.onboarding.products.wallet.ui.dialogs.AccessCodeDialog
|
||||
import com.tangem.tap.mainScope
|
||||
import com.tangem.tap.proxy.redux.DaggerGraphState
|
||||
import com.tangem.tap.scope
|
||||
import com.tangem.tap.store
|
||||
|
|
@ -72,6 +71,7 @@ import com.tangem.wallet.databinding.ViewOnboardingProgressBinding
|
|||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlinx.coroutines.launch
|
||||
import org.rekotlin.StoreSubscriber
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
|
||||
@Suppress("LargeClass", "MagicNumber")
|
||||
|
|
@ -452,6 +452,11 @@ class OnboardingWalletFragment :
|
|||
setOnCancelListener {
|
||||
store.dispatch(BackupAction.OnAccessCodeDialogClosed)
|
||||
}
|
||||
|
||||
setOnShowListener { setSecurityMode(true) }
|
||||
|
||||
setOnDismissListener { setSecurityMode(false) }
|
||||
|
||||
show()
|
||||
showInfoScreen()
|
||||
val view =
|
||||
|
|
@ -666,17 +671,21 @@ class OnboardingWalletFragment :
|
|||
}
|
||||
|
||||
override fun allowScreenshots(allow: Boolean) {
|
||||
mainScope.launch {
|
||||
if (allow) {
|
||||
requireActivity().window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE)
|
||||
} else {
|
||||
requireActivity().window.setFlags(
|
||||
WindowManager.LayoutParams.FLAG_SECURE,
|
||||
WindowManager.LayoutParams.FLAG_SECURE,
|
||||
)
|
||||
}
|
||||
}
|
||||
setSecurityMode(value = !allow)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setSecurityMode(value: Boolean) {
|
||||
Timber.d("Security mode: ${if (value) "enabled" else "disabled"}")
|
||||
|
||||
if (value) {
|
||||
requireActivity().window.setFlags(
|
||||
WindowManager.LayoutParams.FLAG_SECURE,
|
||||
WindowManager.LayoutParams.FLAG_SECURE,
|
||||
)
|
||||
} else {
|
||||
requireActivity().window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -27,8 +27,10 @@ class AccessCodeDialog(context: Context) : BottomSheetDialog(context) {
|
|||
}
|
||||
|
||||
override fun setOnDismissListener(listener: DialogInterface.OnDismissListener?) {
|
||||
super.setOnDismissListener(listener)
|
||||
binding = null
|
||||
super.setOnDismissListener {
|
||||
listener?.onDismiss(it)
|
||||
binding = null
|
||||
}
|
||||
}
|
||||
|
||||
fun showInfoScreen() = with(binding!!) {
|
||||
|
|
|
|||
|
|
@ -5,19 +5,26 @@ import androidx.compose.runtime.Composable
|
|||
import androidx.compose.runtime.DisposableEffect
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import com.tangem.core.ui.utils.findActivity
|
||||
import timber.log.Timber
|
||||
|
||||
/**
|
||||
* Disables screenshots for the current composition.
|
||||
*
|
||||
* @see <a href = "https://developer.android.com/jetpack/androidx/releases/activity?hl=ru#1.10.0">Migration</a>
|
||||
*/
|
||||
@Composable
|
||||
fun DisableScreenshotsDisposableEffect() {
|
||||
val activity = LocalContext.current.findActivity()
|
||||
|
||||
DisposableEffect(activity) {
|
||||
Timber.d("Security mode: enabled")
|
||||
activity.window.setFlags(
|
||||
WindowManager.LayoutParams.FLAG_SECURE,
|
||||
WindowManager.LayoutParams.FLAG_SECURE,
|
||||
)
|
||||
|
||||
onDispose {
|
||||
Timber.d("Security mode: disabled")
|
||||
activity.window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import com.tangem.core.decompose.model.getOrCreateModel
|
|||
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfig
|
||||
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfigContent
|
||||
import com.tangem.core.ui.decompose.ComposableBottomSheetComponent
|
||||
import com.tangem.core.ui.security.DisableScreenshotsDisposableEffect
|
||||
import com.tangem.features.onboarding.v2.multiwallet.impl.child.MultiWalletChildParams
|
||||
import com.tangem.features.onboarding.v2.multiwallet.impl.child.accesscode.model.MultiWalletAccessCodeModel
|
||||
import com.tangem.features.onboarding.v2.multiwallet.impl.child.accesscode.ui.MultiWalletAccessCodeBS
|
||||
|
|
@ -16,7 +17,6 @@ import kotlinx.coroutines.delay
|
|||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@Suppress("UnusedPrivateMember")
|
||||
class MultiWalletAccessCodeComponent(
|
||||
context: AppComponentContext,
|
||||
params: MultiWalletChildParams,
|
||||
|
|
@ -62,6 +62,8 @@ class MultiWalletAccessCodeComponent(
|
|||
state = state,
|
||||
onBack = { model.onBack() },
|
||||
)
|
||||
|
||||
DisableScreenshotsDisposableEffect()
|
||||
}
|
||||
|
||||
@JvmInline
|
||||
|
|
|
|||
|
|
@ -76,9 +76,6 @@ internal class MultiWalletSeedPhraseComponent(
|
|||
|
||||
DisableScreenshotsDisposableEffect()
|
||||
|
||||
MultiWalletSeedPhrase(
|
||||
modifier = modifier,
|
||||
state = state,
|
||||
)
|
||||
MultiWalletSeedPhrase(modifier = modifier, state = state)
|
||||
}
|
||||
}
|
||||
|
|
@ -91,7 +91,7 @@ markdownComposeView = "0.5.4"
|
|||
# region Tangem
|
||||
tangemBlockchainSdk = "develop-942"
|
||||
#tangemBlockchainSdk = "0.0.1" # Keep it! - used for local builds
|
||||
tangemCardSdk = "develop-432"
|
||||
tangemCardSdk = "develop-433"
|
||||
#tangemCardSdk = "0.0.1" # Keep it! - used for local builds ^
|
||||
tangemVico = "2.0.0-alpha.25-tangem-developments8"
|
||||
#tangemVico = "0.0.1" # Keep it! - used for local builds ^
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue