Skip to content

Commit e947caa

Browse files
authored
[Fix]Control camera switch button with capabilities (#666)
1 parent e1cd6d3 commit e947caa

File tree

8 files changed

+14
-2
lines changed

8 files changed

+14
-2
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
99
- The `OutgoingCallView` provided by the default `ViewFactory` implementation won't show the current user in the ringing member bubbles [#660](https://github.com/GetStream/stream-video-swift/pull/660)
1010

1111
### 🔄 Changed
12-
- The provided `CallControls` component will now respect user's capabilities in order to show/hide the video/audio buttons. [#661](https://github.com/GetStream/stream-video-swift/pull/661)
12+
- The provided `CallControls` and `CallTopView` component will now respect user's capabilities in order to show/hide the video, audio and toggleCamerat buttons. [#661](https://github.com/GetStream/stream-video-swift/pull/661) [#666](https://github.com/GetStream/stream-video-swift/pull/666)
1313

1414
# [1.16.0](https://github.com/GetStream/stream-video-swift/releases/tag/1.16.0)
1515
_January 31, 2025_

Sources/StreamVideoSwiftUI/CallView/CallTopView.swift

+13-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import SwiftUI
77

88
public struct CallTopView: View {
99

10+
@Injected(\.streamVideo) var streamVideo
1011
@Injected(\.colors) var colors
1112
@Injected(\.images) var images
1213

@@ -30,7 +31,9 @@ public struct CallTopView: View {
3031
.accessibility(identifier: "viewMenu")
3132
}
3233

33-
ToggleCameraIconView(viewModel: viewModel)
34+
if call?.state.ownCapabilities.contains(.sendVideo) == true {
35+
ToggleCameraIconView(viewModel: viewModel)
36+
}
3437

3538
Spacer()
3639
}
@@ -67,6 +70,15 @@ public struct CallTopView: View {
6770
viewModel.call?.state.screenSharingSession != nil
6871
&& viewModel.call?.state.isCurrentUserScreensharing == false
6972
}
73+
74+
private var call: Call? {
75+
switch viewModel.callingState {
76+
case .incoming, .outgoing:
77+
return streamVideo.state.ringingCall
78+
default:
79+
return viewModel.call
80+
}
81+
}
7082
}
7183

7284
public struct SharingIndicator: View {

0 commit comments

Comments
 (0)