TP-40390 | Alfred masking issue (#7782)

This commit is contained in:
Sayed Owais Ali
2023-09-07 12:59:57 +05:30
committed by GitHub
parent e782b9a2af
commit 7d783b6e42
2 changed files with 13 additions and 6 deletions

View File

@@ -30,8 +30,6 @@ import androidx.lifecycle.Lifecycle
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.repeatOnLifecycle
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.google.android.datatransport.runtime.scheduling.persistence.EventStoreModule_PackageNameFactory.packageName
import com.google.android.play.core.install.model.AppUpdateType
import com.google.gson.JsonParser
@@ -660,6 +658,7 @@ class HomeFragment : PaymentBaseFragment(), WidgetCallback, PlayStoreActionListe
?.contains(Constants.SENSITIVE_VIEW) == true
if (isSensitive) {
activity?.window?.decorView?.rootView?.tag = Constants.SENSITIVE_VIEW
composeView.tag = Constants.SENSITIVE_VIEW
}
composeView.setProperties(

View File

@@ -56,19 +56,27 @@ suspend fun captureScreen(
return null
}
if (canvas != null && bmp != null) {
if (isMaskingEnabled(screenName)) {
if (isMaskingEnabled(screenName) || (v.tag == SENSITIVE_VIEW_TAG)) {
val maskedViewsList = findViewWithTagRecursive(v, 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) {
val savedAlpha = maskedView.alpha
alphaList.add(Pair(maskedView, maskedView.alpha))
maskedView.alpha = 0.0f
v.draw(canvas)
maskedView.alpha = savedAlpha
}
v.draw(canvas)
for (alphaView in alphaList) {
val view = alphaView.first
view.alpha = alphaView.second
}
alphaList.clear()
}
} catch (e: Exception) {
e.log()