fix: do not assume there is only one health alert button
Signed-off-by: Infi <infi@infi.sh>
This commit is contained in:
parent
1b4080520a
commit
2d461e2759
|
|
@ -3,7 +3,6 @@ package chat.revolt.components.generic
|
||||||
import androidx.browser.customtabs.CustomTabColorSchemeParams
|
import androidx.browser.customtabs.CustomTabColorSchemeParams
|
||||||
import androidx.browser.customtabs.CustomTabsIntent
|
import androidx.browser.customtabs.CustomTabsIntent
|
||||||
import androidx.compose.material3.AlertDialog
|
import androidx.compose.material3.AlertDialog
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TextButton
|
import androidx.compose.material3.TextButton
|
||||||
|
|
@ -15,7 +14,6 @@ import androidx.core.net.toUri
|
||||||
import chat.revolt.R
|
import chat.revolt.R
|
||||||
import chat.revolt.api.schemas.HealthNotice
|
import chat.revolt.api.schemas.HealthNotice
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
|
||||||
@Composable
|
@Composable
|
||||||
fun HealthAlert(notice: HealthNotice, onDismiss: () -> Unit) {
|
fun HealthAlert(notice: HealthNotice, onDismiss: () -> Unit) {
|
||||||
val context = LocalContext.current
|
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))
|
Text(notice.alert?.text ?: stringResource(R.string.service_health_alert_body_default))
|
||||||
},
|
},
|
||||||
confirmButton = {
|
confirmButton = {
|
||||||
notice.alert?.actions?.firstOrNull()?.let { action ->
|
notice.alert?.actions?.map { action ->
|
||||||
when (action.type) {
|
when (action.type) {
|
||||||
"external" -> TextButton(
|
"external" -> TextButton(
|
||||||
onClick = {
|
onClick = {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue