Rename LightweightCallManager to LightweightGroupCallManager
This commit is contained in:
parent
d5848b7dd4
commit
883cd6a976
@ -29,7 +29,7 @@
|
||||
17EC850C29133CDB00319C82 /* CancelledGroupRing.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17EC850B29133CDB00319C82 /* CancelledGroupRing.swift */; };
|
||||
23B9887F4A95010141FCF725 /* Pods_SignalUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E36B9FCE67E9FFDA471A085 /* Pods_SignalUI.framework */; };
|
||||
3236FCC42592B67B006D33B9 /* NameCollisionReviewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3236FCC32592B67B006D33B9 /* NameCollisionReviewCell.swift */; };
|
||||
32525F9527C74B1A0099E801 /* LightweightCallManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32525F9427C74B1A0099E801 /* LightweightCallManager.swift */; };
|
||||
32525F9527C74B1A0099E801 /* LightweightGroupCallManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32525F9427C74B1A0099E801 /* LightweightGroupCallManager.swift */; };
|
||||
326DF2612739F4D90017B789 /* FeaturedBadgeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 326DF2602739F4D90017B789 /* FeaturedBadgeViewController.swift */; };
|
||||
327CF66825ACE7DD00DA0A6F /* GetStartedBannerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 327CF66725ACE7DC00DA0A6F /* GetStartedBannerViewController.swift */; };
|
||||
328EF3DC25782A6A00D5C31D /* GroupCallSwipeToastView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 328EF3DB25782A6A00D5C31D /* GroupCallSwipeToastView.swift */; };
|
||||
@ -2575,7 +2575,7 @@
|
||||
264242150E87D10A357DB07B /* Pods_SignalMessaging.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SignalMessaging.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
30A821E68938D081D1190643 /* Pods-SignalServiceKit.profiling.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SignalServiceKit.profiling.xcconfig"; path = "Pods/Target Support Files/Pods-SignalServiceKit/Pods-SignalServiceKit.profiling.xcconfig"; sourceTree = "<group>"; };
|
||||
3236FCC32592B67B006D33B9 /* NameCollisionReviewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NameCollisionReviewCell.swift; sourceTree = "<group>"; };
|
||||
32525F9427C74B1A0099E801 /* LightweightCallManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LightweightCallManager.swift; sourceTree = "<group>"; };
|
||||
32525F9427C74B1A0099E801 /* LightweightGroupCallManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LightweightGroupCallManager.swift; sourceTree = "<group>"; };
|
||||
326DF2602739F4D90017B789 /* FeaturedBadgeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeaturedBadgeViewController.swift; sourceTree = "<group>"; };
|
||||
327CF66725ACE7DC00DA0A6F /* GetStartedBannerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GetStartedBannerViewController.swift; sourceTree = "<group>"; };
|
||||
328EF3DB25782A6A00D5C31D /* GroupCallSwipeToastView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GroupCallSwipeToastView.swift; sourceTree = "<group>"; };
|
||||
@ -5218,7 +5218,7 @@
|
||||
32525F9327C74AC50099E801 /* calls */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
32525F9427C74B1A0099E801 /* LightweightCallManager.swift */,
|
||||
32525F9427C74B1A0099E801 /* LightweightGroupCallManager.swift */,
|
||||
);
|
||||
path = calls;
|
||||
sourceTree = "<group>";
|
||||
@ -11543,7 +11543,7 @@
|
||||
340B870E23DF3E3A00BE0AFC /* GroupV2UpdatesImpl.swift in Sources */,
|
||||
88F67A0C24E5126D00435A71 /* HapticFeedback.swift in Sources */,
|
||||
4C9D347F23689E06006A4307 /* IncomingContactSyncJobQueue.swift in Sources */,
|
||||
32525F9527C74B1A0099E801 /* LightweightCallManager.swift in Sources */,
|
||||
32525F9527C74B1A0099E801 /* LightweightGroupCallManager.swift in Sources */,
|
||||
4C35B08A23F8A9D2003EB937 /* MessageRequestPendingReceipts.swift in Sources */,
|
||||
34BB78B5272C510900DA0D04 /* MobileCoinHelperMinimal.swift in Sources */,
|
||||
764981432A230F2C00EC1287 /* MockSMEnvironment.swift in Sources */,
|
||||
|
||||
@ -18,7 +18,12 @@ protocol CallServiceObserver: AnyObject {
|
||||
func didUpdateCall(from oldValue: SignalCall?, to newValue: SignalCall?)
|
||||
}
|
||||
|
||||
public final class CallService: LightweightCallManager {
|
||||
/// Manages events related to both 1:1 and group calls, while the main app is
|
||||
/// running.
|
||||
///
|
||||
/// Responsible for the 1:1 or group call this device is currently active in, if
|
||||
/// any, as well as any other updates to other calls that we learn about.
|
||||
public final class CallService: LightweightGroupCallManager {
|
||||
public typealias CallManagerType = CallManager<SignalCall, CallService>
|
||||
|
||||
private var _callManager: CallManagerType! = nil
|
||||
@ -48,6 +53,8 @@ public final class CallService: LightweightCallManager {
|
||||
/// but othere call state may race (observer state, sleep state, etc.)
|
||||
private var _currentCallLock = UnfairLock()
|
||||
private var _currentCall: SignalCall?
|
||||
|
||||
/// Represents the call currently occuring on this device.
|
||||
@objc
|
||||
public private(set) var currentCall: SignalCall? {
|
||||
get {
|
||||
@ -498,7 +505,7 @@ public final class CallService: LightweightCallManager {
|
||||
|
||||
// Kick off a peek now that we've disconnected to get an updated participant state.
|
||||
if let thread = call.thread as? TSGroupThread {
|
||||
peekCallAndUpdateThread(thread)
|
||||
peekGroupCallAndUpdateThread(thread)
|
||||
} else {
|
||||
owsFailDebug("Invalid thread type")
|
||||
}
|
||||
@ -555,7 +562,7 @@ public final class CallService: LightweightCallManager {
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - LightweightCallManager
|
||||
// MARK: -
|
||||
|
||||
func buildAndConnectGroupCallIfPossible(thread: TSGroupThread, videoMuted: Bool) -> SignalCall? {
|
||||
AssertIsOnMainThread()
|
||||
@ -845,17 +852,19 @@ public final class CallService: LightweightCallManager {
|
||||
|
||||
// MARK: -
|
||||
|
||||
override public func peekCallAndUpdateThread(_ thread: TSGroupThread,
|
||||
expectedEraId: String? = nil,
|
||||
triggerEventTimestamp: UInt64 = NSDate.ows_millisecondTimeStamp(),
|
||||
completion: (() -> Void)? = nil) {
|
||||
override public func peekGroupCallAndUpdateThread(
|
||||
_ thread: TSGroupThread,
|
||||
expectedEraId: String? = nil,
|
||||
triggerEventTimestamp: UInt64 = NSDate.ows_millisecondTimeStamp(),
|
||||
completion: (() -> Void)? = nil
|
||||
) {
|
||||
// If the currentCall is for the provided thread, we don't need to perform an explicit
|
||||
// peek. Connected calls will receive automatic updates from RingRTC
|
||||
guard currentCall?.thread != thread else {
|
||||
Logger.info("Ignoring peek request for the current call")
|
||||
return
|
||||
}
|
||||
super.peekCallAndUpdateThread(thread, expectedEraId: expectedEraId, triggerEventTimestamp: triggerEventTimestamp, completion: completion)
|
||||
super.peekGroupCallAndUpdateThread(thread, expectedEraId: expectedEraId, triggerEventTimestamp: triggerEventTimestamp, completion: completion)
|
||||
}
|
||||
|
||||
override public func postUserNotificationIfNecessary(groupCallMessage: OWSGroupCallMessage, transaction: SDSAnyWriteTransaction) {
|
||||
|
||||
@ -8,7 +8,8 @@ import SignalRingRTC
|
||||
import SignalServiceKit
|
||||
import SignalUI
|
||||
|
||||
// All Observer methods will be invoked from the main thread.
|
||||
/// Represents an observer who will receive updates about a call happening on
|
||||
/// this device. See ``SignalCall``.
|
||||
public protocol CallObserver: AnyObject {
|
||||
func individualCallStateDidChange(_ call: SignalCall, state: CallState)
|
||||
func individualCallLocalVideoMuteDidChange(_ call: SignalCall, isVideoMuted: Bool)
|
||||
@ -47,6 +48,7 @@ public extension CallObserver {
|
||||
func callMessageSendFailedUntrustedIdentity(_ call: SignalCall) {}
|
||||
}
|
||||
|
||||
/// Represents a call happening on this device.
|
||||
@objc
|
||||
public class SignalCall: NSObject, CallManagerCallReference {
|
||||
public let mode: Mode
|
||||
|
||||
@ -167,7 +167,7 @@ public class WebRTCCallMessageHandler: NSObject, OWSCallMessageHandler {
|
||||
completion: @escaping () -> Void
|
||||
) {
|
||||
Logger.info("Received group call update message for thread: \(groupThread.uniqueId) eraId: \(String(describing: updateMessage.eraID))")
|
||||
callService.peekCallAndUpdateThread(
|
||||
callService.peekGroupCallAndUpdateThread(
|
||||
groupThread,
|
||||
expectedEraId: updateMessage.eraID,
|
||||
triggerEventTimestamp: serverReceivedTimestamp,
|
||||
|
||||
@ -95,7 +95,7 @@ public extension ConversationViewController {
|
||||
|
||||
func refreshCallState() {
|
||||
if let groupThread = thread as? TSGroupThread {
|
||||
callService.peekCallAndUpdateThread(groupThread)
|
||||
callService.peekGroupCallAndUpdateThread(groupThread)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -115,6 +115,6 @@ public class AppEnvironment: NSObject {
|
||||
}
|
||||
|
||||
// Hang certain singletons on SMEnvironment too.
|
||||
SMEnvironment.shared.lightweightCallManagerRef = callServiceRef
|
||||
SMEnvironment.shared.lightweightGroupCallManagerRef = callServiceRef
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,8 +7,15 @@ import LibSignalClient
|
||||
import SignalServiceKit
|
||||
import SignalRingRTC
|
||||
|
||||
open class LightweightCallManager: NSObject, Dependencies {
|
||||
|
||||
/// Responsible for updating group call state when we learn it may have changed.
|
||||
///
|
||||
/// Lightweight in that it does not maintain or manage state for active calls,
|
||||
/// and can be used both in the main app and in extensions.
|
||||
///
|
||||
/// - Note
|
||||
/// This class is subclassed by ``CallService`` in the main app, to additionally
|
||||
/// manage calls this device is actively participating in.
|
||||
open class LightweightGroupCallManager: NSObject, Dependencies {
|
||||
public let sfuClient: SFUClient
|
||||
public let httpClient: HTTPClient
|
||||
private var sfuUrl: String { DebugFlags.callingUseTestSFU.get() ? TSConstants.sfuTestURL : TSConstants.sfuURL }
|
||||
@ -21,7 +28,7 @@ open class LightweightCallManager: NSObject, Dependencies {
|
||||
httpClient.delegate = self
|
||||
}
|
||||
|
||||
open dynamic func peekCallAndUpdateThread(
|
||||
open dynamic func peekGroupCallAndUpdateThread(
|
||||
_ thread: TSGroupThread,
|
||||
expectedEraId: String? = nil,
|
||||
triggerEventTimestamp: UInt64 = NSDate.ows_millisecondTimeStamp(),
|
||||
@ -171,7 +178,7 @@ open class LightweightCallManager: NSObject, Dependencies {
|
||||
}
|
||||
}
|
||||
|
||||
extension LightweightCallManager {
|
||||
extension LightweightGroupCallManager {
|
||||
|
||||
/// Fetches a data blob that serves as proof of membership in the group
|
||||
/// Used by RingRTC to verify access to group call information
|
||||
@ -217,7 +224,7 @@ extension LightweightCallManager {
|
||||
|
||||
// MARK: - <CallManagerLiteDelegate>
|
||||
|
||||
extension LightweightCallManager: HTTPDelegate {
|
||||
extension LightweightGroupCallManager: HTTPDelegate {
|
||||
/**
|
||||
* A HTTP request should be sent to the given url.
|
||||
* Invoked on the main thread, asychronously.
|
||||
@ -34,7 +34,7 @@ public class SMEnvironment {
|
||||
public let smJobQueuesRef: SignalMessagingJobQueues
|
||||
|
||||
// This property is configured after SMEnvironment is created.
|
||||
public var lightweightCallManagerRef: LightweightCallManager?
|
||||
public var lightweightGroupCallManagerRef: LightweightGroupCallManager?
|
||||
|
||||
public init(
|
||||
preferences: Preferences,
|
||||
|
||||
@ -42,12 +42,12 @@ public extension NSObject {
|
||||
SMEnvironment.shared.avatarBuilderRef
|
||||
}
|
||||
|
||||
var lightweightCallManager: LightweightCallManager? {
|
||||
SMEnvironment.shared.lightweightCallManagerRef
|
||||
var lightweightGroupCallManager: LightweightGroupCallManager? {
|
||||
SMEnvironment.shared.lightweightGroupCallManagerRef
|
||||
}
|
||||
|
||||
static var lightweightCallManager: LightweightCallManager? {
|
||||
SMEnvironment.shared.lightweightCallManagerRef
|
||||
static var lightweightGroupCallManager: LightweightGroupCallManager? {
|
||||
SMEnvironment.shared.lightweightGroupCallManagerRef
|
||||
}
|
||||
|
||||
var smJobQueues: SignalMessagingJobQueues {
|
||||
|
||||
@ -184,7 +184,7 @@ public class NSECallMessageHandler: NSObject, OWSCallMessageHandler {
|
||||
completion: @escaping () -> Void
|
||||
) {
|
||||
NSELogger.uncorrelated.info("Received group call update for thread \(groupThread.uniqueId)")
|
||||
lightweightCallManager?.peekCallAndUpdateThread(
|
||||
lightweightGroupCallManager?.peekGroupCallAndUpdateThread(
|
||||
groupThread,
|
||||
expectedEraId: updateMessage.eraID,
|
||||
triggerEventTimestamp: serverReceivedTimestamp,
|
||||
|
||||
@ -142,7 +142,7 @@ class NSEEnvironment: Dependencies {
|
||||
notificationPresenter: NotificationPresenter()
|
||||
)
|
||||
|
||||
SMEnvironment.shared.lightweightCallManagerRef = LightweightCallManager()
|
||||
SMEnvironment.shared.lightweightGroupCallManagerRef = LightweightGroupCallManager()
|
||||
|
||||
databaseContinuation.prepareDatabase().done(on: DispatchQueue.main) { finalSetupContinuation in
|
||||
switch finalSetupContinuation.finish(willResumeInProgressRegistration: false) {
|
||||
|
||||
@ -66,7 +66,7 @@ public class ShareViewController: UIViewController, ShareViewDelegate, SAEFailed
|
||||
|
||||
// Configure the rest of the globals before preparing the database.
|
||||
SUIEnvironment.shared.setup()
|
||||
SMEnvironment.shared.lightweightCallManagerRef = LightweightCallManager()
|
||||
SMEnvironment.shared.lightweightGroupCallManagerRef = LightweightGroupCallManager()
|
||||
|
||||
databaseContinuation.prepareDatabase().done(on: DispatchQueue.main) { finalContinuation in
|
||||
switch finalContinuation.finish(willResumeInProgressRegistration: false) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user