Skip to content

Commit d50d7c9

Browse files
committed
Use StreamCore based chat
1 parent 1e36bde commit d50d7c9

27 files changed

+70
-236
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ let package = Package(
1616
)
1717
],
1818
dependencies: [
19-
.package(url: "https://github.com/GetStream/stream-chat-swift.git", from: "4.91.0")
19+
.package(url: "https://github.com/GetStream/stream-chat-swift.git", branch: "v5-stream-core-web-socket-client")
2020
],
2121
targets: [
2222
.target(

Sources/StreamChatSwiftUI/ChatChannel/ChatChannelView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public struct ChatChannelView<Factory: ViewFactory>: View, KeyboardReadable {
8383
)
8484
} else {
8585
ZStack {
86-
factory.makeEmptyMessagesView(for: channel, colors: colors)
86+
factory.makeEmptyMessagesView(options: EmptyMessagesViewOptions(channel: channel, colors: colors))
8787
.dismissKeyboardOnTap(enabled: keyboardShown) {
8888
hideComposerCommandsAndAttachmentsPicker()
8989
}

Sources/StreamChatSwiftUI/ChatChannel/Composer/MessageComposerView.swift

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -410,13 +410,15 @@ public struct ComposerInputView<Factory: ViewFactory>: View, KeyboardReadable {
410410
}
411411

412412
factory.makeComposerTextInputView(
413-
text: $text,
414-
height: $textHeight,
415-
selectedRangeLocation: $selectedRangeLocation,
416-
placeholder: isInCooldown ? L10n.Composer.Placeholder.slowMode : (isChannelFrozen ? L10n.Composer.Placeholder.messageDisabled : L10n.Composer.Placeholder.message),
417-
editable: !isInputDisabled,
418-
maxMessageLength: maxMessageLength,
419-
currentHeight: textFieldHeight
413+
options: ComposerTextInputViewOptions(
414+
text: $text,
415+
height: $textHeight,
416+
selectedRangeLocation: $selectedRangeLocation,
417+
placeholder: isInCooldown ? L10n.Composer.Placeholder.slowMode : (isChannelFrozen ? L10n.Composer.Placeholder.messageDisabled : L10n.Composer.Placeholder.message),
418+
editable: !isInputDisabled,
419+
maxMessageLength: maxMessageLength,
420+
currentHeight: textFieldHeight
421+
)
420422
)
421423
.environmentObject(viewModel)
422424
.accessibilityIdentifier("ComposerTextInputView")

Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ public struct MessageListView<Factory: ViewFactory>: View, KeyboardReadable {
321321
)
322322
) : nil
323323
)
324-
.modifier(factory.makeMessageListContainerModifier())
324+
.modifier(factory.makeMessageListContainerModifier(options: MessageListContainerModifierOptions()))
325325
.onDisappear {
326326
messageRenderingUtil.update(previousTopMessage: nil)
327327
}

Sources/StreamChatSwiftUI/ChatChannel/MessageList/Polls/PollCommentsViewModel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ import SwiftUI
4545
$comments
4646
.dropFirst()
4747
.map { _ in true }
48-
.assignWeakly(to: \.animateChanges, on: self)
48+
.assign(to: \.animateChanges, onWeak: self)
4949
.store(in: &cancellables)
5050
}
5151

Sources/StreamChatSwiftUI/ChatChannel/MessageList/Polls/PollOptionAllVotesViewModel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import SwiftUI
3333
$pollVotes
3434
.dropFirst()
3535
.map { _ in true }
36-
.assignWeakly(to: \.animateChanges, on: self)
36+
.assign(to: \.animateChanges, onWeak: self)
3737
.store(in: &cancellables)
3838
}
3939

Sources/StreamChatSwiftUI/ChatChannel/Polls/CreatePollViewModel.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ import SwiftUI
8181
.combineLatest($maxVotesEnabled)
8282
.map { $0 && $1 }
8383
.removeDuplicates()
84-
.assignWeakly(to: \.showsMaxVotesError, on: self)
84+
.assign(to: \.showsMaxVotesError, onWeak: self)
8585
.store(in: &cancellables)
8686
$options
8787
.map { options in
@@ -97,7 +97,7 @@ import SwiftUI
9797
return errorIndices
9898
}
9999
.removeDuplicates()
100-
.assignWeakly(to: \.optionsErrorIndices, on: self)
100+
.assign(to: \.optionsErrorIndices, onWeak: self)
101101
.store(in: &cancellables)
102102
}
103103

Sources/StreamChatSwiftUI/DependencyInjection.swift

Lines changed: 0 additions & 45 deletions
This file was deleted.

Sources/StreamChatSwiftUI/InjectedValuesExtensions.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import StreamChat
77

88
extension InjectedValues {
99
/// Provides access to the `ChatClient` instance.
10-
public var chatClient: ChatClient {
10+
@MainActor public var chatClient: ChatClient {
1111
get {
1212
streamChat.chatClient
1313
}
@@ -17,7 +17,7 @@ extension InjectedValues {
1717
}
1818

1919
/// Provides access to the `ColorPalette` instance.
20-
public var colors: ColorPalette {
20+
@MainActor public var colors: ColorPalette {
2121
get {
2222
streamChat.appearance.colors
2323
}
@@ -27,7 +27,7 @@ extension InjectedValues {
2727
}
2828

2929
/// Provides access to the `Utils` instance.
30-
public var utils: Utils {
30+
@MainActor public var utils: Utils {
3131
get {
3232
streamChat.utils
3333
}
@@ -37,7 +37,7 @@ extension InjectedValues {
3737
}
3838

3939
/// Provides access to the `Images` instance.
40-
public var images: Images {
40+
@MainActor public var images: Images {
4141
get {
4242
streamChat.appearance.images
4343
}
@@ -47,7 +47,7 @@ extension InjectedValues {
4747
}
4848

4949
/// Provides access to the `Fonts` instance.
50-
public var fonts: Fonts {
50+
@MainActor public var fonts: Fonts {
5151
get {
5252
streamChat.appearance.fonts
5353
}

Sources/StreamChatSwiftUI/StreamChat.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import StreamChat
2626

2727
/// Returns the current value for the `StreamChat` instance.
2828
private struct StreamChatProviderKey: InjectionKey {
29-
static var currentValue: StreamChat?
29+
nonisolated(unsafe) static var currentValue: StreamChat?
3030
}
3131

3232
extension InjectedValues {

0 commit comments

Comments
 (0)