mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-15 01:35:07 +08:00
Fix PR comments
This commit is contained in:
parent
369c0f166d
commit
e7f3cf6d57
@ -138,19 +138,15 @@ class TimelineItemFactory @Inject constructor(
|
||||
// Crypto
|
||||
EventType.ENCRYPTED -> {
|
||||
val relationContent = event.getRelationContent()
|
||||
if (event.root.isRedacted()) {
|
||||
when {
|
||||
// Redacted event, let the MessageItemFactory handle it
|
||||
messageItemFactory.create(params)
|
||||
} else if (relationContent?.type == RelationType.REFERENCE) {
|
||||
// Hide the decryption error for VoiceBroadcast chunks
|
||||
val startEvent = relationContent.eventId?.let { session.getRoom(event.roomId)?.getTimelineEvent(it) }
|
||||
if (startEvent?.isVoiceBroadcast() == false) {
|
||||
encryptedItemFactory.create(params)
|
||||
} else {
|
||||
null
|
||||
event.root.isRedacted() -> messageItemFactory.create(params)
|
||||
relationContent?.type == RelationType.REFERENCE -> {
|
||||
// Hide the decryption error for VoiceBroadcast chunks
|
||||
val relatedEvent = relationContent.eventId?.let { session.getRoom(event.roomId)?.getTimelineEvent(it) }
|
||||
if (relatedEvent?.isVoiceBroadcast() != true) encryptedItemFactory.create(params) else null
|
||||
}
|
||||
} else {
|
||||
encryptedItemFactory.create(params)
|
||||
else -> encryptedItemFactory.create(params)
|
||||
}
|
||||
}
|
||||
EventType.KEY_VERIFICATION_CANCEL,
|
||||
|
@ -137,15 +137,19 @@ abstract class MessageVoiceBroadcastListeningItem : AbsMessageVoiceBroadcastItem
|
||||
|
||||
private fun renderPlaybackError(holder: Holder, playbackState: State) {
|
||||
with(holder) {
|
||||
if (playbackState is State.Error) {
|
||||
controlsGroup.isVisible = false
|
||||
errorView.setTextOrHide(errorFormatter.toHumanReadable(playbackState.failure))
|
||||
} else if (playbackState is State.Idle && hasUnableToDecryptEvent) {
|
||||
controlsGroup.isVisible = false
|
||||
errorView.setTextOrHide(errorFormatter.toHumanReadable(VoiceBroadcastFailure.ListeningError.UnableToDecrypt))
|
||||
} else {
|
||||
errorView.isVisible = false
|
||||
controlsGroup.isVisible = true
|
||||
when {
|
||||
playbackState is State.Error -> {
|
||||
controlsGroup.isVisible = false
|
||||
errorView.setTextOrHide(errorFormatter.toHumanReadable(playbackState.failure))
|
||||
}
|
||||
playbackState is State.Idle && hasUnableToDecryptEvent -> {
|
||||
controlsGroup.isVisible = false
|
||||
errorView.setTextOrHide(errorFormatter.toHumanReadable(VoiceBroadcastFailure.ListeningError.UnableToDecrypt))
|
||||
}
|
||||
else -> {
|
||||
errorView.isVisible = false
|
||||
controlsGroup.isVisible = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -146,7 +146,9 @@ class GetLiveVoiceBroadcastChunksUseCase @Inject constructor(
|
||||
it.isVoiceBroadcast() && it.getVoiceBroadcastEventId() == voiceBroadcastId && it.root.senderId == senderId
|
||||
}?.root
|
||||
}
|
||||
event.getClearType() == EventType.ENCRYPTED && relationContent?.type == RelationType.REFERENCE -> event
|
||||
event.getClearType() == EventType.ENCRYPTED && relationContent?.type == RelationType.REFERENCE -> {
|
||||
event.takeIf { relationContent.eventId == voiceBroadcastId }
|
||||
}
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user