mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-09-28 07:51:42 +01:00
Fix call linked missed call bug.
This commit is contained in:
committed by
Michelle Tang
parent
a4c4c0a2c4
commit
21fba1b4b7
@@ -134,7 +134,7 @@ class CallEventCache(
|
||||
}
|
||||
|
||||
private fun isMissedGroupCall(call: CacheRecord): Boolean {
|
||||
return call.event == CallTable.Event.GENERIC_GROUP_CALL.code && !call.didLocalUserJoin && !call.isGroupCallActive
|
||||
return call.type == Type.GROUP_CALL.code && call.event == CallTable.Event.GENERIC_GROUP_CALL.code && !call.didLocalUserJoin && !call.isGroupCallActive
|
||||
}
|
||||
|
||||
private fun isWithinTimeout(parent: CacheRecord, child: CacheRecord): Boolean {
|
||||
|
||||
@@ -1425,7 +1425,7 @@ class CallTable(context: Context, databaseHelper: SignalDatabase) : DatabaseTabl
|
||||
companion object Deserializer : Serializer<Call, Cursor> {
|
||||
|
||||
private fun isDisplayedAsMissedCallInUi(call: Call): Boolean {
|
||||
return call.direction == Direction.INCOMING && (call.event in Event.DISPLAY_AS_MISSED_CALL || (call.event == Event.GENERIC_GROUP_CALL && !call.didLocalUserJoin && !call.isGroupCallActive))
|
||||
return call.direction == Direction.INCOMING && (call.event in Event.DISPLAY_AS_MISSED_CALL || (call.type == Type.GROUP_CALL && call.event == Event.GENERIC_GROUP_CALL && !call.didLocalUserJoin && !call.isGroupCallActive))
|
||||
}
|
||||
|
||||
fun getMessageType(type: Type, direction: Direction, event: Event): Long {
|
||||
|
||||
@@ -286,6 +286,51 @@ class CallEventCacheTest {
|
||||
assertThat(result[2].callLinkPeekInfo).isNull()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Given an unjoined call link, when I filter by missed, then I expect nothing`() {
|
||||
val testData = listOf(
|
||||
createCacheRecord(
|
||||
callId = 1,
|
||||
type = Type.AD_HOC_CALL.code,
|
||||
event = Event.GENERIC_GROUP_CALL.code
|
||||
)
|
||||
)
|
||||
|
||||
val filterState = CallEventCache.FilterState(filter = CallLogFilter.MISSED)
|
||||
val result = CallEventCache.clusterCallEvents(testData, filterState)
|
||||
assertThat(result).isEmpty()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Given an unjoined group call, when I filter by missed, then I expect one entry`() {
|
||||
val testData = listOf(
|
||||
createCacheRecord(
|
||||
callId = 1,
|
||||
type = Type.GROUP_CALL.code,
|
||||
event = Event.GENERIC_GROUP_CALL.code
|
||||
)
|
||||
)
|
||||
|
||||
val filterState = CallEventCache.FilterState(filter = CallLogFilter.MISSED)
|
||||
val result = CallEventCache.clusterCallEvents(testData, filterState)
|
||||
assertThat(result).size().isEqualTo(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Given a missed call link ring, when I filter by missed, then I expect one entry`() {
|
||||
val testData = listOf(
|
||||
createCacheRecord(
|
||||
callId = 1,
|
||||
type = Type.AD_HOC_CALL.code,
|
||||
event = Event.MISSED.code
|
||||
)
|
||||
)
|
||||
|
||||
val filterState = CallEventCache.FilterState(filter = CallLogFilter.MISSED)
|
||||
val result = CallEventCache.clusterCallEvents(testData, filterState)
|
||||
assertThat(result).size().isEqualTo(1)
|
||||
}
|
||||
|
||||
private fun createCacheRecord(
|
||||
callId: Long,
|
||||
peer: Long = 1,
|
||||
|
||||
Reference in New Issue
Block a user