diff --git a/.github/workflows/release-publish.yml b/.github/workflows/release-publish.yml index 0d42daa8..8def5f08 100644 --- a/.github/workflows/release-publish.yml +++ b/.github/workflows/release-publish.yml @@ -26,3 +26,11 @@ jobs: MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} APPSTORE_API_KEY: ${{ secrets.APPSTORE_API_KEY }} run: bundle exec fastlane publish_release --verbose + + - uses: 8398a7/action-slack@v3 + with: + status: ${{ job.status }} + text: "šŸŽ‰ The new release has been shipped! šŸš¢\n\nāš ļø , don't forget to merge `main` back to `develop` from `localhost` using the command: `bundle exec fastlane merge_main`" + fields: repo + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/.gitignore b/.gitignore index 4b393755..181c19d7 100644 --- a/.gitignore +++ b/.gitignore @@ -91,3 +91,7 @@ buildcache App Thinning Size Report.txt app-thinning.plist *.dmg + +# VSCode +.vscode +buildServer.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 2df8c568..688c9c08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,21 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### šŸ”„ Changed +# [4.67.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.67.0) +_November 25, 2024_ + +### āœ… Added +- Make `VoiceRecordingButton` public [#658](https://github.com/GetStream/stream-chat-swiftui/pull/658) +- Add config to skip edited label for some messages [#660](https://github.com/GetStream/stream-chat-swiftui/pull/665) +### šŸž Fixed +- Fix message long press taking too much time to show actions [#648](https://github.com/GetStream/stream-chat-swiftui/pull/648) +- Fix rendering link attachment preview with other attachment types [#659](https://github.com/GetStream/stream-chat-swiftui/pull/659) +- Fix not using colors from the palette in some of the poll views [#661](https://github.com/GetStream/stream-chat-swiftui/pull/661) +- Fix a rare crash when handling list change in the `ChatChannelViewModel` [#663](https://github.com/GetStream/stream-chat-swiftui/pull/663) +### šŸ”„ Changed +- Message composer now uses `.uploadFile` capability when showing attachment picker icon [#646](https://github.com/GetStream/stream-chat-swiftui/pull/646) +- `ChannelInfoView` now uses `.updateChannelMembers` capability to show "Add Users" button [#651](https://github.com/GetStream/stream-chat-swiftui/pull/651) + # [4.66.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.66.0) _November 06, 2024_ @@ -50,8 +65,8 @@ _September 12, 2024_ ### šŸ”„ Changed - Improved subtitle info in pinned messages view [#594](https://github.com/GetStream/stream-chat-swiftui/pull/594) -- The `image(for channel: ChatChannel)` in `ChannelHeaderLoader` is now open [#595](https://github.com/GetStream/stream-chat-swiftui/pull/595) -- FlagMessage Action is now only shown if the user has a permission to perform the action [#599](https://github.com/GetStream/stream-chat-swiftui/pull/599) +- The `image(for channel: ChatChannel)` in `ChannelHeaderLoader` is now open [#595](https://github.com/GetStream/stream-chat-swiftui/pull/595) +- FlagMessage Action is now only shown if the user has a permission to perform the action [#599](https://github.com/GetStream/stream-chat-swiftui/pull/599) ### šŸž Fixed - Typing users did not update reliably in the message list [#591](https://github.com/GetStream/stream-chat-swiftui/pull/591) diff --git a/DemoAppSwiftUI/AppDelegate.swift b/DemoAppSwiftUI/AppDelegate.swift index 8737a3f6..f2d27e2d 100644 --- a/DemoAppSwiftUI/AppDelegate.swift +++ b/DemoAppSwiftUI/AppDelegate.swift @@ -63,7 +63,13 @@ class AppDelegate: NSObject, UIApplicationDelegate { #endif let utils = Utils( - messageListConfig: MessageListConfig(dateIndicatorPlacement: .messageList, userBlockingEnabled: true), + messageListConfig: MessageListConfig( + dateIndicatorPlacement: .messageList, + userBlockingEnabled: true, + skipEditedMessageLabel: { message in + message.extraData["ai_generated"]?.boolValue == true + } + ), composerConfig: ComposerConfig(isVoiceRecordingEnabled: true) ) streamChat = StreamChat(chatClient: chatClient, utils: utils) diff --git a/Gemfile.lock b/Gemfile.lock index 35964476..e464e06c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -200,7 +200,7 @@ GEM fastlane pry fastlane-plugin-sonarcloud_metric_kit (0.2.1) - fastlane-plugin-stream_actions (0.3.71) + fastlane-plugin-stream_actions (0.3.76) xctest_list (= 1.2.1) fastlane-plugin-versioning (0.6.0) ffi (1.17.0) @@ -310,9 +310,10 @@ GEM puma (6.4.3) nio4r (~> 2.0) racc (1.8.1) - rack (3.1.7) - rack-protection (4.0.0) + rack (3.1.8) + rack-protection (4.1.0) base64 (>= 0.1.0) + logger (>= 1.6.0) rack (>= 3.0.0, < 4) rack-session (2.0.0) rack (>= 3.0.0) @@ -367,10 +368,11 @@ GEM simctl (1.6.10) CFPropertyList naturally - sinatra (4.0.0) + sinatra (4.1.0) + logger (>= 1.6.0) mustermann (~> 3.0) rack (>= 3.0.0, < 4) - rack-protection (= 4.0.0) + rack-protection (= 4.1.0) rack-session (>= 2.0.0, < 3) tilt (~> 2.0) slather (2.8.4) @@ -427,7 +429,7 @@ DEPENDENCIES fastlane-plugin-create_xcframework fastlane-plugin-lizard fastlane-plugin-sonarcloud_metric_kit - fastlane-plugin-stream_actions (= 0.3.71) + fastlane-plugin-stream_actions (= 0.3.76) fastlane-plugin-versioning jazzy json diff --git a/Package.swift b/Package.swift index d61121b0..45e6b6fa 100644 --- a/Package.swift +++ b/Package.swift @@ -16,7 +16,7 @@ let package = Package( ) ], dependencies: [ - .package(url: "https://github.com/GetStream/stream-chat-swift.git", from: "4.66.0"), + .package(url: "https://github.com/GetStream/stream-chat-swift.git", from: "4.67.0"), ], targets: [ .target( diff --git a/README.md b/README.md index abf60a16..2b40c92e 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@

- StreamChatSwiftUI + StreamChatSwiftUI

## SwiftUI StreamChat SDK diff --git a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoView.swift b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoView.swift index f9e1de48..d6438a3a 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoView.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoView.swift @@ -137,7 +137,7 @@ public struct ChatChannelInfoView: View, KeyboardReadable { } ToolbarItem(placement: .navigationBarTrailing) { - viewModel.channel.isDirectMessageChannel ? nil : + if viewModel.shouldShowAddUserButton { Button { viewModel.addUsersShown = true } label: { @@ -148,6 +148,7 @@ public struct ChatChannelInfoView: View, KeyboardReadable { .background(colors.tintColor) .clipShape(Circle()) } + } } } .onReceive(keyboardWillChangePublisher) { visible in diff --git a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoViewModel.swift b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoViewModel.swift index 7e3bd71c..e28333e6 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoViewModel.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoViewModel.swift @@ -48,6 +48,14 @@ public class ChatChannelInfoViewModel: ObservableObject, ChatChannelControllerDe channel.ownCapabilities.contains(.updateChannel) } + public var shouldShowAddUserButton: Bool { + if channel.isDirectMessageChannel { + return false + } else { + return channel.ownCapabilities.contains(.updateChannelMembers) + } + } + var channelController: ChatChannelController! private var memberListController: ChatChannelMemberListController! private var loadingUsers = false diff --git a/Sources/StreamChatSwiftUI/ChatChannel/ChatChannelViewModel.swift b/Sources/StreamChatSwiftUI/ChatChannel/ChatChannelViewModel.swift index 547bd21a..5ee41f5b 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/ChatChannelViewModel.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/ChatChannelViewModel.swift @@ -709,19 +709,18 @@ open class ChatChannelViewModel: ObservableObject, MessagesDataSource { .remove(_, index: _): return true case let .update(message, index: index): - let animateReactions = message.reactionScoresId != messages[index.row].reactionScoresId + guard index.row >= messages.startIndex, index.row < messages.endIndex else { continue } + let existingDisplayedMessage = messages[index.row] + let animateReactions = message.reactionScoresId != existingDisplayedMessage.reactionScoresId && utils.messageListConfig.messageDisplayOptions.shouldAnimateReactions - if index.row < messages.count, - message.messageId != messages[index.row].messageId + if animateReactions, + message.messageId != existingDisplayedMessage.messageId || message.type == .ephemeral || !message.linkAttachments.isEmpty { - if index.row < messages.count - && animateReactions { - animateChanges = message.linkAttachments.isEmpty - } + animateChanges = message.linkAttachments.isEmpty } - default: - break + case .move(_, fromIndex: _, toIndex: _): + continue } } diff --git a/Sources/StreamChatSwiftUI/ChatChannel/Composer/AttachmentPickerTypeView.swift b/Sources/StreamChatSwiftUI/ChatChannel/Composer/AttachmentPickerTypeView.swift index 840391e2..b4853153 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/Composer/AttachmentPickerTypeView.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/Composer/AttachmentPickerTypeView.swift @@ -27,6 +27,7 @@ public enum AttachmentPickerType { /// View for picking the attachment type (media or giphy commands). public struct AttachmentPickerTypeView: View { + @EnvironmentObject private var composerViewModel: MessageComposerViewModel @Injected(\.images) private var images @Injected(\.colors) private var colors @@ -49,7 +50,7 @@ public struct AttachmentPickerTypeView: View { HStack(spacing: 16) { switch pickerTypeState { case let .expanded(attachmentPickerType): - if channelConfig?.uploadsEnabled == true { + if composerViewModel.channelController.channel?.canUploadFile == true { PickerTypeButton( pickerTypeState: $pickerTypeState, pickerType: .media, diff --git a/Sources/StreamChatSwiftUI/ChatChannel/Composer/MessageComposerView.swift b/Sources/StreamChatSwiftUI/ChatChannel/Composer/MessageComposerView.swift index c5536bb9..acafd934 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/Composer/MessageComposerView.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/Composer/MessageComposerView.swift @@ -68,6 +68,7 @@ public struct MessageComposerView: View, KeyboardReadable state: $viewModel.pickerTypeState, channelConfig: channelConfig ) + .environmentObject(viewModel) factory.makeComposerInputView( text: $viewModel.text, diff --git a/Sources/StreamChatSwiftUI/ChatChannel/Composer/TrailingComposerView.swift b/Sources/StreamChatSwiftUI/ChatChannel/Composer/TrailingComposerView.swift index f02dd43f..ebc0ad31 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/Composer/TrailingComposerView.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/Composer/TrailingComposerView.swift @@ -38,7 +38,8 @@ public struct TrailingComposerView: View { } } -struct VoiceRecordingButton: View { +/// The button responsible to start voice recording. +public struct VoiceRecordingButton: View { @Injected(\.colors) var colors @Injected(\.utils) var utils @@ -47,7 +48,11 @@ struct VoiceRecordingButton: View { @State private var longPressed = false @State private var longPressStarted: Date? - var body: some View { + public init(viewModel: MessageComposerViewModel) { + self.viewModel = viewModel + } + + public var body: some View { Image(systemName: "mic") .foregroundColor(Color(colors.textLowEmphasis)) .gesture( diff --git a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageContainerView.swift b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageContainerView.swift index ea39a48d..0aff7889 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageContainerView.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageContainerView.swift @@ -121,11 +121,14 @@ public struct MessageContainerView: View { handleGestureForMessage(showsMessageActions: true) } } - .onLongPressGesture(perform: { - if !message.isDeleted { - handleGestureForMessage(showsMessageActions: true) - } - }) + .highPriorityGesture( + LongPressGesture() + .onEnded { _ in + if !message.isDeleted { + handleGestureForMessage(showsMessageActions: true) + } + } + ) .offset(x: min(self.offsetX, maximumHorizontalSwipeDisplacement)) .simultaneousGesture( DragGesture( diff --git a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListConfig.swift b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListConfig.swift index d68bd92d..b0236fda 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListConfig.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListConfig.swift @@ -31,7 +31,8 @@ public struct MessageListConfig { localLinkDetectionEnabled: Bool = true, isMessageEditedLabelEnabled: Bool = true, markdownSupportEnabled: Bool = true, - userBlockingEnabled: Bool = false + userBlockingEnabled: Bool = false, + skipEditedMessageLabel: @escaping (ChatMessage) -> Bool = { _ in false } ) { self.messageListType = messageListType self.typingIndicatorPlacement = typingIndicatorPlacement @@ -56,6 +57,7 @@ public struct MessageListConfig { self.isMessageEditedLabelEnabled = isMessageEditedLabelEnabled self.markdownSupportEnabled = markdownSupportEnabled self.userBlockingEnabled = userBlockingEnabled + self.skipEditedMessageLabel = skipEditedMessageLabel } public let messageListType: MessageListType @@ -81,6 +83,7 @@ public struct MessageListConfig { public let isMessageEditedLabelEnabled: Bool public let markdownSupportEnabled: Bool public let userBlockingEnabled: Bool + public let skipEditedMessageLabel: (ChatMessage) -> Bool } /// Contains information about the message paddings. diff --git a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListHelperViews.swift b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListHelperViews.swift index 6c409894..370841b2 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListHelperViews.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListHelperViews.swift @@ -66,7 +66,9 @@ struct MessageDateView: View { var text: String { var text = dateFormatter.string(from: message.createdAt) - let showMessageEditedLabel = utils.messageListConfig.isMessageEditedLabelEnabled + let messageListConfig = utils.messageListConfig + let showMessageEditedLabel = messageListConfig.isMessageEditedLabelEnabled + && !messageListConfig.skipEditedMessageLabel(message) && message.textUpdatedAt != nil && !message.isDeleted if showMessageEditedLabel { diff --git a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageView.swift b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageView.swift index dacf7ad7..169ad667 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageView.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageView.swift @@ -44,7 +44,8 @@ public struct MessageView: View { } else if let poll = message.poll { factory.makePollView(message: message, poll: poll, isFirst: isFirst) } else if !message.attachmentCounts.isEmpty { - if messageTypeResolver.hasLinkAttachment(message: message) { + let hasOnlyLinks = { message.attachmentCounts.keys.allSatisfy { $0 == .linkPreview } } + if messageTypeResolver.hasLinkAttachment(message: message) && hasOnlyLinks() { factory.makeLinkAttachmentView( for: message, isFirst: isFirst, diff --git a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/Polls/PollAllOptionsView.swift b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/Polls/PollAllOptionsView.swift index e8a2de2f..e52fa6a8 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/Polls/PollAllOptionsView.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/Polls/PollAllOptionsView.swift @@ -31,6 +31,7 @@ struct PollAllOptionsView: View { viewModel: viewModel, option: option, optionFont: fonts.headline, + textColor: Color(colors.text), alternativeStyle: true, checkboxButtonSpacing: 8 ) diff --git a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/Polls/PollAttachmentView.swift b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/Polls/PollAttachmentView.swift index ad17f840..f56d82d9 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/Polls/PollAttachmentView.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/Polls/PollAttachmentView.swift @@ -40,6 +40,7 @@ public struct PollAttachmentView: View { HStack { Text(poll.name) .font(fonts.bodyBold) + .foregroundColor(textColor(for: message)) Spacer() } @@ -56,7 +57,8 @@ public struct PollAttachmentView: View { viewModel: viewModel, option: option, optionVotes: poll.voteCount(for: option), - maxVotes: poll.currentMaximumVoteCount + maxVotes: poll.currentMaximumVoteCount, + textColor: textColor(for: message) ) .layoutPriority(1) // do not compress long text } @@ -188,6 +190,7 @@ struct PollOptionView: View { var optionFont: Font = InjectedValues[\.fonts].body var optionVotes: Int? var maxVotes: Int? + var textColor: Color /// If true, only option name and vote count is shown, otherwise votes indicator and avatars appear as well. var alternativeStyle: Bool = false /// The spacing between the checkbox and the option name. @@ -211,6 +214,7 @@ struct PollOptionView: View { HStack(alignment: .top) { Text(option.text) .font(optionFont) + .foregroundColor(textColor) Spacer() if !alternativeStyle, viewModel.showVoterAvatars { HStack(spacing: -4) { @@ -225,6 +229,7 @@ struct PollOptionView: View { } } Text("\(viewModel.poll.voteCountsByOption?[option.id] ?? 0)") + .foregroundColor(textColor) } if !alternativeStyle { PollVotesIndicatorView( diff --git a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/Polls/PollResultsView.swift b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/Polls/PollResultsView.swift index 46b1b3e2..de710fbe 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/Polls/PollResultsView.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/Polls/PollResultsView.swift @@ -55,6 +55,7 @@ struct PollResultsView: View { Spacer() } } + .background(Color(colors.background).ignoresSafeArea()) .toolbar { ToolbarItem(placement: .principal) { Text(L10n.Message.Polls.Toolbar.resultsTitle) diff --git a/Sources/StreamChatSwiftUI/ChatChannel/Polls/CreatePollView.swift b/Sources/StreamChatSwiftUI/ChatChannel/Polls/CreatePollView.swift index d9cf6367..8a90e1eb 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/Polls/CreatePollView.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/Polls/CreatePollView.swift @@ -162,6 +162,7 @@ struct CreatePollView: View { Spacer() .modifier(ListRowModifier()) } + .background(Color(colors.background).ignoresSafeArea()) .listStyle(.plain) .id(listId) .toolbar { @@ -229,11 +230,14 @@ struct CreatePollItemModifier: ViewModifier { } struct ListRowModifier: ViewModifier { - + + @Injected(\.colors) var colors + func body(content: Content) -> some View { if #available(iOS 15.0, *) { content .listRowSeparator(.hidden) + .listRowBackground(Color(colors.background)) } else { content } diff --git a/Sources/StreamChatSwiftUI/Generated/SystemEnvironment+Version.swift b/Sources/StreamChatSwiftUI/Generated/SystemEnvironment+Version.swift index 514b3b3a..2f9eaf25 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.66.0" + public static let version: String = "4.67.0" } diff --git a/Sources/StreamChatSwiftUI/Info.plist b/Sources/StreamChatSwiftUI/Info.plist index bc6a72f5..8aad8a3a 100644 --- a/Sources/StreamChatSwiftUI/Info.plist +++ b/Sources/StreamChatSwiftUI/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString - 4.66.0 + 4.67.0 CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPhotoLibraryUsageDescription diff --git a/StreamChatSwiftUI-XCFramework.podspec b/StreamChatSwiftUI-XCFramework.podspec index 14eb0b70..861475e2 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.66.0' + spec.version = '4.67.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.66.0' + spec.dependency 'StreamChat-XCFramework', '~> 4.67.0' spec.cocoapods_version = '>= 1.11.0' end diff --git a/StreamChatSwiftUI.podspec b/StreamChatSwiftUI.podspec index e481276f..8d4e44c5 100644 --- a/StreamChatSwiftUI.podspec +++ b/StreamChatSwiftUI.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |spec| spec.name = 'StreamChatSwiftUI' - spec.version = '4.66.0' + spec.version = '4.67.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.66.0' + spec.dependency 'StreamChat', '~> 4.67.0' end diff --git a/StreamChatSwiftUI.xcodeproj/project.pbxproj b/StreamChatSwiftUI.xcodeproj/project.pbxproj index 09620d43..ce96227e 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.66.0; + minimumVersion = 4.67.0; }; }; E3A1C01A282BAC66002D1E26 /* XCRemoteSwiftPackageReference "sentry-cocoa" */ = { diff --git a/StreamChatSwiftUIArtifacts.json b/StreamChatSwiftUIArtifacts.json index f8359c53..eaf33257 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"} \ 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"} \ No newline at end of file diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/ChannelInfo/ChatChannelInfoViewModel_Tests.swift b/StreamChatSwiftUITests/Tests/ChatChannel/ChannelInfo/ChatChannelInfoViewModel_Tests.swift index f11ea200..5625ba95 100644 --- a/StreamChatSwiftUITests/Tests/ChatChannel/ChannelInfo/ChatChannelInfoViewModel_Tests.swift +++ b/StreamChatSwiftUITests/Tests/ChatChannel/ChannelInfo/ChatChannelInfoViewModel_Tests.swift @@ -262,6 +262,42 @@ class ChatChannelInfoViewModel_Tests: StreamChatTestCase { XCTAssert(leaveButton == false) } + func test_chatChannelInfoVM_addUserButtonShownInGroup() { + // Given + let channel = mockGroup(with: 5) + let viewModel = ChatChannelInfoViewModel(channel: channel) + + // When + let leaveButton = viewModel.shouldShowAddUserButton + + // Then + XCTAssert(leaveButton == true) + } + + func test_chatChannelInfoVM_addUserButtonHiddenInGroup() { + // Given + let channel = mockGroup(with: 5, updateCapabilities: false) + let viewModel = ChatChannelInfoViewModel(channel: channel) + + // When + let leaveButton = viewModel.shouldShowAddUserButton + + // Then + XCTAssert(leaveButton == false) + } + + func test_chatChannelInfoVM_addUserButtonHiddenInDM() { + // Given + let channel = ChatChannel.mockDMChannel() + let viewModel = ChatChannelInfoViewModel(channel: channel) + + // When + let leaveButton = viewModel.shouldShowAddUserButton + + // Then + XCTAssert(leaveButton == false) + } + // MARK: - private private func mockGroup(with memberCount: Int, updateCapabilities: Bool = true) -> ChatChannel { @@ -275,6 +311,7 @@ class ChatChannelInfoViewModel_Tests: StreamChatTestCase { capabilities.insert(.updateChannel) capabilities.insert(.deleteChannel) capabilities.insert(.leaveChannel) + capabilities.insert(.updateChannelMembers) } let channel = ChatChannel.mock( cid: cid, diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/ChannelInfo/ChatChannelInfoView_Tests.swift b/StreamChatSwiftUITests/Tests/ChatChannel/ChannelInfo/ChatChannelInfoView_Tests.swift index cd581ac9..359d34d2 100644 --- a/StreamChatSwiftUITests/Tests/ChatChannel/ChannelInfo/ChatChannelInfoView_Tests.swift +++ b/StreamChatSwiftUITests/Tests/ChatChannel/ChannelInfo/ChatChannelInfoView_Tests.swift @@ -151,7 +151,7 @@ class ChatChannelInfoView_Tests: StreamChatTestCase { let group = ChatChannel.mock( cid: .unique, name: "Test Group", - ownCapabilities: [.updateChannel, .leaveChannel], + ownCapabilities: [.updateChannel, .leaveChannel, .updateChannelMembers], lastActiveMembers: members, memberCount: members.count ) diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/ChatChannelTestHelpers.swift b/StreamChatSwiftUITests/Tests/ChatChannel/ChatChannelTestHelpers.swift index 29a873fc..919fcf4b 100644 --- a/StreamChatSwiftUITests/Tests/ChatChannel/ChatChannelTestHelpers.swift +++ b/StreamChatSwiftUITests/Tests/ChatChannel/ChatChannelTestHelpers.swift @@ -15,7 +15,11 @@ class ChatChannelTestHelpers { lastActiveWatchers: [ChatUser] = [] ) -> ChatChannelController_Mock { let config = ChannelConfig(commands: [Command(name: "giphy", description: "", set: "", args: "")]) - let channel = chatChannel ?? ChatChannel.mockDMChannel(config: config, lastActiveWatchers: lastActiveWatchers) + let channel = chatChannel ?? ChatChannel.mockDMChannel( + config: config, + ownCapabilities: [.uploadFile], + lastActiveWatchers: lastActiveWatchers + ) let channelQuery = ChannelQuery(cid: channel.cid) let channelListQuery = ChannelListQuery(filter: .containMembers(userIds: [chatClient.currentUserId ?? .unique])) let channelController = ChatChannelController_Mock.mock( diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/ChatChannelViewModel_Tests.swift b/StreamChatSwiftUITests/Tests/ChatChannel/ChatChannelViewModel_Tests.swift index 8c98ce1a..075c10d9 100644 --- a/StreamChatSwiftUITests/Tests/ChatChannel/ChatChannelViewModel_Tests.swift +++ b/StreamChatSwiftUITests/Tests/ChatChannel/ChatChannelViewModel_Tests.swift @@ -489,6 +489,30 @@ class ChatChannelViewModel_Tests: StreamChatTestCase { // Then XCTAssert(shouldJump == false) } + + func test_chatChannelVM_crashWhenIndexAccess() { + // Given + let message1 = ChatMessage.mock() + let message2 = ChatMessage.mock() + let message3 = ChatMessage.mock() + let channelController = makeChannelController(messages: [message1, message2]) + let viewModel = ChatChannelViewModel(channelController: channelController) + let newMessages = LazyCachedMapCollection(elements: [message1, message2, message3]) + + // When + viewModel.dataSource( + channelDataSource: ChatChannelDataSource(controller: channelController), + didUpdateMessages: newMessages, + changes: [ + .insert(message3, index: IndexPath(row: 2, section: 0)), + .update(message3, index: IndexPath(row: 2, section: 0)), + .update(message3, index: IndexPath(row: 3, section: 0)) // intentionally invalid path + ] + ) + + // Then + XCTAssertEqual(3, viewModel.messages.count) + } // MARK: - private diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/CreatePollView_Tests.swift b/StreamChatSwiftUITests/Tests/ChatChannel/CreatePollView_Tests.swift index fdb6bede..6b91d7ae 100644 --- a/StreamChatSwiftUITests/Tests/ChatChannel/CreatePollView_Tests.swift +++ b/StreamChatSwiftUITests/Tests/ChatChannel/CreatePollView_Tests.swift @@ -19,9 +19,9 @@ final class CreatePollView_Tests: StreamChatTestCase { .applyDefaultSize() // Then - assertSnapshot(matching: view, as: .image) + AssertSnapshot(view, variants: .onlyUserInterfaceStyles) } - + func test_createPollView_allOptionsDisabledSnapshot() { // Given let hidden = PollsEntryConfig(configurable: false, defaultValue: false) @@ -38,7 +38,7 @@ final class CreatePollView_Tests: StreamChatTestCase { .applyDefaultSize() // Then - assertSnapshot(matching: view, as: .image) + AssertSnapshot(view, variants: .onlyUserInterfaceStyles) } func test_createPollView_allOptionsEnabledSnapshot() { @@ -58,7 +58,7 @@ final class CreatePollView_Tests: StreamChatTestCase { .applyDefaultSize() // Then - assertSnapshot(matching: view, as: .image) + AssertSnapshot(view, variants: .onlyUserInterfaceStyles) } func test_createPollView_mixedOptionsSnapshot() { @@ -81,6 +81,6 @@ final class CreatePollView_Tests: StreamChatTestCase { .applyDefaultSize() // Then - assertSnapshot(matching: view, as: .image) + AssertSnapshot(view, variants: .onlyUserInterfaceStyles) } } diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/MessageActions_Tests.swift b/StreamChatSwiftUITests/Tests/ChatChannel/MessageActions_Tests.swift index 0d5f24fb..8194afe6 100644 --- a/StreamChatSwiftUITests/Tests/ChatChannel/MessageActions_Tests.swift +++ b/StreamChatSwiftUITests/Tests/ChatChannel/MessageActions_Tests.swift @@ -217,7 +217,12 @@ class MessageActions_Tests: StreamChatTestCase { let channel = ChatChannel.mockDMChannel() let moderationDetails = MessageModerationDetails( originalText: "Some text", - action: .bounce + action: .bounce, + textHarms: nil, + imageHarms: nil, + blocklistMatched: nil, + semanticFilterMatched: nil, + platformCircumvented: nil ) let message = ChatMessage.mock( id: .unique, diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/MessageComposerView_Tests.swift b/StreamChatSwiftUITests/Tests/ChatChannel/MessageComposerView_Tests.swift index 620434cd..18c9d4d3 100644 --- a/StreamChatSwiftUITests/Tests/ChatChannel/MessageComposerView_Tests.swift +++ b/StreamChatSwiftUITests/Tests/ChatChannel/MessageComposerView_Tests.swift @@ -25,7 +25,7 @@ class MessageComposerView_Tests: StreamChatTestCase { // Given let factory = DefaultViewFactory.shared let channelController = ChatChannelTestHelpers.makeChannelController(chatClient: chatClient) - + // When let view = MessageComposerView( viewFactory: factory, @@ -194,6 +194,40 @@ class MessageComposerView_Tests: StreamChatTestCase { assertSnapshot(matching: view, as: .image(perceptualPrecision: precision)) } + func test_leadingComposerView_uploadFileCapability() { + // Given + let factory = DefaultViewFactory.shared + let mockChannelController = ChatChannelTestHelpers.makeChannelController(chatClient: chatClient) + mockChannelController.channel_mock = .mockDMChannel(ownCapabilities: [.uploadFile]) + let viewModel = MessageComposerViewModel(channelController: mockChannelController, messageController: nil) + + // When + let pickerTypeState: Binding = .constant(.expanded(.none)) + let view = factory.makeLeadingComposerView(state: pickerTypeState, channelConfig: nil) + .environmentObject(viewModel) + .frame(width: 36, height: 36) + + // Then + assertSnapshot(matching: view, as: .image(perceptualPrecision: precision)) + } + + func test_leadingComposerView_withoutUploadFileCapability() { + // Given + let factory = DefaultViewFactory.shared + let mockChannelController = ChatChannelTestHelpers.makeChannelController(chatClient: chatClient) + mockChannelController.channel_mock = .mockDMChannel(ownCapabilities: []) + let viewModel = MessageComposerViewModel(channelController: mockChannelController, messageController: nil) + + // When + let pickerTypeState: Binding = .constant(.expanded(.none)) + let view = factory.makeLeadingComposerView(state: pickerTypeState, channelConfig: nil) + .environmentObject(viewModel) + .frame(width: 36, height: 36) + + // Then + assertSnapshot(matching: view, as: .image(perceptualPrecision: precision)) + } + func test_composerInputView_inputTextView() { // Given let view = InputTextView( diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/MessageContainerView_Tests.swift b/StreamChatSwiftUITests/Tests/ChatChannel/MessageContainerView_Tests.swift index b09c05c2..f20e4fba 100644 --- a/StreamChatSwiftUITests/Tests/ChatChannel/MessageContainerView_Tests.swift +++ b/StreamChatSwiftUITests/Tests/ChatChannel/MessageContainerView_Tests.swift @@ -54,6 +54,35 @@ class MessageContainerView_Tests: StreamChatTestCase { assertSnapshot(matching: view, as: .image(perceptualPrecision: precision)) } + func test_messageContainerEditedAIGenerated_snapshot() { + // Given + let key = "ai_generated" + let utils = Utils( + dateFormatter: EmptyDateFormatter(), + messageListConfig: .init( + skipEditedMessageLabel: { message in + message.extraData[key]?.boolValue == true + } + ) + ) + streamChat = StreamChat(chatClient: chatClient, utils: utils) + let message = ChatMessage.mock( + id: .unique, + cid: .unique, + text: "Message sent by current user", + author: .mock(id: Self.currentUserId, name: "Martin"), + extraData: [key: true], + isSentByCurrentUser: true, + textUpdatedAt: Date() + ) + + // When + let view = testMessageViewContainer(message: message) + + // Then + assertSnapshot(matching: view, as: .image(perceptualPrecision: precision)) + } + func test_messageContainerCurrentUserColor_snapshot() { // Given let utils = Utils(dateFormatter: EmptyDateFormatter()) diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/MessageView_Tests.swift b/StreamChatSwiftUITests/Tests/ChatChannel/MessageView_Tests.swift index ce10eda2..2fffac28 100644 --- a/StreamChatSwiftUITests/Tests/ChatChannel/MessageView_Tests.swift +++ b/StreamChatSwiftUITests/Tests/ChatChannel/MessageView_Tests.swift @@ -388,6 +388,33 @@ class MessageView_Tests: StreamChatTestCase { assertSnapshot(matching: view, as: .image(perceptualPrecision: precision)) } + func test_linkAttachmentView_shouldNotRenderLinkPreviewWithOtherAttachments() { + // Given + let messageWithLinkAndImages = ChatMessage.mock( + id: .unique, + cid: .unique, + text: "https://getstream.io", + author: .mock(id: .unique), + attachments: [ + ChatChannelTestHelpers.imageAttachments[0], + ChatChannelTestHelpers.videoAttachments[0] + ] + ) + + // When + let view = MessageView( + factory: DefaultViewFactory.shared, + message: messageWithLinkAndImages, + contentWidth: defaultScreenSize.width, + isFirst: true, + scrolledId: .constant(nil) + ) + .applyDefaultSize() + + // Then + assertSnapshot(matching: view, as: .image(perceptualPrecision: precision)) + } + func test_deletedMessageView_snapshot() { // Given let message = ChatMessage.mock( diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/PollAttachmentView_Tests.swift b/StreamChatSwiftUITests/Tests/ChatChannel/PollAttachmentView_Tests.swift index cf88ba6a..ba97d073 100644 --- a/StreamChatSwiftUITests/Tests/ChatChannel/PollAttachmentView_Tests.swift +++ b/StreamChatSwiftUITests/Tests/ChatChannel/PollAttachmentView_Tests.swift @@ -31,7 +31,7 @@ final class PollAttachmentView_Tests: StreamChatTestCase { .frame(width: defaultScreenSize.width, height: 240) // Then - assertSnapshot(matching: view, as: .image) + AssertSnapshot(view, variants: .onlyUserInterfaceStyles) } func test_pollAttachmentView_snapshotUniqueVotes() { @@ -59,7 +59,7 @@ final class PollAttachmentView_Tests: StreamChatTestCase { .frame(width: defaultScreenSize.width, height: 150) // Then - assertSnapshot(matching: view, as: .image) + AssertSnapshot(view, variants: .onlyUserInterfaceStyles) } func test_pollAttachmentView_closedPoll() { @@ -88,7 +88,7 @@ final class PollAttachmentView_Tests: StreamChatTestCase { .frame(width: defaultScreenSize.width, height: 150) // Then - assertSnapshot(matching: view, as: .image) + AssertSnapshot(view, variants: .onlyUserInterfaceStyles) } func test_pollAttachmentView_resultsSnapshot() { @@ -101,7 +101,7 @@ final class PollAttachmentView_Tests: StreamChatTestCase { .applyDefaultSize() // Then - assertSnapshot(matching: view, as: .image) + AssertSnapshot(view, variants: .onlyUserInterfaceStyles) } func test_pollAttachmentView_allOptions() { @@ -114,7 +114,7 @@ final class PollAttachmentView_Tests: StreamChatTestCase { .applyDefaultSize() // Then - assertSnapshot(matching: view, as: .image) + AssertSnapshot(view, variants: .onlyUserInterfaceStyles) } func test_pollAttachmentView_allVotes() { @@ -126,7 +126,7 @@ final class PollAttachmentView_Tests: StreamChatTestCase { .applyDefaultSize() // Then - assertSnapshot(matching: view, as: .image) + AssertSnapshot(view, variants: .onlyUserInterfaceStyles) } func test_pollAttachmentView_allComments() { @@ -145,6 +145,6 @@ final class PollAttachmentView_Tests: StreamChatTestCase { .applyDefaultSize() // Then - assertSnapshot(matching: view, as: .image) + AssertSnapshot(view, variants: .onlyUserInterfaceStyles) } } diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/CreatePollView_Tests/test_createPollView_allOptionsDisabledSnapshot.default-dark.png b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/CreatePollView_Tests/test_createPollView_allOptionsDisabledSnapshot.default-dark.png new file mode 100644 index 00000000..033c8cd1 Binary files /dev/null and b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/CreatePollView_Tests/test_createPollView_allOptionsDisabledSnapshot.default-dark.png differ diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/CreatePollView_Tests/test_createPollView_allOptionsDisabledSnapshot.default-light.png b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/CreatePollView_Tests/test_createPollView_allOptionsDisabledSnapshot.default-light.png new file mode 100644 index 00000000..59b8a434 Binary files /dev/null and b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/CreatePollView_Tests/test_createPollView_allOptionsDisabledSnapshot.default-light.png differ diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/CreatePollView_Tests/test_createPollView_allOptionsEnabledSnapshot.default-dark.png b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/CreatePollView_Tests/test_createPollView_allOptionsEnabledSnapshot.default-dark.png new file mode 100644 index 00000000..b8fed21f Binary files /dev/null and b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/CreatePollView_Tests/test_createPollView_allOptionsEnabledSnapshot.default-dark.png differ diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/CreatePollView_Tests/test_createPollView_allOptionsEnabledSnapshot.default-light.png b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/CreatePollView_Tests/test_createPollView_allOptionsEnabledSnapshot.default-light.png new file mode 100644 index 00000000..a81b5822 Binary files /dev/null and b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/CreatePollView_Tests/test_createPollView_allOptionsEnabledSnapshot.default-light.png differ diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/CreatePollView_Tests/test_createPollView_mixedOptionsSnapshot.default-dark.png b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/CreatePollView_Tests/test_createPollView_mixedOptionsSnapshot.default-dark.png new file mode 100644 index 00000000..df32bcb9 Binary files /dev/null and b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/CreatePollView_Tests/test_createPollView_mixedOptionsSnapshot.default-dark.png differ diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/CreatePollView_Tests/test_createPollView_mixedOptionsSnapshot.default-light.png b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/CreatePollView_Tests/test_createPollView_mixedOptionsSnapshot.default-light.png new file mode 100644 index 00000000..449d4008 Binary files /dev/null and b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/CreatePollView_Tests/test_createPollView_mixedOptionsSnapshot.default-light.png differ diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/CreatePollView_Tests/test_createPollView_snapshot.default-dark.png b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/CreatePollView_Tests/test_createPollView_snapshot.default-dark.png new file mode 100644 index 00000000..80de67e5 Binary files /dev/null and b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/CreatePollView_Tests/test_createPollView_snapshot.default-dark.png differ diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/CreatePollView_Tests/test_createPollView_snapshot.default-light.png b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/CreatePollView_Tests/test_createPollView_snapshot.default-light.png new file mode 100644 index 00000000..3809329b Binary files /dev/null and b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/CreatePollView_Tests/test_createPollView_snapshot.default-light.png differ diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageComposerView_Tests/test_leadingComposerView_uploadFileCapability.1.png b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageComposerView_Tests/test_leadingComposerView_uploadFileCapability.1.png new file mode 100644 index 00000000..4109e2e0 Binary files /dev/null and b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageComposerView_Tests/test_leadingComposerView_uploadFileCapability.1.png differ diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageComposerView_Tests/test_leadingComposerView_withoutUploadFileCapability.1.png b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageComposerView_Tests/test_leadingComposerView_withoutUploadFileCapability.1.png new file mode 100644 index 00000000..86c39cbb Binary files /dev/null and b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageComposerView_Tests/test_leadingComposerView_withoutUploadFileCapability.1.png differ diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageComposerView_Tests/test_messageComposerView_addedVoiceRecording.1.png b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageComposerView_Tests/test_messageComposerView_addedVoiceRecording.1.png index 8a6c5cd4..2f9327c8 100644 Binary files a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageComposerView_Tests/test_messageComposerView_addedVoiceRecording.1.png and b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageComposerView_Tests/test_messageComposerView_addedVoiceRecording.1.png differ diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageComposerView_Tests/test_messageComposerView_recordingTip.1.png b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageComposerView_Tests/test_messageComposerView_recordingTip.1.png index 72edd67c..91334bdf 100644 Binary files a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageComposerView_Tests/test_messageComposerView_recordingTip.1.png and b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageComposerView_Tests/test_messageComposerView_recordingTip.1.png differ diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageComposerView_Tests/test_messageComposerView_snapshot.1.png b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageComposerView_Tests/test_messageComposerView_snapshot.1.png index 472f42e5..be0140c1 100644 Binary files a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageComposerView_Tests/test_messageComposerView_snapshot.1.png and b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageComposerView_Tests/test_messageComposerView_snapshot.1.png differ diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageContainerView_Tests/test_messageContainerEditedAIGenerated_snapshot.1.png b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageContainerView_Tests/test_messageContainerEditedAIGenerated_snapshot.1.png new file mode 100644 index 00000000..a2aa7b0d Binary files /dev/null and b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageContainerView_Tests/test_messageContainerEditedAIGenerated_snapshot.1.png differ diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_linkAttachmentView_shouldNotRenderLinkPreviewWithOtherAttachments.1.png b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_linkAttachmentView_shouldNotRenderLinkPreviewWithOtherAttachments.1.png new file mode 100644 index 00000000..50fa41b9 Binary files /dev/null and b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageView_Tests/test_linkAttachmentView_shouldNotRenderLinkPreviewWithOtherAttachments.1.png differ diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_allComments.1.png b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_allComments.1.png deleted file mode 100644 index 51d752e1..00000000 Binary files a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_allComments.1.png and /dev/null differ diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_allComments.default-dark.png b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_allComments.default-dark.png new file mode 100644 index 00000000..89ae67a3 Binary files /dev/null and b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_allComments.default-dark.png differ diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_allComments.default-light.png b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_allComments.default-light.png new file mode 100644 index 00000000..97fbdeca Binary files /dev/null and b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_allComments.default-light.png differ diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_allOptions.1.png b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_allOptions.1.png deleted file mode 100644 index 9762e4c4..00000000 Binary files a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_allOptions.1.png and /dev/null differ diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_allOptions.default-dark.png b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_allOptions.default-dark.png new file mode 100644 index 00000000..e7fac76b Binary files /dev/null and b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_allOptions.default-dark.png differ diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_allOptions.default-light.png b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_allOptions.default-light.png new file mode 100644 index 00000000..688c5e08 Binary files /dev/null and b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_allOptions.default-light.png differ diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_allVotes.1.png b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_allVotes.1.png deleted file mode 100644 index ff1b9939..00000000 Binary files a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_allVotes.1.png and /dev/null differ diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_allVotes.default-dark.png b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_allVotes.default-dark.png new file mode 100644 index 00000000..767438c8 Binary files /dev/null and b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_allVotes.default-dark.png differ diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_allVotes.default-light.png b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_allVotes.default-light.png new file mode 100644 index 00000000..3d558a6b Binary files /dev/null and b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_allVotes.default-light.png differ diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_closedPoll.1.png b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_closedPoll.1.png deleted file mode 100644 index 973eec26..00000000 Binary files a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_closedPoll.1.png and /dev/null differ diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_closedPoll.default-dark.png b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_closedPoll.default-dark.png new file mode 100644 index 00000000..123d17e8 Binary files /dev/null and b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_closedPoll.default-dark.png differ diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_closedPoll.default-light.png b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_closedPoll.default-light.png new file mode 100644 index 00000000..367faab1 Binary files /dev/null and b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_closedPoll.default-light.png differ diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_resultsSnapshot.1.png b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_resultsSnapshot.1.png deleted file mode 100644 index c6ec0c8d..00000000 Binary files a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_resultsSnapshot.1.png and /dev/null differ diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_resultsSnapshot.default-dark.png b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_resultsSnapshot.default-dark.png new file mode 100644 index 00000000..0443c65b Binary files /dev/null and b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_resultsSnapshot.default-dark.png differ diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_resultsSnapshot.default-light.png b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_resultsSnapshot.default-light.png new file mode 100644 index 00000000..bff1bb49 Binary files /dev/null and b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_resultsSnapshot.default-light.png differ diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_snapshotCommentsAndSuggestions.1.png b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_snapshotCommentsAndSuggestions.1.png deleted file mode 100644 index d53ef697..00000000 Binary files a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_snapshotCommentsAndSuggestions.1.png and /dev/null differ diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_snapshotCommentsAndSuggestions.default-dark.png b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_snapshotCommentsAndSuggestions.default-dark.png new file mode 100644 index 00000000..1155df43 Binary files /dev/null and b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_snapshotCommentsAndSuggestions.default-dark.png differ diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_snapshotCommentsAndSuggestions.default-light.png b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_snapshotCommentsAndSuggestions.default-light.png new file mode 100644 index 00000000..7de95a0b Binary files /dev/null and b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_snapshotCommentsAndSuggestions.default-light.png differ diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_snapshotUniqueVotes.1.png b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_snapshotUniqueVotes.1.png deleted file mode 100644 index 66c02949..00000000 Binary files a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_snapshotUniqueVotes.1.png and /dev/null differ diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_snapshotUniqueVotes.default-dark.png b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_snapshotUniqueVotes.default-dark.png new file mode 100644 index 00000000..ff76da68 Binary files /dev/null and b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_snapshotUniqueVotes.default-dark.png differ diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_snapshotUniqueVotes.default-light.png b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_snapshotUniqueVotes.default-light.png new file mode 100644 index 00000000..99664650 Binary files /dev/null and b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_snapshotUniqueVotes.default-light.png differ diff --git a/StreamChatSwiftUITestsAppTests/Pages/MessageListPage.swift b/StreamChatSwiftUITestsAppTests/Pages/MessageListPage.swift index c2a93582..a0b06971 100644 --- a/StreamChatSwiftUITestsAppTests/Pages/MessageListPage.swift +++ b/StreamChatSwiftUITestsAppTests/Pages/MessageListPage.swift @@ -188,6 +188,10 @@ class MessageListPage { static func giphyCancelButton(in messageCell: XCUIElement) -> XCUIElement { attachmentActionButton(in: messageCell, label: "Cancel") } + + static func giphyImage(in messageCell: XCUIElement) -> XCUIElement { + messageCell.otherElements["GiphyAttachmentView"].images.firstMatch + } static func giphyLabel(in messageCell: XCUIElement) -> XCUIElement { messageCell.staticTexts["GiphyAttachmentView"] diff --git a/StreamChatSwiftUITestsAppTests/Robots/UserRobot+Asserts.swift b/StreamChatSwiftUITestsAppTests/Robots/UserRobot+Asserts.swift index 27f4c167..dbd33f6d 100644 --- a/StreamChatSwiftUITestsAppTests/Robots/UserRobot+Asserts.swift +++ b/StreamChatSwiftUITestsAppTests/Robots/UserRobot+Asserts.swift @@ -663,8 +663,8 @@ extension UserRobot { if ProcessInfo().operatingSystemVersion.majorVersion > 14 { // There is no image preview element details in the hierarchy tree on iOS < 15 - let previewImage = attributes.LinkPreview.image(in: messageCell) - XCTAssertTrue(previewImage.isHittable, "Preview image is not clickable") + let link = attributes.LinkPreview.link(in: messageCell) + XCTAssertTrue(link.isHittable, "Preview image is not clickable") } XCTAssertTrue(previewTitle.isHittable, "Preview title is not clickable") XCTAssertTrue(previewDescription.isHittable, "Preview description is not clickable") @@ -866,7 +866,7 @@ extension UserRobot { ) -> Self { let cell = messageCell(withIndex: messageCellIndex, file: file, line: line).wait() XCTAssertTrue(attributes.giphyLabel(in: cell).wait().exists, "Giphy label does not exist") - XCTAssertEqual(0, attributes.giphyButtons(in: cell).count) + XCTAssertTrue(attributes.giphyImage(in: cell).exists, "Giphy image does not exist") return self } @@ -931,22 +931,12 @@ extension UserRobot { let image = attributes.image(in: messageCell) if isPresent { image.wait() - sleep(2) // At the moment, this assert is flaky without it } else { image.waitForDisappearance() } let errMessage = isPresent ? "Image is not presented" : "Image is presented" - XCTAssertTrue(image.exists, errMessage, file: file, line: line) - - image.safeTap() - image.waitForDisappearance(timeout: 2) - if image.exists { - image.safeTap() - } - - let fullscreenImage = attributes.fullscreenImage().wait() - XCTAssertTrue(fullscreenImage.exists, "Fullscreen \(errMessage)", file: file, line: line) + XCTAssertEqual(isPresent, image.exists, errMessage, file: file, line: line) return self } diff --git a/StreamChatSwiftUITestsAppTests/Robots/UserRobot.swift b/StreamChatSwiftUITestsAppTests/Robots/UserRobot.swift index 739a3911..14e4c913 100644 --- a/StreamChatSwiftUITestsAppTests/Robots/UserRobot.swift +++ b/StreamChatSwiftUITestsAppTests/Robots/UserRobot.swift @@ -362,8 +362,8 @@ extension UserRobot { typeText("/giphy") sendMessage(text, waitForAppearance: false) } - if send { tapOnSendGiphyButton() } MessageListPage.Attributes.actionButtons().firstMatch.wait() + if send { tapOnSendGiphyButton() } return self } diff --git a/StreamChatSwiftUITestsAppTests/Tests/Ephemeral_Messages_Tests.swift b/StreamChatSwiftUITestsAppTests/Tests/Ephemeral_Messages_Tests.swift index 161b61e5..0c87ecc8 100644 --- a/StreamChatSwiftUITestsAppTests/Tests/Ephemeral_Messages_Tests.swift +++ b/StreamChatSwiftUITestsAppTests/Tests/Ephemeral_Messages_Tests.swift @@ -13,11 +13,6 @@ final class Ephemeral_Messages_Tests: StreamTestCase { func test_userObservesAnimatedGiphy_whenUserAddsGiphyMessage() throws { linkToScenario(withId: 435) - - try XCTSkipIf( - ProcessInfo().operatingSystemVersion.majorVersion > 16, - "The test cannot tap on a `Send` button on iOS 17" - ) GIVEN("user opens a channel") { userRobot @@ -25,7 +20,7 @@ final class Ephemeral_Messages_Tests: StreamTestCase { .openChannel() } WHEN("user sends a giphy using giphy command") { - userRobot.sendGiphy() + userRobot.sendGiphy(useComposerCommand: true) } THEN("user observes the animated gif") { userRobot.assertGiphyImage() @@ -141,11 +136,6 @@ final class Ephemeral_Messages_Tests: StreamTestCase { func test_userObservesAnimatedGiphy_afterAddingGiphyThroughComposerMenu() throws { linkToScenario(withId: 441) - - try XCTSkipIf( - ProcessInfo().operatingSystemVersion.majorVersion > 16, - "The test cannot tap on a `Send` button on iOS 17" - ) GIVEN("user opens a channel") { userRobot diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 187cc426..d5aeea36 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -75,7 +75,7 @@ lane :release do |options| File.write(artifacts_path, JSON.dump(artifacts)) # Set the framework version in SystemEnvironment+Version.swift - new_content = File.read(swift_environment_path).gsub!(previous_version_number, release_version) + new_content = File.read(swift_environment_path).gsub!(previous_version_number, release_version).gsub!('-SNAPSHOT', '') File.open(swift_environment_path, 'w') { |f| f.puts(new_content) } # Update sdk sizes @@ -101,11 +101,17 @@ end lane :merge_main do merge_main_to_develop + current_version = get_sdk_version_from_environment + add_snapshot_to_current_version(file_path: swift_environment_path) + ensure_git_branch(branch: 'develop') + sh("git add #{swift_environment_path}") + sh("git commit -m 'Add snapshot postfix to v#{current_version}'") + sh('git push') end desc "Publish a new release to GitHub and CocoaPods" lane :publish_release do |options| - release_version = File.read(swift_environment_path).match(/String\s+=\s+"([\d.]+)"/)[1] + release_version = get_sdk_version_from_environment UI.user_error!("Release #{release_version} has already been published.") if git_tag_exists(tag: release_version, remote: true) UI.user_error!('Release version cannot be empty') if release_version.to_s.empty? ensure_git_branch(branch: 'main') @@ -128,6 +134,10 @@ lane :publish_release do |options| update_spm(version: release_version) end +lane :get_sdk_version_from_environment do + File.read(swift_environment_path).match(/String\s+=\s+"([\d.]+).*"/)[1] +end + private_lane :appstore_api_key do @appstore_api_key ||= app_store_connect_api_key( key_id: 'MT3PRT8TB7', diff --git a/fastlane/Pluginfile b/fastlane/Pluginfile index 98410b08..204d77e1 100644 --- a/fastlane/Pluginfile +++ b/fastlane/Pluginfile @@ -5,4 +5,4 @@ gem 'fastlane-plugin-versioning' gem 'fastlane-plugin-sonarcloud_metric_kit' gem 'fastlane-plugin-create_xcframework' -gem 'fastlane-plugin-stream_actions', '0.3.71' +gem 'fastlane-plugin-stream_actions', '0.3.76' diff --git a/yeetd-normal.pkg b/yeetd-normal.pkg deleted file mode 100644 index e7fe6d35..00000000 Binary files a/yeetd-normal.pkg and /dev/null differ diff --git a/yeetd-normal.pkg.1 b/yeetd-normal.pkg.1 deleted file mode 100644 index e7fe6d35..00000000 Binary files a/yeetd-normal.pkg.1 and /dev/null differ