Subtituted 'Session' into 'Quit Session' text on go-back modal

This commit is contained in:
Al Lansley 2024-08-30 13:18:50 +10:00 committed by fanchao
parent 67bcc937ce
commit 786485d874

View File

@ -6,10 +6,12 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import com.squareup.phrase.Phrase
import network.loki.messenger.R
import org.session.libsession.utilities.NonTranslatableStringConstants.APP_NAME
import org.session.libsession.utilities.StringSubstitutionConstants.APP_NAME_KEY
import org.thoughtcrime.securesms.ui.AlertDialog
import org.thoughtcrime.securesms.ui.DialogButtonModel
import org.thoughtcrime.securesms.ui.GetString
import org.thoughtcrime.securesms.ui.getSubbedString
import org.thoughtcrime.securesms.ui.theme.LocalColors
@Composable
@ -18,16 +20,18 @@ fun OnboardingBackPressAlertDialog(
@StringRes textId: Int = R.string.onboardingBackAccountCreation,
quit: () -> Unit
) {
val c = LocalContext.current
val quitButtonText = c.getSubbedString(R.string.quit, APP_NAME_KEY to APP_NAME)
AlertDialog(
onDismissRequest = dismissDialog,
title = stringResource(R.string.warning),
text = stringResource(textId).let { txt ->
val c = LocalContext.current
Phrase.from(txt).put(APP_NAME_KEY, c.getString(R.string.app_name)).format().toString()
},
buttons = listOf(
DialogButtonModel(
GetString(stringResource(R.string.quit)),
text = GetString(quitButtonText),
color = LocalColors.current.danger,
onClick = quit
),