-
Notifications
You must be signed in to change notification settings - Fork 28
Fix ChatView disappearing when call events happening #181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// | ||
// Copyright © 2023 Stream.io Inc. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import SwiftUI | ||
import StreamVideoSwiftUI | ||
|
||
struct ChatModifier: ViewModifier { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like this idea of having chat modifier. Maybe we could introduce chat extensions for video as reusable components in the future 👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds a good idea and will make integration much easier for customers. I think we should have that in our roadmap |
||
|
||
@ObservedObject var viewModel: CallViewModel | ||
@ObservedObject var chatViewModel: DemoChatViewModel | ||
|
||
func body(content: Content) -> some View { | ||
content | ||
.halfSheetIfAvailable( | ||
isPresented: $chatViewModel.isChatVisible, | ||
onDismiss: {} | ||
) { | ||
if let channelController = chatViewModel.channelController { | ||
VStack { | ||
ChatControlsHeader(viewModel: viewModel) | ||
ChatView( | ||
channelController: channelController, | ||
chatViewModel: chatViewModel, | ||
callViewModel: viewModel | ||
) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
extension View { | ||
|
||
@ViewBuilder | ||
func chat(viewModel: CallViewModel, chatViewModel: DemoChatViewModel?) -> some View { | ||
if let chatViewModel { | ||
self.modifier(ChatModifier(viewModel: viewModel, chatViewModel: chatViewModel)) | ||
} else { | ||
self | ||
} | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.