Making sure we bold appropriately

This commit is contained in:
ThomasSession 2024-08-29 14:03:41 +10:00
parent 8e80ab08a9
commit 78a9ab7159
3 changed files with 13 additions and 11 deletions

View File

@ -32,6 +32,7 @@ import org.thoughtcrime.securesms.dependencies.DatabaseComponent
import com.bumptech.glide.RequestManager
import org.thoughtcrime.securesms.preferences.PrivacySettingsActivity
import org.thoughtcrime.securesms.showSessionDialog
import org.thoughtcrime.securesms.ui.getSubbedCharSequence
import org.thoughtcrime.securesms.ui.getSubbedString
class ConversationAdapter(
@ -159,7 +160,7 @@ class ConversationAdapter(
val titleTxt = context.getSubbedString(R.string.callsMissedCallFrom, NAME_KEY to message.individualRecipient.name!!)
title(titleTxt)
val bodyTxt = context.getSubbedString(R.string.callsYouMissedCallPermissions, NAME_KEY to message.individualRecipient.name!!)
val bodyTxt = context.getSubbedCharSequence(R.string.callsYouMissedCallPermissions, NAME_KEY to message.individualRecipient.name!!)
text(bodyTxt)
button(R.string.sessionSettings) {

View File

@ -78,21 +78,21 @@ class BlockedContactsViewModel @Inject constructor(private val storage: Storage)
fun getTitle(context: Context): String = context.getString(R.string.blockUnblock)
// Method to get the appropriate text to display when unblocking 1, 2, or several contacts
fun getText(context: Context, contactsToUnblock: Set<Recipient>): String {
fun getText(context: Context, contactsToUnblock: Set<Recipient>): CharSequence {
return when (contactsToUnblock.size) {
// Note: We do not have to handle 0 because if no contacts are chosen then the unblock button is deactivated
1 -> Phrase.from(context, R.string.blockUnblockName)
.put(NAME_KEY, contactsToUnblock.elementAt(0).name)
.format().toString()
.format()
2 -> Phrase.from(context, R.string.blockUnblockNameTwo)
.put(NAME_KEY, contactsToUnblock.elementAt(0).name)
.format().toString()
.format()
else -> {
val othersCount = contactsToUnblock.size - 1
Phrase.from(context, R.string.blockUnblockNameMultiple)
.put(NAME_KEY, contactsToUnblock.elementAt(0).name)
.put(COUNT_KEY, othersCount)
.format().toString()
.format()
}
}
}

View File

@ -17,6 +17,8 @@ import org.thoughtcrime.securesms.calls.WebRtcCallActivity
import org.thoughtcrime.securesms.notifications.NotificationChannels
import org.thoughtcrime.securesms.preferences.SettingsActivity
import org.thoughtcrime.securesms.service.WebRtcCallService
import org.thoughtcrime.securesms.ui.getSubbedCharSequence
import org.thoughtcrime.securesms.ui.getSubbedString
class CallNotificationBuilder {
@ -41,12 +43,11 @@ class CallNotificationBuilder {
val pendingIntent = PendingIntent.getActivity(context, 0, contentIntent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
val titleTxt = Phrase.from(context, R.string.callsMissedCallFrom)
.put(NAME_KEY, callerName)
.format().toString()
val bodyTxt = Phrase.from(context, R.string.callsYouMissedCallPermissions)
.put(NAME_KEY, callerName)
.format().toString()
val titleTxt = context.getSubbedString(R.string.callsMissedCallFrom, NAME_KEY to callerName)
val bodyTxt = context.getSubbedCharSequence(
R.string.callsYouMissedCallPermissions,
NAME_KEY to callerName
)
val builder = NotificationCompat.Builder(context, NotificationChannels.CALLS)
.setSound(null)