From 684e7a52de12acee4c982660ca0dc2ecb983f9dd Mon Sep 17 00:00:00 2001 From: Jordan Rose Date: Wed, 27 Jul 2022 11:09:54 -0700 Subject: [PATCH] Keep RingRTC up to date on our ACI --- Signal/src/Calls/CallService.swift | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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() {