TP-65195 | Homepage transition fix (#154)
This commit is contained in:
@@ -28,7 +28,6 @@ import com.navi.alfred.db.dao.ScreenShotDao
|
||||
import com.navi.alfred.db.dao.ZipDetailsDao
|
||||
import com.navi.alfred.db.model.ZipDetailsHelper
|
||||
import com.navi.alfred.dispatcher.AlfredDispatcher
|
||||
import com.navi.alfred.model.CurrentScreen
|
||||
import com.navi.alfred.model.NaviMotionEvent
|
||||
import com.navi.alfred.model.WorkManagerFailureInputData
|
||||
import com.navi.alfred.network.AlfredFailureRetrofitProvider
|
||||
@@ -89,7 +88,7 @@ object AlfredManager {
|
||||
internal var hasUploadFlowStarted: Boolean = false
|
||||
internal var isAppInBackground: Boolean = false
|
||||
internal var hasRecordingStarted: Boolean = false
|
||||
internal var currentScreen: CurrentScreen = CurrentScreen()
|
||||
internal var currentScreenName: String? = null
|
||||
internal var currentModuleName: String? = null
|
||||
internal var sessionIdForCrash: String? = null
|
||||
internal var sessionStartRecordingTimeForCrash: Long? = null
|
||||
@@ -164,8 +163,8 @@ object AlfredManager {
|
||||
override fun run() {
|
||||
coroutineScope.launch(Dispatchers.IO) {
|
||||
if (moduleName == THIRD_PARTY_MODULE) {
|
||||
currentScreen.name = activity?.localClassName.toString()
|
||||
if (isScreenDisabled(currentScreen.name, moduleName)) {
|
||||
currentScreenName = activity?.localClassName.toString()
|
||||
if (isScreenDisabled(currentScreenName, moduleName)) {
|
||||
if (bmpForThirdPartySdkScreen == null) {
|
||||
val thirdPartyScreenView =
|
||||
LayoutInflater.from(applicationContext)
|
||||
@@ -173,7 +172,7 @@ object AlfredManager {
|
||||
measureInflatedView(thirdPartyScreenView)
|
||||
thirdPartyScreenView
|
||||
.findViewById<AppCompatTextView>(R.id.tv_third_party_name)
|
||||
.text = currentScreen.name
|
||||
.text = currentScreenName
|
||||
bmpForThirdPartySdkScreen =
|
||||
thirdPartyScreenView?.let {
|
||||
captureScreenshotOfCustomView(it)
|
||||
@@ -193,7 +192,7 @@ object AlfredManager {
|
||||
captureScreen(
|
||||
view,
|
||||
context,
|
||||
screenName = currentScreen.name,
|
||||
screenName = currentScreenName,
|
||||
scope = coroutineScope,
|
||||
canvas = bmpForCanvas?.first,
|
||||
bmp = bmpForCanvas?.second,
|
||||
@@ -217,7 +216,7 @@ object AlfredManager {
|
||||
view,
|
||||
bottomSheetView,
|
||||
context,
|
||||
currentScreen.name,
|
||||
currentScreenName,
|
||||
bmpForCanvas?.first,
|
||||
rootBmp = bmpForCanvas?.second,
|
||||
moduleName = moduleName
|
||||
@@ -226,7 +225,7 @@ object AlfredManager {
|
||||
captureScreen(
|
||||
view,
|
||||
context,
|
||||
screenName = currentScreen.name,
|
||||
screenName = currentScreenName,
|
||||
scope = coroutineScope,
|
||||
canvas = bmpForCanvas?.first,
|
||||
bmp = bmpForCanvas?.second,
|
||||
@@ -257,7 +256,7 @@ object AlfredManager {
|
||||
val stopRecordingEvent =
|
||||
buildEvent(
|
||||
AlfredConstants.STOP_RECORDING_EVENT,
|
||||
screenName = currentScreen.name,
|
||||
screenName = currentScreenName,
|
||||
moduleName = currentModuleName
|
||||
)
|
||||
AlfredDispatcher.addTaskToQueue(AddEventTask(stopRecordingEvent, applicationContext))
|
||||
@@ -417,7 +416,7 @@ object AlfredManager {
|
||||
buildNegativeCaseEvent(
|
||||
AlfredConstants.ANR_EVENT,
|
||||
anrEventProperties as HashMap<String, String>,
|
||||
screenName = currentScreen.name,
|
||||
screenName = currentScreenName,
|
||||
moduleName = currentModuleName
|
||||
)
|
||||
AlfredDispatcher.addTaskToQueue(AddNegativeCase(event, this.applicationContext))
|
||||
@@ -438,7 +437,7 @@ object AlfredManager {
|
||||
buildNegativeCaseEvent(
|
||||
AlfredConstants.CRASH_ANALYTICS_EVENT,
|
||||
crashEventProperties as HashMap<String, String>,
|
||||
screenName = currentScreen.name,
|
||||
screenName = currentScreenName,
|
||||
moduleName = currentModuleName
|
||||
)
|
||||
AlfredDispatcher.addTaskToQueue(AddNegativeCase(event, applicationContext))
|
||||
@@ -455,7 +454,7 @@ object AlfredManager {
|
||||
buildNegativeCaseEvent(
|
||||
AlfredConstants.ERROR_LOG,
|
||||
swwEventProperties as HashMap<String, String>,
|
||||
screenName = currentScreen.name,
|
||||
screenName = currentScreenName,
|
||||
moduleName = currentModuleName
|
||||
)
|
||||
AlfredDispatcher.addTaskToQueue(AddNegativeCase(event, applicationContext))
|
||||
@@ -464,11 +463,8 @@ object AlfredManager {
|
||||
}
|
||||
}
|
||||
|
||||
fun setCurrentScreenName(screenName: String?, isComposeScreen: Boolean? = false) {
|
||||
if (isAlfredRecordingEnabled()) {
|
||||
currentScreen.name = screenName ?: ""
|
||||
currentScreen.isComposeScreen = isComposeScreen ?: false
|
||||
}
|
||||
fun setCurrentScreenName(screenName: String?) {
|
||||
currentScreenName = screenName ?: ""
|
||||
}
|
||||
|
||||
fun setUserId(userId: String?) {
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2023 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
|
||||
package com.navi.alfred.model
|
||||
|
||||
data class CurrentScreen(var name: String? = "", var isComposeScreen: Boolean? = false) {
|
||||
override fun toString(): String {
|
||||
return "CurrentScreen(name='$name', isComposeScreen=$isComposeScreen)"
|
||||
}
|
||||
}
|
||||
@@ -629,7 +629,7 @@ internal fun buildAppPerformanceEvent(
|
||||
eventType = eventType,
|
||||
sessionId = AlfredManager.config.getAlfredSessionId(),
|
||||
attributes = attribute,
|
||||
screenName = AlfredManager.currentScreen.name,
|
||||
screenName = AlfredManager.currentScreenName,
|
||||
moduleName = AlfredManager.currentModuleName,
|
||||
fragmentList = getFragmentList()
|
||||
)
|
||||
|
||||
@@ -194,76 +194,35 @@ internal suspend fun captureScreen(
|
||||
bmp: Bitmap? = null,
|
||||
moduleName: String? = null
|
||||
): Bitmap? {
|
||||
if (isScreenDisabled(screenName, moduleName)) {
|
||||
if (isScreenDisabled(screenName, moduleName) || canvas == null || bmp == null) {
|
||||
return null
|
||||
}
|
||||
if (canvas != null && bmp != null) {
|
||||
val currentScreen = AlfredManager.currentScreen
|
||||
|
||||
withContext(Dispatchers.Main) {
|
||||
val rootView = AlfredManager.sensitiveComposeRepository.getRootViewOfComposeScreen()
|
||||
if (
|
||||
isMaskingEnabled(screenName) ||
|
||||
(v.tag == AlfredConstants.SENSITIVE_VIEW_TAG) ||
|
||||
(v.tag == AlfredConstants.SENSITIVE_COMPOSE_VIEW_TAG)
|
||||
) {
|
||||
if (isMaskingEnabled(AlfredManager.currentScreenName)) {
|
||||
try {
|
||||
if (currentScreen.isComposeScreen == true) {
|
||||
if (rootView != null) {
|
||||
if (AlfredManager.sensitiveComposeRepository.getBlurSensitiveScreenStatus()) {
|
||||
withContext(Dispatchers.Main) { blurScreen(canvas, v) }
|
||||
blurScreen(canvas, rootView)
|
||||
} else {
|
||||
if (rootView != null) {
|
||||
withContext(Dispatchers.Main) {
|
||||
captureComposeViewWithMasking(canvas, rootView)
|
||||
}
|
||||
} else {
|
||||
withContext(Dispatchers.Main) { v.draw(canvas) }
|
||||
}
|
||||
captureComposeViewWithMasking(canvas, rootView)
|
||||
}
|
||||
} else {
|
||||
val maskedViewsList =
|
||||
findViewWithTagRecursive(
|
||||
v,
|
||||
AlfredConstants.SENSITIVE_VIEW_TAG,
|
||||
mutableListOf()
|
||||
)
|
||||
withContext(Dispatchers.Main) {
|
||||
try {
|
||||
if (maskedViewsList.isEmpty()) {
|
||||
v.draw(canvas)
|
||||
} else {
|
||||
val alphaList = mutableListOf<Pair<View, Float>>()
|
||||
|
||||
for (maskedView in maskedViewsList) {
|
||||
alphaList.add(Pair(maskedView, maskedView.alpha))
|
||||
maskedView.alpha = 0.0f
|
||||
}
|
||||
|
||||
v.draw(canvas)
|
||||
|
||||
for (alphaView in alphaList) {
|
||||
val view = alphaView.first
|
||||
view.alpha = alphaView.second
|
||||
}
|
||||
alphaList.clear()
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.log()
|
||||
}
|
||||
if (v.tag == AlfredConstants.SENSITIVE_VIEW_TAG) {
|
||||
captureXmlViewWithMasking(canvas, v)
|
||||
} else {
|
||||
v.draw(canvas)
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.log()
|
||||
}
|
||||
} else {
|
||||
withContext(Dispatchers.Main) {
|
||||
try {
|
||||
v.draw(canvas)
|
||||
} catch (e: Exception) {
|
||||
e.log()
|
||||
}
|
||||
}
|
||||
v.draw(canvas)
|
||||
}
|
||||
insertScreenShotPathInDb(scope, context, bmp, bottomSheetFlow)
|
||||
}
|
||||
insertScreenShotPathInDb(scope, context, bmp, bottomSheetFlow)
|
||||
return bmp
|
||||
}
|
||||
|
||||
@@ -351,6 +310,33 @@ internal fun blurScreen(canvas: Canvas, rootView: View) {
|
||||
)
|
||||
}
|
||||
|
||||
internal fun captureXmlViewWithMasking(canvas: Canvas, v: View) {
|
||||
val maskedViewsList =
|
||||
findViewWithTagRecursive(v, AlfredConstants.SENSITIVE_VIEW_TAG, mutableListOf())
|
||||
try {
|
||||
if (maskedViewsList.isEmpty()) {
|
||||
v.draw(canvas)
|
||||
} else {
|
||||
val alphaList = mutableListOf<Pair<View, Float>>()
|
||||
|
||||
for (maskedView in maskedViewsList) {
|
||||
alphaList.add(Pair(maskedView, maskedView.alpha))
|
||||
maskedView.alpha = 0.0f
|
||||
}
|
||||
|
||||
v.draw(canvas)
|
||||
|
||||
for (alphaView in alphaList) {
|
||||
val view = alphaView.first
|
||||
view.alpha = alphaView.second
|
||||
}
|
||||
alphaList.clear()
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.log()
|
||||
}
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
internal fun measureInflatedView(view: View, width: Int = 1080, height: Int = 1920) {
|
||||
view.layoutParams = ViewGroup.LayoutParams(width, height)
|
||||
|
||||
Reference in New Issue
Block a user