Skip to content

Commit

Permalink
Fix snapshot tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ipavlidakis committed Nov 20, 2024
1 parent 5a0bc11 commit 2696168
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ struct DemoCallModifier<Factory: ViewFactory>: ViewModifier {
contentView(content)
}

@MainActor
@ViewBuilder
private func contentView(_ rootView: Content) -> some View {
if
Expand All @@ -41,6 +42,7 @@ struct DemoCallModifier<Factory: ViewFactory>: ViewModifier {
type: call.callType,
id: call.callId,
handleParticipationWithLifecycle: false,
showsLeaveCallButton: true,
onFullScreenStateChange: { [weak viewModel] in viewModel?.hideUIElements = $0 }
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public struct LivestreamPlayer: View {
@Injected(\.colors) var colors

var handleParticipationWithLifecycle: Bool
var showsLeaveCallButton: Bool
var onFullScreenStateChange: ((Bool) -> Void)?

@StateObject var state: CallState
Expand All @@ -22,6 +23,7 @@ public struct LivestreamPlayer: View {
muted: Bool = false,
showParticipantCount: Bool = true,
handleParticipationWithLifecycle: Bool = true,
showsLeaveCallButton: Bool = false,
onFullScreenStateChange: ((Bool) -> Void)? = nil
) {
let viewModel = LivestreamPlayerViewModel(
Expand All @@ -33,6 +35,7 @@ public struct LivestreamPlayer: View {
_viewModel = StateObject(wrappedValue: viewModel)
_state = StateObject(wrappedValue: viewModel.call.state)
self.handleParticipationWithLifecycle = handleParticipationWithLifecycle
self.showsLeaveCallButton = showsLeaveCallButton
self.onFullScreenStateChange = onFullScreenStateChange
}

Expand Down Expand Up @@ -90,8 +93,10 @@ public struct LivestreamPlayer: View {
LivestreamButton(imageName: "viewfinder") {
viewModel.update(fullScreen: !viewModel.fullScreen)
}
LivestreamButton(imageName: "phone.down.fill") {
viewModel.leaveLivestream()
if showsLeaveCallButton {
LivestreamButton(imageName: "phone.down.fill") {
viewModel.leaveLivestream()
}
}
}
.padding()
Expand Down

0 comments on commit 2696168

Please sign in to comment.