diff --git a/.github/workflows/smoke-checks.yml b/.github/workflows/smoke-checks.yml index def433690..f89ff5971 100644 --- a/.github/workflows/smoke-checks.yml +++ b/.github/workflows/smoke-checks.yml @@ -53,6 +53,9 @@ jobs: steps: - uses: actions/checkout@v4.1.1 - uses: ./.github/actions/bootstrap + env: + INSTALL_INTERFACE_ANALYZER: true + - run: bundle exec fastlane validate_public_interface - run: bundle exec fastlane lint_pr - run: bundle exec fastlane rubocop - run: bundle exec fastlane run_swift_format strict:true diff --git a/.gitignore b/.gitignore index ff9c090ec..45ae8d6e0 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,12 @@ StreamChatSwiftUI.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.res build/ DerivedData/ +# Interface Analyser +stream-module-interface-analyser/ +interface-analyser-report.md +public_interface_current.* +public_interface_previous.* + ## Various settings *.pbxuser !default.pbxuser diff --git a/.swiftformat b/.swiftformat index 2de565d0c..49e9dfeae 100644 --- a/.swiftformat +++ b/.swiftformat @@ -33,3 +33,6 @@ --wraparguments before-first --wrapparameters before-first --wrapcollections before-first + +# Exclude paths +--exclude Sources/StreamChatSwiftUI/Generated,Sources/StreamChatSwiftUI/StreamSwiftyGif,Sources/StreamChatSwiftUI/StreamNuke diff --git a/CHANGELOG.md b/CHANGELOG.md index cc0bb9f5c..5c05df514 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,23 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### 🔄 Changed +# [4.83.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.83.0) +_July 29, 2025_ + +### ✅ Added +- Add support for showing current poll comment on alert [#891](https://github.com/GetStream/stream-chat-swiftui/pull/891) + +### 🐞 Fixed +- Fix polls multiple answers minimum value being 1 instead of 2 [#898](https://github.com/GetStream/stream-chat-swiftui/pull/898) + +### 🔄 Changed +- Make `ChatChannelInfoView` subviews public for creating custom info views through composition [#892](https://github.com/GetStream/stream-chat-swiftui/pull/892) + - `ChannelTitleView` + - `ChannelInfoDivider` + - `ChatInfoDirectChannelView` + - `ChatInfoParticipantsView` +- Make `MediaViewsOptions` initializer public [#899](https://github.com/GetStream/stream-chat-swiftui/pull/899) + # [4.82.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.82.0) _July 16, 2025_ diff --git a/DemoAppSwiftUI/AppDelegate.swift b/DemoAppSwiftUI/AppDelegate.swift index 35fe2f196..a015ba5ec 100644 --- a/DemoAppSwiftUI/AppDelegate.swift +++ b/DemoAppSwiftUI/AppDelegate.swift @@ -2,7 +2,6 @@ // Copyright © 2025 Stream.io Inc. All rights reserved. // -import Network import Sentry import StreamChat import StreamChatSwiftUI @@ -25,11 +24,6 @@ class AppDelegate: NSObject, UIApplicationDelegate { _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil ) -> Bool { - // Xcode 26 beta workaround - if #available(iOS 26.0, *) { - nw_tls_create_options() - } - /* //Customizations, uncomment to customize. var colors = ColorPalette() diff --git a/Gemfile.lock b/Gemfile.lock index 9dc531882..79ac0a7db 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -289,7 +289,7 @@ GEM netrc (0.11.0) nio4r (2.7.4) nkf (0.2.0) - nokogiri (1.18.8) + nokogiri (1.18.9) mini_portile2 (~> 2.8.2) racc (~> 1.4) octokit (10.0.0) diff --git a/Githubfile b/Githubfile index 384620cc5..0b24052d2 100644 --- a/Githubfile +++ b/Githubfile @@ -6,3 +6,4 @@ export YEETD_VERSION='1.0' export MINT_VERSION='0.17.5' export SONAR_VERSION='6.2.1.4610' export IPSW_VERSION='3.1.592' +export INTERFACE_ANALYZER_VERSION='1.0.7' diff --git a/Package.swift b/Package.swift index bbb74235d..1f10d7342 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.82.0"), + .package(url: "https://github.com/GetStream/stream-chat-swift.git", from: "4.83.0") ], targets: [ .target( diff --git a/README.md b/README.md index 0229fb20c..0c93a569e 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@

