TP-44151 | gi enable alfred screen name tag (#8169)

This commit is contained in:
Himanshu Tanwar
2023-10-09 20:47:05 +05:30
committed by GitHub
parent c2e53afb80
commit 69137e2d8d
4 changed files with 26 additions and 18 deletions

View File

@@ -49,11 +49,6 @@ abstract class GiBaseActivity : BaseActivity(), ActionHandler.ActionOwner {
getViewModel()?.performAction(action, this)
}
override fun dispatchTouchEvent(ev: MotionEvent?): Boolean {
AlfredManager.handleTouchEvent(ev, screenName = this.screenName, moduleName = AlfredConstants.INSURANCE_MODULE )
return super.dispatchTouchEvent(ev)
}
protected fun handleOnNewIntent(intent: Intent?) {
val screenIdentifier = intent?.getStringExtra(KEY_SCREEN_IDENTIFIER)
screenIdentifier?.takeIf { it.isNotEmpty() }?.let {

View File

@@ -80,8 +80,8 @@ class PostPurchaseFormActivity : BaseActivity(), ActionHandler.ActionOwner {
viewModel.performActionFromCta(action, this)
}
override fun dispatchTouchEvent(event: MotionEvent): Boolean {
if (event.action == MotionEvent.ACTION_DOWN) {
override fun dispatchTouchEvent(event: MotionEvent?): Boolean {
if (event?.action == MotionEvent.ACTION_DOWN) {
val v: View? = currentFocus
if (v is EditText) {
val outRect = Rect()

View File

@@ -10,6 +10,7 @@ package com.navi.insurance.health.activity
import android.app.AlertDialog
import android.content.Context
import android.os.Bundle
import android.view.MotionEvent
import androidx.annotation.LayoutRes
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
@@ -22,6 +23,8 @@ import com.google.android.play.core.appupdate.AppUpdateManagerFactory
import com.google.android.play.core.install.InstallStateUpdatedListener
import com.google.android.play.core.install.model.InstallStatus
import com.google.firebase.crashlytics.FirebaseCrashlytics
import com.navi.analytics.alfred.AlfredManager
import com.navi.analytics.alfred.utils.AlfredConstants
import com.navi.analytics.moengage.MoengageUtil
import com.navi.analytics.utils.NaviTrackEvent
import com.navi.base.deeplink.DeepLinkManager
@@ -78,6 +81,11 @@ abstract class BaseActivity : AppCompatActivity() {
handleRedirection()
}
override fun dispatchTouchEvent(ev: MotionEvent?): Boolean {
AlfredManager.handleTouchEvent(ev, screenName = this.screenName, moduleName = AlfredConstants.INSURANCE_MODULE )
return super.dispatchTouchEvent(ev)
}
fun getCurrentFragmentScreenName(): String {
return try {
if(supportFragmentManager.backStackEntryCount > 0) {

View File

@@ -4,6 +4,7 @@ import android.annotation.SuppressLint
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.collectIsDraggedAsState
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
@@ -78,7 +79,7 @@ fun AutoCarouselWithDescriptionWidgetView(
val pagerBgColor = remember {
Color(android.graphics.Color.parseColor(data?.widgetData?.carouselBgColor ?: "#FFFFFF"))
}
val bottomSheetClick = remember { mutableStateOf(true) }
val autoCarouselEnabledState = remember { mutableStateOf(true) }
Box(
modifier = Modifier
.fillMaxSize()
@@ -102,6 +103,12 @@ fun AutoCarouselWithDescriptionWidgetView(
initialPageOffsetFraction = 0f,
pageCount = { Int.MAX_VALUE },
)
val isDraggedState = pagerState.interactionSource.collectIsDraggedAsState()
LaunchedEffect(isDraggedState.value) {
if (isDraggedState.value) {
autoCarouselEnabledState.value = false
}
}
val indicatorState = rememberPagerState(
initialPage = startIndex,
initialPageOffsetFraction = 0f,
@@ -130,7 +137,7 @@ fun AutoCarouselWithDescriptionWidgetView(
items = data?.widgetData?.carouselItems?.toMutableList(),
currentPageIndexState = currentPageIndex,
carouselTransitionDelay = data?.widgetData?.carouselTransitionDelay ?: DEFAULT_CAROUSEL_TRANSITION_DELAY,
bottomSheetClick = bottomSheetClick.value,
autoCarouselEnabledState = autoCarouselEnabledState,
startIndexState = startIndexState,
pagerState = pagerState
)
@@ -151,7 +158,7 @@ fun AutoCarouselWithDescriptionWidgetView(
itemStyling = data?.widgetData?.descriptionSectionStyling,
widgetCallback = widgetCallback
) {
bottomSheetClick.value = false
autoCarouselEnabledState.value = false
}
}
}
@@ -264,7 +271,7 @@ internal fun AnimatedViewPager(
items: MutableList<AutoCarouselWithDescriptionWidgetData.CarouselItem?>?,
currentPageIndexState: MutableState<Int> = mutableIntStateOf(0),
carouselTransitionDelay: Long,
bottomSheetClick: Boolean,
autoCarouselEnabledState: MutableState<Boolean>,
startIndexState: MutableIntState,
pagerState: PagerState
) {
@@ -281,13 +288,11 @@ internal fun AnimatedViewPager(
}
}
LaunchedEffect(bottomSheetClick) {
while (bottomSheetClick) {
if (bottomSheetClick) {
delay(carouselTransitionDelay)
val nextPage = (pagerState.currentPage + 1) % (Int.MAX_VALUE)
pagerState.animateScrollToPage(nextPage)
}
LaunchedEffect(autoCarouselEnabledState.value) {
while (autoCarouselEnabledState.value) {
delay(carouselTransitionDelay)
val nextPage = (pagerState.currentPage + 1) % (Int.MAX_VALUE)
pagerState.animateScrollToPage(nextPage)
}
}