Don't present survey over a different chat

This commit is contained in:
Elaine 2026-01-21 12:22:07 -05:00 committed by GitHub
parent 2f79c01bbc
commit 09bf7bec6d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 23 additions and 0 deletions

View File

@ -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,

View File

@ -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,

View File

@ -466,6 +466,7 @@ final class IndividualCallService: CallServiceStateObserver {
case .video: .individualVideo
}
}(),
threadUniqueId: call.individualCall.thread.uniqueId,
deps: .init(
db: DependenciesBridge.shared.db,
accountManager: tsAccountManager,