- StreamChatSwiftUI + StreamChatSwiftUI

## SwiftUI StreamChat SDK diff --git a/Scripts/bootstrap.sh b/Scripts/bootstrap.sh index 7fd9b5974..d6b05bfb5 100755 --- a/Scripts/bootstrap.sh +++ b/Scripts/bootstrap.sh @@ -79,3 +79,11 @@ if [[ ${INSTALL_IPSW-default} == true ]]; then chmod +x ipsw sudo mv ipsw /usr/local/bin/ fi + +if [[ ${INSTALL_INTERFACE_ANALYZER-default} == true ]]; then + puts "Install interface-analyser v${INTERFACE_ANALYZER_VERSION}" + FILE="interface-analyser" + wget "https://github.com/GetStream/stream-module-interface-analyser/releases/download/v${INTERFACE_ANALYZER_VERSION}/${FILE}" + chmod +x ${FILE} + sudo mv ${FILE} /usr/local/bin/ +fi diff --git a/Sources/StreamChatSwiftUI/ChatChannel/ChannelHeader/ChatChannelHeaderViewModifier.swift b/Sources/StreamChatSwiftUI/ChatChannel/ChannelHeader/ChatChannelHeaderViewModifier.swift index a78147291..2931fb8ad 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/ChannelHeader/ChatChannelHeaderViewModifier.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/ChannelHeader/ChatChannelHeaderViewModifier.swift @@ -119,15 +119,20 @@ public struct DefaultChannelHeaderModifier: ChatChannelHea } } -struct ChannelTitleView: View { +public struct ChannelTitleView: View { @Injected(\.fonts) private var fonts @Injected(\.utils) private var utils @Injected(\.colors) private var colors @Injected(\.chatClient) private var chatClient - var channel: ChatChannel - var shouldShowTypingIndicator: Bool + let channel: ChatChannel + let shouldShowTypingIndicator: Bool + public init(channel: ChatChannel, shouldShowTypingIndicator: Bool) { + self.channel = channel + self.shouldShowTypingIndicator = shouldShowTypingIndicator + } + private var currentUserId: String { chatClient.currentUserId ?? "" } @@ -136,7 +141,7 @@ struct ChannelTitleView: View { utils.channelNamer } - var body: some View { + public var body: some View { VStack(spacing: 2) { Text(channelNamer(channel, currentUserId) ?? "") .font(fonts.bodyBold) diff --git a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoHelperViews.swift b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoHelperViews.swift index f10750075..d5f7a9f34 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoHelperViews.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoHelperViews.swift @@ -38,10 +38,12 @@ public struct ChatChannelInfoButton: View { } } -struct ChannelInfoDivider: View { +public struct ChannelInfoDivider: View { @Injected(\.colors) private var colors - var body: some View { + public init() {} + + public var body: some View { Rectangle() .fill(Color(colors.innerBorder)) .frame(height: 8) @@ -240,19 +242,19 @@ public struct ChannelInfoItemView: View { } } -struct ChatInfoDirectChannelView: View { +public struct ChatInfoDirectChannelView: View { @Injected(\.fonts) private var fonts @Injected(\.colors) private var colors let factory: Factory var participant: ParticipantInfo? - init(factory: Factory = DefaultViewFactory.shared, participant: ParticipantInfo?) { + public init(factory: Factory = DefaultViewFactory.shared, participant: ParticipantInfo?) { self.factory = factory self.participant = participant } - var body: some View { + public var body: some View { VStack { let displayInfo = UserDisplayInfo( id: participant?.chatUser.id ?? "", diff --git a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoView.swift b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoView.swift index 283fbec13..8dd856949 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoView.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoView.swift @@ -58,7 +58,7 @@ public struct ChatChannelInfoView: View, KeyboardReadable if viewModel.showMoreUsersButton { ChatChannelInfoButton( - title: L10n.ChatInfo.Users.loadMore(viewModel.notDisplayedParticipantsCount), + title: viewModel.showMoreUsersButtonTitle, iconName: "chevron.down", foregroundColor: Color(colors.textLowEmphasis) ) { diff --git a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoViewModel.swift b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoViewModel.swift index 96c0ee38c..ab17499df 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoViewModel.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatChannelInfoViewModel.swift @@ -99,6 +99,10 @@ public class ChatChannelInfoViewModel: ObservableObject, ChatChannelControllerDe return L10n.Alert.Actions.leaveGroupMessage } } + + public var showMoreUsersButtonTitle: String { + L10n.ChatInfo.Users.loadMore(notDisplayedParticipantsCount) + } public var notDisplayedParticipantsCount: Int { let total = channel.memberCount diff --git a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatInfoParticipantsView.swift b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatInfoParticipantsView.swift index 1945b2984..47979b01c 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatInfoParticipantsView.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/ChatInfoParticipantsView.swift @@ -6,7 +6,7 @@ import StreamChat import SwiftUI /// View for the chat info participants. -struct ChatInfoParticipantsView: View { +public struct ChatInfoParticipantsView: View { @Injected(\.fonts) private var fonts @Injected(\.colors) private var colors @@ -14,7 +14,7 @@ struct ChatInfoParticipantsView: View { var participants: [ParticipantInfo] var onItemAppear: (ParticipantInfo) -> Void - init( + public init( factory: Factory = DefaultViewFactory.shared, participants: [ParticipantInfo], onItemAppear: @escaping (ParticipantInfo) -> Void @@ -24,7 +24,7 @@ struct ChatInfoParticipantsView: View { self.onItemAppear = onItemAppear } - var body: some View { + public var body: some View { LazyVStack { ForEach(participants) { participant in HStack { diff --git a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/ImageAttachmentView.swift b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/ImageAttachmentView.swift index f79f9cf62..1f09486cc 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/ImageAttachmentView.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/ImageAttachmentView.swift @@ -484,4 +484,8 @@ enum MediaAttachmentType { public struct MediaViewsOptions { /// The index of the selected media item. public let selectedIndex: Int + + public init(selectedIndex: Int) { + self.selectedIndex = selectedIndex + } } diff --git a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/Polls/PollCommentsView.swift b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/Polls/PollCommentsView.swift index c25f70ad5..8c1951b86 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/Polls/PollCommentsView.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/Polls/PollCommentsView.swift @@ -77,6 +77,7 @@ struct PollCommentsView: View { } .padding() } + .background(Color(colors.background).ignoresSafeArea()) .alertBanner( isPresented: $viewModel.errorShown, action: viewModel.refresh diff --git a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/Polls/PollCommentsViewModel.swift b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/Polls/PollCommentsViewModel.swift index bba62ca8d..0f5a31833 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/Polls/PollCommentsViewModel.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/Polls/PollCommentsViewModel.swift @@ -76,7 +76,6 @@ class PollCommentsViewModel: ObservableObject, PollVoteListControllerDelegate { self?.errorShown = true } } - newCommentText = "" } func onAppear(comment: PollVote) { @@ -93,13 +92,18 @@ class PollCommentsViewModel: ObservableObject, PollVoteListControllerDelegate { ) { if animateChanges { withAnimation { - self.comments = Array(self.commentsController.votes) + self.updateCommentList() } } else { - comments = Array(commentsController.votes) + updateCommentList() } } + private func updateCommentList() { + comments = Array(commentsController.votes) + newCommentText = comments.first(where: { $0.user?.id == chatClient.currentUserId })?.answerText ?? "" + } + private func loadComments() { guard !loadingComments, !commentsController.hasLoadedAllVotes else { return } loadingComments = true diff --git a/Sources/StreamChatSwiftUI/ChatChannel/Polls/CreatePollView.swift b/Sources/StreamChatSwiftUI/ChatChannel/Polls/CreatePollView.swift index b2e7a38d4..4e985af9c 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/Polls/CreatePollView.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/Polls/CreatePollView.swift @@ -119,7 +119,7 @@ public struct CreatePollView: View { if viewModel.multipleAnswers { HStack(alignment: .textFieldToggle) { VStack(alignment: .leading, spacing: 6) { - Text(L10n.Composer.Polls.typeNumberFrom1And10) + Text(L10n.Composer.Polls.typeNumberMinMaxRange) .foregroundColor(Color(colors.alert)) .font(fonts.caption1) .offset(y: viewModel.showsMaxVotesError ? 0 : 6) diff --git a/Sources/StreamChatSwiftUI/ChatChannel/Polls/CreatePollViewModel.swift b/Sources/StreamChatSwiftUI/ChatChannel/Polls/CreatePollViewModel.swift index f7bd44c76..fccbe3162 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/Polls/CreatePollViewModel.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/Polls/CreatePollViewModel.swift @@ -76,7 +76,7 @@ class CreatePollViewModel: ObservableObject { .map { text in guard !text.isEmpty else { return false } let intValue = Int(text) ?? 0 - return intValue < 1 || intValue > 10 + return intValue < 2 || intValue > 10 } .combineLatest($maxVotesEnabled) .map { $0 && $1 } @@ -132,6 +132,7 @@ class CreatePollViewModel: ObservableObject { guard optionsErrorIndices.isEmpty else { return false } guard !showsMaxVotesError else { return false } guard options.contains(where: { !$0.trimmed.isEmpty }) else { return false } + guard !(maxVotesEnabled && maxVotes.trimmed.isEmpty) else { return false } return true } diff --git a/Sources/StreamChatSwiftUI/Generated/L10n.swift b/Sources/StreamChatSwiftUI/Generated/L10n.swift index 109848843..a9d6cf0bd 100644 --- a/Sources/StreamChatSwiftUI/Generated/L10n.swift +++ b/Sources/StreamChatSwiftUI/Generated/L10n.swift @@ -275,8 +275,8 @@ internal enum L10n { internal static var question: String { L10n.tr("Localizable", "composer.polls.question") } /// Suggest an option internal static var suggestOption: String { L10n.tr("Localizable", "composer.polls.suggest-option") } - /// Type a number from 1 and 10 - internal static var typeNumberFrom1And10: String { L10n.tr("Localizable", "composer.polls.type-number-from-1-and-10") } + /// Type a number from 2 and 10 + internal static var typeNumberMinMaxRange: String { L10n.tr("Localizable", "composer.polls.type-number-min-max-range") } } internal enum Quoted { /// Giphy diff --git a/Sources/StreamChatSwiftUI/Generated/SystemEnvironment+Version.swift b/Sources/StreamChatSwiftUI/Generated/SystemEnvironment+Version.swift index 692b61e69..ed418c411 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.82.0" + public static let version: String = "4.83.0" } diff --git a/Sources/StreamChatSwiftUI/Info.plist b/Sources/StreamChatSwiftUI/Info.plist index 657592e06..e63a5cbbf 100644 --- a/Sources/StreamChatSwiftUI/Info.plist +++ b/Sources/StreamChatSwiftUI/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString - 4.82.0 + 4.83.0 CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPhotoLibraryUsageDescription diff --git a/Sources/StreamChatSwiftUI/Resources/en.lproj/Localizable.strings b/Sources/StreamChatSwiftUI/Resources/en.lproj/Localizable.strings index 3d57da52a..0257af1a7 100644 --- a/Sources/StreamChatSwiftUI/Resources/en.lproj/Localizable.strings +++ b/Sources/StreamChatSwiftUI/Resources/en.lproj/Localizable.strings @@ -148,7 +148,7 @@ "composer.polls.duplicate-option" = "This is already an option"; "composer.polls.multiple-answers" = "Multiple answers"; "composer.polls.suggest-option" = "Suggest an option"; -"composer.polls.type-number-from-1-and-10" = "Type a number from 1 and 10"; +"composer.polls.type-number-min-max-range" = "Type a number from 2 and 10"; "composer.audio-recording.start" = "Start recording audio message"; "composer.audio-recording.stop" = "Stop recording audio message"; diff --git a/StreamChatSwiftUI-XCFramework.podspec b/StreamChatSwiftUI-XCFramework.podspec index 6f9652142..8257411bd 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.82.0' + spec.version = '4.83.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.82.0' + spec.dependency 'StreamChat-XCFramework', '~> 4.83.0' spec.cocoapods_version = '>= 1.11.0' end diff --git a/StreamChatSwiftUI.podspec b/StreamChatSwiftUI.podspec index 047d122b2..1b2881dbf 100644 --- a/StreamChatSwiftUI.podspec +++ b/StreamChatSwiftUI.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |spec| spec.name = 'StreamChatSwiftUI' - spec.version = '4.82.0' + spec.version = '4.83.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.82.0' + spec.dependency 'StreamChat', '~> 4.83.0' end diff --git a/StreamChatSwiftUI.xcodeproj/project.pbxproj b/StreamChatSwiftUI.xcodeproj/project.pbxproj index 85d23f495..0a5e22a8d 100644 --- a/StreamChatSwiftUI.xcodeproj/project.pbxproj +++ b/StreamChatSwiftUI.xcodeproj/project.pbxproj @@ -3908,7 +3908,7 @@ repositoryURL = "https://github.com/GetStream/stream-chat-swift.git"; requirement = { kind = upToNextMajorVersion; - minimumVersion = 4.82.0; + minimumVersion = 4.83.0; }; }; E3A1C01A282BAC66002D1E26 /* XCRemoteSwiftPackageReference "sentry-cocoa" */ = { diff --git a/StreamChatSwiftUIArtifacts.json b/StreamChatSwiftUIArtifacts.json index 249ae875f..c0cbedc3a 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","4.68.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.68.0/StreamChatSwiftUI.zip","4.69.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.69.0/StreamChatSwiftUI.zip","4.70.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.70.0/StreamChatSwiftUI.zip","4.71.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.71.0/StreamChatSwiftUI.zip","4.72.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.72.0/StreamChatSwiftUI.zip","4.73.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.73.0/StreamChatSwiftUI.zip","4.74.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.74.0/StreamChatSwiftUI.zip","4.75.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.75.0/StreamChatSwiftUI.zip","4.76.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.76.0/StreamChatSwiftUI.zip","4.77.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.77.0/StreamChatSwiftUI.zip","4.78.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.78.0/StreamChatSwiftUI.zip","4.79.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.79.0/StreamChatSwiftUI.zip","4.79.1":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.79.1/StreamChatSwiftUI.zip","4.80.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.80.0/StreamChatSwiftUI.zip","4.81.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.81.0/StreamChatSwiftUI.zip","4.82.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.82.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","4.69.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.69.0/StreamChatSwiftUI.zip","4.70.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.70.0/StreamChatSwiftUI.zip","4.71.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.71.0/StreamChatSwiftUI.zip","4.72.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.72.0/StreamChatSwiftUI.zip","4.73.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.73.0/StreamChatSwiftUI.zip","4.74.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.74.0/StreamChatSwiftUI.zip","4.75.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.75.0/StreamChatSwiftUI.zip","4.76.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.76.0/StreamChatSwiftUI.zip","4.77.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.77.0/StreamChatSwiftUI.zip","4.78.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.78.0/StreamChatSwiftUI.zip","4.79.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.79.0/StreamChatSwiftUI.zip","4.79.1":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.79.1/StreamChatSwiftUI.zip","4.80.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.80.0/StreamChatSwiftUI.zip","4.81.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.81.0/StreamChatSwiftUI.zip","4.82.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.82.0/StreamChatSwiftUI.zip","4.83.0":"https://github.com/GetStream/stream-chat-swiftui/releases/download/4.83.0/StreamChatSwiftUI.zip"} \ No newline at end of file diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/PollCommentsViewModel_Tests.swift b/StreamChatSwiftUITests/Tests/ChatChannel/PollCommentsViewModel_Tests.swift index 6981b7e56..666f6ddbc 100644 --- a/StreamChatSwiftUITests/Tests/ChatChannel/PollCommentsViewModel_Tests.swift +++ b/StreamChatSwiftUITests/Tests/ChatChannel/PollCommentsViewModel_Tests.swift @@ -52,7 +52,7 @@ final class PollCommentsViewModel_Tests: StreamChatTestCase { XCTAssertFalse(viewModel.showsAddCommentButton) } - func test_addComment_whenSuccess_thenCommentTextReset() { + func test_addComment_whenSuccess() { // Given let pollController = makePollController() @@ -66,7 +66,7 @@ final class PollCommentsViewModel_Tests: StreamChatTestCase { // Then XCTAssertTrue(pollController.castPollVote_called) - XCTAssertEqual("", viewModel.newCommentText) + XCTAssertEqual("A", viewModel.newCommentText) } // MARK: - Test Data 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 index 541bcc0c1..31620e44e 100644 Binary files a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_allComments.default-dark.png and b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/PollAttachmentView_Tests/test_pollAttachmentView_allComments.default-dark.png differ diff --git a/fastlane/Fastfile b/fastlane/Fastfile index b1492eb63..dd1a3d898 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -1,4 +1,5 @@ default_platform :ios +opt_out_usage skip_docs require 'json' @@ -220,7 +221,7 @@ end desc 'Builds the latest version of Demo app and uploads it to TestFlight' lane :swiftui_testflight_build do |options| - is_manual_upload = is_localhost || !options[:configuration].to_s.empty? + is_manual_upload = is_localhost || ENV['GITHUB_EVENT_NAME'] == 'workflow_dispatch' configuration = options[:configuration].to_s.empty? ? 'Release' : options[:configuration] match_me @@ -496,8 +497,8 @@ desc 'Run source code formatting/linting' lane :run_swift_format do |options| Dir.chdir('..') do strict = options[:strict] ? '--lint' : nil - sources_matrix[:swiftformat_include].each do |path| - sh("mint run swiftformat #{strict} --config .swiftformat --exclude #{sources_matrix[:swiftformat_exclude].join(',')} #{path}") + sources_matrix[:swiftformat].each do |path| + sh("mint run swiftformat #{strict} --config .swiftformat #{path}") next if path.include?('Tests') sh("mint run swiftlint lint --config .swiftlint.yml --fix --progress --quiet --reporter json #{path}") unless strict @@ -530,8 +531,8 @@ lane :sources_matrix do ruby: ['fastlane', 'Gemfile', 'Gemfile.lock'], size: ['Sources', xcode_project], sonar: ['Sources'], - swiftformat_include: ['Sources', 'DemoAppSwiftUI', 'StreamChatSwiftUITests'], - swiftformat_exclude: ['**/Generated', 'Sources/StreamChatSwiftUI/StreamNuke', 'Sources/StreamChatSwiftUI/StreamSwiftyGif'] + public_interface: ['Sources'], + swiftformat: ['Sources', 'DemoAppSwiftUI', 'StreamChatSwiftUITests'] } end @@ -545,6 +546,45 @@ lane :copyright do ) end +lane :validate_public_interface do + next unless is_check_required(sources: sources_matrix[:public_interface], force_check: @force_check) + + # Run the analysis on the current branch + original_branch = current_branch + sh('interface-analyser analysis ../Sources/ public_interface_current.json') + + # Checkout the target branch + target_branch = original_branch.include?('release/') ? 'main' : 'develop' + sh("git fetch origin #{target_branch}") + sh("git checkout #{target_branch}") + + # Run the analysis on the target branch + sh('interface-analyser analysis ../Sources/ public_interface_previous.json') + + # Run diff + report_path = 'interface-analyser-report.md' + sh("interface-analyser diff public_interface_current.json public_interface_previous.json #{report_path}") + + # Check if report exists and is non-zero in size + diff = + if File.exist?(report_path) && File.size(report_path) > 0 + File.read(report_path).strip + else + '🚀 No changes affecting the public interface.' + end + + # Generate markdown table for the PR comment + header = '## Public Interface' + content = "#{header}\n#{diff}" + + # Post PR comment if running in CI + pr_comment(text: content, edit_last_comment_with_text: header) if is_ci + + # Checkout the original branch + sh("git fetch origin #{original_branch}") + sh("git checkout #{original_branch}") +end + lane :show_frameworks_sizes do |options| next unless is_check_required(sources: sources_matrix[:size], force_check: @force_check) diff --git a/lefthook.yml b/lefthook.yml index 30b72f3b5..2463ab07c 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -1,9 +1,35 @@ pre-commit: - parallel: true + parallel: false jobs: - - run: bundle exec fastlane run_swift_format + - run: mint run swiftformat --config .swiftformat {staged_files} glob: "*.{swift}" stage_fixed: true + exclude: + - Sources/StreamChatSwiftUI/Generated/** + - Sources/StreamChatSwiftUI/StreamNuke/** + - Sources/StreamChatSwiftUI/StreamSwiftyGif/** skip: - merge - rebase + + - run: mint run swiftlint lint --config .swiftlint.yml --fix --progress --quiet --reporter json {staged_files} + glob: "*.{swift}" + stage_fixed: true + exclude: + - Sources/StreamChatSwiftUI/Generated/** + - Sources/StreamChatSwiftUI/StreamNuke/** + - Sources/StreamChatSwiftUI/StreamSwiftyGif/** + skip: + - merge + - rebase + +pre-push: + jobs: + - run: mint run swiftlint lint --config .swiftlint.yml --strict --progress --quiet --reporter json {push_files} + glob: "*.{swift}" + exclude: + - Sources/StreamChatSwiftUI/Generated/** + - Sources/StreamChatSwiftUI/StreamNuke/** + - Sources/StreamChatSwiftUI/StreamSwiftyGif/** + skip: + - merge-commit