-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix ChatView disappearing when call events happening (#181)
- Loading branch information
1 parent
889e0c0
commit 7f1ae48
Showing
6 changed files
with
61 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { | ||
|
||
@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 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters