diff --git a/CHANGELOG.md b/CHANGELOG.md index 688c9c089..4f3dc9ade 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### 🔄 Changed +# [4.68.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.68.0) +_December 03, 2024_ + +### 🐞 Fixed +- Fix showing giphy message in the channel list [#669](https://github.com/GetStream/stream-chat-swiftui/pull/669) +- Fix message list scroll not working when drag gestured is initiated from a message [#671](https://github.com/GetStream/stream-chat-swiftui/pull/671) + # [4.67.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.67.0) _November 25, 2024_ diff --git a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageContainerView.swift b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageContainerView.swift index 0aff7889d..ea39a48d9 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageContainerView.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageContainerView.swift @@ -121,14 +121,11 @@ public struct MessageContainerView: View { handleGestureForMessage(showsMessageActions: true) } } - .highPriorityGesture( - LongPressGesture() - .onEnded { _ in - if !message.isDeleted { - handleGestureForMessage(showsMessageActions: true) - } - } - ) + .onLongPressGesture(perform: { + if !message.isDeleted { + handleGestureForMessage(showsMessageActions: true) + } + }) .offset(x: min(self.offsetX, maximumHorizontalSwipeDisplacement)) .simultaneousGesture( DragGesture( diff --git a/Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelListItem.swift b/Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelListItem.swift index a2cf7af0b..2da9efbb7 100644 --- a/Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelListItem.swift +++ b/Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelListItem.swift @@ -269,6 +269,12 @@ public struct InjectedChannelInfo { extension ChatChannel { + public var previewMessageText: String? { + guard let previewMessage else { return nil } + let messageFormatter = InjectedValues[\.utils].messagePreviewFormatter + return messageFormatter.format(previewMessage) + } + public var lastMessageText: String? { guard let latestMessage = latestMessages.first else { return nil } let messageFormatter = InjectedValues[\.utils].messagePreviewFormatter @@ -293,8 +299,8 @@ extension ChatChannel { return L10n.Channel.Item.muted } else if shouldShowTypingIndicator { return typingIndicatorString(currentUserId: InjectedValues[\.chatClient].currentUserId) - } else if let lastMessageText = lastMessageText { - return lastMessageText + } else if let previewMessageText { + return previewMessageText } else { return L10n.Channel.Item.emptyMessages } diff --git a/Sources/StreamChatSwiftUI/Generated/SystemEnvironment+Version.swift b/Sources/StreamChatSwiftUI/Generated/SystemEnvironment+Version.swift index 2f9eaf251..6c619ebfa 100644 --- a/Sources/StreamChatSwiftUI/Generated/SystemEnvironment+Version.swift +++ b/Sources/StreamChatSwiftUI/Generated/SystemEnvironment+Version.swift @@ -7,5 +7,5 @@ import Foundation enum SystemEnvironment { /// A Stream Chat version. - public static let version: String = "4.67.0" + public static let version: String = "4.68.0" } diff --git a/Sources/StreamChatSwiftUI/Info.plist b/Sources/StreamChatSwiftUI/Info.plist index 8aad8a3ac..bd19c03b8 100644 --- a/Sources/StreamChatSwiftUI/Info.plist +++ b/Sources/StreamChatSwiftUI/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString - 4.67.0 + 4.68.0 CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPhotoLibraryUsageDescription diff --git a/StreamChatSwiftUI-XCFramework.podspec b/StreamChatSwiftUI-XCFramework.podspec index 861475e23..d5966bc30 100644 --- a/StreamChatSwiftUI-XCFramework.podspec +++ b/StreamChatSwiftUI-XCFramework.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |spec| spec.name = 'StreamChatSwiftUI-XCFramework' - spec.version = '4.67.0' + spec.version = '4.68.0' spec.summary = 'StreamChat SwiftUI Chat Components' spec.description = 'StreamChatSwiftUI SDK offers flexible SwiftUI components able to display data provided by StreamChat SDK.' @@ -19,7 +19,7 @@ Pod::Spec.new do |spec| spec.framework = 'Foundation', 'UIKit', 'SwiftUI' - spec.dependency 'StreamChat-XCFramework', '~> 4.67.0' + spec.dependency 'StreamChat-XCFramework', '~> 4.68.0' spec.cocoapods_version = '>= 1.11.0' end diff --git a/StreamChatSwiftUI.podspec b/StreamChatSwiftUI.podspec index 8d4e44c59..fda38108c 100644 --- a/StreamChatSwiftUI.podspec +++ b/StreamChatSwiftUI.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |spec| spec.name = 'StreamChatSwiftUI' - spec.version = '4.67.0' + spec.version = '4.68.0' spec.summary = 'StreamChat SwiftUI Chat Components' spec.description = 'StreamChatSwiftUI SDK offers flexible SwiftUI components able to display data provided by StreamChat SDK.' @@ -19,5 +19,5 @@ Pod::Spec.new do |spec| spec.framework = 'Foundation', 'UIKit', 'SwiftUI' - spec.dependency 'StreamChat', '~> 4.67.0' + spec.dependency 'StreamChat', '~> 4.68.0' end diff --git a/StreamChatSwiftUI.xcodeproj/project.pbxproj b/StreamChatSwiftUI.xcodeproj/project.pbxproj index ce96227e7..c2620ee12 100644 --- a/StreamChatSwiftUI.xcodeproj/project.pbxproj +++ b/StreamChatSwiftUI.xcodeproj/project.pbxproj @@ -3821,7 +3821,7 @@ repositoryURL = "https://github.com/GetStream/stream-chat-swift.git"; requirement = { kind = upToNextMajorVersion; - minimumVersion = 4.67.0; + minimumVersion = 4.68.0; }; }; E3A1C01A282BAC66002D1E26 /* XCRemoteSwiftPackageReference "sentry-cocoa" */ = { diff --git a/StreamChatSwiftUIArtifacts.json b/StreamChatSwiftUIArtifacts.json index eaf332571..e55a7fb34 100644 --- a/StreamChatSwiftUIArtifacts.json +++ b/StreamChatSwiftUIArtifacts.json @@ -1 +1 @@ -{"4.40.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.40.0/StreamChatSwiftUI.zip","4.41.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.41.0/StreamChatSwiftUI.zip","4.42.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.42.0/StreamChatSwiftUI.zip","4.43.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.43.0/StreamChatSwiftUI.zip","4.44.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.44.0/StreamChatSwiftUI.zip","4.45.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.45.0/StreamChatSwiftUI.zip","4.46.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.46.0/StreamChatSwiftUI.zip","4.47.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.47.0/StreamChatSwiftUI.zip","4.47.1":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.47.1/StreamChatSwiftUI.zip","4.48.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.48.0/StreamChatSwiftUI.zip","4.49.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.49.0/StreamChatSwiftUI.zip","4.50.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.50.0/StreamChatSwiftUI.zip","4.50.1":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.50.1/StreamChatSwiftUI.zip","4.51.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.51.0/StreamChatSwiftUI.zip","4.52.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.52.0/StreamChatSwiftUI.zip","4.53.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.53.0/StreamChatSwiftUI.zip","4.54.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.54.0/StreamChatSwiftUI.zip","4.55.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.55.0/StreamChatSwiftUI.zip","4.56.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.56.0/StreamChatSwiftUI.zip","4.57.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.57.0/StreamChatSwiftUI.zip","4.58.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.58.0/StreamChatSwiftUI.zip","4.59.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.59.0/StreamChatSwiftUI.zip","4.60.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.60.0/StreamChatSwiftUI.zip","4.61.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.61.0/StreamChatSwiftUI.zip","4.62.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.62.0/StreamChatSwiftUI.zip","4.63.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.63.0/StreamChatSwiftUI.zip","4.64.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.64.0/StreamChatSwiftUI.zip","4.65.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.65.0/StreamChatSwiftUI.zip","4.66.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.66.0/StreamChatSwiftUI.zip","4.67.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.67.0/StreamChatSwiftUI.zip"} \ No newline at end of file +{"4.40.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.40.0/StreamChatSwiftUI.zip","4.41.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.41.0/StreamChatSwiftUI.zip","4.42.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.42.0/StreamChatSwiftUI.zip","4.43.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.43.0/StreamChatSwiftUI.zip","4.44.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.44.0/StreamChatSwiftUI.zip","4.45.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.45.0/StreamChatSwiftUI.zip","4.46.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.46.0/StreamChatSwiftUI.zip","4.47.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.47.0/StreamChatSwiftUI.zip","4.47.1":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.47.1/StreamChatSwiftUI.zip","4.48.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.48.0/StreamChatSwiftUI.zip","4.49.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.49.0/StreamChatSwiftUI.zip","4.50.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.50.0/StreamChatSwiftUI.zip","4.50.1":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.50.1/StreamChatSwiftUI.zip","4.51.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.51.0/StreamChatSwiftUI.zip","4.52.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.52.0/StreamChatSwiftUI.zip","4.53.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.53.0/StreamChatSwiftUI.zip","4.54.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.54.0/StreamChatSwiftUI.zip","4.55.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.55.0/StreamChatSwiftUI.zip","4.56.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.56.0/StreamChatSwiftUI.zip","4.57.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.57.0/StreamChatSwiftUI.zip","4.58.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.58.0/StreamChatSwiftUI.zip","4.59.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.59.0/StreamChatSwiftUI.zip","4.60.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.60.0/StreamChatSwiftUI.zip","4.61.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.61.0/StreamChatSwiftUI.zip","4.62.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.62.0/StreamChatSwiftUI.zip","4.63.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.63.0/StreamChatSwiftUI.zip","4.64.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.64.0/StreamChatSwiftUI.zip","4.65.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.65.0/StreamChatSwiftUI.zip","4.66.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.66.0/StreamChatSwiftUI.zip","4.67.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.67.0/StreamChatSwiftUI.zip","4.68.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.68.0/StreamChatSwiftUI.zip"} \ No newline at end of file diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/ChannelInfo/AddUsersViewModel_Tests.swift b/StreamChatSwiftUITests/Tests/ChatChannel/ChannelInfo/AddUsersViewModel_Tests.swift index 36c8bb0e0..0fc659fb4 100644 --- a/StreamChatSwiftUITests/Tests/ChatChannel/ChannelInfo/AddUsersViewModel_Tests.swift +++ b/StreamChatSwiftUITests/Tests/ChatChannel/ChannelInfo/AddUsersViewModel_Tests.swift @@ -5,6 +5,7 @@ import Combine @testable import StreamChat @testable import StreamChatSwiftUI +@testable import StreamChatTestTools import XCTest class AddUsersViewModel_Tests: StreamChatTestCase { diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/ChannelInfo/AddUsersView_Tests.swift b/StreamChatSwiftUITests/Tests/ChatChannel/ChannelInfo/AddUsersView_Tests.swift index 0564411c2..c1cdef6c1 100644 --- a/StreamChatSwiftUITests/Tests/ChatChannel/ChannelInfo/AddUsersView_Tests.swift +++ b/StreamChatSwiftUITests/Tests/ChatChannel/ChannelInfo/AddUsersView_Tests.swift @@ -5,6 +5,7 @@ @testable import SnapshotTesting @testable import StreamChat @testable import StreamChatSwiftUI +@testable import StreamChatTestTools import StreamSwiftTestHelpers import SwiftUI import XCTest diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/ChannelInfo/FileAttachmentsViewModel_Tests.swift b/StreamChatSwiftUITests/Tests/ChatChannel/ChannelInfo/FileAttachmentsViewModel_Tests.swift index fa6a49df7..5811bb8ff 100644 --- a/StreamChatSwiftUITests/Tests/ChatChannel/ChannelInfo/FileAttachmentsViewModel_Tests.swift +++ b/StreamChatSwiftUITests/Tests/ChatChannel/ChannelInfo/FileAttachmentsViewModel_Tests.swift @@ -5,6 +5,7 @@ import Combine @testable import StreamChat @testable import StreamChatSwiftUI +@testable import StreamChatTestTools import XCTest class FileAttachmentsViewModel_Tests: StreamChatTestCase { diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/ChannelInfo/FileAttachmentsView_Tests.swift b/StreamChatSwiftUITests/Tests/ChatChannel/ChannelInfo/FileAttachmentsView_Tests.swift index 7ecd428ca..a224579b1 100644 --- a/StreamChatSwiftUITests/Tests/ChatChannel/ChannelInfo/FileAttachmentsView_Tests.swift +++ b/StreamChatSwiftUITests/Tests/ChatChannel/ChannelInfo/FileAttachmentsView_Tests.swift @@ -5,6 +5,7 @@ @testable import SnapshotTesting @testable import StreamChat @testable import StreamChatSwiftUI +@testable import StreamChatTestTools import StreamSwiftTestHelpers import SwiftUI import XCTest diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/ChannelInfo/MediaAttachmentsViewModel_Tests.swift b/StreamChatSwiftUITests/Tests/ChatChannel/ChannelInfo/MediaAttachmentsViewModel_Tests.swift index adf4b0671..241e87ae1 100644 --- a/StreamChatSwiftUITests/Tests/ChatChannel/ChannelInfo/MediaAttachmentsViewModel_Tests.swift +++ b/StreamChatSwiftUITests/Tests/ChatChannel/ChannelInfo/MediaAttachmentsViewModel_Tests.swift @@ -5,6 +5,7 @@ import Combine @testable import StreamChat @testable import StreamChatSwiftUI +@testable import StreamChatTestTools import XCTest class MediaAttachmentsViewModel_Tests: StreamChatTestCase { diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/ChannelInfo/MediaAttachmentsView_Tests.swift b/StreamChatSwiftUITests/Tests/ChatChannel/ChannelInfo/MediaAttachmentsView_Tests.swift index eb2c6b699..2eeea81d0 100644 --- a/StreamChatSwiftUITests/Tests/ChatChannel/ChannelInfo/MediaAttachmentsView_Tests.swift +++ b/StreamChatSwiftUITests/Tests/ChatChannel/ChannelInfo/MediaAttachmentsView_Tests.swift @@ -5,6 +5,7 @@ @testable import SnapshotTesting @testable import StreamChat @testable import StreamChatSwiftUI +@testable import StreamChatTestTools import StreamSwiftTestHelpers import SwiftUI import XCTest diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/ChatChannelDataSource_Tests.swift b/StreamChatSwiftUITests/Tests/ChatChannel/ChatChannelDataSource_Tests.swift index b00a879b8..f76b460a7 100644 --- a/StreamChatSwiftUITests/Tests/ChatChannel/ChatChannelDataSource_Tests.swift +++ b/StreamChatSwiftUITests/Tests/ChatChannel/ChatChannelDataSource_Tests.swift @@ -5,6 +5,7 @@ import SnapshotTesting @testable import StreamChat @testable import StreamChatSwiftUI +@testable import StreamChatTestTools import SwiftUI import XCTest diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/ChatChannelTestHelpers.swift b/StreamChatSwiftUITests/Tests/ChatChannel/ChatChannelTestHelpers.swift index 919fcf4ba..bf287d2f2 100644 --- a/StreamChatSwiftUITests/Tests/ChatChannel/ChatChannelTestHelpers.swift +++ b/StreamChatSwiftUITests/Tests/ChatChannel/ChatChannelTestHelpers.swift @@ -4,6 +4,7 @@ @testable import StreamChat @testable import StreamChatSwiftUI +@testable import StreamChatTestTools import XCTest class ChatChannelTestHelpers { diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/ChatChannelViewDateOverlay_Tests.swift b/StreamChatSwiftUITests/Tests/ChatChannel/ChatChannelViewDateOverlay_Tests.swift index 510b367dd..6c59180e7 100644 --- a/StreamChatSwiftUITests/Tests/ChatChannel/ChatChannelViewDateOverlay_Tests.swift +++ b/StreamChatSwiftUITests/Tests/ChatChannel/ChatChannelViewDateOverlay_Tests.swift @@ -5,6 +5,7 @@ @testable import SnapshotTesting @testable import StreamChat @testable import StreamChatSwiftUI +@testable import StreamChatTestTools import StreamSwiftTestHelpers import SwiftUI import XCTest diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/ChatChannelViewModel_Tests.swift b/StreamChatSwiftUITests/Tests/ChatChannel/ChatChannelViewModel_Tests.swift index 075c10d94..81890c358 100644 --- a/StreamChatSwiftUITests/Tests/ChatChannel/ChatChannelViewModel_Tests.swift +++ b/StreamChatSwiftUITests/Tests/ChatChannel/ChatChannelViewModel_Tests.swift @@ -4,6 +4,7 @@ @testable import StreamChat @testable import StreamChatSwiftUI +@testable import StreamChatTestTools import SwiftUI import XCTest diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/ChatChannelView_Tests.swift b/StreamChatSwiftUITests/Tests/ChatChannel/ChatChannelView_Tests.swift index f1b41abf0..7917fccc4 100644 --- a/StreamChatSwiftUITests/Tests/ChatChannel/ChatChannelView_Tests.swift +++ b/StreamChatSwiftUITests/Tests/ChatChannel/ChatChannelView_Tests.swift @@ -5,6 +5,7 @@ @testable import SnapshotTesting @testable import StreamChat @testable import StreamChatSwiftUI +@testable import StreamChatTestTools import StreamSwiftTestHelpers import SwiftUI import XCTest diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/ChatMessage_AdjustedText_Tests.swift b/StreamChatSwiftUITests/Tests/ChatChannel/ChatMessage_AdjustedText_Tests.swift index 58efb7362..36ffd21ba 100644 --- a/StreamChatSwiftUITests/Tests/ChatChannel/ChatMessage_AdjustedText_Tests.swift +++ b/StreamChatSwiftUITests/Tests/ChatChannel/ChatMessage_AdjustedText_Tests.swift @@ -4,6 +4,7 @@ @testable import StreamChat @testable import StreamChatSwiftUI +@testable import StreamChatTestTools import XCTest class ChatMessage_AdjustedText_Tests: StreamChatTestCase { diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/MessageComposerView_Tests.swift b/StreamChatSwiftUITests/Tests/ChatChannel/MessageComposerView_Tests.swift index 18c9d4d38..ee2c246dc 100644 --- a/StreamChatSwiftUITests/Tests/ChatChannel/MessageComposerView_Tests.swift +++ b/StreamChatSwiftUITests/Tests/ChatChannel/MessageComposerView_Tests.swift @@ -6,6 +6,7 @@ import Photos import SnapshotTesting @testable import StreamChat @testable import StreamChatSwiftUI +@testable import StreamChatTestTools import StreamSwiftTestHelpers import SwiftUI import XCTest diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/MessageListViewLastGroupHeader_Tests.swift b/StreamChatSwiftUITests/Tests/ChatChannel/MessageListViewLastGroupHeader_Tests.swift index 52501d6b3..1af3ce33a 100644 --- a/StreamChatSwiftUITests/Tests/ChatChannel/MessageListViewLastGroupHeader_Tests.swift +++ b/StreamChatSwiftUITests/Tests/ChatChannel/MessageListViewLastGroupHeader_Tests.swift @@ -5,6 +5,7 @@ import SnapshotTesting @testable import StreamChat @testable import StreamChatSwiftUI +@testable import StreamChatTestTools import StreamSwiftTestHelpers import SwiftUI import XCTest diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/Suggestions/TestCommandsConfig.swift b/StreamChatSwiftUITests/Tests/ChatChannel/Suggestions/TestCommandsConfig.swift index 2c1f305ad..dbddc4765 100644 --- a/StreamChatSwiftUITests/Tests/ChatChannel/Suggestions/TestCommandsConfig.swift +++ b/StreamChatSwiftUITests/Tests/ChatChannel/Suggestions/TestCommandsConfig.swift @@ -6,6 +6,7 @@ import Combine import Foundation import StreamChat import StreamChatSwiftUI +@testable import StreamChatTestTools import SwiftUI /// Test commands configuration. diff --git a/StreamChatSwiftUITests/Tests/ChatChannelList/ChatChannelListItemView_Tests.swift b/StreamChatSwiftUITests/Tests/ChatChannelList/ChatChannelListItemView_Tests.swift index 8f908d0b3..e272d2bc0 100644 --- a/StreamChatSwiftUITests/Tests/ChatChannelList/ChatChannelListItemView_Tests.swift +++ b/StreamChatSwiftUITests/Tests/ChatChannelList/ChatChannelListItemView_Tests.swift @@ -23,7 +23,7 @@ final class ChatChannelListItemView_Tests: StreamChatTestCase { func test_channelListItem_audioMessage() throws { // Given let message = try mockAudioMessage(text: "Audio", isSentByCurrentUser: true) - let channel = ChatChannel.mock(cid: .unique, latestMessages: [message]) + let channel = ChatChannel.mock(cid: .unique, latestMessages: [message], previewMessage: message) // When let view = ChatChannelListItem( @@ -42,7 +42,7 @@ final class ChatChannelListItemView_Tests: StreamChatTestCase { func test_channelListItem_imageMessage() throws { // Given let message = try mockImageMessage(text: "Image", isSentByCurrentUser: true) - let channel = ChatChannel.mock(cid: .unique, latestMessages: [message]) + let channel = ChatChannel.mock(cid: .unique, latestMessages: [message], previewMessage: message) // When let view = ChatChannelListItem( @@ -61,7 +61,7 @@ final class ChatChannelListItemView_Tests: StreamChatTestCase { func test_channelListItem_videoMessage() throws { // Given let message = try mockVideoMessage(text: "Video", isSentByCurrentUser: true) - let channel = ChatChannel.mock(cid: .unique, latestMessages: [message]) + let channel = ChatChannel.mock(cid: .unique, latestMessages: [message], previewMessage: message) // When let view = ChatChannelListItem( @@ -80,7 +80,7 @@ final class ChatChannelListItemView_Tests: StreamChatTestCase { func test_channelListItem_fileMessage() throws { // Given let message = try mockFileMessage(title: "Filename", text: "File", isSentByCurrentUser: true) - let channel = ChatChannel.mock(cid: .unique, latestMessages: [message]) + let channel = ChatChannel.mock(cid: .unique, latestMessages: [message], previewMessage: message) // When let view = ChatChannelListItem( @@ -96,10 +96,11 @@ final class ChatChannelListItemView_Tests: StreamChatTestCase { assertSnapshot(matching: view, as: .image(perceptualPrecision: precision)) } - func test_channelListItem_giphyMessage() throws { + func test_channelListItem_giphyMessageLatestButPreviewIsAnotherMessage() throws { // Given - let message = try mockGiphyMessage(text: "Giphy", isSentByCurrentUser: true) - let channel = ChatChannel.mock(cid: .unique, latestMessages: [message]) + let previewMessage = try mockImageMessage(text: "Hi!", isSentByCurrentUser: true) + let latestMessage = try mockGiphyMessage(text: "Giphy", isSentByCurrentUser: true) + let channel = ChatChannel.mock(cid: .unique, latestMessages: [latestMessage], previewMessage: previewMessage) // When let view = ChatChannelListItem( @@ -118,7 +119,7 @@ final class ChatChannelListItemView_Tests: StreamChatTestCase { func test_channelListItem_pollMessage_youCreated() throws { // Given let message = try mockPollMessage(isSentByCurrentUser: true) - let channel = ChatChannel.mock(cid: .unique, latestMessages: [message]) + let channel = ChatChannel.mock(cid: .unique, latestMessages: [message], previewMessage: message) // When let view = ChatChannelListItem( @@ -137,7 +138,7 @@ final class ChatChannelListItemView_Tests: StreamChatTestCase { func test_channelListItem_pollMessage_someoneCreated() throws { // Given let message = try mockPollMessage(isSentByCurrentUser: false) - let channel = ChatChannel.mock(cid: .unique, latestMessages: [message]) + let channel = ChatChannel.mock(cid: .unique, latestMessages: [message], previewMessage: message) // When let view = ChatChannelListItem( @@ -161,7 +162,7 @@ final class ChatChannelListItemView_Tests: StreamChatTestCase { .unique, .unique ]) - let channel = ChatChannel.mock(cid: .unique, membership: .mock(id: currentUserId), latestMessages: [message]) + let channel = ChatChannel.mock(cid: .unique, membership: .mock(id: currentUserId), previewMessage: message) // When let view = ChatChannelListItem( @@ -185,7 +186,7 @@ final class ChatChannelListItemView_Tests: StreamChatTestCase { .unique, .mock(pollId: .unique, optionId: .unique, user: .mock(id: currentUserId)) ]) - let channel = ChatChannel.mock(cid: .unique, membership: .mock(id: currentUserId), latestMessages: [message]) + let channel = ChatChannel.mock(cid: .unique, membership: .mock(id: currentUserId), previewMessage: message) // When let view = ChatChannelListItem( diff --git a/StreamChatSwiftUITests/Tests/ChatChannelList/ChatChannelListView_Tests.swift b/StreamChatSwiftUITests/Tests/ChatChannelList/ChatChannelListView_Tests.swift index ec8741cc9..ef947161e 100644 --- a/StreamChatSwiftUITests/Tests/ChatChannelList/ChatChannelListView_Tests.swift +++ b/StreamChatSwiftUITests/Tests/ChatChannelList/ChatChannelListView_Tests.swift @@ -5,6 +5,7 @@ import SnapshotTesting @testable import StreamChat @testable import StreamChatSwiftUI +@testable import StreamChatTestTools import StreamSwiftTestHelpers import SwiftUI import XCTest diff --git a/StreamChatSwiftUITests/Tests/ChatChannelList/__Snapshots__/ChatChannelListItemView_Tests/test_channelListItem_giphyMessage.1.png b/StreamChatSwiftUITests/Tests/ChatChannelList/__Snapshots__/ChatChannelListItemView_Tests/test_channelListItem_giphyMessage.1.png deleted file mode 100644 index a4e86ff46..000000000 Binary files a/StreamChatSwiftUITests/Tests/ChatChannelList/__Snapshots__/ChatChannelListItemView_Tests/test_channelListItem_giphyMessage.1.png and /dev/null differ diff --git a/StreamChatSwiftUITests/Tests/ChatChannelList/__Snapshots__/ChatChannelListItemView_Tests/test_channelListItem_giphyMessageLatestButPreviewIsAnotherMessage.1.png b/StreamChatSwiftUITests/Tests/ChatChannelList/__Snapshots__/ChatChannelListItemView_Tests/test_channelListItem_giphyMessageLatestButPreviewIsAnotherMessage.1.png new file mode 100644 index 000000000..804db36fb Binary files /dev/null and b/StreamChatSwiftUITests/Tests/ChatChannelList/__Snapshots__/ChatChannelListItemView_Tests/test_channelListItem_giphyMessageLatestButPreviewIsAnotherMessage.1.png differ diff --git a/fastlane/Fastfile b/fastlane/Fastfile index d5aeea366..e353a6ef0 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -181,7 +181,7 @@ lane :swiftui_testflight_build do sdk_target: 'StreamChatSwiftUI', app_target: 'DemoAppSwiftUI', app_identifier: 'io.getstream.iOS.DemoAppSwiftUI', - app_version: last_git_tag + app_version: File.read(swift_environment_path).match(/String\s+=\s+"([\d.]+)"/)[1] ) end