Skip to content

Commit 7ed74b0

Browse files
committed
Revert "[Fix]Mistakenly prompting for permissions (#988)"
This reverts commit 9c85357.
1 parent 0099e2c commit 7ed74b0

File tree

5 files changed

+8
-73
lines changed

5 files changed

+8
-73
lines changed

CHANGELOG.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
44

55
# Upcoming
66

7-
### 🐞 Fixed
8-
- Fix permission prompts appearing when not needed. [#988](https://github.com/GetStream/stream-video-swift/pull/988)
9-
107
### ✅ Added
118
- SwiftUI modifiers that surface moderation blur and warning events in `CallView`. [#987](https://github.com/GetStream/stream-video-swift/pull/987)
129

Sources/StreamVideo/WebRTC/PeerConnectionFactory.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ final class PeerConnectionFactory: @unchecked Sendable {
2020
)
2121
let decoderFactory = RTCDefaultVideoDecoderFactory()
2222
return RTCPeerConnectionFactory(
23-
audioDeviceModuleType: .audioEngine,
23+
audioDeviceModuleType: .platformDefault,
2424
bypassVoiceProcessing: false,
2525
encoderFactory: encoderFactory,
2626
decoderFactory: decoderFactory,

Sources/StreamVideo/WebRTC/v2/WebRTCPermissionsAdapter.swift

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ final class WebRTCPermissionsAdapter: @unchecked Sendable {
5252
private weak var delegate: WebRTCPermissionsAdapterDelegate?
5353
private var requiredPermissions: Set<RequiredPermission> = []
5454
private var lastCallSettings: CallSettings?
55-
private var ownCapabilities: Set<OwnCapability> = []
5655

5756
/// Creates an adapter and begins observing app/permission changes.
5857
///
@@ -156,12 +155,6 @@ final class WebRTCPermissionsAdapter: @unchecked Sendable {
156155
}
157156
}
158157

159-
func willSet(ownCapabilities: Set<OwnCapability>) {
160-
processingQueue.addOperation { [weak self] in
161-
self?.ownCapabilities = ownCapabilities
162-
}
163-
}
164-
165158
func cleanUp() {
166159
processingQueue.addOperation { [weak self] in
167160
// By emptying the Set we are saying that there are no permissions
@@ -244,11 +237,9 @@ final class WebRTCPermissionsAdapter: @unchecked Sendable {
244237

245238
switch permission {
246239
case .microphone:
247-
return !permissions.hasMicrophonePermission && permissions.canRequestMicrophonePermission && ownCapabilities
248-
.contains(.sendAudio)
240+
return !permissions.hasMicrophonePermission && permissions.canRequestMicrophonePermission
249241
case .camera:
250-
return !permissions.hasCameraPermission && permissions.canRequestCameraPermission && ownCapabilities
251-
.contains(.sendVideo)
242+
return !permissions.hasCameraPermission && permissions.canRequestCameraPermission
252243
}
253244
}
254245
}

Sources/StreamVideo/WebRTC/v2/WebRTCStateAdapter.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,7 @@ actor WebRTCStateAdapter: ObservableObject, StreamAudioSessionAdapterDelegate, W
165165
func set(connectOptions value: ConnectOptions) { self.connectOptions = value }
166166

167167
/// Sets the own capabilities of the current user.
168-
func set(ownCapabilities value: Set<OwnCapability>) {
169-
self.ownCapabilities = value
170-
permissionsAdapter.willSet(ownCapabilities: value)
171-
}
168+
func set(ownCapabilities value: Set<OwnCapability>) { self.ownCapabilities = value }
172169

173170
/// Sets the WebRTC stats reporter.
174171
func set(statsAdapter value: WebRTCStatsAdapting?) {

StreamVideoTests/WebRTC/v2/WebRTCPermissionsAdapter_Tests.swift

Lines changed: 4 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ final class WebRTCPermissionsAdapter_Tests: StreamVideoTestCase, @unchecked Send
2222
super.tearDown()
2323
}
2424

25-
func test_willSet_audioOnTrue_withoutSendAudio_withDeniedMic_downgradesAudioOff() async {
25+
func test_willSet_audioOnTrue_withDeniedMic_downgradesAudioOff() async {
2626
mockAppStateAdapter.makeShared()
2727
mockPermissions.stubMicrophonePermission(.denied)
2828
await fulfillment { self.mockPermissions.mockStore.state.microphonePermission == .denied }
@@ -34,33 +34,7 @@ final class WebRTCPermissionsAdapter_Tests: StreamVideoTestCase, @unchecked Send
3434
XCTAssertEqual(output.videoOn, false)
3535
}
3636

37-
func test_willSet_audioOnTrue_withSendAudio_withDeniedMic_downgradesAudioOff() async {
38-
mockAppStateAdapter.makeShared()
39-
mockPermissions.stubMicrophonePermission(.denied)
40-
await fulfillment { self.mockPermissions.mockStore.state.microphonePermission == .denied }
41-
42-
let input = CallSettings(audioOn: true, videoOn: false)
43-
subject.willSet(ownCapabilities: [.sendAudio])
44-
let output = await subject.willSet(callSettings: input)
45-
46-
XCTAssertEqual(output.audioOn, false)
47-
XCTAssertEqual(output.videoOn, false)
48-
}
49-
50-
func test_willSet_videoOnTrue_withSendVideo_withDeniedCamera_downgradesVideoOff() async {
51-
mockAppStateAdapter.makeShared()
52-
mockPermissions.stubCameraPermission(.denied)
53-
await fulfillment { self.mockPermissions.mockStore.state.cameraPermission == .denied }
54-
55-
let input = CallSettings(audioOn: false, videoOn: true)
56-
subject.willSet(ownCapabilities: [.sendVideo])
57-
let output = await subject.willSet(callSettings: input)
58-
59-
XCTAssertEqual(output.audioOn, false)
60-
XCTAssertEqual(output.videoOn, false)
61-
}
62-
63-
func test_willSet_videoOnTrue_withoutSendVideo_withDeniedCamera_downgradesVideoOff() async {
37+
func test_willSet_videoOnTrue_withDeniedCamera_downgradesVideoOff() async {
6438
mockAppStateAdapter.makeShared()
6539
mockPermissions.stubCameraPermission(.denied)
6640
await fulfillment { self.mockPermissions.mockStore.state.cameraPermission == .denied }
@@ -72,22 +46,10 @@ final class WebRTCPermissionsAdapter_Tests: StreamVideoTestCase, @unchecked Send
7246
XCTAssertEqual(output.videoOn, false)
7347
}
7448

75-
func test_willSet_audioOnTrue_unknownMic_inForeground_withoutSendAudio_requestsPermission_andKeepsAudioOnWhenGranted() async {
76-
mockAppStateAdapter.makeShared()
77-
mockAppStateAdapter.stubbedState = .foreground
78-
mockPermissions.stubMicrophonePermission(.unknown)
79-
await fulfillment { self.mockPermissions.mockStore.state.microphonePermission == .unknown }
80-
81-
let input = CallSettings(audioOn: true, videoOn: false)
82-
let output = await self.subject.willSet(callSettings: input)
83-
XCTAssertEqual(output.audioOn, false)
84-
}
85-
86-
func test_willSet_audioOnTrue_unknownMic_inForeground_withSendAudio_requestsPermission_andKeepsAudioOnWhenGranted() async {
49+
func test_willSet_audioOnTrue_unknownMic_inForeground_requestsPermission_andKeepsAudioOnWhenGranted() async {
8750
mockAppStateAdapter.makeShared()
8851
mockAppStateAdapter.stubbedState = .foreground
8952
mockPermissions.stubMicrophonePermission(.unknown)
90-
subject.willSet(ownCapabilities: [.sendAudio])
9153
await fulfillment { self.mockPermissions.mockStore.state.microphonePermission == .unknown }
9254

9355
await withTaskGroup(of: Void.self) { group in
@@ -109,22 +71,10 @@ final class WebRTCPermissionsAdapter_Tests: StreamVideoTestCase, @unchecked Send
10971
}
11072
}
11173

112-
func test_willSet_videoOnTrue_unknownCamera_inForeground_withoutSendVideo_requestsPermission_andKeepsVideoOnWhenGranted() async {
113-
mockAppStateAdapter.makeShared()
114-
mockAppStateAdapter.stubbedState = .foreground
115-
mockPermissions.stubCameraPermission(.unknown)
116-
await fulfillment { self.mockPermissions.mockStore.state.cameraPermission == .unknown }
117-
118-
let input = CallSettings(audioOn: false, videoOn: true)
119-
let output = await self.subject.willSet(callSettings: input)
120-
XCTAssertEqual(output.videoOn, false)
121-
}
122-
123-
func test_willSet_videoOnTrue_unknownCamera_inForeground_withSendVideo_requestsPermission_andKeepsVideoOnWhenGranted() async {
74+
func test_willSet_videoOnTrue_unknownCamera_inForeground_requestsPermission_andKeepsVideoOnWhenGranted() async {
12475
mockAppStateAdapter.makeShared()
12576
mockAppStateAdapter.stubbedState = .foreground
12677
mockPermissions.stubCameraPermission(.unknown)
127-
subject.willSet(ownCapabilities: [.sendVideo])
12878
await fulfillment { self.mockPermissions.mockStore.state.cameraPermission == .unknown }
12979

13080
await withTaskGroup(of: Void.self) { group in

0 commit comments

Comments
 (0)