Avoids item drawing mishandling of multiple incognitos in the same chat screen

This commit is contained in:
Vitor Pamplona
2025-05-14 18:28:49 -04:00
parent 3c5b9dbca6
commit acf944ebac
3 changed files with 10 additions and 2 deletions
@@ -125,6 +125,9 @@ fun stringRes(
)
}
/**
* This cache can only be used if the painter is the only copy on the screen
*/
@Composable
fun painterRes(
@DrawableRes id: Int,
@@ -49,6 +49,7 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import com.vitorpamplona.amethyst.R
@@ -518,7 +519,7 @@ fun IncognitoIconOn(
tint: Color,
) {
Icon(
painter = painterRes(id = R.drawable.incognito),
painter = painterResource(id = R.drawable.incognito),
contentDescription = stringRes(id = R.string.accessibility_turn_off_sealed_message),
modifier = modifier,
tint = tint,
@@ -531,7 +532,7 @@ fun IncognitoIconOff(
tint: Color,
) {
Icon(
painter = painterRes(id = R.drawable.incognito_off),
painter = painterResource(id = R.drawable.incognito_off),
contentDescription = stringRes(id = R.string.accessibility_turn_on_sealed_message),
modifier = modifier,
tint = tint,
@@ -39,6 +39,10 @@ open class Event(
val content: String,
val sig: HexKey,
) : IEvent {
/**
* Set this to true if the .content is encrypted or encoded in a
* way that it should not be indexed for local search.
*/
open fun isContentEncoded() = false
open fun countMemory(): Long =