Fix extra clicks on media tab (#3930)

If:

1. You're viewing an account's media tab
2. Some of the media was marked sensitivei
3. The `alwaysShowSensitiveMedia` setting was `true`

tapping on the image (once) would do nothing visible, because it was
treated as the "reveal sensitive media" tap. You had to tap on it a
second time to open it.

Fix this, by passing the preference value through to the relevant code.

---------

Co-authored-by: Tiga! <maxiinne@proton.me>
This commit is contained in:
Nik Clayton 2023-08-07 19:30:56 +02:00 committed by GitHub
commit 791092ef13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 21 additions and 12 deletions

View file

@ -35,7 +35,7 @@ data class AttachmentViewData(
companion object {
@JvmStatic
fun list(status: Status): List<AttachmentViewData> {
fun list(status: Status, alwaysShowSensitiveMedia: Boolean = false): List<AttachmentViewData> {
val actionable = status.actionableStatus
return actionable.attachments.map { attachment ->
AttachmentViewData(
@ -43,7 +43,7 @@ data class AttachmentViewData(
statusId = actionable.id,
statusUrl = actionable.url!!,
sensitive = actionable.sensitive,
isRevealed = !actionable.sensitive
isRevealed = alwaysShowSensitiveMedia || !actionable.sensitive
)
}
}