Skip to content

Commit 400eb8f

Browse files
added channel screen, bug fixes
1 parent 36dcb70 commit 400eb8f

File tree

5 files changed

+31
-9
lines changed

5 files changed

+31
-9
lines changed

DemoAppSwiftUI/CustomChannelHeader.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,24 +68,24 @@ struct CustomChannelModifier: ChannelListHeaderViewModifier {
6868
logoutAlertShown: $logoutAlertShown
6969
)
7070
}
71+
72+
NavigationLink(isActive: $isNewChatShown) {
73+
NewChatView(isNewChatShown: $isNewChatShown)
74+
} label: {
75+
EmptyView()
76+
}
77+
.isDetailLink(false)
7178
.alert(isPresented: $logoutAlertShown) {
7279
Alert(
7380
title: Text("Sign out"),
7481
message: Text("Are you sure you want to sign out?"),
7582
primaryButton: .destructive(Text("Sign out")) {
7683
withAnimation {
7784
AppState.shared.userState = .notLoggedIn
78-
}
85+
}
7986
},
8087
secondaryButton: .cancel())
8188
}
82-
83-
NavigationLink(isActive: $isNewChatShown) {
84-
NewChatView(isNewChatShown: $isNewChatShown)
85-
} label: {
86-
EmptyView()
87-
}
88-
.isDetailLink(false)
8989
}
9090

9191
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//
2+
// Copyright © 2021 Stream.io Inc. All rights reserved.
3+
//
4+
5+
import StreamChat
6+
import SwiftUI
7+
8+
/// Screen component for the chat channel view.
9+
struct ChatChannelScreen: View {
10+
var chatChannelController: ChatChannelController
11+
12+
var body: some View {
13+
ChatChannelView(
14+
viewFactory: DefaultViewFactory.shared,
15+
channelController: chatChannelController
16+
)
17+
}
18+
}

Sources/StreamChatSwiftUI/ViewFactory.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ public protocol ViewFactory: AnyObject {
388388
onError: @escaping (Error) -> Void
389389
) -> MessageActionsViewType
390390

391-
associatedtype MessageReactionViewType
391+
associatedtype MessageReactionViewType: View
392392
/// Creates the reactions view shown above the message.
393393
/// - Parameter message: the message for which reactions are shown.
394394
/// - Returns: view shown in the message reactions slot.

StreamChatSwiftUI.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@
133133
8465FDD72746A95800AF091E /* Appearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8465FD692746A95700AF091E /* Appearance.swift */; };
134134
8465FDD82746AA2700AF091E /* StreamChatSwiftUI.h in Headers */ = {isa = PBXBuildFile; fileRef = 8465FD602746A95700AF091E /* StreamChatSwiftUI.h */; settings = {ATTRIBUTES = (Public, ); }; };
135135
8465FDDD2747A14700AF091E /* CustomComposerAttachmentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8465FDDC2747A14700AF091E /* CustomComposerAttachmentView.swift */; };
136+
84AD8425274E2C380098C3C4 /* ChatChannelScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84AD8424274E2C380098C3C4 /* ChatChannelScreen.swift */; };
136137
84B288CD274C544B00DD090B /* CreateGroupView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84B288CC274C544B00DD090B /* CreateGroupView.swift */; };
137138
84B288CF274C545900DD090B /* CreateGroupViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84B288CE274C545900DD090B /* CreateGroupViewModel.swift */; };
138139
84B288D1274CEDD000DD090B /* GroupNameView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84B288D0274CEDD000DD090B /* GroupNameView.swift */; };
@@ -299,6 +300,7 @@
299300
8465FD682746A95700AF091E /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
300301
8465FD692746A95700AF091E /* Appearance.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Appearance.swift; sourceTree = "<group>"; };
301302
8465FDDC2747A14700AF091E /* CustomComposerAttachmentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomComposerAttachmentView.swift; sourceTree = "<group>"; };
303+
84AD8424274E2C380098C3C4 /* ChatChannelScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatChannelScreen.swift; sourceTree = "<group>"; };
302304
84B288CC274C544B00DD090B /* CreateGroupView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateGroupView.swift; sourceTree = "<group>"; };
303305
84B288CE274C545900DD090B /* CreateGroupViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateGroupViewModel.swift; sourceTree = "<group>"; };
304306
84B288D0274CEDD000DD090B /* GroupNameView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GroupNameView.swift; sourceTree = "<group>"; };
@@ -473,6 +475,7 @@
473475
8465FCFC2746A95600AF091E /* ChatChannel */ = {
474476
isa = PBXGroup;
475477
children = (
478+
84AD8424274E2C380098C3C4 /* ChatChannelScreen.swift */,
476479
8465FD2D2746A95600AF091E /* ChatChannelView.swift */,
477480
8465FD302746A95600AF091E /* ChatChannelViewModel.swift */,
478481
8465FD2E2746A95600AF091E /* ChannelHeader */,
@@ -859,6 +862,7 @@
859862
8465FD822746A95700AF091E /* LinkTextView.swift in Sources */,
860863
8465FD6D2746A95700AF091E /* ViewModelsFactory.swift in Sources */,
861864
8465FDBA2746A95700AF091E /* BundleExtensions.swift in Sources */,
865+
84AD8425274E2C380098C3C4 /* ChatChannelScreen.swift in Sources */,
862866
8465FD812746A95700AF091E /* SystemMessageView.swift in Sources */,
863867
8465FD7D2746A95700AF091E /* MessageBubble.swift in Sources */,
864868
8465FDC62746A95700AF091E /* ChannelHeaderLoader.swift in Sources */,

0 commit comments

Comments
 (0)