From 2d461e27597a14bdf220c6f12afaa7477d4b3fa3 Mon Sep 17 00:00:00 2001 From: Infi Date: Sat, 16 Nov 2024 20:51:48 +0100 Subject: [PATCH] fix: do not assume there is only one health alert button Signed-off-by: Infi --- .../main/java/chat/revolt/components/generic/HealthAlert.kt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/src/main/java/chat/revolt/components/generic/HealthAlert.kt b/app/src/main/java/chat/revolt/components/generic/HealthAlert.kt index cd37a3cf..3df371b7 100644 --- a/app/src/main/java/chat/revolt/components/generic/HealthAlert.kt +++ b/app/src/main/java/chat/revolt/components/generic/HealthAlert.kt @@ -3,7 +3,6 @@ package chat.revolt.components.generic import androidx.browser.customtabs.CustomTabColorSchemeParams import androidx.browser.customtabs.CustomTabsIntent import androidx.compose.material3.AlertDialog -import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TextButton @@ -15,7 +14,6 @@ import androidx.core.net.toUri import chat.revolt.R import chat.revolt.api.schemas.HealthNotice -@OptIn(ExperimentalMaterial3Api::class) @Composable fun HealthAlert(notice: HealthNotice, onDismiss: () -> Unit) { val context = LocalContext.current @@ -32,7 +30,7 @@ fun HealthAlert(notice: HealthNotice, onDismiss: () -> Unit) { Text(notice.alert?.text ?: stringResource(R.string.service_health_alert_body_default)) }, confirmButton = { - notice.alert?.actions?.firstOrNull()?.let { action -> + notice.alert?.actions?.map { action -> when (action.type) { "external" -> TextButton( onClick = {