Silence some warnings. (#4747)

This commit is contained in:
Doug
2025-11-14 16:59:54 +00:00
committed by GitHub
parent ea5006f07b
commit eb0ff83bc5
11 changed files with 40 additions and 80 deletions
@@ -2141,9 +2141,9 @@ class CXProviderMock: CXProviderProtocol, @unchecked Sendable {
} }
var reportNewIncomingCallWithUpdateCompletionReceivedArguments: (uuid: UUID, update: CXCallUpdate, completion: (Error?) -> Void)? var reportNewIncomingCallWithUpdateCompletionReceivedArguments: (uuid: UUID, update: CXCallUpdate, completion: (Error?) -> Void)?
var reportNewIncomingCallWithUpdateCompletionReceivedInvocations: [(uuid: UUID, update: CXCallUpdate, completion: (Error?) -> Void)] = [] var reportNewIncomingCallWithUpdateCompletionReceivedInvocations: [(uuid: UUID, update: CXCallUpdate, completion: (Error?) -> Void)] = []
var reportNewIncomingCallWithUpdateCompletionClosure: ((UUID, CXCallUpdate, @escaping (Error?) -> Void) -> Void)? var reportNewIncomingCallWithUpdateCompletionClosure: ((UUID, CXCallUpdate, @Sendable @escaping (Error?) -> Void) -> Void)?
func reportNewIncomingCall(with uuid: UUID, update: CXCallUpdate, completion: @escaping (Error?) -> Void) { func reportNewIncomingCall(with uuid: UUID, update: CXCallUpdate, completion: @Sendable @escaping (Error?) -> Void) {
reportNewIncomingCallWithUpdateCompletionCallsCount += 1 reportNewIncomingCallWithUpdateCompletionCallsCount += 1
reportNewIncomingCallWithUpdateCompletionReceivedArguments = (uuid: uuid, update: update, completion: completion) reportNewIncomingCallWithUpdateCompletionReceivedArguments = (uuid: uuid, update: update, completion: completion)
DispatchQueue.main.async { DispatchQueue.main.async {
@@ -111,7 +111,7 @@ struct AttributedStringBuilder: AttributedStringBuilderProtocol {
// MARK: - Private // MARK: - Private
// swiftlint:disable:next function_body_length // swiftlint:disable:next function_body_length cyclomatic_complexity
func attributedString(element: Element, func attributedString(element: Element,
documentBody: Element, documentBody: Element,
preserveFormatting: Bool, preserveFormatting: Bool,
+20
View File
@@ -51,6 +51,14 @@ extension SDKListener: VerificationStateListener where T == VerificationState {
func onUpdate(status: VerificationState) { onUpdateClosure(status) } func onUpdate(status: VerificationState) { onUpdateClosure(status) }
} }
extension SDKListener: IgnoredUsersListener where T == [String] {
func call(ignoredUserIds: [String]) { onUpdateClosure(ignoredUserIds) }
}
extension SDKListener: SendQueueRoomErrorListener where T == (String, ClientError) {
func onError(roomId: String, error: ClientError) { onUpdateClosure((roomId, error)) }
}
// MARK: SecureBackupController // MARK: SecureBackupController
extension SDKListener: BackupStateListener where T == BackupState { extension SDKListener: BackupStateListener where T == BackupState {
@@ -107,6 +115,18 @@ extension SDKListener: CallDeclineListener where T == String {
func call(declinerUserId: String) { onUpdateClosure(declinerUserId) } func call(declinerUserId: String) { onUpdateClosure(declinerUserId) }
} }
extension SDKListener: TypingNotificationsListener where T == [String] {
func call(typingUserIds: [String]) { onUpdateClosure(typingUserIds) }
}
extension SDKListener: IdentityStatusChangeListener where T == [IdentityStatusChange] {
func call(identityStatusChange: [IdentityStatusChange]) { onUpdateClosure(identityStatusChange) }
}
extension SDKListener: KnockRequestsListener where T == [KnockRequest] {
func call(joinRequests: [KnockRequest]) { onUpdateClosure(joinRequests) }
}
// MARK: TimelineProxy // MARK: TimelineProxy
extension SDKListener: PaginationStatusListener where T == RoomPaginationStatus { extension SDKListener: PaginationStatusListener where T == RoomPaginationStatus {
@@ -6,7 +6,7 @@
// Please see LICENSE files in the repository root for full details. // Please see LICENSE files in the repository root for full details.
// //
import Combine @preconcurrency import Combine
import CryptoKit import CryptoKit
import Foundation import Foundation
import OrderedCollections import OrderedCollections
@@ -208,7 +208,7 @@ class ClientProxy: ClientProxyProtocol {
loadUserAvatarURLFromCache() loadUserAvatarURLFromCache()
ignoredUsersListenerTaskHandle = client.subscribeToIgnoredUsers(listener: IgnoredUsersListenerProxy { [weak self] ignoredUsers in ignoredUsersListenerTaskHandle = client.subscribeToIgnoredUsers(listener: SDKListener { [weak self] ignoredUsers in
self?.ignoredUsersSubject.send(ignoredUsers) self?.ignoredUsersSubject.send(ignoredUsers)
}) })
@@ -218,7 +218,7 @@ class ClientProxy: ClientProxyProtocol {
Task { await self?.updateVerificationState(verificationState) } Task { await self?.updateVerificationState(verificationState) }
}) })
sendQueueListenerTaskHandle = client.subscribeToSendQueueStatus(listener: SendQueueRoomErrorListenerProxy { [weak self] roomID, error in sendQueueListenerTaskHandle = client.subscribeToSendQueueStatus(listener: SDKListener { [weak self] roomID, error in
MXLog.error("Send queue failed in room: \(roomID) with error: \(error)") MXLog.error("Send queue failed in room: \(roomID) with error: \(error)")
self?.sendQueueStatusSubject.send(false) self?.sendQueueStatusSubject.send(false)
}) })
@@ -1143,10 +1143,10 @@ class ClientProxy: ClientProxyProtocol {
} }
} }
private class ClientDelegateWrapper: ClientDelegate { private final class ClientDelegateWrapper: ClientDelegate {
private let authErrorCallback: (Bool) -> Void private let authErrorCallback: @Sendable (Bool) -> Void
init(authErrorCallback: @escaping (Bool) -> Void) { init(authErrorCallback: @escaping @Sendable (Bool) -> Void) {
self.authErrorCallback = authErrorCallback self.authErrorCallback = authErrorCallback
} }
@@ -1162,7 +1162,7 @@ private class ClientDelegateWrapper: ClientDelegate {
} }
} }
private class ClientDecryptionErrorDelegate: UnableToDecryptDelegate { private final class ClientDecryptionErrorDelegate: UnableToDecryptDelegate {
private let actionsSubject: PassthroughSubject<ClientProxyAction, Never> private let actionsSubject: PassthroughSubject<ClientProxyAction, Never>
init(actionsSubject: PassthroughSubject<ClientProxyAction, Never>) { init(actionsSubject: PassthroughSubject<ClientProxyAction, Never>) {
@@ -1174,30 +1174,6 @@ private class ClientDecryptionErrorDelegate: UnableToDecryptDelegate {
} }
} }
private class IgnoredUsersListenerProxy: IgnoredUsersListener {
private let onUpdateClosure: ([String]) -> Void
init(onUpdateClosure: @escaping ([String]) -> Void) {
self.onUpdateClosure = onUpdateClosure
}
func call(ignoredUserIds: [String]) {
onUpdateClosure(ignoredUserIds)
}
}
private class SendQueueRoomErrorListenerProxy: SendQueueRoomErrorListener {
private let onErrorClosure: (String, ClientError) -> Void
init(onErrorClosure: @escaping (String, ClientError) -> Void) {
self.onErrorClosure = onErrorClosure
}
func onError(roomId: String, error: ClientError) {
onErrorClosure(roomId, error)
}
}
private struct ClientProxyServices { private struct ClientProxyServices {
let syncService: SyncService let syncService: SyncService
let roomListService: RoomListService let roomListService: RoomListService
@@ -10,7 +10,7 @@ import CallKit
// sourcery: AutoMockable // sourcery: AutoMockable
protocol CXProviderProtocol { protocol CXProviderProtocol {
func setDelegate(_ delegate: CXProviderDelegate?, queue: DispatchQueue?) func setDelegate(_ delegate: CXProviderDelegate?, queue: DispatchQueue?)
func reportNewIncomingCall(with uuid: UUID, update: CXCallUpdate, completion: @escaping (Error?) -> Void) func reportNewIncomingCall(with uuid: UUID, update: CXCallUpdate, completion: @escaping @Sendable (Error?) -> Void)
func reportCall(with uuid: UUID, endedAt: Date?, reason: CXCallEndedReason) func reportCall(with uuid: UUID, endedAt: Date?, reason: CXCallEndedReason)
} }
@@ -48,7 +48,7 @@ struct ElementCallWidgetMessage: Codable {
} }
} }
class ElementCallWidgetDriver: WidgetCapabilitiesProvider, ElementCallWidgetDriverProtocol { final class ElementCallWidgetDriver: WidgetCapabilitiesProvider, ElementCallWidgetDriverProtocol {
private let room: RoomProtocol private let room: RoomProtocol
private let deviceID: String private let deviceID: String
@@ -7,7 +7,7 @@
// //
import Foundation import Foundation
import KeychainAccess @preconcurrency import KeychainAccess
import MatrixRustSDK import MatrixRustSDK
enum KeychainControllerService: String { enum KeychainControllerService: String {
@@ -23,7 +23,7 @@ enum KeychainControllerService: String {
} }
} }
class KeychainController: KeychainControllerProtocol { final class KeychainController: KeychainControllerProtocol {
/// The keychain responsible for storing account restoration tokens (keyed by userID). /// The keychain responsible for storing account restoration tokens (keyed by userID).
private let restorationTokenKeychain: Keychain private let restorationTokenKeychain: Keychain
/// The keychain responsible for storing all other secrets in the app (keyed by `Key`s). /// The keychain responsible for storing all other secrets in the app (keyed by `Key`s).
@@ -58,7 +58,7 @@ extension MediaFileHandleProxy: Hashable {
/// An unmanaged file handle that can be created direct from a URL. /// An unmanaged file handle that can be created direct from a URL.
/// ///
/// This type allows for mocking but doesn't provide the automatic clean-up mechanism provided by the SDK. /// This type allows for mocking but doesn't provide the automatic clean-up mechanism provided by the SDK.
private class UnmanagedMediaFileHandle: MediaFileHandleProtocol { private final class UnmanagedMediaFileHandle: MediaFileHandleProtocol {
func persist(path: String) throws -> Bool { func persist(path: String) throws -> Bool {
false false
} }
@@ -739,7 +739,7 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
// MARK: - Private // MARK: - Private
private func subscribeToTypingNotifications() { private func subscribeToTypingNotifications() {
typingNotificationObservationToken = room.subscribeToTypingNotifications(listener: RoomTypingNotificationUpdateListener { [weak self] typingUserIDs in typingNotificationObservationToken = room.subscribeToTypingNotifications(listener: SDKListener { [weak self] typingUserIDs in
guard let self else { return } guard let self else { return }
MXLog.info("Received typing notification update, typingUsers: \(typingUserIDs)") MXLog.info("Received typing notification update, typingUsers: \(typingUserIDs)")
@@ -758,7 +758,7 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
private func subscribeToIdentityStatusChanges() async { private func subscribeToIdentityStatusChanges() async {
do { do {
identityStatusChangesObservationToken = try await room.subscribeToIdentityStatusChanges(listener: RoomIdentityStatusChangeListener { [weak self] changes in identityStatusChangesObservationToken = try await room.subscribeToIdentityStatusChanges(listener: SDKListener { [weak self] changes in
guard let self else { return } guard let self else { return }
MXLog.info("Received identity status changes: \(changes)") MXLog.info("Received identity status changes: \(changes)")
@@ -772,7 +772,7 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
private func subscribeToKnockRequests() async { private func subscribeToKnockRequests() async {
do { do {
knockRequestsChangesObservationToken = try await room.subscribeToKnockRequests(listener: RoomKnockRequestsListener { [weak self] requests in knockRequestsChangesObservationToken = try await room.subscribeToKnockRequests(listener: SDKListener { [weak self] requests in
guard let self else { return } guard let self else { return }
MXLog.info("Received requests to join update, requests id: \(requests.map(\.eventId))") MXLog.info("Received requests to join update, requests id: \(requests.map(\.eventId))")
@@ -801,39 +801,3 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
return .exclude(eventTypes: stateEventFilters.map { FilterTimelineEventType.state(eventType: $0) }) return .exclude(eventTypes: stateEventFilters.map { FilterTimelineEventType.state(eventType: $0) })
}() }()
} }
private final class RoomTypingNotificationUpdateListener: TypingNotificationsListener {
private let onUpdateClosure: ([String]) -> Void
init(_ onUpdateClosure: @escaping ([String]) -> Void) {
self.onUpdateClosure = onUpdateClosure
}
func call(typingUserIds: [String]) {
onUpdateClosure(typingUserIds)
}
}
private final class RoomIdentityStatusChangeListener: IdentityStatusChangeListener {
private let onUpdateClosure: ([IdentityStatusChange]) -> Void
init(_ onUpdateClosure: @escaping ([IdentityStatusChange]) -> Void) {
self.onUpdateClosure = onUpdateClosure
}
func call(identityStatusChange: [IdentityStatusChange]) {
onUpdateClosure(identityStatusChange)
}
}
private final class RoomKnockRequestsListener: KnockRequestsListener {
private let onUpdateClosure: ([KnockRequest]) -> Void
init(_ onUpdateClosure: @escaping ([KnockRequest]) -> Void) {
self.onUpdateClosure = onUpdateClosure
}
func call(joinRequests: [KnockRequest]) {
onUpdateClosure(joinRequests)
}
}
@@ -10,7 +10,7 @@ import Combine
import Foundation import Foundation
import MatrixRustSDK import MatrixRustSDK
private class WeakSessionVerificationControllerProxy: SessionVerificationControllerDelegate { private final class WeakSessionVerificationControllerProxy: SessionVerificationControllerDelegate {
private weak var proxy: SessionVerificationControllerProxy? private weak var proxy: SessionVerificationControllerProxy?
init(proxy: SessionVerificationControllerProxy) { init(proxy: SessionVerificationControllerProxy) {
+1 -1
View File
@@ -117,7 +117,7 @@ final class NSEUserSession {
} }
} }
private class ClientDelegateWrapper: ClientDelegate { private final class ClientDelegateWrapper: ClientDelegate {
// MARK: - ClientDelegate // MARK: - ClientDelegate
func didReceiveAuthError(isSoftLogout: Bool) { func didReceiveAuthError(isSoftLogout: Bool) {