Skip to content

Commit

Permalink
Updated StreamChat dependency to 4.65.0 (#625)
Browse files Browse the repository at this point in the history
* Updated StreamChat dependency to 4.65.0

* Format code according to swiftformat

* Fix Tests

* One more

* Fix demo app linting
  • Loading branch information
nuno-vieira authored Oct 18, 2024
1 parent 6c5cfeb commit 753ef67
Show file tree
Hide file tree
Showing 17 changed files with 63 additions and 63 deletions.
18 changes: 9 additions & 9 deletions DemoAppSwiftUI/DemoAppSwiftUIApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
32 changes: 16 additions & 16 deletions Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,22 +81,22 @@ public struct ChatChannelListView<Factory: ViewFactory>: 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
Expand Down
14 changes: 8 additions & 6 deletions Sources/StreamChatSwiftUI/ChatThreadList/ChatThreadList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public struct ThreadList<Factory: ViewFactory, HeaderView: View, FooterView: Vie
self.factory = factory
self.threads = threads
self.threadDestination = threadDestination
self._selectedThread = selectedThread
_selectedThread = selectedThread
self.onItemTap = onItemTap
self.onItemAppear = onItemAppear
self.headerView = headerView
Expand All @@ -49,7 +49,7 @@ public struct ThreadList<Factory: ViewFactory, HeaderView: View, FooterView: Vie
factory: factory,
threads: threads,
threadDestination: threadDestination,
selectedThread: $selectedThread,
selectedThread: $selectedThread,
onItemTap: onItemTap,
onItemAppear: onItemAppear
)
Expand Down Expand Up @@ -82,7 +82,7 @@ public struct ThreadsLazyVStack<Factory: ViewFactory>: View {
self.threadDestination = threadDestination
self.onItemTap = onItemTap
self.onItemAppear = onItemAppear
self._selectedThread = selectedThread
_selectedThread = selectedThread
}

public var body: some View {
Expand All @@ -93,9 +93,11 @@ public struct ThreadsLazyVStack<Factory: ViewFactory>: 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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public struct ChatThreadListNavigatableItem<ThreadListItem: View, ThreadDestinat
self.thread = thread
self.threadListItem = threadListItem
self.threadDestination = threadDestination
self._selectedThread = selectedThread
_selectedThread = selectedThread
self.handleTabBarVisibility = handleTabBarVisibility
}

Expand Down Expand Up @@ -55,7 +55,7 @@ public struct ThreadSelectionInfo: Identifiable {

public init(thread: ChatThread) {
self.thread = thread
self.id = thread.id
id = thread.id
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@ public struct ChatThreadListContentView<Factory: ViewFactory>: 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)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<MessageId> = [] {
didSet {
newThreadsCount = newAvailableThreadIds.count
hasNewThreads = newThreadsCount > 0
}
}
private var newAvailableThreadIds: Set<MessageId> = [] {
didSet {
newThreadsCount = newAvailableThreadIds.count
hasNewThreads = newThreadsCount > 0
}
}

/// Creates a view model for the `ChatThreadListView`.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ extension View {
}
}


struct FloatingBannerViewModifier<BannerView: View>: ViewModifier {
let alignment: Alignment
var isPresented: Bool
Expand Down
5 changes: 2 additions & 3 deletions Sources/StreamChatSwiftUI/CommonViews/Shimmer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ struct Shimmer: ViewModifier {
)
.animation(
.linear(duration: duration)
.delay(delay)
.repeatForever(autoreverses: false),
.delay(delay)
.repeatForever(autoreverses: false),
value: isInitialState
)
.onAppear {
Expand All @@ -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.
Expand Down
1 change: 1 addition & 0 deletions Sources/StreamChatSwiftUI/DefaultViewFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ extension ViewFactory {
)
}
}

public func makeMessageListModifier() -> some ViewModifier {
EmptyViewModifier()
}
Expand Down
4 changes: 2 additions & 2 deletions StreamChatSwiftUI-XCFramework.podspec
Original file line number Diff line number Diff line change
@@ -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.'

Expand All @@ -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
4 changes: 2 additions & 2 deletions StreamChatSwiftUI.podspec
Original file line number Diff line number Diff line change
@@ -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.'

Expand All @@ -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
2 changes: 1 addition & 1 deletion StreamChatSwiftUI.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class CustomFactory: ViewFactory {

private class MockChatThreadListViewModel: ChatThreadListViewModel {
static func empty() -> MockChatThreadListViewModel {
return MockChatThreadListViewModel(
MockChatThreadListViewModel(
threads: [],
isLoading: false,
isReloading: false,
Expand All @@ -86,7 +86,7 @@ private class MockChatThreadListViewModel: ChatThreadListViewModel {
}

static func loading() -> MockChatThreadListViewModel {
return MockChatThreadListViewModel(
MockChatThreadListViewModel(
threads: [],
isLoading: true,
isReloading: false,
Expand All @@ -101,7 +101,7 @@ private class MockChatThreadListViewModel: ChatThreadListViewModel {
}

static func withThreads() -> MockChatThreadListViewModel {
return MockChatThreadListViewModel(
MockChatThreadListViewModel(
threads: mockThreads,
isLoading: false,
isReloading: false,
Expand All @@ -116,7 +116,7 @@ private class MockChatThreadListViewModel: ChatThreadListViewModel {
}

static func loadingMoreThreads() -> MockChatThreadListViewModel {
return MockChatThreadListViewModel(
MockChatThreadListViewModel(
threads: mockThreads,
isLoading: false,
isReloading: false,
Expand All @@ -131,7 +131,7 @@ private class MockChatThreadListViewModel: ChatThreadListViewModel {
}

static func reloadingThreads() -> MockChatThreadListViewModel {
return MockChatThreadListViewModel(
MockChatThreadListViewModel(
threads: mockThreads,
isLoading: false,
isReloading: true,
Expand All @@ -146,7 +146,7 @@ private class MockChatThreadListViewModel: ChatThreadListViewModel {
}

static func newThreadsAvailable() -> MockChatThreadListViewModel {
return MockChatThreadListViewModel(
MockChatThreadListViewModel(
threads: mockThreads,
isLoading: false,
isReloading: false,
Expand All @@ -161,7 +161,7 @@ private class MockChatThreadListViewModel: ChatThreadListViewModel {
}

static func errorLoadingThreads() -> MockChatThreadListViewModel {
return MockChatThreadListViewModel(
MockChatThreadListViewModel(
threads: [],
isLoading: false,
isReloading: false,
Expand All @@ -176,7 +176,7 @@ private class MockChatThreadListViewModel: ChatThreadListViewModel {
}

static func errorLoadingMoreThreads() -> MockChatThreadListViewModel {
return MockChatThreadListViewModel(
MockChatThreadListViewModel(
threads: mockThreads,
isLoading: false,
isReloading: false,
Expand Down Expand Up @@ -223,7 +223,6 @@ private class MockChatThreadListViewModel: ChatThreadListViewModel {
didChangeThreads changes: [ListChange<ChatThread>]
) {}


static var mockYoda = ChatUser.mock(id: .unique, name: "Yoda")
static var mockVader = ChatUser.mock(id: .unique, name: "Vader")

Expand Down

0 comments on commit 753ef67

Please sign in to comment.