Skip to content

Commit c1d1cd0

Browse files
authored
Pinned channels are not appearing at the top in the demo app (#945)
1 parent 19a7867 commit c1d1cd0

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

DemoAppSwiftUI/DemoAppSwiftUIApp.swift

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -147,19 +147,13 @@ extension AppState {
147147
guard let currentUserId = chatClient.currentUserId else { fatalError("Not logged in") }
148148
switch identifier {
149149
case .initial:
150+
var sort: [Sorting<ChannelListSortingKey>] = [Sorting(key: .default)]
151+
if AppConfiguration.default.isChannelPinningFeatureEnabled {
152+
sort.insert(Sorting(key: .pinnedAt), at: 0)
153+
}
150154
return ChannelListQuery(
151155
filter: .containMembers(userIds: [currentUserId]),
152-
sort: [
153-
Sorting(key: .default)
154-
]
155-
)
156-
case .initial where AppConfiguration.default.isChannelPinningFeatureEnabled:
157-
return ChannelListQuery(
158-
filter: .containMembers(userIds: [currentUserId]),
159-
sort: [
160-
Sorting(key: .pinnedAt),
161-
Sorting(key: .default)
162-
]
156+
sort: sort
163157
)
164158
case .archived:
165159
return ChannelListQuery(

0 commit comments

Comments
 (0)