Updated on 2026-08-14

This commit is contained in:
Tangem 2025-11-17 11:59:24 +03:00
parent 01c539a111
commit 315ff5aa6f
11 changed files with 42 additions and 39 deletions

View file

@ -302,7 +302,9 @@ class MainActivity : AppCompatActivity(), ActivityResultCallbackHolder {
}
private fun createAppThemeModeFlow(): SharedFlow<AppThemeMode> {
val tangemApplication = application as TangemApplication
val tangemApplication = requireNotNull(application as? TangemApplication) {
"Application is null"
}
return tangemApplication.getAppThemeModeUseCase()
.filterNotNull()

View file

@ -54,8 +54,8 @@ class PushNotificationDelegate(private val context: Context) {
.setContentIntent(pendingIntent)
.setVibrate(vibratePattern)
.apply {
imageUrl?.let { uri ->
val bitmap = getBitmapImageFromUrl(uri)
if (imageUrl != null) {
val bitmap = getBitmapImageFromUrl(imageUrl)
setStyle(
NotificationCompat
.BigPictureStyle()
@ -64,7 +64,10 @@ class PushNotificationDelegate(private val context: Context) {
}
}
val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
val service = context.getSystemService(Context.NOTIFICATION_SERVICE)
val notificationManager = requireNotNull(service as? NotificationManager) {
"NotificationManager not available"
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val notificationChannel = NotificationChannel(

View file

@ -6,6 +6,7 @@ import com.tangem.tap.features.welcome.redux.WelcomeReducer
import com.tangem.tap.proxy.redux.DaggerGraphReducer
import org.rekotlin.Action
@Suppress("CanBeNonNullable")
fun appReducer(action: Action, state: AppState?): AppState {
requireNotNull(state)
if (action is AppAction.RestoreState) return action.state

View file

@ -4,9 +4,9 @@ import android.content.Context
import android.os.Build
import android.os.Vibrator
import android.os.VibratorManager
import com.tangem.tap.common.haptic.DefaultVibratorHapticManager
import com.tangem.core.ui.haptic.TangemHapticEffect
import com.tangem.core.ui.haptic.VibratorHapticManager
import com.tangem.tap.common.haptic.DefaultVibratorHapticManager
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
@ -22,10 +22,14 @@ class HapticModule {
@Singleton
fun provideHapticManager(@ApplicationContext context: Context): VibratorHapticManager {
val vibrator = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
val vibratorManager = context.getSystemService(Context.VIBRATOR_MANAGER_SERVICE) as VibratorManager
val service = context.getSystemService(Context.VIBRATOR_MANAGER_SERVICE)
val vibratorManager = requireNotNull(service as? VibratorManager) {
"VibratorManager not available"
}
vibratorManager.defaultVibrator
} else {
context.getSystemService(Context.VIBRATOR_SERVICE) as Vibrator
val service = context.getSystemService(Context.VIBRATOR_SERVICE)
requireNotNull(service as? Vibrator) { "Vibrator service not available" }
}
return if (vibrator.hasVibrator()) {

View file

@ -120,16 +120,14 @@ internal class LegacyScanProcessor @Inject constructor(
}
}
private fun sendAnalytics(analyticsEvent: AnalyticsEvent?, scanResponse: ScanResponse) {
analyticsEvent?.let { event ->
// this workaround needed to send CardWasScannedEvent without adding a context
val interceptor = CardContextInterceptor(scanResponse)
val params = event.params.toMutableMap()
interceptor.intercept(params)
event.params = params.toMap()
private fun sendAnalytics(analyticsEvent: AnalyticsEvent, scanResponse: ScanResponse) {
// this workaround needed to send CardWasScannedEvent without adding a context
val interceptor = CardContextInterceptor(scanResponse)
val params = analyticsEvent.params.toMutableMap()
interceptor.intercept(params)
analyticsEvent.params = params.toMap()
Analytics.send(event)
}
Analytics.send(analyticsEvent)
}
// TODO: [REDACTED_JIRA]

View file

@ -23,11 +23,7 @@ import com.tangem.domain.card.repository.CardSdkConfigRepository
import com.tangem.domain.models.scan.CardDTO
import com.tangem.domain.models.scan.ScanResponse
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.domain.visa.model.TangemPayInitialCredentials
import com.tangem.domain.visa.model.VisaActivationInput
import com.tangem.domain.visa.model.VisaDataForApprove
import com.tangem.domain.visa.model.VisaSignedDataByCustomerWallet
import com.tangem.domain.visa.model.sign
import com.tangem.domain.visa.model.*
import com.tangem.domain.wallets.derivations.derivationStyleProvider
import com.tangem.features.onboarding.v2.OnboardingV2FeatureToggles
import com.tangem.operations.ScanTask
@ -82,13 +78,12 @@ internal class DefaultTangemSdkManager(
secureStorage = tangemSdk.secureStorage,
)
}
override val needEnrollBiometrics: Boolean
get() = tangemSdk.authenticationManager.needEnrollBiometrics
override val canUseBiometry: Boolean
get() = tangemSdk.authenticationManager.canAuthenticate || needEnrollBiometrics
override val needEnrollBiometrics: Boolean
get() = tangemSdk.authenticationManager.needEnrollBiometrics
override val keystoreManager: KeystoreManager
get() = tangemSdk.keystoreManager

View file

@ -177,7 +177,7 @@ class VisaCardActivationTask @AssistedInject constructor(
.getOrElse { raise(it.tangemError) }
if (remoteState !is VisaActivationRemoteState.CardWalletSignatureRequired) {
return raise(VisaActivationError.WrongRemoteState.tangemError)
raise(VisaActivationError.WrongRemoteState.tangemError)
}
visaActivationRepository.getCardWalletAcceptanceData(

View file

@ -36,11 +36,6 @@ internal class BiometricUserWalletsListManager(
.mapLatest { it.userWallets }
.distinctUntilChanged()
override val savedWalletsCount: Flow<Int>
get() = state
.mapLatest { walletsCount }
.distinctUntilChanged()
override val userWalletsSync: List<UserWallet>
get() = state.value.userWallets
@ -71,6 +66,11 @@ internal class BiometricUserWalletsListManager(
override val walletsCount: Int
get() = state.value.userWallets.size
override val savedWalletsCount: Flow<Int>
get() = state
.mapLatest { walletsCount }
.distinctUntilChanged()
override suspend fun unlock(type: UnlockType): CompletionResult<UserWallet> {
return unlockAndSetSelectedUserWallet(type)
.mapFailure { error ->

View file

@ -20,11 +20,6 @@ internal class RuntimeUserWalletsListManager : UserWalletsListManager {
.mapLatest { listOfNotNull(it.userWallet) }
.distinctUntilChanged()
override val savedWalletsCount: Flow<Int>
get() = state
.mapLatest { walletsCount }
.distinctUntilChanged()
override val selectedUserWallet: Flow<UserWallet>
get() = state
.mapLatest { it.userWallet }
@ -46,6 +41,11 @@ internal class RuntimeUserWalletsListManager : UserWalletsListManager {
override val walletsCount: Int
get() = if (hasUserWallets) 1 else 0
override val savedWalletsCount: Flow<Int>
get() = state
.mapLatest { walletsCount }
.distinctUntilChanged()
override suspend fun select(userWalletId: UserWalletId): CompletionResult<UserWallet> = catching {
state.value.userWallet
?.takeIf { it.walletId == userWalletId }

View file

@ -33,12 +33,12 @@ class MoonPayService(
private val userWalletProvider: () -> UserWallet?,
) : SellService {
override val initializationStatus: StateFlow<SellServiceInitializationStatus>
get() = _initializationStatus
private val _initializationStatus: MutableStateFlow<SellServiceInitializationStatus> =
MutableStateFlow(value = lceLoading())
override val initializationStatus: StateFlow<SellServiceInitializationStatus>
get() = _initializationStatus
private var status: MoonPayStatus? = null
override suspend fun update() {

@ -1 +1 @@
Subproject commit 92c1bfd3123f0b2fd9e5a80b9d69bbc17a6e1160
Subproject commit 193db8a0247a1f33574dcdd5f9ec4dab2c28ea73