Update wordings for local room timeline
This commit is contained in:
parent
e86f9193dd
commit
b144bac578
@ -30,6 +30,7 @@ import org.matrix.android.sdk.api.session.Session
|
|||||||
import org.matrix.android.sdk.api.session.events.model.content.EncryptionEventContent
|
import org.matrix.android.sdk.api.session.events.model.content.EncryptionEventContent
|
||||||
import org.matrix.android.sdk.api.session.events.model.toModel
|
import org.matrix.android.sdk.api.session.events.model.toModel
|
||||||
import org.matrix.android.sdk.api.session.getRoomSummary
|
import org.matrix.android.sdk.api.session.getRoomSummary
|
||||||
|
import org.matrix.android.sdk.api.session.room.model.localecho.RoomLocalEcho
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class EncryptionItemFactory @Inject constructor(
|
class EncryptionItemFactory @Inject constructor(
|
||||||
@ -55,13 +56,20 @@ class EncryptionItemFactory @Inject constructor(
|
|||||||
val description: String
|
val description: String
|
||||||
val shield: StatusTileTimelineItem.ShieldUIState
|
val shield: StatusTileTimelineItem.ShieldUIState
|
||||||
if (isSafeAlgorithm) {
|
if (isSafeAlgorithm) {
|
||||||
|
val isDirect = session.getRoomSummary(event.root.roomId.orEmpty())?.isDirect.orFalse()
|
||||||
title = stringProvider.getString(R.string.encryption_enabled)
|
title = stringProvider.getString(R.string.encryption_enabled)
|
||||||
description = stringProvider.getString(
|
description = stringProvider.getString(
|
||||||
if (session.getRoomSummary(event.root.roomId ?: "")?.isDirect.orFalse()) {
|
when {
|
||||||
|
isDirect && RoomLocalEcho.isLocalEchoId(event.root.roomId.orEmpty()) -> {
|
||||||
|
R.string.direct_room_encryption_enabled_tile_description_future
|
||||||
|
}
|
||||||
|
isDirect -> {
|
||||||
R.string.direct_room_encryption_enabled_tile_description
|
R.string.direct_room_encryption_enabled_tile_description
|
||||||
} else {
|
}
|
||||||
|
else -> {
|
||||||
R.string.encryption_enabled_tile_description
|
R.string.encryption_enabled_tile_description
|
||||||
}
|
}
|
||||||
|
}
|
||||||
)
|
)
|
||||||
shield = StatusTileTimelineItem.ShieldUIState.BLACK
|
shield = StatusTileTimelineItem.ShieldUIState.BLACK
|
||||||
} else {
|
} else {
|
||||||
|
@ -117,6 +117,7 @@ class MergedHeaderItemFactory @Inject constructor(
|
|||||||
highlighted = true
|
highlighted = true
|
||||||
}
|
}
|
||||||
val data = BasedMergedItem.Data(
|
val data = BasedMergedItem.Data(
|
||||||
|
roomId = mergedEvent.root.roomId,
|
||||||
userId = mergedEvent.root.senderId ?: "",
|
userId = mergedEvent.root.senderId ?: "",
|
||||||
avatarUrl = mergedEvent.senderInfo.avatarUrl,
|
avatarUrl = mergedEvent.senderInfo.avatarUrl,
|
||||||
memberName = mergedEvent.senderInfo.disambiguatedDisplayName,
|
memberName = mergedEvent.senderInfo.disambiguatedDisplayName,
|
||||||
@ -199,6 +200,7 @@ class MergedHeaderItemFactory @Inject constructor(
|
|||||||
highlighted = true
|
highlighted = true
|
||||||
}
|
}
|
||||||
val data = BasedMergedItem.Data(
|
val data = BasedMergedItem.Data(
|
||||||
|
roomId = mergedEvent.root.roomId,
|
||||||
userId = mergedEvent.root.senderId ?: "",
|
userId = mergedEvent.root.senderId ?: "",
|
||||||
avatarUrl = mergedEvent.senderInfo.avatarUrl,
|
avatarUrl = mergedEvent.senderInfo.avatarUrl,
|
||||||
memberName = mergedEvent.senderInfo.disambiguatedDisplayName,
|
memberName = mergedEvent.senderInfo.disambiguatedDisplayName,
|
||||||
|
@ -54,6 +54,7 @@ abstract class BasedMergedItem<H : BasedMergedItem.Holder> : BaseEventItem<H>()
|
|||||||
}
|
}
|
||||||
|
|
||||||
data class Data(
|
data class Data(
|
||||||
|
val roomId: String?,
|
||||||
val localId: Long,
|
val localId: Long,
|
||||||
val eventId: String,
|
val eventId: String,
|
||||||
val userId: String,
|
val userId: String,
|
||||||
|
@ -40,6 +40,7 @@ import im.vector.app.features.home.room.detail.timeline.TimelineEventController
|
|||||||
import im.vector.app.features.home.room.detail.timeline.tools.linkify
|
import im.vector.app.features.home.room.detail.timeline.tools.linkify
|
||||||
import me.gujun.android.span.span
|
import me.gujun.android.span.span
|
||||||
import org.matrix.android.sdk.api.session.room.model.RoomSummary
|
import org.matrix.android.sdk.api.session.room.model.RoomSummary
|
||||||
|
import org.matrix.android.sdk.api.session.room.model.localecho.RoomLocalEcho
|
||||||
import org.matrix.android.sdk.api.util.toMatrixItem
|
import org.matrix.android.sdk.api.util.toMatrixItem
|
||||||
|
|
||||||
@EpoxyModelClass(layout = R.layout.item_timeline_event_base_noinfo)
|
@EpoxyModelClass(layout = R.layout.item_timeline_event_base_noinfo)
|
||||||
@ -102,11 +103,17 @@ abstract class MergedRoomCreationItem : BasedMergedItem<MergedRoomCreationItem.H
|
|||||||
}
|
}
|
||||||
if (attributes.isEncryptionAlgorithmSecure) {
|
if (attributes.isEncryptionAlgorithmSecure) {
|
||||||
holder.e2eTitleTextView.text = holder.expandView.resources.getString(R.string.encryption_enabled)
|
holder.e2eTitleTextView.text = holder.expandView.resources.getString(R.string.encryption_enabled)
|
||||||
holder.e2eTitleDescriptionView.text = if (data?.isDirectRoom == true) {
|
holder.e2eTitleDescriptionView.text = when {
|
||||||
|
data?.isDirectRoom == true && RoomLocalEcho.isLocalEchoId(data.roomId.orEmpty()) -> {
|
||||||
|
holder.expandView.resources.getString(R.string.direct_room_encryption_enabled_tile_description_future)
|
||||||
|
}
|
||||||
|
data?.isDirectRoom == true -> {
|
||||||
holder.expandView.resources.getString(R.string.direct_room_encryption_enabled_tile_description)
|
holder.expandView.resources.getString(R.string.direct_room_encryption_enabled_tile_description)
|
||||||
} else {
|
}
|
||||||
|
else -> {
|
||||||
holder.expandView.resources.getString(R.string.encryption_enabled_tile_description)
|
holder.expandView.resources.getString(R.string.encryption_enabled_tile_description)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
holder.e2eTitleDescriptionView.textAlignment = View.TEXT_ALIGNMENT_CENTER
|
holder.e2eTitleDescriptionView.textAlignment = View.TEXT_ALIGNMENT_CENTER
|
||||||
holder.e2eTitleTextView.setCompoundDrawablesWithIntrinsicBounds(
|
holder.e2eTitleTextView.setCompoundDrawablesWithIntrinsicBounds(
|
||||||
ContextCompat.getDrawable(holder.view.context, R.drawable.ic_shield_black),
|
ContextCompat.getDrawable(holder.view.context, R.drawable.ic_shield_black),
|
||||||
@ -130,18 +137,30 @@ abstract class MergedRoomCreationItem : BasedMergedItem<MergedRoomCreationItem.H
|
|||||||
val roomDisplayName = roomSummary?.displayName
|
val roomDisplayName = roomSummary?.displayName
|
||||||
holder.roomNameText.setTextOrHide(roomDisplayName)
|
holder.roomNameText.setTextOrHide(roomDisplayName)
|
||||||
val isDirect = roomSummary?.isDirect == true
|
val isDirect = roomSummary?.isDirect == true
|
||||||
|
val isLocalRoom = RoomLocalEcho.isLocalEchoId(roomSummary?.roomId.orEmpty())
|
||||||
val membersCount = roomSummary?.otherMemberIds?.size ?: 0
|
val membersCount = roomSummary?.otherMemberIds?.size ?: 0
|
||||||
|
|
||||||
if (isDirect) {
|
when {
|
||||||
|
isDirect -> {
|
||||||
|
if (isLocalRoom) {
|
||||||
|
holder.roomDescriptionText.text = holder.view.resources.getString(
|
||||||
|
R.string.send_your_first_msg_to_invite,
|
||||||
|
roomSummary?.displayName.orEmpty()
|
||||||
|
)
|
||||||
|
} else {
|
||||||
holder.roomDescriptionText.text = holder.view.resources.getString(
|
holder.roomDescriptionText.text = holder.view.resources.getString(
|
||||||
R.string.this_is_the_beginning_of_dm,
|
R.string.this_is_the_beginning_of_dm,
|
||||||
roomSummary?.displayName ?: ""
|
roomSummary?.displayName.orEmpty()
|
||||||
)
|
)
|
||||||
} else if (roomDisplayName.isNullOrBlank() || roomSummary.name.isBlank()) {
|
}
|
||||||
|
}
|
||||||
|
roomDisplayName.isNullOrBlank() || roomSummary.name.isBlank() -> {
|
||||||
holder.roomDescriptionText.text = holder.view.resources.getString(R.string.this_is_the_beginning_of_room_no_name)
|
holder.roomDescriptionText.text = holder.view.resources.getString(R.string.this_is_the_beginning_of_room_no_name)
|
||||||
} else {
|
}
|
||||||
|
else -> {
|
||||||
holder.roomDescriptionText.text = holder.view.resources.getString(R.string.this_is_the_beginning_of_room, roomDisplayName)
|
holder.roomDescriptionText.text = holder.view.resources.getString(R.string.this_is_the_beginning_of_room, roomDisplayName)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val topic = roomSummary?.topic
|
val topic = roomSummary?.topic
|
||||||
if (topic.isNullOrBlank()) {
|
if (topic.isNullOrBlank()) {
|
||||||
|
@ -2399,7 +2399,8 @@
|
|||||||
|
|
||||||
<string name="encryption_enabled">Encryption enabled</string>
|
<string name="encryption_enabled">Encryption enabled</string>
|
||||||
<string name="encryption_enabled_tile_description">Messages in this room are end-to-end encrypted. Learn more & verify users in their profile.</string>
|
<string name="encryption_enabled_tile_description">Messages in this room are end-to-end encrypted. Learn more & verify users in their profile.</string>
|
||||||
<string name="direct_room_encryption_enabled_tile_description">Messages in this room are end-to-end encrypted.</string>
|
<string name="direct_room_encryption_enabled_tile_description">Messages in this chat are end-to-end encrypted.</string>
|
||||||
|
<string name="direct_room_encryption_enabled_tile_description_future">Messages in this chat will be end-to-end encrypted.</string>
|
||||||
<string name="encryption_not_enabled">Encryption not enabled</string>
|
<string name="encryption_not_enabled">Encryption not enabled</string>
|
||||||
<string name="encryption_misconfigured">Encryption is misconfigured</string>
|
<string name="encryption_misconfigured">Encryption is misconfigured</string>
|
||||||
<string name="encryption_unknown_algorithm_tile_description">The encryption used by this room is not supported</string>
|
<string name="encryption_unknown_algorithm_tile_description">The encryption used by this room is not supported</string>
|
||||||
@ -2411,6 +2412,7 @@
|
|||||||
<string name="this_is_the_beginning_of_room">This is the beginning of %s.</string>
|
<string name="this_is_the_beginning_of_room">This is the beginning of %s.</string>
|
||||||
<string name="this_is_the_beginning_of_room_no_name">This is the beginning of this conversation.</string>
|
<string name="this_is_the_beginning_of_room_no_name">This is the beginning of this conversation.</string>
|
||||||
<string name="this_is_the_beginning_of_dm">This is the beginning of your direct message history with %s.</string>
|
<string name="this_is_the_beginning_of_dm">This is the beginning of your direct message history with %s.</string>
|
||||||
|
<string name="send_your_first_msg_to_invite">Send your first message to invite %s to chat</string>
|
||||||
<!-- First param will be replaced by the value of add_a_topic_link_text, that will be clickable-->
|
<!-- First param will be replaced by the value of add_a_topic_link_text, that will be clickable-->
|
||||||
<string name="room_created_summary_no_topic_creation_text">%s to let people know what this room is about.</string>
|
<string name="room_created_summary_no_topic_creation_text">%s to let people know what this room is about.</string>
|
||||||
<string name="add_a_topic_link_text">Add a topic</string>
|
<string name="add_a_topic_link_text">Add a topic</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user