Skip to content

Commit 5fd4972

Browse files
authored
[V5] Replace StreamCollection and LazyCachedMapCollection with Array (#3830)
1 parent cb8ceca commit 5fd4972

File tree

89 files changed

+323
-489
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+323
-489
lines changed

DemoShare/DemoShareViewModel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class DemoShareViewModel: ObservableObject, ChatChannelControllerDelegate {
3232
chatClient.currentUserId
3333
}
3434

35-
@Published var channels = LazyCachedMapCollection<ChatChannel>()
35+
@Published var channels: [ChatChannel] = []
3636
@Published var text = ""
3737
@Published var images = [UIImage]()
3838
@Published var selectedChannel: ChatChannel?

Sources/StreamChat/Controllers/ChannelController/ChannelController+SwiftUI.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ extension ChatChannelController {
1818
@Published public private(set) var channel: ChatChannel?
1919

2020
/// The messages related to the channel.
21-
@Published public private(set) var messages: LazyCachedMapCollection<ChatMessage> = []
21+
@Published public private(set) var messages: [ChatMessage] = []
2222

2323
/// The current state of the Controller.
2424
@Published public private(set) var state: DataController.State

Sources/StreamChat/Controllers/ChannelController/ChannelController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public class ChatChannelController: DataController, DelegateCallable, DataStoreP
5555
/// To observe changes of the messages, set your class as a delegate of this controller or use the provided
5656
/// `Combine` publishers.
5757
///
58-
public var messages: LazyCachedMapCollection<ChatMessage> {
58+
public var messages: [ChatMessage] {
5959
if state == .initialized {
6060
setLocalStateBasedOnError(startDatabaseObservers())
6161
}
@@ -1697,7 +1697,7 @@ public class ChatChannelController: DataController, DelegateCallable, DataStoreP
16971697
public func getFirstUnreadMessageId(for channel: ChatChannel) -> MessageId? {
16981698
UnreadMessageLookup.firstUnreadMessageId(
16991699
in: channel,
1700-
messages: StreamCollection(messages),
1700+
messages: messages,
17011701
hasLoadedAllPreviousMessages: hasLoadedAllPreviousMessages,
17021702
currentUserId: client.currentUserId
17031703
)

Sources/StreamChat/Controllers/ChannelListController/ChannelListController+SwiftUI.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ extension ChatChannelListController {
1515
public let controller: ChatChannelListController
1616

1717
/// The channels matching the query.
18-
@Published public private(set) var channels: LazyCachedMapCollection<ChatChannel> = []
18+
@Published public private(set) var channels: [ChatChannel] = []
1919

2020
/// The current state of the Controller.
2121
@Published public private(set) var state: DataController.State

Sources/StreamChat/Controllers/ChannelListController/ChannelListController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public class ChatChannelListController: DataController, DelegateCallable, DataSt
4545
/// To observe changes of the channels, set your class as a delegate of this controller or use the provided
4646
/// `Combine` publishers.
4747
///
48-
public var channels: LazyCachedMapCollection<ChatChannel> {
48+
public var channels: [ChatChannel] {
4949
startChannelListObserverIfNeeded()
5050
return channelListObserver.items
5151
}

Sources/StreamChat/Controllers/ChannelWatcherListController/ChatChannelWatcherListController+SwiftUI.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ extension ChatChannelWatcherListController {
1616
public let controller: ChatChannelWatcherListController
1717

1818
/// The channel members.
19-
@Published public private(set) var watchers: LazyCachedMapCollection<ChatUser> = []
19+
@Published public private(set) var watchers: [ChatUser] = []
2020

2121
/// The current state of the controller.
2222
@Published public private(set) var state: DataController.State

Sources/StreamChat/Controllers/ChannelWatcherListController/ChatChannelWatcherListController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class ChatChannelWatcherListController: DataController, DelegateCallable,
2727
/// The channel watchers matching the query.
2828
/// To observe the watcher list changes, set your class as a delegate of this controller or use the provided
2929
/// `Combine` publishers.
30-
public var watchers: LazyCachedMapCollection<ChatUser> {
30+
public var watchers: [ChatUser] {
3131
startObservingIfNeeded()
3232
return watchersObserver.items
3333
}

Sources/StreamChat/Controllers/DatabaseObserver/BackgroundListDatabaseObserver.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import CoreData
66
import Foundation
77

88
class BackgroundListDatabaseObserver<Item: Sendable, DTO: NSManagedObject>: BackgroundDatabaseObserver<Item, DTO>, @unchecked Sendable {
9-
var items: LazyCachedMapCollection<Item> {
10-
LazyCachedMapCollection(elements: rawItems)
9+
var items: [Item] {
10+
rawItems
1111
}
1212

1313
init(

Sources/StreamChat/Controllers/MemberListController/MemberListController+SwiftUI.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ extension ChatChannelMemberListController {
1616
public let controller: ChatChannelMemberListController
1717

1818
/// The channel members.
19-
@Published public private(set) var members: LazyCachedMapCollection<ChatChannelMember> = []
19+
@Published public private(set) var members: [ChatChannelMember] = []
2020

2121
/// The current state of the controller.
2222
@Published public private(set) var state: DataController.State

Sources/StreamChat/Controllers/MemberListController/MemberListController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class ChatChannelMemberListController: DataController, DelegateCallable,
2929
/// The channel members matching the query.
3030
/// To observe the member list changes, set your class as a delegate of this controller or use the provided
3131
/// `Combine` publishers.
32-
public var members: LazyCachedMapCollection<ChatChannelMember> {
32+
public var members: [ChatChannelMember] {
3333
startObservingIfNeeded()
3434
return memberListObserver.items
3535
}

0 commit comments

Comments
 (0)