Skip to content

Commit 2d8382b

Browse files
authored
Merge branch 'develop' into fix/trailing-toolbarItem-button-style
2 parents 1203442 + a9084a7 commit 2d8382b

19 files changed

+58
-500
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
55

66
### 🐞 Fixed
77
- Fix thread reply action shown when inside a Thread [#717](https://github.com/GetStream/stream-chat-swiftui/pull/717)
8+
### 🔄 Changed
9+
- Deprecate unused `ChatMessage.userDisplayInfo(from:)` which only accessed cached data [#718](https://github.com/GetStream/stream-chat-swiftui/pull/718)
810

911
# [4.70.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.70.0)
1012
_January 15, 2025_

DemoAppSwiftUI/ChannelHeader/NewChatView.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ struct NewChatView: View, KeyboardReadable {
9292
viewFactory: DemoAppFactory.shared,
9393
channelController: controller
9494
)
95+
.modifier(TabBarVisibilityModifier())
9596
} else {
9697
Spacer()
9798
}
@@ -104,6 +105,19 @@ struct NewChatView: View, KeyboardReadable {
104105
}
105106
}
106107

108+
struct TabBarVisibilityModifier: ViewModifier {
109+
110+
func body(content: Content) -> some View {
111+
if #available(iOS 18, *) {
112+
content.toolbarVisibility(.hidden, for: .bottomBar)
113+
} else if #available(iOS 16.0, *) {
114+
content.toolbar(.hidden, for: .bottomBar)
115+
} else {
116+
content
117+
}
118+
}
119+
}
120+
107121
struct SelectedUserView: View {
108122

109123
@Injected(\.colors) var colors

Sources/StreamChatSwiftUI/ChatChannel/ChatChannelViewModel.swift

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -272,17 +272,7 @@ open class ChatChannelViewModel: ObservableObject, MessagesDataSource {
272272
scrolledId = nil
273273
return true
274274
} else {
275-
let findBaseId: String? = {
276-
if StreamRuntimeCheck._isDatabaseObserverItemReusingEnabled {
277-
return messageId
278-
} else {
279-
return messageId.components(separatedBy: "$").first
280-
}
281-
}()
282-
guard let baseId = findBaseId else {
283-
scrolledId = nil
284-
return true
285-
}
275+
let baseId = messageId
286276
let alreadyLoaded = messages.map(\.id).contains(baseId)
287277
if alreadyLoaded {
288278
if scrolledId == nil {
@@ -368,8 +358,8 @@ open class ChatChannelViewModel: ObservableObject, MessagesDataSource {
368358

369359
let previous = index - 1
370360
let previousMessage = messages[previous]
371-
let currentAuthorId = messageCachingUtils.authorId(for: message)
372-
let previousAuthorId = messageCachingUtils.authorId(for: previousMessage)
361+
let currentAuthorId = message.author.id
362+
let previousAuthorId = previousMessage.author.id
373363

374364
if currentAuthorId != previousAuthorId {
375365
temp[message.id]?.append(firstMessageKey)

Sources/StreamChatSwiftUI/ChatChannel/MessageList/AsyncVoiceMessages/VoiceRecordingContainerView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public struct VoiceRecordingContainerView<Factory: ViewFactory>: View {
4141
public var body: some View {
4242
VStack(spacing: 0) {
4343
VStack {
44-
if let quotedMessage = utils.messageCachingUtils.quotedMessage(for: message) {
44+
if let quotedMessage = message.quotedMessage {
4545
factory.makeQuotedMessageView(
4646
quotedMessage: quotedMessage,
4747
fillAvailableSpace: !message.attachmentCounts.isEmpty,

Sources/StreamChatSwiftUI/ChatChannel/MessageList/FileAttachmentView.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ import StreamChat
66
import SwiftUI
77

88
public struct FileAttachmentsContainer<Factory: ViewFactory>: View {
9-
10-
@Injected(\.utils) private var utils
11-
129
var factory: Factory
1310
var message: ChatMessage
1411
var width: CGFloat
@@ -31,7 +28,7 @@ public struct FileAttachmentsContainer<Factory: ViewFactory>: View {
3128

3229
public var body: some View {
3330
VStack(alignment: message.alignmentInBubble) {
34-
if let quotedMessage = utils.messageCachingUtils.quotedMessage(for: message) {
31+
if let quotedMessage = message.quotedMessage {
3532
factory.makeQuotedMessageView(
3633
quotedMessage: quotedMessage,
3734
fillAvailableSpace: !message.attachmentCounts.isEmpty,

Sources/StreamChatSwiftUI/ChatChannel/MessageList/GiphyAttachmentView.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ public struct GiphyAttachmentView<Factory: ViewFactory>: View {
1111
@Injected(\.chatClient) private var chatClient
1212
@Injected(\.colors) private var colors
1313
@Injected(\.fonts) private var fonts
14-
@Injected(\.utils) private var utils
1514

1615
let factory: Factory
1716
let message: ChatMessage
@@ -24,7 +23,7 @@ public struct GiphyAttachmentView<Factory: ViewFactory>: View {
2423
alignment: message.alignmentInBubble,
2524
spacing: 0
2625
) {
27-
if let quotedMessage = utils.messageCachingUtils.quotedMessage(for: message) {
26+
if let quotedMessage = message.quotedMessage {
2827
factory.makeQuotedMessageView(
2928
quotedMessage: quotedMessage,
3029
fillAvailableSpace: !message.attachmentCounts.isEmpty,

Sources/StreamChatSwiftUI/ChatChannel/MessageList/ImageAttachmentView.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import SwiftUI
77

88
public struct ImageAttachmentContainer<Factory: ViewFactory>: View {
99
@Injected(\.colors) private var colors
10-
@Injected(\.utils) private var utils
1110

1211
var factory: Factory
1312
let message: ChatMessage
@@ -23,7 +22,7 @@ public struct ImageAttachmentContainer<Factory: ViewFactory>: View {
2322
alignment: message.alignmentInBubble,
2423
spacing: 0
2524
) {
26-
if let quotedMessage = utils.messageCachingUtils.quotedMessage(for: message) {
25+
if let quotedMessage = message.quotedMessage {
2726
factory.makeQuotedMessageView(
2827
quotedMessage: quotedMessage,
2928
fillAvailableSpace: !message.attachmentCounts.isEmpty,

Sources/StreamChatSwiftUI/ChatChannel/MessageList/LinkAttachmentView.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import SwiftUI
99
/// In case of more than one link, only the first link is previewed.
1010
public struct LinkAttachmentContainer<Factory: ViewFactory>: View {
1111
@Injected(\.colors) private var colors
12-
@Injected(\.utils) private var utils
1312

1413
var factory: Factory
1514
var message: ChatMessage
@@ -38,7 +37,7 @@ public struct LinkAttachmentContainer<Factory: ViewFactory>: View {
3837
alignment: message.alignmentInBubble,
3938
spacing: 0
4039
) {
41-
if let quotedMessage = utils.messageCachingUtils.quotedMessage(for: message) {
40+
if let quotedMessage = message.quotedMessage {
4241
factory.makeQuotedMessageView(
4342
quotedMessage: quotedMessage,
4443
fillAvailableSpace: !message.attachmentCounts.isEmpty,

Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageContainerView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public struct MessageContainerView<Factory: ViewFactory>: View {
6868
} else {
6969
if messageListConfig.messageDisplayOptions.showAvatars(for: channel) {
7070
factory.makeMessageAvatarView(
71-
for: utils.messageCachingUtils.authorInfo(from: message)
71+
for: message.authorDisplayInfo
7272
)
7373
.opacity(showsAllInfo ? 1 : 0)
7474
.offset(y: bottomReactionsShown ? offsetYAvatar : 0)

Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageIdBuilder.swift

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,6 @@ public class DefaultMessageIdBuilder: MessageIdBuilder {
1616
public init() { /* Public init. */ }
1717

1818
public func makeMessageId(for message: ChatMessage) -> String {
19-
if StreamRuntimeCheck._isDatabaseObserverItemReusingEnabled {
20-
return message.id
21-
}
22-
var statesId = "empty"
23-
if message.localState != nil {
24-
statesId = message.uploadingStatesId
25-
}
26-
if message.textUpdatedAt != nil {
27-
statesId = "edited"
28-
}
29-
return message.baseId + statesId + message.reactionScoresId
30-
+ message.repliesCountId + "\(message.updatedAt)" + message.pinStateId
19+
message.id
3120
}
3221
}

0 commit comments

Comments
 (0)