diff --git a/android/app/src/main/java/com/naviapp/home/usecase/RenderingConfigurationUseCase.kt b/android/app/src/main/java/com/naviapp/home/usecase/RenderingConfigurationUseCase.kt index 9789ddb529..5d737b894f 100644 --- a/android/app/src/main/java/com/naviapp/home/usecase/RenderingConfigurationUseCase.kt +++ b/android/app/src/main/java/com/naviapp/home/usecase/RenderingConfigurationUseCase.kt @@ -9,6 +9,8 @@ package com.naviapp.home.usecase import android.content.Context import com.navi.common.firebaseremoteconfig.FirebaseRemoteConfigHelper +import com.navi.common.firebaseremoteconfig.FirebaseRemoteConfigHelper.TOUCH_DISABLED_DEVICE_LIST +import com.navi.common.utils.getDeviceModelName import com.navi.common.utils.getTotalRamMemory import dagger.hilt.android.qualifiers.ApplicationContext import javax.inject.Inject @@ -32,6 +34,8 @@ constructor(@ApplicationContext private val context: Context) { */ val deviceRamGb: Double by lazy { getTotalRamMemory(context)?.toDoubleOrNull() ?: 0.0 } + val deviceModel: String? by lazy { getDeviceModelName() } + /** Flag indicating if the device has lower RAM than the threshold defined in remote config. */ private val isRamBelowThreshold by lazy { val maxRamThreshold = @@ -62,9 +66,22 @@ constructor(@ApplicationContext private val context: Context) { isDelayedRenderingFeatureEnabled && isRamBelowThreshold } + /** Device list from Firebase Remote Config stored as JSON array. */ + private val touchDisabledDeviceList: List by lazy { + val devices = FirebaseRemoteConfigHelper.getString(TOUCH_DISABLED_DEVICE_LIST, "") + devices.split(",").map { it.trim() }.filter { it.isNotEmpty() } + } + + /** Flag indicating if current device model is in the Firebase device list. */ + private val isCurrentDeviceInList: Boolean by lazy { + deviceModel?.let { model -> + touchDisabledDeviceList.any { it.equals(model, ignoreCase = true) } + } ?: false + } + /** Cached result for initial touch disabled decision. */ private val _isInitialTouchDisabled by lazy { - isTouchDisabledFeatureEnabled && isRamBelowThreshold + (isTouchDisabledFeatureEnabled && isRamBelowThreshold) || isCurrentDeviceInList } /** diff --git a/android/navi-common/src/main/java/com/navi/common/firebaseremoteconfig/FirebaseRemoteConfigHelper.kt b/android/navi-common/src/main/java/com/navi/common/firebaseremoteconfig/FirebaseRemoteConfigHelper.kt index 9e863403a4..eb367f0376 100644 --- a/android/navi-common/src/main/java/com/navi/common/firebaseremoteconfig/FirebaseRemoteConfigHelper.kt +++ b/android/navi-common/src/main/java/com/navi/common/firebaseremoteconfig/FirebaseRemoteConfigHelper.kt @@ -259,6 +259,7 @@ object FirebaseRemoteConfigHelper { const val DISABLE_INITIAL_TOUCH_EVENT = "DISABLE_INITIAL_TOUCH_EVENT" const val DISABLE_INITIAL_TOUCH_EVENT_MAX_RAM = "DISABLE_INITIAL_TOUCH_EVENT_MAX_RAM" + const val TOUCH_DISABLED_DEVICE_LIST = "TOUCH_DISABLED_DEVICE_LIST" // Api Retry constants const val RETRY_INTERCEPTOR_ENABLED = "RETRY_INTERCEPTOR_ENABLED"