Skip to content

Commit

Permalink
Show pinned channels at the top in the demo app (#731)
Browse files Browse the repository at this point in the history
  • Loading branch information
laevandus authored Jan 29, 2025
1 parent 7e2a185 commit 536ca99
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
2 changes: 0 additions & 2 deletions DemoAppSwiftUI/ChannelHeader/ChannelListQueryIdentifier.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ enum ChannelListQueryIdentifier: String, CaseIterable, Identifiable {
case initial
case archived
case pinned
case unarchivedAndPinnedSorted

var id: String {
rawValue
Expand All @@ -20,7 +19,6 @@ enum ChannelListQueryIdentifier: String, CaseIterable, Identifiable {
case .initial: "Initial Channels"
case .archived: "Archived Channels"
case .pinned: "Pinned Channels"
case .unarchivedAndPinnedSorted: "Sort by Pinned and Ignore Archived Channels"
}
}
}
14 changes: 4 additions & 10 deletions DemoAppSwiftUI/DemoAppSwiftUIApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -149,17 +149,11 @@ extension AppState {
switch identifier {
case .initial:
return ChannelListQuery(
filter: .containMembers(userIds: [currentUserId])
)
case .unarchivedAndPinnedSorted:
return ChannelListQuery(
filter: .and([
.containMembers(userIds: [currentUserId]),
.equal(.archived, to: false)
]),
filter: .containMembers(userIds: [currentUserId]),
sort: [
.init(key: .pinnedAt, isAscending: false),
.init(key: .default)
Sorting(key: .pinnedAt),
Sorting(key: .lastMessageAt),
Sorting(key: .createdAt)
]
)
case .archived:
Expand Down

0 comments on commit 536ca99

Please sign in to comment.