-
Notifications
You must be signed in to change notification settings - Fork 29
[Enhancement]Recording permission prompt #915
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
[Enhancement]Recording permission prompt #915
Conversation
Generated by 🚫 Danger |
Public Interface+ extension PermissionStore: InjectionKey
+
+ nonisolated public static var currentValue: PermissionStore
+ public final class PermissionStore: ObservableObject, @unchecked Sendable
+
+ @Published public private var hasMicrophonePermission: Bool
+ @Published public private var hasCameraPermission: Bool
+
+
+ public func requestMicrophonePermission()async throws -> Bool
+ public func requestCameraPermission()async throws -> Bool
+ public func requestPushNotificationPermission(with options: UNAuthorizationOptions)async throws -> Bool
+ public protocol URLNavigating
+ public enum Permission: Equatable, Sendable, CustomStringConvertible
+
+ case unknown
+ case requesting
+ case denied
+ case granted
+
+
+ public var description: String
+ public enum StoreAction: Sendable, Equatable
+
+ case setMicrophonePermission(Permission)
+ case requestMicrophonePermission
+ case setCameraPermission(Permission)
+ case requestCameraPermission
+ case setPushNotificationPermission(Permission)
+ case requestPushNotificationPermission(UNAuthorizationOptions)
+ public struct StoreState: Equatable, CustomStringConvertible
+
+ public var microphonePermission: Permission
+ public var cameraPermission: Permission
+ public var pushNotificationPermission: Permission
+ public var description: String
+ public struct ToggleControlStyle
+
+ public var enabled: ControlStyle
+ public var disabled: ControlStyle
+
+
+ public init(enabled: ControlStyle,disabled: ControlStyle)
+ public struct PermissionsPromptView: View
+
+ public var body: some View
+
+
+ public init(call: Call?)
+ public struct ControlStyle
+
+ public var icon: Image
+ public var iconStyle: CallIconStyle
+
+
+ public init(icon: Image,iconStyle: CallIconStyle)
extension ViewFactory
+ public func makePermissionsPromptView(call: Call?)-> some View
public struct StatelessMicrophoneIconView: View
- public var body: some View
+ public var controlStyle: ToggleControlStyle
-
+ public var body: some View
-
+
- @MainActor public init(call: Call?,size: CGFloat = 44,actionHandler: ActionHandler? = nil)
+
+ @MainActor public init(call: Call?,callSettings: CallSettings = .init(),size: CGFloat = 44,controlStyle: ToggleControlStyle = .init(
+ enabled: .init(icon: Appearance.default.images.micTurnOn, iconStyle: .transparent),
+ disabled: .init(icon: Appearance.default.images.micTurnOff, iconStyle: .disabled)
+ ),actionHandler: ActionHandler? = nil)
extension InjectedValues
- public var pictureInPictureAdapter: StreamPictureInPictureAdapter
+ public var urlNavigator: URLNavigating
public struct StatelessVideoIconView: View
- public var body: some View
+ public var controlStyle: ToggleControlStyle
-
+ public var body: some View
-
+
- public init(call: Call?,size: CGFloat = 44,actionHandler: ActionHandler? = nil)
+
+ public init(call: Call?,callSettings: CallSettings = .init(),size: CGFloat = 44,controlStyle: ToggleControlStyle = .init(
+ enabled: .init(icon: Appearance.default.images.videoTurnOn, iconStyle: .transparent),
+ disabled: .init(icon: Appearance.default.images.videoTurnOff, iconStyle: .disabled)
+ ),actionHandler: ActionHandler? = nil)
public struct CallTopView: View
- public init(viewModel: CallViewModel)
+ public init(viewFactory: Factory = DefaultViewFactory.shared,viewModel: CallViewModel)
public struct ControlBadgeView: View
- public var body: some View
+ case text(String, foreground: Color, background: Color)
-
+ case image(Image, foreground: Color, background: Color)
-
+
- public init(_ value: String)
+
+ public var body: some View
+
+
+ public init(_ value: String,foreground: Color = InjectedValues[\.colors].textInverted,background: Color = InjectedValues[\.colors].onlineIndicatorColor)
+ public init(_ image: Image,foreground: Color = InjectedValues[\.colors].textInverted,background: Color = InjectedValues[\.colors].onlineIndicatorColor) |
SDK Size
|
b08dc1a
to
c7ed68c
Compare
@@ -380,15 +381,23 @@ public struct VideoCallParticipantView<Factory: ViewFactory>: View { | |||
} | |||
|
|||
private var showVideo: Bool { | |||
participant.shouldDisplayTrack || customData["videoOn"]?.boolValue == true | |||
if isLocalParticipant { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually improving the logic on showing the placeholder (user avatar) when video is off for localparticipant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did we merge the customData change? Wasn't this handled there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c7ed68c
to
ea3a174
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Left few small comments, most important is to check if we consider the case where we don't need camera permission (maybe we do, but might've missed it).
...s/StreamVideo/Utils/PermissionsStore/Namespace/Components/MicrophonePermissionProvider.swift
Show resolved
Hide resolved
...s/StreamVideo/Utils/PermissionsStore/Namespace/Components/MicrophonePermissionProvider.swift
Outdated
Show resolved
Hide resolved
Sources/StreamVideoSwiftUI/CallView/PermissionsPromptView.swift
Outdated
Show resolved
Hide resolved
@@ -380,15 +381,23 @@ public struct VideoCallParticipantView<Factory: ViewFactory>: View { | |||
} | |||
|
|||
private var showVideo: Bool { | |||
participant.shouldDisplayTrack || customData["videoOn"]?.boolValue == true | |||
if isLocalParticipant { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did we merge the customData change? Wasn't this handled there?
97af53f
to
ca9c696
Compare
Improvements Improve participant placeholder
3b89b1c
to
1a44cba
Compare
|
🔗 Issue Links
Resolves https://linear.app/stream/issue/IOS-1080/recording-permission-prompt
Docs link
🎯 Goal
Prompt user when they haven't accepted the microphone access permission.
🛠 Implementation
This revision centralise permission read across the SDK. The new PermissionStore component is exposed via InjectedValues[.permissions] and offers access and reactivity around microphone, camera and push notifications permissions.
🎨 Showcase
img
🧪 Manual Testing Notes
☑️ Contributor Checklist