-
Notifications
You must be signed in to change notification settings - Fork 26
[Enhancement]Implement proximity policies #770
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
base: develop
Are you sure you want to change the base?
[Enhancement]Implement proximity policies #770
Conversation
SDK Size
|
Public Interface+ public final class SpeakerProximityPolicy: ProximityPolicy, Hashable, @unchecked Sendable
+
+ public let identifier: ObjectIdentifier
+
+
+ public init()
+
+
+ public static func ==(lhs: SpeakerProximityPolicy,rhs: SpeakerProximityPolicy)-> Bool
+ public func hash(into hasher: inout Hasher)
+ public func attach(on call: Call)
+ public func detach()
+ public final class VideoProximityPolicy: ProximityPolicy, Hashable, @unchecked Sendable
+
+ public let identifier: ObjectIdentifier
+
+
+ public init()
+
+
+ public static func ==(lhs: VideoProximityPolicy,rhs: VideoProximityPolicy)-> Bool
+ public func hash(into hasher: inout Hasher)
+ public func attach(on call: Call)
+ public func detach()
+ public enum ProximityState: Hashable, Sendable
+
+ case near, far
+ public protocol ProximityPolicy: Sendable, Hashable
public class Call: @unchecked Sendable, WSEventsSubscriber
- public func updateAudioSessionPolicy(_ policy: AudioSessionPolicy)async throws
+ public func updateAudioSessionPolicy(_ policy: AudioSessionPolicy)async throws
+ public func addProximityPolicy(_ policy: any ProximityPolicy)
+ public func removeProximityPolicy(_ policy: any ProximityPolicy)
public final class CurrentDevice: @unchecked Sendable
-
+ @MainActor public var isProximityMonitoringEnabled: Bool
-
+
- public enum DeviceType: Sendable
+
-
+ public enum DeviceType: Sendable
- case unspecified
+
- case phone
+ case unspecified
- case pad
+ case phone
- case tv
+ case pad
- case carPlay
+ case tv
- case mac
+ case carPlay
- case vision
+ case mac
+ case vision |
Generated by 🚫 Danger |
Public Interface+ public final class SpeakerProximityPolicy: ProximityPolicy, Hashable, @unchecked Sendable
+
+ public let identifier: ObjectIdentifier
+
+
+ public init()
+
+
+ public static func ==(lhs: SpeakerProximityPolicy,rhs: SpeakerProximityPolicy)-> Bool
+ public func hash(into hasher: inout Hasher)
+ public func attach(on call: Call)
+ public func detach()
+ public enum ProximityState: Hashable, Sendable
+
+ case near, far
+ public final class VideoProximityPolicy: ProximityPolicy, Hashable, @unchecked Sendable
+
+ public let identifier: ObjectIdentifier
+
+
+ public init()
+
+
+ public static func ==(lhs: VideoProximityPolicy,rhs: VideoProximityPolicy)-> Bool
+ public func hash(into hasher: inout Hasher)
+ public func attach(on call: Call)
+ public func detach()
+ extension ProximityMonitor: InjectionKey
+
+ nonisolated public static var currentValue: ProximityMonitor
+ public final class ProximityMonitor: ObservableObject, @unchecked Sendable
+
+ @MainActor public func startObservation()
+ public func stopObservation()
+ public protocol ProximityPolicy: Sendable, Hashable
public final class CurrentDevice: @unchecked Sendable
-
+ @MainActor public var isProximityMonitoringEnabled: Bool
-
+
- public enum DeviceType: Sendable
+
-
+ public enum DeviceType: Sendable
- case unspecified
+
- case phone
+ case unspecified
- case pad
+ case phone
- case tv
+ case pad
- case carPlay
+ case tv
- case mac
+ case carPlay
- case vision
+ case mac
+ case vision
public class Call: @unchecked Sendable, WSEventsSubscriber
- public func updateAudioSessionPolicy(_ policy: AudioSessionPolicy)async throws
+ public func updateAudioSessionPolicy(_ policy: AudioSessionPolicy)async throws
+ public func addProximityPolicy(_ policy: any ProximityPolicy)
+ public func removeProximityPolicy(_ policy: any ProximityPolicy) |
5c803ab
to
1a8a4d4
Compare
Public Interface+ public final class SpeakerProximityPolicy: ProximityPolicy, @unchecked Sendable
+
+ public static let identifier: ObjectIdentifier
+
+
+ public init()
+
+
+ public func didUpdateProximity(_ proximity: ProximityState,on call: Call)
+ public final class VideoProximityPolicy: ProximityPolicy, @unchecked Sendable
+
+ public static let identifier: ObjectIdentifier
+
+
+ public init()
+
+
+ public func didUpdateProximity(_ proximity: ProximityState,on call: Call)
+ public protocol ProximityPolicy: Sendable, CustomStringConvertible
+ public final class ProximityMonitor: ObservableObject, @unchecked Sendable
+
+ @MainActor public func startObservation()
+ public func stopObservation()
+ extension ProximityPolicy
+
+ public var description: String
+ public enum ProximityState: Hashable, Sendable
+
+ case near, far
+ extension ProximityMonitor: InjectionKey
+
+ nonisolated public static var currentValue: ProximityMonitor
public class Call: @unchecked Sendable, WSEventsSubscriber
- public func updateAudioSessionPolicy(_ policy: AudioSessionPolicy)async throws
+ public func updateAudioSessionPolicy(_ policy: AudioSessionPolicy)async throws
+ public func addProximityPolicy(_ policy: any ProximityPolicy)throws
+ public func removeProximityPolicy(_ policy: any ProximityPolicy)
public final class CurrentDevice: @unchecked Sendable
-
+ @MainActor public var isProximityMonitoringEnabled: Bool
-
+
- public enum DeviceType: Sendable
+
-
+ public enum DeviceType: Sendable
- case unspecified
+
- case phone
+ case unspecified
- case pad
+ case phone
- case tv
+ case pad
- case carPlay
+ case tv
- case mac
+ case carPlay
- case vision
+ case mac
+ case vision |
dafcec1
to
feacae7
Compare
Public Interface+ public enum ProximityState: Hashable, Sendable
+
+ case near
+ case far
+ public protocol ProximityProviding
+ public final class VideoProximityPolicy: ProximityPolicy, @unchecked Sendable
+
+ public static let identifier: ObjectIdentifier
+
+
+ public init()
+
+
+ public func didUpdateProximity(_ proximity: ProximityState,on call: Call)
+ public final class SpeakerProximityPolicy: ProximityPolicy, @unchecked Sendable
+
+ public static let identifier: ObjectIdentifier
+
+
+ public init()
+
+
+ public func didUpdateProximity(_ proximity: ProximityState,on call: Call)
+ public protocol ProximityPolicy: Sendable, CustomStringConvertible
+ extension ProximityPolicy
+
+ public var description: String
public final class CurrentDevice: @unchecked Sendable
-
+ @MainActor public var isProximityMonitoringEnabled: Bool
-
+
- public enum DeviceType: Sendable
+
-
+ public enum DeviceType: Sendable
- case unspecified
+
- case phone
+ case unspecified
- case pad
+ case phone
- case tv
+ case pad
- case carPlay
+ case tv
- case mac
+ case carPlay
- case vision
+ case mac
+ case vision
public class Call: @unchecked Sendable, WSEventsSubscriber
- public func updateAudioSessionPolicy(_ policy: AudioSessionPolicy)async throws
+ public func updateAudioSessionPolicy(_ policy: AudioSessionPolicy)async throws
+ public func addProximityPolicy(_ policy: any ProximityPolicy)throws
+ public func removeProximityPolicy(_ policy: any ProximityPolicy) |
feacae7
to
49130f2
Compare
Public Interface+ public enum ProximityState: Hashable, Sendable
+
+ case near
+ case far
+ extension ProximityPolicy
+
+ public var description: String
+ public protocol ProximityProviding
+ public final class SpeakerProximityPolicy: ProximityPolicy, @unchecked Sendable
+
+ public static let identifier: ObjectIdentifier
+
+
+ public init()
+
+
+ public func didUpdateProximity(_ proximity: ProximityState,on call: Call)
+ public protocol ProximityPolicy: Sendable, CustomStringConvertible
+ public final class VideoProximityPolicy: ProximityPolicy, @unchecked Sendable
+
+ public static let identifier: ObjectIdentifier
+
+
+ public init()
+
+
+ public func didUpdateProximity(_ proximity: ProximityState,on call: Call)
public class Call: @unchecked Sendable, WSEventsSubscriber
- public func updateAudioSessionPolicy(_ policy: AudioSessionPolicy)async throws
+ public func updateAudioSessionPolicy(_ policy: AudioSessionPolicy)async throws
+ public func addProximityPolicy(_ policy: any ProximityPolicy)throws
+ public func removeProximityPolicy(_ policy: any ProximityPolicy)
public final class CurrentDevice: @unchecked Sendable
-
+ @MainActor public var isProximityMonitoringEnabled: Bool
-
+
- public enum DeviceType: Sendable
+
-
+ public enum DeviceType: Sendable
- case unspecified
+
- case phone
+ case unspecified
- case pad
+ case phone
- case tv
+ case pad
- case carPlay
+ case tv
- case mac
+ case carPlay
- case vision
+ case mac
+ case vision |
49130f2
to
3ef6705
Compare
Public Interface+ public protocol ProximityProviding
+ public final class VideoProximityPolicy: ProximityPolicy, @unchecked Sendable
+
+ public static let identifier: ObjectIdentifier
+
+
+ public init()
+
+
+ public func didUpdateProximity(_ proximity: ProximityState,on call: Call)
+ extension ProximityPolicy
+
+ public var description: String
+ public enum ProximityState: Hashable, Sendable
+
+ case near
+ case far
+ public protocol ProximityPolicy: Sendable, CustomStringConvertible
+ public final class SpeakerProximityPolicy: ProximityPolicy, @unchecked Sendable
+
+ public static let identifier: ObjectIdentifier
+
+
+ public init()
+
+
+ public func didUpdateProximity(_ proximity: ProximityState,on call: Call)
public final class CurrentDevice: @unchecked Sendable
-
+ @MainActor public var isProximityMonitoringEnabled: Bool
-
+
- public enum DeviceType: Sendable
+
-
+ public enum DeviceType: Sendable
- case unspecified
+
- case phone
+ case unspecified
- case pad
+ case phone
- case tv
+ case pad
- case carPlay
+ case tv
- case mac
+ case carPlay
- case vision
+ case mac
+ case vision
public class Call: @unchecked Sendable, WSEventsSubscriber
- public func updateAudioSessionPolicy(_ policy: AudioSessionPolicy)async throws
+ public func updateAudioSessionPolicy(_ policy: AudioSessionPolicy)async throws
+ public func addProximityPolicy(_ policy: any ProximityPolicy)throws
+ public func removeProximityPolicy(_ policy: any ProximityPolicy) |
3ef6705
to
8127e8a
Compare
Public Interface+ public enum ProximityState: Hashable, Sendable
+
+ case near
+ case far
+ public final class SpeakerProximityPolicy: ProximityPolicy, @unchecked Sendable
+
+ public static let identifier: ObjectIdentifier
+
+
+ public init()
+
+
+ public func didUpdateProximity(_ proximity: ProximityState,on call: Call)
+ extension ProximityPolicy
+
+ public var description: String
+ public protocol ProximityPolicy: Sendable, CustomStringConvertible
+ public protocol ProximityProviding
+ public final class VideoProximityPolicy: ProximityPolicy, @unchecked Sendable
+
+ public static let identifier: ObjectIdentifier
+
+
+ public init()
+
+
+ public func didUpdateProximity(_ proximity: ProximityState,on call: Call)
public final class CurrentDevice: @unchecked Sendable
-
+ @MainActor public var isProximityMonitoringEnabled: Bool
-
+
- public enum DeviceType: Sendable
+
-
+ public enum DeviceType: Sendable
- case unspecified
+
- case phone
+ case unspecified
- case pad
+ case phone
- case tv
+ case pad
- case carPlay
+ case tv
- case mac
+ case carPlay
- case vision
+ case mac
+ case vision
public class Call: @unchecked Sendable, WSEventsSubscriber
- public func updateAudioSessionPolicy(_ policy: AudioSessionPolicy)async throws
+ public func updateAudioSessionPolicy(_ policy: AudioSessionPolicy)async throws
+ public func addProximityPolicy(_ policy: any ProximityPolicy)throws
+ public func removeProximityPolicy(_ policy: any ProximityPolicy) |
|
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.
Nice addition! Just one question (see comments). Additionally, we should add some docs about this.
@@ -108,7 +108,6 @@ open class CallViewModel: ObservableObject { | |||
@Published public private(set) var callParticipants = [String: CallParticipant]() { | |||
didSet { | |||
updateCallStateIfNeeded() | |||
checkCallSettingsForCurrentUser() |
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.
I believe we had this for cases where an admin mutes you remotely. Do you think this might break it?
🔗 Issue Links
Resolves https://linear.app/stream/issue/IOS-827/[feature-request]proximity-for-calls
🎯 Goal
Provide proximity based operations during a call.
🛠 Implementation
We introduce a new protocol
ProximityPolicy
that can be used to define what will happen when the device's proximity change during a call. You can attachProximityPolicy
instances on any Call object.Out of the box, the SDK ships with the following
ProximityPolicy
implementations:SpeakerProximityPolicy
: If speaker is enabled when proximity changes tonear
the policy will switch to earpiece. It will then restore speaker when proximity changes tofar
.VideoProximityPolicy
: The policy disables all video (remote and local) when proximity changes tonear
and restores everything back when proximity changes tofar
.☑️ Contributor Checklist