Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,4 @@ public protocol PresentationDelegate: AnyObject {

// Called when showing the password prompt before joining a group conversation
func showPasswordPrompt(for conversationName: String, completion: @escaping (String?) -> Void)

/// Updates the calling UI state if there's an active call
func updateActiveCallPresentationStateIfNeeded()

}
Original file line number Diff line number Diff line change
Expand Up @@ -125,23 +125,6 @@ extension SessionManager: UNUserNotificationCenterDelegate {
fatalError("User session \(session) is not present in backgroundSessions")
}
}

/// Registers an observer to update active call presentation state when the conversation becomes visible.
fileprivate func observeConversationDidBecomeVisible() {
conversationVisibleObserver = NotificationCenter.default.addObserver(
forName: .conversationDidBecomeVisible,
object: nil,
queue: .main
) { [weak self] _ in
guard let self else { return }

if let observer = conversationVisibleObserver {
NotificationCenter.default.removeObserver(observer)
conversationVisibleObserver = nil
}
presentationDelegate?.updateActiveCallPresentationStateIfNeeded()
}
}
}

public extension SessionManager {
Expand All @@ -155,11 +138,6 @@ public extension SessionManager {
return
}

// If switching accounts, observe when conversation becomes visible to update call UI
if session != activeUserSession {
observeConversationDidBecomeVisible()
}

activateAccount(for: session) {
self.presentationDelegate?.showConversation(conversation, at: message)
}
Expand All @@ -175,7 +153,3 @@ public extension SessionManager {
presentationDelegate?.showUserProfile(user: user)
}
}

public extension Notification.Name {
static let conversationDidBecomeVisible = Notification.Name("ConversationDidBecomeVisible")
}
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,6 @@
let jailbreakDetector: JailbreakDetectorProtocol?
fileprivate var accountTokens: [UUID: [Any]] = [:]
fileprivate var memoryWarningObserver: NSObjectProtocol?
var conversationVisibleObserver: NSObjectProtocol?
fileprivate var isSelectingAccount: Bool = false

var proxyCredentials: WireTransport.ProxyCredentials?
Expand Down Expand Up @@ -474,7 +473,7 @@
object: nil,
queue: nil
) { [weak self] _ in
WireLogger.sessionManager.debug("Received memory warning, tearing down background user sessions.")

Check warning on line 476 in wire-ios-sync-engine/Source/SessionManager/SessionManager.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'self' with non-Sendable type 'SessionManager?' in a '@Sendable' closure

Capture of 'self' with non-Sendable type 'SessionManager?' in a '@sendable' closure
self?.tearDownAllBackgroundSessions()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,4 @@ class MockPresentationDelegate: PresentationDelegate {
completion(mockPassword)
}

func updateActiveCallPresentationStateIfNeeded() {}

}
2 changes: 2 additions & 0 deletions wire-ios/Wire-iOS/Sources/AppRootRouter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,8 @@ extension AppRootRouter {
presentAlertForDeletedAccountIfNeeded(error)
sessionManager.processPendingURLActionDoesNotRequireAuthentication()
case .authenticated:
// This is needed to display an ongoing call when coming from the background.
authenticatedRouter?.updateActiveCallPresentationState()
urlActionRouter.authenticatedRouter = authenticatedRouter
ZClientViewController.shared?.legalHoldDisclosureController?.discloseCurrentState(cause: .appOpen)
sessionManager.processPendingURLActionRequiresAuthentication()
Expand Down
4 changes: 0 additions & 4 deletions wire-ios/Wire-iOS/Sources/URLActionRouter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,6 @@ class URLActionRouter: URLActionRouterProtocol {

extension URLActionRouter: PresentationDelegate {

func updateActiveCallPresentationStateIfNeeded() {
authenticatedRouter?.updateActiveCallPresentationState()
}

func showPasswordPrompt(for conversationName: String, completion: @escaping (String?) -> Void) {
typealias ConversationAlert = L10n.Localizable.Join.Group.Conversation.Alert

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,5 @@ extension ConversationViewController {
isAppearing = false

syncCellsState()
notifyConversationDidBecomeVisible()

}

private func notifyConversationDidBecomeVisible() {
NotificationCenter.default.post(
name: .conversationDidBecomeVisible,
object: nil
)
}

}
Loading