diff --git a/Sources/StreamVideo/Utils/Sorting.swift b/Sources/StreamVideo/Utils/Sorting.swift index 366b70788..d57998e7e 100644 --- a/Sources/StreamVideo/Utils/Sorting.swift +++ b/Sources/StreamVideo/Utils/Sorting.swift @@ -17,13 +17,12 @@ public typealias StreamSortComparator = (Value, Value) -> ComparisonResul public let defaultComparators: [StreamSortComparator] = [ pinned, screensharing, - ifInvisible(combineComparators([ + combineComparators([ dominantSpeaker, isSpeaking, - isSpeaking, publishingVideo, publishingAudio - ])), + ]), ifInvisible(userId) ] diff --git a/StreamVideoTests/Utils/Sorting_Tests.swift b/StreamVideoTests/Utils/Sorting_Tests.swift index 20ff7087f..763c872a0 100644 --- a/StreamVideoTests/Utils/Sorting_Tests.swift +++ b/StreamVideoTests/Utils/Sorting_Tests.swift @@ -702,7 +702,8 @@ final class Sorting_Tests: XCTestCase { ) } - func test_defaultComparators_someSpeakingWhileDominantSpeakerIsVisible_orderDoesNotChange() { + func test_defaultComparators_someSpeakingWhileDominantSpeakerIsVisible_orderSetsToShowDominanFirstAndTheOthersSortedBasedOnOtherCriteria( + ) { let combined = combineComparators(defaultComparators) assertSort( @@ -733,7 +734,7 @@ final class Sorting_Tests: XCTestCase { ) ], comparator: combined, - expectedTransformer: { [$0[0], $0[1], $0[2], $0[3]] } + expectedTransformer: { [$0[3], $0[0], $0[1], $0[2]] } ) }