diff --git a/Signal/src/Calls/CallService.swift b/Signal/src/Calls/CallService.swift index 1ea3b5db6c..498234fb36 100644 --- a/Signal/src/Calls/CallService.swift +++ b/Signal/src/Calls/CallService.swift @@ -162,6 +162,11 @@ public final class CallService: LightweightCallManager { selector: #selector(configureBandwidthMode), name: Self.callServicePreferencesDidChange, object: nil) + NotificationCenter.default.addObserver( + self, + selector: #selector(registrationChanged), + name: .registrationStateDidChange, + object: nil) // Note that we're not using the usual .owsReachabilityChanged // We want to update our bandwidth mode if the app has been backgrounded @@ -173,6 +178,9 @@ public final class CallService: LightweightCallManager { AppReadiness.runNowOrWhenAppDidBecomeReadyAsync { SDSDatabaseStorage.shared.appendDatabaseChangeDelegate(self) + if let localUuid = self.tsAccountManager.localUuid { + self.callManager.setSelfUuid(localUuid) + } } } @@ -607,6 +615,14 @@ public final class CallService: LightweightCallManager { self.updateIsVideoEnabled() } + @objc + private func registrationChanged() { + AssertIsOnMainThread() + if let localUuid = tsAccountManager.localUuid { + callManager.setSelfUuid(localUuid) + } + } + // MARK: - private func updateGroupMembersForCurrentCallIfNecessary() {