Fix Swift 6.4 warnings (#6240)

This commit is contained in:
Mauro
2026-10-01 10:55:19 +02:00
committed by GitHub
parent 99c0fa5729
commit 831234865b
28 changed files with 71 additions and 69 deletions
@@ -723,7 +723,7 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
fatalError("User session not setup")
}
Task {
Task { [self] in
let credentials = SoftLogoutScreenCredentials(userID: userSession.clientProxy.userID,
homeserverName: userSession.clientProxy.homeserver,
userDisplayName: userSession.clientProxy.userProfilePublisher.value.displayName ?? "",
@@ -744,7 +744,7 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
appHooks: appHooks,
userIndicatorController: userIndicatorController)
let coordinator = SoftLogoutScreenCoordinator(parameters: parameters)
self.softLogoutCoordinator = coordinator
softLogoutCoordinator = coordinator
coordinator.actions
.sink { [weak self] action in
guard let self else { return }
@@ -247,7 +247,7 @@ private extension UIWindowScene {
self.sizeRestrictions?.maximumSize = size
Task {
try await Task.sleep(for: .milliseconds(100))
try? await Task.sleep(for: .milliseconds(100))
self.sizeRestrictions?.minimumSize = sizeRestrictions.minimumSize
self.sizeRestrictions?.maximumSize = sizeRestrictions.maximumSize
}
@@ -308,9 +308,9 @@ final class RoomMembersFlowCoordinator: FlowCoordinatorProtocol {
// Replace the RoomMemberDetailsScreen without any animation.
// If this pop and push happens before the previous navigation is completed it might break screen presentation logic
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(500)) {
self.navigationStackCoordinator.pop(animated: false)
self.navigationStackCoordinator.push(coordinator, animated: false) { [weak self] in
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(500)) { [self] in
navigationStackCoordinator.pop(animated: false)
navigationStackCoordinator.push(coordinator, animated: false) { [weak self] in
self?.stateMachine.tryEvent(.dismissedUserProfile)
}
}
@@ -371,7 +371,7 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
self.navigationTabCoordinator.setSheetCoordinator(nil)
// The sheet needs to be dismissed before the alert can be shown
try await Task.sleep(for: .milliseconds(100))
try? await Task.sleep(for: .milliseconds(100))
await self.runLogoutFlow()
}
case .forceLogout:
@@ -30,14 +30,14 @@ extension SessionVerificationControllerProxyMock {
Task {
guard let mock else { return }
try await Task.sleep(for: requestDelay)
try? await Task.sleep(for: requestDelay)
mock.actions.send(.acceptedVerificationRequest)
if otherDeviceStartsSasVerification {
try await Task.sleep(for: requestDelay)
try? await Task.sleep(for: requestDelay)
mock.actions.send(.startedSasVerification)
try await Task.sleep(for: requestDelay)
try? await Task.sleep(for: requestDelay)
mock.actions.send(.receivedVerificationData(emojis))
}
}
@@ -49,11 +49,11 @@ extension SessionVerificationControllerProxyMock {
Task {
guard let mock else { return }
try await Task.sleep(for: requestDelay)
try? await Task.sleep(for: requestDelay)
mock.actions.send(.startedSasVerification)
Task {
try await Task.sleep(for: requestDelay)
try? await Task.sleep(for: requestDelay)
mock.actions.send(.receivedVerificationData(emojis))
}
}
@@ -65,7 +65,7 @@ extension SessionVerificationControllerProxyMock {
Task {
guard let mock else { return }
try await Task.sleep(for: requestDelay)
try? await Task.sleep(for: requestDelay)
mock.actions.send(.finished)
}
@@ -76,7 +76,7 @@ extension SessionVerificationControllerProxyMock {
Task {
guard let mock else { return }
try await Task.sleep(for: requestDelay)
try? await Task.sleep(for: requestDelay)
mock.actions.send(.cancelled)
}
@@ -87,7 +87,7 @@ extension SessionVerificationControllerProxyMock {
Task {
guard let mock else { return }
try await Task.sleep(for: requestDelay)
try? await Task.sleep(for: requestDelay)
mock.actions.send(.cancelled)
}
@@ -6,7 +6,7 @@
// Please see LICENSE files in the repository root for full details.
//
import Foundation
import SwiftUI
enum UserIDAttribute: AttributedStringKey {
typealias Value = String
@@ -49,7 +49,7 @@ class UserIndicatorController: ObservableObject, UserIndicatorControllerProtocol
delayedIndicators.insert(indicator.id)
Task {
try await Task.sleep(for: .seconds(delay.seconds))
try? await Task.sleep(for: .seconds(delay.seconds))
guard delayedIndicators.contains(indicator.id) else {
return
@@ -78,7 +78,7 @@ class PollFormScreenViewModel: PollFormScreenViewModelType, PollFormScreenViewMo
case .deleteOption(let index):
// fixes a crash that caused an index out of range when an option with the keyboard focus was deleted
Task {
try await Task.sleep(for: .milliseconds(100))
try? await Task.sleep(for: .milliseconds(100))
guard state.bindings.options.indices.contains(index) else {
return
}
@@ -283,13 +283,13 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
// perphery: ignore - used in release mode
func presentCrashedLastRunAlert() {
// Delay setting the alert otherwise it automatically gets dismissed. Same as the force logout one.
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
self.state.bindings.alertInfo = AlertInfo(id: UUID(),
title: L10n.crashDetectionDialogContent(InfoPlistReader.main.bundleDisplayName),
primaryButton: .init(title: L10n.actionNo, action: nil),
secondaryButton: .init(title: L10n.actionYes) { [weak self] in
self?.actionsSubject.send(.presentFeedbackScreen)
})
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { [self] in
state.bindings.alertInfo = AlertInfo(id: UUID(),
title: L10n.crashDetectionDialogContent(InfoPlistReader.main.bundleDisplayName),
primaryButton: .init(title: L10n.actionNo, action: nil),
secondaryButton: .init(title: L10n.actionYes) { [weak self] in
self?.actionsSubject.send(.presentFeedbackScreen)
})
}
}
@@ -401,7 +401,7 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
private static let leaveRoomLoadingID = "LeaveRoomLoading"
private func startLeaveRoomProcess(roomID: String) {
Task {
Task { [self] in
defer {
userIndicatorController.retractIndicatorWithId(Self.leaveRoomLoadingID)
}
@@ -88,7 +88,7 @@ class KnockRequestsListScreenViewModel: KnockRequestsListScreenViewModelType, Kn
let eventID = request.eventID
state.handledEventIDs.insert(eventID)
Task {
Task { [self] in
switch await request.accept() {
case .success:
hideLoadingIndicator()
@@ -110,7 +110,7 @@ class KnockRequestsListScreenViewModel: KnockRequestsListScreenViewModelType, Kn
let eventID = request.eventID
state.handledEventIDs.insert(eventID)
Task {
Task { [self] in
switch await request.decline() {
case .success:
hideLoadingIndicator()
@@ -132,7 +132,7 @@ class KnockRequestsListScreenViewModel: KnockRequestsListScreenViewModelType, Kn
let eventID = request.eventID
state.handledEventIDs.insert(eventID)
Task {
Task { [self] in
switch await request.ban() {
case .success:
hideLoadingIndicator()
@@ -155,7 +155,7 @@ class KnockRequestsListScreenViewModel: KnockRequestsListScreenViewModelType, Kn
showLoadingIndicator(title: L10n.screenKnockRequestsListAcceptAllLoadingTitle)
state.handledEventIDs.formUnion(Set(requests.map(\.eventID)))
Task {
Task { [self] in
let failedIDs = await withTaskGroup(of: (String, Result<Void, KnockRequestProxyError>).self) { group in
for request in requests {
group.addTask {
@@ -217,7 +217,7 @@ private class ElementTextView: UITextView, PillAttachmentViewProviderDelegate {
super.init(frame: .zero, textContainer: nil)
// Avoid `Publishing changes from within view update` warnings
DispatchQueue.main.async {
DispatchQueue.main.async { [self] in
presendCallback.wrappedValue = { [weak self] in
self?.acceptCurrentSuggestion()
}
@@ -166,7 +166,7 @@ class NotificationSettingsEditScreenViewModel: NotificationSettingsEditScreenVie
roomNotificationModeProxy = .mentionsAndKeywordsOnly
}
state.pendingMode = mode
Task {
Task { [self] in
do {
// On modern clients, we don't have different settings for encrypted and non-encrypted rooms.
let isOneToOne = chatType == .oneToOneChat
@@ -72,7 +72,7 @@ class SpaceScreenViewModel: SpaceScreenViewModelType, SpaceScreenViewModelProtoc
.weakAssign(to: \.state.selectedSpaceRoomID, on: self)
.store(in: &cancellables)
Task {
Task { [self] in
if case let .joined(roomProxy) = await userSession.clientProxy.roomForIdentifier(spaceRoomListProxy.id) {
// Required to listen for membership updates in the members flow
await roomProxy.subscribeForUpdates()
+1 -1
View File
@@ -149,7 +149,7 @@ targets:
SWIFT_OBJC_INTERFACE_HEADER_NAME: GeneratedInterface-Swift.h
PILLS_UT_TYPE_IDENTIFIER: $(BASE_BUNDLE_IDENTIFIER).pills
DEVELOPMENT_ASSET_PATHS: Components/DevelopmentAssets/Media
SWIFT_VERSION: 6.2
SWIFT_VERSION: 6
SWIFT_APPROACHABLE_CONCURRENCY: YES
SWIFT_DEFAULT_ACTOR_ISOLATION: MainActor
OTHER_SWIFT_FLAGS: