From 09bf7bec6d33037d5341e7a6ae2325f8def78cf8 Mon Sep 17 00:00:00 2001 From: Elaine <138257830+elaine-signal@users.noreply.github.com> Date: Wed, 21 Jan 2026 12:22:07 -0500 Subject: [PATCH] Don't present survey over a different chat --- Signal/Calls/CallQualitySurvey.swift | 16 ++++++++++++++++ Signal/Calls/GroupCall.swift | 6 ++++++ Signal/Calls/IndividualCallService.swift | 1 + 3 files changed, 23 insertions(+) diff --git a/Signal/Calls/CallQualitySurvey.swift b/Signal/Calls/CallQualitySurvey.swift index 99ae0a94f7..d23c27f111 100644 --- a/Signal/Calls/CallQualitySurvey.swift +++ b/Signal/Calls/CallQualitySurvey.swift @@ -55,14 +55,17 @@ class CallQualitySurveyManager { private let callSummary: CallSummary private let callType: CallQualitySurvey.CallType + private let threadUniqueId: String? init( callSummary: CallSummary, callType: CallQualitySurvey.CallType, + threadUniqueId: String?, deps: Deps, ) { self.callSummary = callSummary self.callType = callType + self.threadUniqueId = threadUniqueId self.deps = deps } @@ -71,6 +74,19 @@ class CallQualitySurveyManager { guard deps.db.read(block: shouldShowSurvey(tx:)) else { return } DispatchQueue.main.asyncAfter(deadline: .now() + 2) { + let vc = UIApplication.shared.frontmostViewControllerIgnoringAlerts + let conversationSplitVC = (vc as? ConversationSplitViewController) + ?? (vc?.splitViewController as? ConversationSplitViewController) + let currentlyVisibleConversationThreadId = conversationSplitVC?.selectedThread?.uniqueId + + // Don't present a survey for one chat's call when a different chat is visible to avoid confusion + if + currentlyVisibleConversationThreadId != nil, + currentlyVisibleConversationThreadId != self.threadUniqueId + { + return + } + UIApplication.shared.frontmostViewController?.present( CallQualitySurveyNavigationController(callQualitySurveyManager: self), animated: true, diff --git a/Signal/Calls/GroupCall.swift b/Signal/Calls/GroupCall.swift index 4a00d7bdb0..e552b3da0e 100644 --- a/Signal/Calls/GroupCall.swift +++ b/Signal/Calls/GroupCall.swift @@ -229,6 +229,12 @@ class GroupCall: SignalRingRTC.GroupCallDelegate { case .callLink: .link } }(), + threadUniqueId: { + switch concreteType { + case .groupThread(let groupThread): groupThread.threadUniqueId + case .callLink: nil + } + }(), deps: .init( db: DependenciesBridge.shared.db, accountManager: DependenciesBridge.shared.tsAccountManager, diff --git a/Signal/Calls/IndividualCallService.swift b/Signal/Calls/IndividualCallService.swift index 739438ec39..e64b486dff 100644 --- a/Signal/Calls/IndividualCallService.swift +++ b/Signal/Calls/IndividualCallService.swift @@ -466,6 +466,7 @@ final class IndividualCallService: CallServiceStateObserver { case .video: .individualVideo } }(), + threadUniqueId: call.individualCall.thread.uniqueId, deps: .init( db: DependenciesBridge.shared.db, accountManager: tsAccountManager,