mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-23 01:45:52 +03:00
Differentiate wordings for direct rooms.
This commit is contained in:
parent
5beaa93437
commit
24fcb3f58f
8 changed files with 206 additions and 68 deletions
|
@ -10,13 +10,19 @@
|
|||
<string name="notice_room_invite_no_invitee_by_you">Your invitation</string>
|
||||
<string name="notice_room_created">%1$s created the room</string>
|
||||
<string name="notice_room_created_by_you">You created the room</string>
|
||||
<string name="notice_direct_room_created">%1$s joined</string>
|
||||
<string name="notice_direct_room_created_by_you">You joined</string>
|
||||
<string name="notice_room_invite">%1$s invited %2$s</string>
|
||||
<string name="notice_room_invite_by_you">You invited %1$s</string>
|
||||
<string name="notice_room_invite_you">%1$s invited you</string>
|
||||
<string name="notice_room_join">%1$s joined the room</string>
|
||||
<string name="notice_room_join_by_you">You joined the room</string>
|
||||
<string name="notice_direct_room_join">%1$s joined</string>
|
||||
<string name="notice_direct_room_join_by_you">You joined</string>
|
||||
<string name="notice_room_leave">%1$s left the room</string>
|
||||
<string name="notice_room_leave_by_you">You left the room</string>
|
||||
<string name="notice_direct_room_leave">%1$s left the room</string>
|
||||
<string name="notice_direct_room_leave_by_you">You left the room</string>
|
||||
<string name="notice_room_reject">%1$s rejected the invitation</string>
|
||||
<string name="notice_room_reject_by_you">You rejected the invitation</string>
|
||||
<string name="notice_room_kick">%1$s kicked %2$s</string>
|
||||
|
@ -53,6 +59,8 @@
|
|||
<string name="notice_ended_call_by_you">You ended the call.</string>
|
||||
<string name="notice_made_future_room_visibility">%1$s made future room history visible to %2$s</string>
|
||||
<string name="notice_made_future_room_visibility_by_you">You made future room history visible to %1$s</string>
|
||||
<string name="notice_made_future_direct_room_visibility">%1$s made future messages visible to %2$s</string>
|
||||
<string name="notice_made_future_direct_room_visibility_by_you">You made future messages visible to %1$s</string>
|
||||
<string name="notice_room_visibility_invited">all room members, from the point they are invited.</string>
|
||||
<string name="notice_room_visibility_joined">all room members, from the point they joined.</string>
|
||||
<string name="notice_room_visibility_shared">all room members.</string>
|
||||
|
@ -62,6 +70,8 @@
|
|||
<string name="notice_end_to_end_by_you">You turned on end-to-end encryption (%1$s)</string>
|
||||
<string name="notice_room_update">%s upgraded this room.</string>
|
||||
<string name="notice_room_update_by_you">You upgraded this room.</string>
|
||||
<string name="notice_direct_room_update">%s upgraded here.</string>
|
||||
<string name="notice_direct_room_update_by_you">You upgraded here.</string>
|
||||
|
||||
<string name="notice_requested_voip_conference">%1$s requested a VoIP conference</string>
|
||||
<string name="notice_requested_voip_conference_by_you">You requested a VoIP conference</string>
|
||||
|
@ -83,8 +93,12 @@
|
|||
<string name="notice_profile_change_redacted_by_you">You updated your profile %1$s</string>
|
||||
<string name="notice_room_third_party_invite">%1$s sent an invitation to %2$s to join the room</string>
|
||||
<string name="notice_room_third_party_invite_by_you">You sent an invitation to %1$s to join the room</string>
|
||||
<string name="notice_direct_room_third_party_invite">%1$s invited %2$s</string>
|
||||
<string name="notice_direct_room_third_party_invite_by_you">You invited %1$s</string>
|
||||
<string name="notice_room_third_party_revoked_invite">%1$s revoked the invitation for %2$s to join the room</string>
|
||||
<string name="notice_room_third_party_revoked_invite_by_you">You revoked the invitation for %1$s to join the room</string>
|
||||
<string name="notice_direct_room_third_party_revoked_invite">%1$s revoked the invitation for %2$s</string>
|
||||
<string name="notice_direct_room_third_party_revoked_invite_by_you">You revoked the invitation for %1$s</string>
|
||||
<string name="notice_room_third_party_registered_invite">%1$s accepted the invitation for %2$s</string>
|
||||
<string name="notice_room_third_party_registered_invite_by_you">You accepted the invitation for %1$s</string>
|
||||
|
||||
|
@ -171,8 +185,12 @@
|
|||
<string name="notice_room_invite_you_with_reason">%1$s invited you. Reason: %2$s</string>
|
||||
<string name="notice_room_join_with_reason">%1$s joined the room. Reason: %2$s</string>
|
||||
<string name="notice_room_join_with_reason_by_you">You joined the room. Reason: %1$s</string>
|
||||
<string name="notice_direct_room_join_with_reason">%1$s joined. Reason: %2$s</string>
|
||||
<string name="notice_direct_room_join_with_reason_by_you">You joined. Reason: %1$s</string>
|
||||
<string name="notice_room_leave_with_reason">%1$s left the room. Reason: %2$s</string>
|
||||
<string name="notice_room_leave_with_reason_by_you">You left the room. Reason: %1$s</string>
|
||||
<string name="notice_direct_room_leave_with_reason">%1$s left. Reason: %2$s</string>
|
||||
<string name="notice_direct_room_leave_with_reason_by_you">You left. Reason: %1$s</string>
|
||||
<string name="notice_room_reject_with_reason">%1$s rejected the invitation. Reason: %2$s</string>
|
||||
<string name="notice_room_reject_with_reason_by_you">You rejected the invitation. Reason: %1$s</string>
|
||||
<string name="notice_room_kick_with_reason">%1$s kicked %2$s. Reason: %3$s</string>
|
||||
|
@ -220,8 +238,12 @@
|
|||
|
||||
<string name="notice_room_guest_access_can_join">"%1$s has allowed guests to join the room."</string>
|
||||
<string name="notice_room_guest_access_can_join_by_you">"You have allowed guests to join the room."</string>
|
||||
<string name="notice_direct_room_guest_access_can_join">"%1$s has allowed guests to join here."</string>
|
||||
<string name="notice_direct_room_guest_access_can_join_by_you">"You have allowed guests to join here."</string>
|
||||
<string name="notice_room_guest_access_forbidden">"%1$s has prevented guests from joining the room."</string>
|
||||
<string name="notice_room_guest_access_forbidden_by_you">"You have prevented guests from joining the room."</string>
|
||||
<string name="notice_direct_room_guest_access_forbidden">"%1$s has prevented guests from joining the room."</string>
|
||||
<string name="notice_direct_room_guest_access_forbidden_by_you">"You have prevented guests from joining the room."</string>
|
||||
|
||||
<string name="notice_end_to_end_ok">%1$s turned on end-to-end encryption.</string>
|
||||
<string name="notice_end_to_end_ok_by_you">You turned on end-to-end encryption.</string>
|
||||
|
|
|
@ -704,7 +704,11 @@ class RoomDetailFragment @Inject constructor(
|
|||
// safeStartCall(it, isVideoCall)
|
||||
// }
|
||||
} else if (!state.isAllowedToStartWebRTCCall) {
|
||||
showDialogWithMessage(getString(R.string.no_permissions_to_start_webrtc_call))
|
||||
if (session.getRoom(state.roomId)?.roomSummary()?.isDirect == true) {
|
||||
showDialogWithMessage(getString(R.string.no_permissions_to_start_webrtc_call_in_direct_room))
|
||||
} else {
|
||||
showDialogWithMessage(getString(R.string.no_permissions_to_start_webrtc_call))
|
||||
}
|
||||
} else {
|
||||
safeStartCall(isVideoCall)
|
||||
}
|
||||
|
@ -714,7 +718,11 @@ class RoomDetailFragment @Inject constructor(
|
|||
// can you add widgets??
|
||||
if (!state.isAllowedToManageWidgets) {
|
||||
// You do not have permission to start a conference call in this room
|
||||
showDialogWithMessage(getString(R.string.no_permissions_to_start_conf_call))
|
||||
if (session.getRoom(state.roomId)?.roomSummary()?.isDirect == true) {
|
||||
showDialogWithMessage(getString(R.string.no_permissions_to_start_conf_call_in_direct_room))
|
||||
} else {
|
||||
showDialogWithMessage(getString(R.string.no_permissions_to_start_conf_call))
|
||||
}
|
||||
} else {
|
||||
if (state.activeRoomWidgets()?.filter { it.type == WidgetType.Jitsi }?.any() == true) {
|
||||
// A conference is already in progress!
|
||||
|
|
|
@ -25,6 +25,8 @@ import im.vector.app.features.home.room.detail.timeline.helper.MessageInformatio
|
|||
import im.vector.app.features.home.room.detail.timeline.helper.MessageItemAttributesFactory
|
||||
import im.vector.app.features.home.room.detail.timeline.item.StatusTileTimelineItem
|
||||
import im.vector.app.features.home.room.detail.timeline.item.StatusTileTimelineItem_
|
||||
import org.matrix.android.sdk.api.extensions.orFalse
|
||||
import org.matrix.android.sdk.api.session.Session
|
||||
import org.matrix.android.sdk.api.session.events.model.toModel
|
||||
import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent
|
||||
import org.matrix.android.sdk.internal.crypto.MXCRYPTO_ALGORITHM_MEGOLM
|
||||
|
@ -36,7 +38,8 @@ class EncryptionItemFactory @Inject constructor(
|
|||
private val messageColorProvider: MessageColorProvider,
|
||||
private val stringProvider: StringProvider,
|
||||
private val informationDataFactory: MessageInformationDataFactory,
|
||||
private val avatarSizeProvider: AvatarSizeProvider) {
|
||||
private val avatarSizeProvider: AvatarSizeProvider,
|
||||
private val session: Session) {
|
||||
|
||||
fun create(event: TimelineEvent,
|
||||
highlight: Boolean,
|
||||
|
@ -51,7 +54,11 @@ class EncryptionItemFactory @Inject constructor(
|
|||
val shield: StatusTileTimelineItem.ShieldUIState
|
||||
if (isSafeAlgorithm) {
|
||||
title = stringProvider.getString(R.string.encryption_enabled)
|
||||
description = stringProvider.getString(R.string.encryption_enabled_tile_description)
|
||||
description = if (session.getRoomSummary(event.root.roomId ?: "")?.isDirect.orFalse()) {
|
||||
stringProvider.getString(R.string.direct_room_encryption_enabled_tile_description)
|
||||
} else {
|
||||
stringProvider.getString(R.string.encryption_enabled_tile_description)
|
||||
}
|
||||
shield = StatusTileTimelineItem.ShieldUIState.BLACK
|
||||
} else {
|
||||
title = stringProvider.getString(R.string.encryption_not_enabled)
|
||||
|
|
|
@ -33,6 +33,7 @@ import im.vector.app.features.home.room.detail.timeline.item.MergedRoomCreationI
|
|||
import im.vector.app.features.home.room.detail.timeline.item.MergedUTDItem
|
||||
import im.vector.app.features.home.room.detail.timeline.item.MergedUTDItem_
|
||||
import im.vector.app.features.settings.VectorPreferences
|
||||
import org.matrix.android.sdk.api.extensions.orFalse
|
||||
import org.matrix.android.sdk.api.session.events.model.EventType
|
||||
import org.matrix.android.sdk.api.session.events.model.toModel
|
||||
import org.matrix.android.sdk.api.session.room.model.create.RoomCreateContent
|
||||
|
@ -78,6 +79,12 @@ class MergedHeaderItemFactory @Inject constructor(private val activeSessionHolde
|
|||
}
|
||||
}
|
||||
|
||||
private fun isDirectRoom(roomId: String?): Boolean {
|
||||
return roomId?.let {
|
||||
activeSessionHolder.getSafeActiveSession()?.getRoom(roomId)?.roomSummary()?.isDirect
|
||||
}.orFalse()
|
||||
}
|
||||
|
||||
private fun buildMembershipEventsMergedSummary(currentPosition: Int,
|
||||
items: List<TimelineEvent>,
|
||||
event: TimelineEvent,
|
||||
|
@ -100,7 +107,8 @@ class MergedHeaderItemFactory @Inject constructor(private val activeSessionHolde
|
|||
avatarUrl = mergedEvent.senderInfo.avatarUrl,
|
||||
memberName = mergedEvent.senderInfo.disambiguatedDisplayName,
|
||||
localId = mergedEvent.localId,
|
||||
eventId = mergedEvent.root.eventId ?: ""
|
||||
eventId = mergedEvent.root.eventId ?: "",
|
||||
isDirectRoom = isDirectRoom(mergedEvent.root.roomId)
|
||||
)
|
||||
mergedData.add(data)
|
||||
}
|
||||
|
@ -157,7 +165,7 @@ class MergedHeaderItemFactory @Inject constructor(private val activeSessionHolde
|
|||
items: List<TimelineEvent>,
|
||||
event: TimelineEvent,
|
||||
eventIdToHighlight: String?,
|
||||
// requestModelBuild: () -> Unit,
|
||||
// requestModelBuild: () -> Unit,
|
||||
callback: TimelineEventController.Callback?): MergedUTDItem_? {
|
||||
Timber.v("## MERGE: buildUTDMergedSummary from position $currentPosition")
|
||||
var prevEvent = items.prevOrNull(currentPosition)
|
||||
|
@ -187,7 +195,8 @@ class MergedHeaderItemFactory @Inject constructor(private val activeSessionHolde
|
|||
avatarUrl = senderAvatar,
|
||||
memberName = senderName,
|
||||
localId = mergedEvent.localId,
|
||||
eventId = mergedEvent.root.eventId ?: ""
|
||||
eventId = mergedEvent.root.eventId ?: "",
|
||||
isDirectRoom = isDirectRoom(mergedEvent.root.roomId)
|
||||
)
|
||||
mergedData.add(data)
|
||||
}
|
||||
|
@ -247,7 +256,8 @@ class MergedHeaderItemFactory @Inject constructor(private val activeSessionHolde
|
|||
avatarUrl = mergedEvent.senderInfo.avatarUrl,
|
||||
memberName = mergedEvent.senderInfo.disambiguatedDisplayName,
|
||||
localId = mergedEvent.localId,
|
||||
eventId = mergedEvent.root.eventId ?: ""
|
||||
eventId = mergedEvent.root.eventId ?: "",
|
||||
isDirectRoom = isDirectRoom(mergedEvent.root.roomId)
|
||||
)
|
||||
mergedData.add(data)
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
package im.vector.app.features.home.room.detail.timeline.format
|
||||
|
||||
import androidx.annotation.StringRes
|
||||
import im.vector.app.ActiveSessionDataSource
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.resources.StringProvider
|
||||
|
@ -56,6 +57,27 @@ class NoticeEventFormatter @Inject constructor(private val activeSessionDataSour
|
|||
|
||||
private fun Event.isSentByCurrentUser() = senderId != null && senderId == currentUserId
|
||||
|
||||
private fun isDirectRoom(roomId: String?): Boolean {
|
||||
return roomId?.let {
|
||||
activeSessionDataSource.currentValue?.orNull()?.getRoom(roomId)?.roomSummary()?.isDirect
|
||||
}.orFalse()
|
||||
}
|
||||
|
||||
private fun chooseResourceByRoomType(event: Event,
|
||||
@StringRes directRoomResId: Int,
|
||||
@StringRes directRoomByUserResId: Int,
|
||||
@StringRes publicRoomResId: Int,
|
||||
@StringRes publicRoomByUserResId: Int,
|
||||
userResArgs: Any? = null,
|
||||
vararg thirdPartyResArgs: Any?
|
||||
): String {
|
||||
return if (isDirectRoom(event.roomId)) {
|
||||
if (event.isSentByCurrentUser()) sp.getString(directRoomByUserResId, userResArgs) else sp.getString(directRoomResId, *thirdPartyResArgs)
|
||||
} else {
|
||||
if (event.isSentByCurrentUser()) sp.getString(publicRoomByUserResId, userResArgs) else sp.getString(publicRoomResId, *thirdPartyResArgs)
|
||||
}
|
||||
}
|
||||
|
||||
fun format(timelineEvent: TimelineEvent): CharSequence? {
|
||||
return when (val type = timelineEvent.root.getClearType()) {
|
||||
EventType.STATE_ROOM_JOIN_RULES -> formatJoinRulesEvent(timelineEvent.root, timelineEvent.senderInfo.disambiguatedDisplayName)
|
||||
|
@ -179,11 +201,14 @@ class NoticeEventFormatter @Inject constructor(private val activeSessionDataSour
|
|||
return event.getClearContent().toModel<RoomCreateContent>()
|
||||
?.takeIf { it.creator.isNullOrBlank().not() }
|
||||
?.let {
|
||||
if (event.isSentByCurrentUser()) {
|
||||
sp.getString(R.string.notice_room_created_by_you)
|
||||
} else {
|
||||
sp.getString(R.string.notice_room_created, it.creator)
|
||||
}
|
||||
chooseResourceByRoomType(
|
||||
event = event,
|
||||
directRoomResId = R.string.notice_room_created_by_you,
|
||||
directRoomByUserResId = R.string.notice_direct_room_created_by_you,
|
||||
publicRoomResId = R.string.notice_room_created,
|
||||
publicRoomByUserResId = R.string.notice_room_created_by_you,
|
||||
thirdPartyResArgs = *arrayOf(it.creator)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -205,11 +230,14 @@ class NoticeEventFormatter @Inject constructor(private val activeSessionDataSour
|
|||
}
|
||||
|
||||
private fun formatRoomTombstoneEvent(event: Event, senderName: String?): CharSequence? {
|
||||
return if (event.isSentByCurrentUser()) {
|
||||
sp.getString(R.string.notice_room_update_by_you)
|
||||
} else {
|
||||
sp.getString(R.string.notice_room_update, senderName)
|
||||
}
|
||||
return chooseResourceByRoomType(
|
||||
event = event,
|
||||
directRoomResId = R.string.notice_direct_room_update,
|
||||
directRoomByUserResId = R.string.notice_direct_room_update_by_you,
|
||||
publicRoomResId = R.string.notice_room_update,
|
||||
publicRoomByUserResId = R.string.notice_room_update_by_you,
|
||||
thirdPartyResArgs = *arrayOf(senderName)
|
||||
)
|
||||
}
|
||||
|
||||
private fun formatRoomTopicEvent(event: Event, senderName: String?): CharSequence? {
|
||||
|
@ -250,11 +278,15 @@ class NoticeEventFormatter @Inject constructor(private val activeSessionDataSour
|
|||
val historyVisibility = event.getClearContent().toModel<RoomHistoryVisibilityContent>()?.historyVisibility ?: return null
|
||||
|
||||
val formattedVisibility = roomHistoryVisibilityFormatter.format(historyVisibility)
|
||||
return if (event.isSentByCurrentUser()) {
|
||||
sp.getString(R.string.notice_made_future_room_visibility_by_you, formattedVisibility)
|
||||
} else {
|
||||
sp.getString(R.string.notice_made_future_room_visibility, senderName, formattedVisibility)
|
||||
}
|
||||
return chooseResourceByRoomType(
|
||||
event = event,
|
||||
directRoomResId = R.string.notice_made_future_direct_room_visibility,
|
||||
directRoomByUserResId = R.string.notice_made_future_direct_room_visibility_by_you,
|
||||
publicRoomResId = R.string.notice_made_future_room_visibility,
|
||||
publicRoomByUserResId = R.string.notice_made_future_room_visibility_by_you,
|
||||
userResArgs = formattedVisibility,
|
||||
thirdPartyResArgs = *arrayOf(senderName, formattedVisibility)
|
||||
)
|
||||
}
|
||||
|
||||
private fun formatRoomThirdPartyInvite(event: Event, senderName: String?): CharSequence? {
|
||||
|
@ -264,19 +296,27 @@ class NoticeEventFormatter @Inject constructor(private val activeSessionDataSour
|
|||
return when {
|
||||
prevContent != null -> {
|
||||
// Revoke case
|
||||
if (event.isSentByCurrentUser()) {
|
||||
sp.getString(R.string.notice_room_third_party_revoked_invite_by_you, prevContent.displayName)
|
||||
} else {
|
||||
sp.getString(R.string.notice_room_third_party_revoked_invite, senderName, prevContent.displayName)
|
||||
}
|
||||
chooseResourceByRoomType(
|
||||
event = event,
|
||||
directRoomResId = R.string.notice_direct_room_third_party_revoked_invite,
|
||||
directRoomByUserResId = R.string.notice_direct_room_third_party_revoked_invite_by_you,
|
||||
publicRoomResId = R.string.notice_room_third_party_revoked_invite,
|
||||
publicRoomByUserResId = R.string.notice_room_third_party_revoked_invite_by_you,
|
||||
userResArgs = prevContent.displayName,
|
||||
thirdPartyResArgs = *arrayOf(senderName, prevContent.displayName)
|
||||
)
|
||||
}
|
||||
content != null -> {
|
||||
// Invitation case
|
||||
if (event.isSentByCurrentUser()) {
|
||||
sp.getString(R.string.notice_room_third_party_invite_by_you, content.displayName)
|
||||
} else {
|
||||
sp.getString(R.string.notice_room_third_party_invite, senderName, content.displayName)
|
||||
}
|
||||
chooseResourceByRoomType(
|
||||
event = event,
|
||||
directRoomResId = R.string.notice_direct_room_third_party_invite,
|
||||
directRoomByUserResId = R.string.notice_direct_room_third_party_invite_by_you,
|
||||
publicRoomResId = R.string.notice_room_third_party_invite,
|
||||
publicRoomByUserResId = R.string.notice_room_third_party_invite_by_you,
|
||||
userResArgs = content.displayName,
|
||||
thirdPartyResArgs = *arrayOf(senderName, content.displayName)
|
||||
)
|
||||
}
|
||||
else -> null
|
||||
}
|
||||
|
@ -391,17 +431,23 @@ class NoticeEventFormatter @Inject constructor(private val activeSessionDataSour
|
|||
val eventContent: RoomGuestAccessContent? = event.getClearContent().toModel()
|
||||
return when (eventContent?.guestAccess) {
|
||||
GuestAccess.CanJoin ->
|
||||
if (event.isSentByCurrentUser()) {
|
||||
sp.getString(R.string.notice_room_guest_access_can_join_by_you)
|
||||
} else {
|
||||
sp.getString(R.string.notice_room_guest_access_can_join, senderName)
|
||||
}
|
||||
chooseResourceByRoomType(
|
||||
event = event,
|
||||
directRoomResId = R.string.notice_direct_room_guest_access_can_join,
|
||||
directRoomByUserResId = R.string.notice_direct_room_guest_access_can_join_by_you,
|
||||
publicRoomResId = R.string.notice_room_guest_access_can_join,
|
||||
publicRoomByUserResId = R.string.notice_room_guest_access_can_join_by_you,
|
||||
thirdPartyResArgs = *arrayOf(senderName)
|
||||
)
|
||||
GuestAccess.Forbidden ->
|
||||
if (event.isSentByCurrentUser()) {
|
||||
sp.getString(R.string.notice_room_guest_access_forbidden_by_you)
|
||||
} else {
|
||||
sp.getString(R.string.notice_room_guest_access_forbidden, senderName)
|
||||
}
|
||||
chooseResourceByRoomType(
|
||||
event = event,
|
||||
directRoomResId = R.string.notice_direct_room_guest_access_forbidden,
|
||||
directRoomByUserResId = R.string.notice_direct_room_guest_access_forbidden_by_you,
|
||||
publicRoomResId = R.string.notice_room_guest_access_forbidden,
|
||||
publicRoomByUserResId = R.string.notice_room_guest_access_forbidden_by_you,
|
||||
thirdPartyResArgs = *arrayOf(senderName)
|
||||
)
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
@ -524,14 +570,25 @@ class NoticeEventFormatter @Inject constructor(private val activeSessionDataSour
|
|||
}
|
||||
}
|
||||
Membership.JOIN ->
|
||||
if (event.isSentByCurrentUser()) {
|
||||
eventContent.safeReason?.let { reason ->
|
||||
sp.getString(R.string.notice_room_join_with_reason_by_you, reason)
|
||||
} ?: sp.getString(R.string.notice_room_join_by_you)
|
||||
} else {
|
||||
eventContent.safeReason?.let { reason ->
|
||||
sp.getString(R.string.notice_room_join_with_reason, senderDisplayName, reason)
|
||||
} ?: sp.getString(R.string.notice_room_join, senderDisplayName)
|
||||
eventContent.safeReason?.let { reason ->
|
||||
chooseResourceByRoomType(
|
||||
event = event,
|
||||
directRoomResId = R.string.notice_direct_room_join_with_reason,
|
||||
directRoomByUserResId = R.string.notice_direct_room_join_with_reason_by_you,
|
||||
publicRoomResId = R.string.notice_room_join_with_reason,
|
||||
publicRoomByUserResId = R.string.notice_room_join_with_reason_by_you,
|
||||
userResArgs = reason,
|
||||
thirdPartyResArgs = *arrayOf(senderDisplayName, reason)
|
||||
)
|
||||
} ?: run {
|
||||
chooseResourceByRoomType(
|
||||
event = event,
|
||||
directRoomResId = R.string.notice_direct_room_join,
|
||||
directRoomByUserResId = R.string.notice_direct_room_join_by_you,
|
||||
publicRoomResId = R.string.notice_room_join,
|
||||
publicRoomByUserResId = R.string.notice_room_join_by_you,
|
||||
thirdPartyResArgs = *arrayOf(senderDisplayName)
|
||||
)
|
||||
}
|
||||
Membership.LEAVE ->
|
||||
// 2 cases here: this member may have left voluntarily or they may have been "left" by someone else ie. kicked
|
||||
|
@ -548,14 +605,25 @@ class NoticeEventFormatter @Inject constructor(private val activeSessionDataSour
|
|||
} ?: sp.getString(R.string.notice_room_reject, senderDisplayName)
|
||||
}
|
||||
else ->
|
||||
if (event.isSentByCurrentUser()) {
|
||||
eventContent.safeReason?.let { reason ->
|
||||
sp.getString(R.string.notice_room_leave_with_reason_by_you, reason)
|
||||
} ?: sp.getString(R.string.notice_room_leave_by_you)
|
||||
} else {
|
||||
eventContent.safeReason?.let { reason ->
|
||||
sp.getString(R.string.notice_room_leave_with_reason, senderDisplayName, reason)
|
||||
} ?: sp.getString(R.string.notice_room_leave, senderDisplayName)
|
||||
eventContent.safeReason?.let { reason ->
|
||||
chooseResourceByRoomType(
|
||||
event = event,
|
||||
directRoomResId = R.string.notice_direct_room_leave_with_reason,
|
||||
directRoomByUserResId = R.string.notice_direct_room_leave_with_reason_by_you,
|
||||
publicRoomResId = R.string.notice_room_leave_with_reason,
|
||||
publicRoomByUserResId = R.string.notice_room_leave_with_reason_by_you,
|
||||
userResArgs = reason,
|
||||
thirdPartyResArgs = *arrayOf(senderDisplayName, reason)
|
||||
)
|
||||
} ?: run {
|
||||
chooseResourceByRoomType(
|
||||
event = event,
|
||||
directRoomResId = R.string.notice_direct_room_leave,
|
||||
directRoomByUserResId = R.string.notice_direct_room_leave_by_you,
|
||||
publicRoomResId = R.string.notice_room_leave,
|
||||
publicRoomByUserResId = R.string.notice_room_leave_by_you,
|
||||
thirdPartyResArgs = *arrayOf(senderDisplayName)
|
||||
)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -622,11 +690,14 @@ class NoticeEventFormatter @Inject constructor(private val activeSessionDataSour
|
|||
val content = event.getClearContent().toModel<RoomJoinRulesContent>() ?: return null
|
||||
return when (content.joinRules) {
|
||||
RoomJoinRules.INVITE ->
|
||||
if (event.isSentByCurrentUser()) {
|
||||
sp.getString(R.string.room_join_rules_invite_by_you)
|
||||
} else {
|
||||
sp.getString(R.string.room_join_rules_invite, senderName)
|
||||
}
|
||||
chooseResourceByRoomType(
|
||||
event = event,
|
||||
directRoomResId = R.string.direct_room_join_rules_invite,
|
||||
directRoomByUserResId = R.string.direct_room_join_rules_invite_by_you,
|
||||
publicRoomResId = R.string.room_join_rules_invite,
|
||||
publicRoomByUserResId = R.string.room_join_rules_invite_by_you,
|
||||
thirdPartyResArgs = *arrayOf(senderName)
|
||||
)
|
||||
RoomJoinRules.PUBLIC ->
|
||||
if (event.isSentByCurrentUser()) {
|
||||
sp.getString(R.string.room_join_rules_public_by_you)
|
||||
|
|
|
@ -62,7 +62,8 @@ abstract class BasedMergedItem<H : BasedMergedItem.Holder> : BaseEventItem<H>()
|
|||
val eventId: String,
|
||||
val userId: String,
|
||||
val memberName: String,
|
||||
val avatarUrl: String?
|
||||
val avatarUrl: String?,
|
||||
val isDirectRoom: Boolean
|
||||
)
|
||||
|
||||
fun Data.toMatrixItem() = MatrixItem.UserItem(userId, memberName, avatarUrl)
|
||||
|
|
|
@ -48,9 +48,17 @@ abstract class MergedRoomCreationItem : BasedMergedItem<MergedRoomCreationItem.H
|
|||
|
||||
val createdFromCurrentUser = data?.userId == attributes.currentUserId
|
||||
val summary = if (createdFromCurrentUser) {
|
||||
holder.expandView.resources.getString(R.string.room_created_summary_item_by_you)
|
||||
if (data?.isDirectRoom == true) {
|
||||
holder.expandView.resources.getString(R.string.direct_room_created_summary_item_by_you)
|
||||
} else {
|
||||
holder.expandView.resources.getString(R.string.room_created_summary_item_by_you)
|
||||
}
|
||||
} else {
|
||||
holder.expandView.resources.getString(R.string.room_created_summary_item, data?.memberName ?: data?.userId ?: "")
|
||||
if (data?.isDirectRoom == true) {
|
||||
holder.expandView.resources.getString(R.string.direct_room_created_summary_item, data.memberName)
|
||||
} else {
|
||||
holder.expandView.resources.getString(R.string.room_created_summary_item, data?.memberName ?: data?.userId ?: "")
|
||||
}
|
||||
}
|
||||
holder.summaryView.text = summary
|
||||
holder.summaryView.visibility = View.VISIBLE
|
||||
|
@ -69,7 +77,11 @@ abstract class MergedRoomCreationItem : BasedMergedItem<MergedRoomCreationItem.H
|
|||
}
|
||||
if (attributes.isEncryptionAlgorithmSecure) {
|
||||
holder.e2eTitleTextView.text = holder.expandView.resources.getString(R.string.encryption_enabled)
|
||||
holder.e2eTitleDescriptionView.text = holder.expandView.resources.getString(R.string.encryption_enabled_tile_description)
|
||||
holder.e2eTitleDescriptionView.text = if (data?.isDirectRoom == true) {
|
||||
holder.expandView.resources.getString(R.string.direct_room_encryption_enabled_tile_description)
|
||||
} else {
|
||||
holder.expandView.resources.getString(R.string.encryption_enabled_tile_description)
|
||||
}
|
||||
holder.e2eTitleDescriptionView.textAlignment = View.TEXT_ALIGNMENT_CENTER
|
||||
holder.e2eTitleTextView.setCompoundDrawablesWithIntrinsicBounds(
|
||||
ContextCompat.getDrawable(holder.view.context, R.drawable.ic_shield_black),
|
||||
|
|
|
@ -89,7 +89,9 @@
|
|||
<string name="missing_permissions_error">"Due to missing permissions, this action is not possible.</string>
|
||||
<string name="missing_permissions_to_start_conf_call">You need permission to invite to start a conference in this room</string>
|
||||
<string name="no_permissions_to_start_conf_call">You do not have permission to start a conference call in this room</string>
|
||||
<string name="no_permissions_to_start_conf_call_in_direct_room">You do not have permission to start a conference call</string>
|
||||
<string name="no_permissions_to_start_webrtc_call">You do not have permission to start a call in this room</string>
|
||||
<string name="no_permissions_to_start_webrtc_call_in_direct_room">You do not have permission to start a call</string>
|
||||
<string name="conference_call_in_progress">A conference is already in progress!</string>
|
||||
<string name="video_meeting">Start video meeting</string>
|
||||
<string name="audio_meeting">Start audio meeting</string>
|
||||
|
@ -1881,6 +1883,8 @@
|
|||
<string name="room_join_rules_public_by_you">You made the room public to whoever knows the link.</string>
|
||||
<string name="room_join_rules_invite">%1$s made the room invite only.</string>
|
||||
<string name="room_join_rules_invite_by_you">You made the room invite only.</string>
|
||||
<string name="direct_room_join_rules_invite">%1$s made this invite only.</string>
|
||||
<string name="direct_room_join_rules_invite_by_you">You made this invite only.</string>
|
||||
<string name="timeline_unread_messages">Unread messages</string>
|
||||
|
||||
<string name="login_splash_title">It\'s your conversation. Own it.</string>
|
||||
|
@ -2355,11 +2359,14 @@
|
|||
|
||||
<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="direct_room_encryption_enabled_tile_description">Messages in this room are end-to-end encrypted.</string>
|
||||
<string name="encryption_not_enabled">Encryption not enabled</string>
|
||||
<string name="encryption_unknown_algorithm_tile_description">The encryption used by this room is not supported</string>
|
||||
|
||||
<string name="room_created_summary_item">%s created and configured the room.</string>
|
||||
<string name="room_created_summary_item_by_you">You created and configured the room.</string>
|
||||
<string name="direct_room_created_summary_item">%s joined.</string>
|
||||
<string name="direct_room_created_summary_item_by_you">You joined.</string>
|
||||
|
||||
<string name="qr_code_scanned_self_verif_notice">Almost there! Is the other device showing the same shield?</string>
|
||||
<string name="qr_code_scanned_verif_waiting_notice">Almost there! Waiting for confirmation…</string>
|
||||
|
|
Loading…
Reference in a new issue