diff --git a/DemoAppSwiftUI/DemoAppSwiftUIApp.swift b/DemoAppSwiftUI/DemoAppSwiftUIApp.swift index e03d7326..87c6ea6a 100644 --- a/DemoAppSwiftUI/DemoAppSwiftUIApp.swift +++ b/DemoAppSwiftUI/DemoAppSwiftUIApp.swift @@ -27,14 +27,14 @@ struct DemoAppSwiftUIApp: App { case .notLoggedIn: LoginView() case .loggedIn: - TabView { - channelListView() - .tabItem { Label("Chat", systemImage: "message") } - .badge(appState.unreadCount.channels) - threadListView() - .tabItem { Label("Threads", systemImage: "text.bubble") } - .badge(appState.unreadCount.threads) - } + TabView { + channelListView() + .tabItem { Label("Chat", systemImage: "message") } + .badge(appState.unreadCount.channels) + threadListView() + .tabItem { Label("Threads", systemImage: "text.bubble") } + .badge(appState.unreadCount.threads) + } } } .onChange(of: appState.userState) { newValue in @@ -104,7 +104,7 @@ class AppState: ObservableObject, CurrentChatUserControllerDelegate { private init() {} func currentUserController(_ controller: CurrentChatUserController, didChangeCurrentUserUnreadCount: UnreadCount) { - self.unreadCount = didChangeCurrentUserUnreadCount + unreadCount = didChangeCurrentUserUnreadCount let totalUnreadBadge = unreadCount.channels + unreadCount.threads if #available(iOS 16.0, *) { UNUserNotificationCenter.current().setBadgeCount(totalUnreadBadge) diff --git a/Package.swift b/Package.swift index 74df90fe..98afbd12 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.64.0"), + .package(url: "https://github.com/GetStream/stream-chat-swift.git", from: "4.65.0"), ], targets: [ .target( diff --git a/Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelListView.swift b/Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelListView.swift index ccfc166e..497cce77 100644 --- a/Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelListView.swift +++ b/Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelListView.swift @@ -81,22 +81,22 @@ public struct ChatChannelListView: View { view.navigationViewStyle(.stack) }) .background( - isIphone && handleTabBarVisibility ? - Color.clear.background( - TabBarAccessor { tabBar in - self.tabBar = tabBar - } - ) - .allowsHitTesting(false) - : nil - ) - .onReceive(viewModel.$hideTabBar) { newValue in - if isIphone && handleTabBarVisibility { - self.setupTabBarAppeareance() - self.tabBar?.isHidden = newValue - } - } - .accessibilityIdentifier("ChatChannelListView") + isIphone && handleTabBarVisibility ? + Color.clear.background( + TabBarAccessor { tabBar in + self.tabBar = tabBar + } + ) + .allowsHitTesting(false) + : nil + ) + .onReceive(viewModel.$hideTabBar) { newValue in + if isIphone && handleTabBarVisibility { + self.setupTabBarAppeareance() + self.tabBar?.isHidden = newValue + } + } + .accessibilityIdentifier("ChatChannelListView") } @ViewBuilder diff --git a/Sources/StreamChatSwiftUI/ChatThreadList/ChatThreadList.swift b/Sources/StreamChatSwiftUI/ChatThreadList/ChatThreadList.swift index 866813a2..f4bc23ae 100644 --- a/Sources/StreamChatSwiftUI/ChatThreadList/ChatThreadList.swift +++ b/Sources/StreamChatSwiftUI/ChatThreadList/ChatThreadList.swift @@ -35,7 +35,7 @@ public struct ThreadList: View { self.threadDestination = threadDestination self.onItemTap = onItemTap self.onItemAppear = onItemAppear - self._selectedThread = selectedThread + _selectedThread = selectedThread } public var body: some View { @@ -93,9 +93,11 @@ public struct ThreadsLazyVStack: View { threadDestination: threadDestination, selectedThread: $selectedThread ) - .background(factory.makeThreadListItemBackground( - thread: thread, - isSelected: selectedThread?.id == thread.id) + .background( + factory.makeThreadListItemBackground( + thread: thread, + isSelected: selectedThread?.id == thread.id + ) ) .contentShape(Rectangle()) .onTapGesture { diff --git a/Sources/StreamChatSwiftUI/ChatThreadList/ChatThreadListItem.swift b/Sources/StreamChatSwiftUI/ChatThreadList/ChatThreadListItem.swift index 6de7f607..5395b98c 100644 --- a/Sources/StreamChatSwiftUI/ChatThreadList/ChatThreadListItem.swift +++ b/Sources/StreamChatSwiftUI/ChatThreadList/ChatThreadListItem.swift @@ -51,7 +51,7 @@ public struct ChatThreadListItemViewModel { parentMessageText = threadTitle } else { let formatter = InjectedValues[\.utils].messagePreviewFormatter - parentMessageText = formatter.formatContent(for: thread.parentMessage) + parentMessageText = formatter.formatContent(for: thread.parentMessage) } return L10n.Thread.Item.repliedTo(parentMessageText.trimmed) } diff --git a/Sources/StreamChatSwiftUI/ChatThreadList/ChatThreadListNavigatableItem.swift b/Sources/StreamChatSwiftUI/ChatThreadList/ChatThreadListNavigatableItem.swift index deace592..44b3191e 100644 --- a/Sources/StreamChatSwiftUI/ChatThreadList/ChatThreadListNavigatableItem.swift +++ b/Sources/StreamChatSwiftUI/ChatThreadList/ChatThreadListNavigatableItem.swift @@ -24,7 +24,7 @@ public struct ChatThreadListNavigatableItem: View { ThreadList( factory: viewFactory, threads: viewModel.threads, - threadDestination: viewFactory.makeThreadDestination(), + threadDestination: viewFactory.makeThreadDestination(), selectedThread: $viewModel.selectedThread, onItemTap: { thread in viewModel.selectedThread = .init(thread: thread) }, onItemAppear: { index in viewModel.didAppearThread(at: index) - }, + }, headerView: { viewFactory.makeThreadListHeaderView(viewModel: viewModel) }, diff --git a/Sources/StreamChatSwiftUI/ChatThreadList/ChatThreadListViewModel.swift b/Sources/StreamChatSwiftUI/ChatThreadList/ChatThreadListViewModel.swift index ae265477..0eb14a17 100644 --- a/Sources/StreamChatSwiftUI/ChatThreadList/ChatThreadListViewModel.swift +++ b/Sources/StreamChatSwiftUI/ChatThreadList/ChatThreadListViewModel.swift @@ -55,12 +55,12 @@ open class ChatThreadListViewModel: ObservableObject, ChatThreadListControllerDe @Published public var hasNewThreads: Bool = false /// The ids of the new threads available to be fetched. - private var newAvailableThreadIds: Set = [] { - didSet { - newThreadsCount = newAvailableThreadIds.count - hasNewThreads = newThreadsCount > 0 - } - } + private var newAvailableThreadIds: Set = [] { + didSet { + newThreadsCount = newAvailableThreadIds.count + hasNewThreads = newThreadsCount > 0 + } + } /// Creates a view model for the `ChatThreadListView`. /// diff --git a/Sources/StreamChatSwiftUI/ChatThreadList/NoThreadsView.swift b/Sources/StreamChatSwiftUI/ChatThreadList/NoThreadsView.swift index 4e982147..791bdbb3 100644 --- a/Sources/StreamChatSwiftUI/ChatThreadList/NoThreadsView.swift +++ b/Sources/StreamChatSwiftUI/ChatThreadList/NoThreadsView.swift @@ -7,7 +7,7 @@ import SwiftUI /// Default SDK implementation for the view displayed when there are no threads available. public struct NoThreadsView: View { - public init () {} + public init() {} public var body: some View { NoContentView( diff --git a/Sources/StreamChatSwiftUI/CommonViews/FloatingBannerViewModifier.swift b/Sources/StreamChatSwiftUI/CommonViews/FloatingBannerViewModifier.swift index 01ae570f..15add172 100644 --- a/Sources/StreamChatSwiftUI/CommonViews/FloatingBannerViewModifier.swift +++ b/Sources/StreamChatSwiftUI/CommonViews/FloatingBannerViewModifier.swift @@ -28,7 +28,6 @@ extension View { } } - struct FloatingBannerViewModifier: ViewModifier { let alignment: Alignment var isPresented: Bool diff --git a/Sources/StreamChatSwiftUI/CommonViews/Shimmer.swift b/Sources/StreamChatSwiftUI/CommonViews/Shimmer.swift index d2e73e8f..2f57ab63 100644 --- a/Sources/StreamChatSwiftUI/CommonViews/Shimmer.swift +++ b/Sources/StreamChatSwiftUI/CommonViews/Shimmer.swift @@ -23,8 +23,8 @@ struct Shimmer: ViewModifier { ) .animation( .linear(duration: duration) - .delay(delay) - .repeatForever(autoreverses: false), + .delay(delay) + .repeatForever(autoreverses: false), value: isInitialState ) .onAppear { @@ -33,7 +33,6 @@ struct Shimmer: ViewModifier { } } - extension View { /// Adds an animated shimmering effect to any view, typically to show that /// an operation is in progress. diff --git a/Sources/StreamChatSwiftUI/DefaultViewFactory.swift b/Sources/StreamChatSwiftUI/DefaultViewFactory.swift index d20f43d2..bce2b7b6 100644 --- a/Sources/StreamChatSwiftUI/DefaultViewFactory.swift +++ b/Sources/StreamChatSwiftUI/DefaultViewFactory.swift @@ -238,6 +238,7 @@ extension ViewFactory { ) } } + public func makeMessageListModifier() -> some ViewModifier { EmptyViewModifier() } diff --git a/StreamChatSwiftUI-XCFramework.podspec b/StreamChatSwiftUI-XCFramework.podspec index 6bf76285..987a5bf2 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.64.0' + spec.version = '4.65.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.64.0' + spec.dependency 'StreamChat-XCFramework', '~> 4.65.0' spec.cocoapods_version = '>= 1.11.0' end diff --git a/StreamChatSwiftUI.podspec b/StreamChatSwiftUI.podspec index 92d1fdd4..d070eb36 100644 --- a/StreamChatSwiftUI.podspec +++ b/StreamChatSwiftUI.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |spec| spec.name = 'StreamChatSwiftUI' - spec.version = '4.64.0' + spec.version = '4.65.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.64.0' + spec.dependency 'StreamChat', '~> 4.65.0' end diff --git a/StreamChatSwiftUI.xcodeproj/project.pbxproj b/StreamChatSwiftUI.xcodeproj/project.pbxproj index ac7fb9fa..353c0916 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.64.0; + minimumVersion = 4.65.0; }; }; E3A1C01A282BAC66002D1E26 /* XCRemoteSwiftPackageReference "sentry-cocoa" */ = { diff --git a/StreamChatSwiftUITests/Tests/ChatThreadList/ChatThreadListViewModel_Tests.swift b/StreamChatSwiftUITests/Tests/ChatThreadList/ChatThreadListViewModel_Tests.swift index 0b3e98d0..bf3648b0 100644 --- a/StreamChatSwiftUITests/Tests/ChatThreadList/ChatThreadListViewModel_Tests.swift +++ b/StreamChatSwiftUITests/Tests/ChatThreadList/ChatThreadListViewModel_Tests.swift @@ -172,7 +172,7 @@ class ChatThreadListViewModel_Tests: StreamChatTestCase { viewModel.eventsController( eventController, didReceiveEvent: ThreadMessageNewEvent( - message: .mock(parentMessageId: .unique), + message: .mock(parentMessageId: .unique), channel: .mock(cid: .unique), unreadCount: .noUnread, createdAt: .unique diff --git a/StreamChatSwiftUITests/Tests/ChatThreadList/ChatThreadListView_Tests.swift b/StreamChatSwiftUITests/Tests/ChatThreadList/ChatThreadListView_Tests.swift index 253e47f8..9711eea5 100644 --- a/StreamChatSwiftUITests/Tests/ChatThreadList/ChatThreadListView_Tests.swift +++ b/StreamChatSwiftUITests/Tests/ChatThreadList/ChatThreadListView_Tests.swift @@ -71,7 +71,7 @@ class CustomFactory: ViewFactory { private class MockChatThreadListViewModel: ChatThreadListViewModel { static func empty() -> MockChatThreadListViewModel { - return MockChatThreadListViewModel( + MockChatThreadListViewModel( threads: [], isLoading: false, isReloading: false, @@ -86,7 +86,7 @@ private class MockChatThreadListViewModel: ChatThreadListViewModel { } static func loading() -> MockChatThreadListViewModel { - return MockChatThreadListViewModel( + MockChatThreadListViewModel( threads: [], isLoading: true, isReloading: false, @@ -101,7 +101,7 @@ private class MockChatThreadListViewModel: ChatThreadListViewModel { } static func withThreads() -> MockChatThreadListViewModel { - return MockChatThreadListViewModel( + MockChatThreadListViewModel( threads: mockThreads, isLoading: false, isReloading: false, @@ -116,7 +116,7 @@ private class MockChatThreadListViewModel: ChatThreadListViewModel { } static func loadingMoreThreads() -> MockChatThreadListViewModel { - return MockChatThreadListViewModel( + MockChatThreadListViewModel( threads: mockThreads, isLoading: false, isReloading: false, @@ -131,7 +131,7 @@ private class MockChatThreadListViewModel: ChatThreadListViewModel { } static func reloadingThreads() -> MockChatThreadListViewModel { - return MockChatThreadListViewModel( + MockChatThreadListViewModel( threads: mockThreads, isLoading: false, isReloading: true, @@ -146,7 +146,7 @@ private class MockChatThreadListViewModel: ChatThreadListViewModel { } static func newThreadsAvailable() -> MockChatThreadListViewModel { - return MockChatThreadListViewModel( + MockChatThreadListViewModel( threads: mockThreads, isLoading: false, isReloading: false, @@ -161,7 +161,7 @@ private class MockChatThreadListViewModel: ChatThreadListViewModel { } static func errorLoadingThreads() -> MockChatThreadListViewModel { - return MockChatThreadListViewModel( + MockChatThreadListViewModel( threads: [], isLoading: false, isReloading: false, @@ -176,7 +176,7 @@ private class MockChatThreadListViewModel: ChatThreadListViewModel { } static func errorLoadingMoreThreads() -> MockChatThreadListViewModel { - return MockChatThreadListViewModel( + MockChatThreadListViewModel( threads: mockThreads, isLoading: false, isReloading: false, @@ -223,7 +223,6 @@ private class MockChatThreadListViewModel: ChatThreadListViewModel { didChangeThreads changes: [ListChange] ) {} - static var mockYoda = ChatUser.mock(id: .unique, name: "Yoda") static var mockVader = ChatUser.mock(id: .unique, name: "Vader")