Skip to content

Commit 20507e8

Browse files
authored
Merge branch 'develop' into add/polls-improvements
2 parents c38c7b8 + 89a3b4e commit 20507e8

File tree

7 files changed

+48
-25
lines changed

7 files changed

+48
-25
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66
### 🔄 Changed
77
- Improves Poll voting UX by making it possible to tap on the whole option as well [#612](https://github.com/GetStream/stream-chat-swiftui/pull/612)
88
### 🐞 Fixed
9+
- Rare crash when accessing frame of the view [#607](https://github.com/GetStream/stream-chat-swiftui/pull/607)
10+
- `ChatChannelListView` navigation did not trigger when using a custom container and its body reloaded [#609](https://github.com/GetStream/stream-chat-swiftui/pull/609)
11+
- Channel was sometimes not marked as read when tapping the x on the unread message pill in the message list [#610](https://github.com/GetStream/stream-chat-swiftui/pull/610)
912
- Fix the poll vote progress view not having full width when the Poll is closed [#612](https://github.com/GetStream/stream-chat-swiftui/pull/612)
1013
- Fix the last vote author not accurate in the channel preview [#612](https://github.com/GetStream/stream-chat-swiftui/pull/612)
1114

Gemfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ GEM
199199
fastlane
200200
pry
201201
fastlane-plugin-sonarcloud_metric_kit (0.2.1)
202-
fastlane-plugin-stream_actions (0.3.63)
202+
fastlane-plugin-stream_actions (0.3.70)
203203
xctest_list (= 1.2.1)
204204
fastlane-plugin-versioning (0.5.2)
205205
ffi (1.17.0)
@@ -306,7 +306,7 @@ GEM
306306
coderay (~> 1.1)
307307
method_source (~> 1.0)
308308
public_suffix (4.0.7)
309-
puma (6.4.2)
309+
puma (6.4.3)
310310
nio4r (~> 2.0)
311311
racc (1.8.1)
312312
rack (3.1.7)
@@ -427,7 +427,7 @@ DEPENDENCIES
427427
fastlane-plugin-create_xcframework
428428
fastlane-plugin-lizard
429429
fastlane-plugin-sonarcloud_metric_kit
430-
fastlane-plugin-stream_actions (= 0.3.63)
430+
fastlane-plugin-stream_actions (= 0.3.70)
431431
fastlane-plugin-versioning
432432
jazzy
433433
json

Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageContainerView.swift

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,7 @@ public struct MessageContainerView<Factory: ViewFactory>: View {
112112
GeometryReader { proxy in
113113
Rectangle().fill(Color.clear)
114114
.onChange(of: computeFrame, perform: { _ in
115-
DispatchQueue.main.async {
116-
frame = proxy.frame(in: .global)
117-
}
115+
frame = proxy.frame(in: .global)
118116
})
119117
}
120118
)
@@ -347,9 +345,8 @@ public struct MessageContainerView<Factory: ViewFactory>: View {
347345
showsMessageActions: Bool,
348346
showsBottomContainer: Bool = true
349347
) {
350-
computeFrame = true
348+
computeFrame.toggle()
351349
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
352-
computeFrame = false
353350
triggerHapticFeedback(style: .medium)
354351
onLongPress(
355352
MessageDisplayInfo(

Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ public struct MessageListView<Factory: ViewFactory>: View, KeyboardReadable {
301301
_ = onJumpToMessage?(firstUnreadMessageId ?? .unknownMessageId)
302302
},
303303
onClose: {
304-
firstUnreadMessageId = nil
304+
chatClient.channelController(for: channel.cid).markRead()
305305
unreadButtonDismissed = true
306306
}
307307
) : nil

Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelListView.swift

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,29 @@ public struct ChatChannelListView<Factory: ViewFactory>: View {
1616

1717
private let viewFactory: Factory
1818
private let title: String
19-
private var onItemTap: (ChatChannel) -> Void
19+
private let customOnItemTap: ((ChatChannel) -> Void)?
2020
private var embedInNavigationView: Bool
2121
private var handleTabBarVisibility: Bool
22-
22+
23+
/// Creates a channel list view.
24+
///
25+
/// - Parameters:
26+
/// - viewFactory: The view factory used for creating views used by the channel list.
27+
/// - viewModel: The view model instance providing the data. Default view model is created if nil.
28+
/// - channelListController: The channel list controller managing the list of channels used as a data souce for the view model. Default controller is created if nil.
29+
/// - title: A title used as the navigation bar title.
30+
/// - onItemTap: A closure for handling a tap on the channel item. Default closure updates the ``ChatChannelListViewModel/selectedChannel`` property in the view model.
31+
/// - selectedChannelId: The id of a channel to be opened after the initial channel list load.
32+
/// - handleTabBarVisibility: True, if TabBar visibility should be automatically updated.
33+
/// - embedInNavigationView: True, if the channel list view should be embedded in a navigation stack.
34+
///
35+
/// Changing the instance of the passed in `viewModel` or `channelListController` does not have an effect without reloading the channel list view by assigning a custom identity. The custom identity should be refreshed when either of the passed in instances have been recreated.
36+
/// ```swift
37+
/// ChatChannelListView(
38+
/// viewModel: viewModel
39+
/// )
40+
/// .id(myCustomViewIdentity)
41+
/// ```
2342
public init(
2443
viewFactory: Factory = DefaultViewFactory.shared,
2544
viewModel: ChatChannelListViewModel? = nil,
@@ -30,23 +49,25 @@ public struct ChatChannelListView<Factory: ViewFactory>: View {
3049
handleTabBarVisibility: Bool = true,
3150
embedInNavigationView: Bool = true
3251
) {
33-
let channelListVM = viewModel ?? ViewModelsFactory.makeChannelListViewModel(
34-
channelListController: channelListController,
35-
selectedChannelId: selectedChannelId
36-
)
3752
_viewModel = StateObject(
38-
wrappedValue: channelListVM
53+
wrappedValue: viewModel ?? ViewModelsFactory.makeChannelListViewModel(
54+
channelListController: channelListController,
55+
selectedChannelId: selectedChannelId
56+
)
3957
)
4058
self.viewFactory = viewFactory
4159
self.title = title
4260
self.handleTabBarVisibility = handleTabBarVisibility
4361
self.embedInNavigationView = embedInNavigationView
44-
if let onItemTap = onItemTap {
45-
self.onItemTap = onItemTap
46-
} else {
47-
self.onItemTap = { channel in
48-
channelListVM.selectedChannel = channel.channelSelectionInfo
49-
}
62+
customOnItemTap = onItemTap
63+
}
64+
65+
var onItemTap: (ChatChannel) -> Void {
66+
if let customOnItemTap {
67+
return customOnItemTap
68+
}
69+
return { [weak viewModel] channel in
70+
viewModel?.selectedChannel = channel.channelSelectionInfo
5071
}
5172
}
5273

fastlane/Fastfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,10 @@ lane :test_ui do |options|
190190
next if png_files.empty?
191191

192192
# Discard all files apart from the snapshots
193-
png_files.each { |png| sh("git add #{png}") || true }
194-
sh('git restore .')
193+
Dir.chdir('..') do
194+
png_files.each { |png| sh("git add #{png}") || true }
195+
sh('git restore .')
196+
end
195197

196198
pr_create(
197199
title: '[CI] Snapshots',

fastlane/Pluginfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
gem 'fastlane-plugin-versioning'
66
gem 'fastlane-plugin-sonarcloud_metric_kit'
77
gem 'fastlane-plugin-create_xcframework'
8-
gem 'fastlane-plugin-stream_actions', '0.3.63'
8+
gem 'fastlane-plugin-stream_actions', '0.3.70'

0 commit comments

Comments
 (0)