Skip to content

Commit ccf540a

Browse files
Fixed a bug with channel list refreshing after deeplinking
1 parent 80f622b commit ccf540a

File tree

5 files changed

+13
-59
lines changed

5 files changed

+13
-59
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
33

44
# Upcoming
55

6-
### 🔄 Changed
6+
### 🐞 Fixed
7+
- Fixed a bug with channel list refreshing after deeplinking
78

89
# [4.19.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.19.0)
910
_July 21, 2022_

Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelDeepLink.swift

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

Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelListView.swift

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,11 @@ public struct ChatChannelListView<Factory: ViewFactory>: View {
5151
} else if viewModel.channels.isEmpty {
5252
viewFactory.makeNoChannelsView()
5353
} else {
54-
ZStack {
55-
ChannelDeepLink(
56-
deeplinkChannel: $viewModel.deeplinkChannel,
57-
channelDestination: viewFactory.makeChannelDestination()
58-
)
59-
60-
ChatChannelListContentView(
61-
viewFactory: viewFactory,
62-
viewModel: viewModel,
63-
onItemTap: onItemTap
64-
)
65-
}
54+
ChatChannelListContentView(
55+
viewFactory: viewFactory,
56+
viewModel: viewModel,
57+
onItemTap: onItemTap
58+
)
6659
}
6760
}
6861
.onDisappear(perform: {

Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelListViewModel.swift

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,6 @@ open class ChatChannelListViewModel: ObservableObject, ChatChannelListController
7777
}
7878
}
7979

