From 3dfc2e2820f89d496ccd338062f3632ef9288a10 Mon Sep 17 00:00:00 2001 From: Ilias Pavlidakis Date: Tue, 3 Dec 2024 13:05:05 +0200 Subject: [PATCH] [Fix]Sorting comparators for fullscreen layout and PiP (#613) --- CHANGELOG.md | 1 + Sources/StreamVideo/Utils/Sorting.swift | 5 ++--- StreamVideoTests/Utils/Sorting_Tests.swift | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b1efee10..edf71027f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### 🐞 Fixed - By observing the `CallKitPushNotificationAdapter.deviceToken` you will be notified with an empty `deviceToken` value, once the object unregister push notifications. [#608](https://github.com/GetStream/stream-video-swift/pull/608) - When a call you receive a ringing while the app isn't running (and the screen is locked), websocket connection wasn't recovered. [#600](https://github.com/GetStream/stream-video-swift/pull/600) +- Sorting order on Fullscreen Layout and Picture-in-Picture wasn't respecting dominant speaker change. [#613](https://github.com/GetStream/stream-video-swift/pull/613) # [1.14.1](https://github.com/GetStream/stream-video-swift/releases/tag/1.14.1) _November 12, 2024_ 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]] } ) }