Updated Phrase usage in ConversationAdapter

This commit is contained in:
alansley 2024-08-29 09:06:22 +10:00
parent 34b15d7865
commit dd57da70f6

View File

@ -12,7 +12,6 @@ import androidx.core.util.getOrDefault
import androidx.core.util.set import androidx.core.util.set
import androidx.lifecycle.LifecycleCoroutineScope import androidx.lifecycle.LifecycleCoroutineScope
import androidx.recyclerview.widget.RecyclerView.ViewHolder import androidx.recyclerview.widget.RecyclerView.ViewHolder
import com.squareup.phrase.Phrase
import java.util.concurrent.atomic.AtomicLong import java.util.concurrent.atomic.AtomicLong
import kotlin.math.min import kotlin.math.min
import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.Dispatchers.IO
@ -33,6 +32,7 @@ import org.thoughtcrime.securesms.dependencies.DatabaseComponent
import com.bumptech.glide.RequestManager import com.bumptech.glide.RequestManager
import org.thoughtcrime.securesms.preferences.PrivacySettingsActivity import org.thoughtcrime.securesms.preferences.PrivacySettingsActivity
import org.thoughtcrime.securesms.showSessionDialog import org.thoughtcrime.securesms.showSessionDialog
import org.thoughtcrime.securesms.ui.getSubbedString
class ConversationAdapter( class ConversationAdapter(
context: Context, context: Context,
@ -156,14 +156,12 @@ class ConversationAdapter(
if (message.isCallLog && message.isFirstMissedCall) { if (message.isCallLog && message.isFirstMissedCall) {
viewHolder.view.setOnClickListener { viewHolder.view.setOnClickListener {
context.showSessionDialog { context.showSessionDialog {
val titleTxt = Phrase.from(context, R.string.callsMissedCallFrom) val titleTxt = context.getSubbedString(R.string.callsMissedCallFrom, NAME_KEY to message.individualRecipient.name!!)
.put(NAME_KEY, message.individualRecipient.name)
.format().toString()
title(titleTxt) title(titleTxt)
val bodyTxt = Phrase.from(context, R.string.callsYouMissedCallPermissions)
.put(NAME_KEY, message.individualRecipient.name) val bodyTxt = context.getSubbedString(R.string.callsYouMissedCallPermissions, NAME_KEY to message.individualRecipient.name!!)
.format().toString()
text(bodyTxt) text(bodyTxt)
button(R.string.sessionSettings) { button(R.string.sessionSettings) {
Intent(context, PrivacySettingsActivity::class.java) Intent(context, PrivacySettingsActivity::class.java)
.let(context::startActivity) .let(context::startActivity)