mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-02-17 04:20:00 +03:00
Timeline call tiles: fix call event grouper
This commit is contained in:
parent
dc7cc2ed5c
commit
ec09532df6
2 changed files with 8 additions and 6 deletions
|
@ -36,7 +36,6 @@ import javax.inject.Inject
|
|||
class CallItemFactory @Inject constructor(
|
||||
private val session: Session,
|
||||
private val userPreferencesProvider: UserPreferencesProvider,
|
||||
private val timelineEventVisibilityHelper: TimelineEventVisibilityHelper,
|
||||
private val messageColorProvider: MessageColorProvider,
|
||||
private val messageInformationDataFactory: MessageInformationDataFactory,
|
||||
private val messageItemAttributesFactory: MessageItemAttributesFactory,
|
||||
|
@ -51,10 +50,9 @@ class CallItemFactory @Inject constructor(
|
|||
val roomId = event.roomId
|
||||
val informationData = messageInformationDataFactory.create(params)
|
||||
val callKind = if (callEventGrouper.isVideo()) CallTileTimelineItem.CallKind.VIDEO else CallTileTimelineItem.CallKind.AUDIO
|
||||
val isRinging = callEventGrouper.isRinging()
|
||||
return when (event.root.getClearType()) {
|
||||
EventType.CALL_ANSWER -> {
|
||||
if (isRinging || showHiddenEvents) {
|
||||
if (callEventGrouper.isInCall() || showHiddenEvents) {
|
||||
createCallTileTimelineItem(
|
||||
roomId = roomId,
|
||||
callId = callEventGrouper.callId,
|
||||
|
@ -63,14 +61,14 @@ class CallItemFactory @Inject constructor(
|
|||
callback = params.callback,
|
||||
highlight = params.isHighlighted,
|
||||
informationData = informationData,
|
||||
isStillActive = isRinging
|
||||
isStillActive = callEventGrouper.isInCall()
|
||||
)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
EventType.CALL_INVITE -> {
|
||||
if (isRinging || showHiddenEvents) {
|
||||
if (callEventGrouper.isRinging() || showHiddenEvents) {
|
||||
createCallTileTimelineItem(
|
||||
roomId = roomId,
|
||||
callId = callEventGrouper.callId,
|
||||
|
@ -79,7 +77,7 @@ class CallItemFactory @Inject constructor(
|
|||
callback = params.callback,
|
||||
highlight = params.isHighlighted,
|
||||
informationData = informationData,
|
||||
isStillActive = isRinging
|
||||
isStillActive = callEventGrouper.isRinging()
|
||||
)
|
||||
} else {
|
||||
null
|
||||
|
|
|
@ -39,6 +39,10 @@ class CallEventGrouper(private val myUserId: String, val callId: String) {
|
|||
return getAnswer() == null && getHangup() == null && getReject() == null
|
||||
}
|
||||
|
||||
fun isInCall(): Boolean{
|
||||
return getHangup() == null && getReject() == null
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if there are only events from the other side - we missed the call
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue