NTP-65561 | Sohan | Added device ram as an input parameter to Home pa… (#16248)
This commit is contained in:
committed by
GitHub
parent
36d65c9c61
commit
8aec31dd47
@@ -19,6 +19,7 @@ import com.navi.common.network.models.ErrorMessage
|
||||
import com.navi.common.network.models.GenericErrorResponse
|
||||
import com.navi.common.network.models.RepoResult
|
||||
import com.navi.common.network.models.isSuccessWithData
|
||||
import com.navi.common.utils.getDeviceModelName
|
||||
import com.naviapp.BuildConfig
|
||||
import com.naviapp.app.NaviApplication
|
||||
import com.naviapp.home.respository.HomeRepository
|
||||
@@ -39,6 +40,7 @@ constructor(
|
||||
screenHash: String? = null,
|
||||
naeScreenName: String,
|
||||
shouldShowNae: Boolean,
|
||||
totalRam: Double,
|
||||
noInternetCallback: () -> Unit,
|
||||
onFailure:
|
||||
suspend (apiErrorMessage: ErrorMessage?, errors: List<GenericErrorResponse>?) -> Unit,
|
||||
@@ -82,7 +84,7 @@ constructor(
|
||||
AlchemistScreenRequest(
|
||||
screenName = HOME_SCREEN_IN_CAPS,
|
||||
screenHash = screenHashForApi,
|
||||
inputMap = queryMap,
|
||||
inputMap = buildQueryMap(queryMap = queryMap, totalRam = totalRam),
|
||||
),
|
||||
naeScreenName = naeScreenName,
|
||||
)
|
||||
@@ -144,8 +146,20 @@ constructor(
|
||||
return NaviCacheAltSourceEntity(isSuccess = false)
|
||||
}
|
||||
|
||||
private fun buildQueryMap(
|
||||
queryMap: HashMap<String, String>,
|
||||
totalRam: Double,
|
||||
): HashMap<String, String> {
|
||||
queryMap[DEVICE_RAM_GB] = totalRam.toString()
|
||||
val deviceName = getDeviceModelName()
|
||||
queryMap[DEVICE_NAME] = deviceName.toString()
|
||||
return queryMap
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val SCREEN_STRUCTURE_AND_META_DATA_NULL =
|
||||
"Both screen structure and meta data is null"
|
||||
const val DEVICE_RAM_GB = "deviceRamGb"
|
||||
const val DEVICE_NAME = "deviceName"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,6 +65,7 @@ import com.naviapp.utils.Constants.HomePageConstants.FETCH_HOME_ITEMS_TIMEOUT
|
||||
import com.naviapp.utils.SelectiveRefreshHandler
|
||||
import dagger.Lazy
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import javax.inject.Inject
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.Job
|
||||
@@ -94,6 +95,7 @@ constructor(
|
||||
val sectionVisibilityTracker: HomePageSectionImpressionTracker,
|
||||
val postRenderTaskExecutor: PostRenderTaskExecutor,
|
||||
private val homeContentProcessingUseCase: HomeContentProcessingUseCase,
|
||||
@ApplicationContext val context: Context,
|
||||
) :
|
||||
BaseMviViewModel<HpStates, HpEvents, HpEffects>(
|
||||
initialState = HpStates(),
|
||||
@@ -105,6 +107,7 @@ constructor(
|
||||
private var analyticsStartTs = System.currentTimeMillis()
|
||||
private var isHomeUIRenderedEventLogged = false
|
||||
var isErrorNaeTriggered = false
|
||||
private val totalRamMemory = getTotalRamMemory(context = context)?.toDoubleOrNull() ?: 100.0
|
||||
|
||||
// Internet Connectivity
|
||||
private val _internetConnectivity = MutableSharedFlow<ConnectivityObserver.Status>()
|
||||
@@ -201,6 +204,7 @@ constructor(
|
||||
screenHash = screenHash,
|
||||
shouldShowNae = shouldShowNae.orFalse(),
|
||||
naeScreenName = naeScreenName,
|
||||
totalRam = totalRamMemory,
|
||||
onFailure = { errorMessage, errors ->
|
||||
setEffect { HpEffects.OnApiFailure(errorMessage, errors) }
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user