80-
@Published public var deeplinkChannel: ChannelSelectionInfo? {
81-
willSet {
82-
hideTabBar = newValue != nil
83-
}
84-
}
85-
8680
@Published public var swipedChannelId: String?
8781
@Published public var channelAlertType: ChannelAlertType? {
8882
didSet {
@@ -254,7 +248,7 @@ open class ChatChannelListViewModel: ObservableObject, ChatChannelListController
254248
// MARK: - private
255249

256250
private func handleChannelListChanges(_ controller: ChatChannelListController) {
257-
if selectedChannel != nil || !searchText.isEmpty || deeplinkChannel != nil {
251+
if selectedChannel != nil || !searchText.isEmpty {
258252
queuedChannelsChanges = controller.channels
259253
updateChannelsIfNeeded()
260254
} else {
@@ -269,7 +263,7 @@ open class ChatChannelListViewModel: ObservableObject, ChatChannelListController
269263
for: channelId,
270264
messageOrdering: .topToBottom
271265
)
272-
deeplinkChannel = chatController.channel?.channelSelectionInfo
266+
selectedChannel = chatController.channel?.channelSelectionInfo
273267
self.selectedChannelId = nil
274268
}
275269
}
@@ -369,17 +363,17 @@ open class ChatChannelListViewModel: ObservableObject, ChatChannelListController
369363
}
370364

371365
private func setInitialChannelIfSplitView() {
372-
if isIPad && deeplinkChannel == nil {
366+
if isIPad && selectedChannel == nil {
373367
selectedChannel = channels.first?.channelSelectionInfo
374368
}
375369
}
376370

377371
private func handleChannelAppearance() {
378-
if !queuedChannelsChanges.isEmpty && selectedChannel == nil && deeplinkChannel == nil {
372+
if !queuedChannelsChanges.isEmpty && selectedChannel == nil {
379373
channels = queuedChannelsChanges
380374
} else if !queuedChannelsChanges.isEmpty {
381375
handleQueuedChanges()
382-
} else if queuedChannelsChanges.isEmpty && (selectedChannel != nil || deeplinkChannel != nil) {
376+
} else if queuedChannelsChanges.isEmpty && selectedChannel != nil {
383377
if selectedChannel?.injectedChannelInfo == nil {
384378
selectedChannel?.injectedChannelInfo = InjectedChannelInfo(unreadCount: 0)
385379
}
@@ -395,7 +389,7 @@ open class ChatChannelListViewModel: ObservableObject, ChatChannelListController
395389
}
396390

397391
private func handleQueuedChanges() {
398-
let selected = selectedChannel != nil ? selectedChannel?.channel : deeplinkChannel?.channel
392+
let selected = selectedChannel?.channel
399393
var index: Int?
400394
var temp = Array(queuedChannelsChanges)
401395
for i in 0..<temp.count {

StreamChatSwiftUI.xcodeproj/project.pbxproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@
168168
8465FDC22746A95700AF091E /* ChatChannelNavigatableListItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8465FD532746A95600AF091E /* ChatChannelNavigatableListItem.swift */; };
169169
8465FDC32746A95700AF091E /* ChatChannelListHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8465FD542746A95700AF091E /* ChatChannelListHeader.swift */; };
170170
8465FDC42746A95700AF091E /* ChatChannelListScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8465FD552746A95700AF091E /* ChatChannelListScreen.swift */; };
171-
8465FDC52746A95700AF091E /* ChatChannelDeepLink.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8465FD562746A95700AF091E /* ChatChannelDeepLink.swift */; };
172171
8465FDC62746A95700AF091E /* ChannelHeaderLoader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8465FD572746A95700AF091E /* ChannelHeaderLoader.swift */; };
173172
8465FDC72746A95700AF091E /* ChatChannelListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8465FD582746A95700AF091E /* ChatChannelListViewModel.swift */; };
174173
8465FDC82746A95700AF091E /* ChatChannelListItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8465FD592746A95700AF091E /* ChatChannelListItem.swift */; };
@@ -558,7 +557,6 @@
558557
8465FD532746A95600AF091E /* ChatChannelNavigatableListItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChatChannelNavigatableListItem.swift; sourceTree = "<group>"; };
559558
8465FD542746A95700AF091E /* ChatChannelListHeader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChatChannelListHeader.swift; sourceTree = "<group>"; };
560559
8465FD552746A95700AF091E /* ChatChannelListScreen.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChatChannelListScreen.swift; sourceTree = "<group>"; };
561-
8465FD562746A95700AF091E /* ChatChannelDeepLink.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChatChannelDeepLink.swift; sourceTree = "<group>"; };
562560
8465FD572746A95700AF091E /* ChannelHeaderLoader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChannelHeaderLoader.swift; sourceTree = "<group>"; };
563561
8465FD582746A95700AF091E /* ChatChannelListViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChatChannelListViewModel.swift; sourceTree = "<group>"; };
564562
8465FD592746A95700AF091E /* ChatChannelListItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChatChannelListItem.swift; sourceTree = "<group>"; };
@@ -1217,7 +1215,6 @@
12171215
8465FD4E2746A95600AF091E /* ChatChannelHelperViews.swift */,
12181216
8465FD502746A95600AF091E /* DefaultChannelActions.swift */,
12191217
8465FD522746A95600AF091E /* NoChannelsView.swift */,
1220-
8465FD562746A95700AF091E /* ChatChannelDeepLink.swift */,
12211218
8465FD572746A95700AF091E /* ChannelHeaderLoader.swift */,
12221219
8465FD4F2746A95600AF091E /* MoreChannelActionsView.swift */,
12231220
8465FD5B2746A95700AF091E /* MoreChannelActionsViewModel.swift */,
@@ -1790,7 +1787,6 @@
17901787
8492975227B156D100A8EEB0 /* SlowModeView.swift in Sources */,
17911788
84AB7B242773528300631A10 /* CommandsContainerView.swift in Sources */,
17921789
8465FDB72746A95700AF091E /* ChatMessageReactionAppeareance.swift in Sources */,
1793-
8465FDC52746A95700AF091E /* ChatChannelDeepLink.swift in Sources */,
17941790
8465FDBF2746A95700AF091E /* DefaultChannelActions.swift in Sources */,
17951791
8465FD772746A95700AF091E /* FileAttachmentPreview.swift in Sources */,
17961792
8465FD862746A95700AF091E /* MessageComposerViewModel.swift in Sources */,

0 commit comments

Comments
 (0)