From 78206667560fee3e5baaca157b8e999448b0a162 Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Thu, 4 Jan 2024 12:39:15 +0200 Subject: [PATCH] Fix various small warnings --- ElementX/Sources/Application/AppCoordinator.swift | 2 -- .../RoomScreen/View/Timeline/FormattedBodyText.swift | 7 ++++--- .../Timeline/TimelineItems/RoomTimelineItemFactory.swift | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/ElementX/Sources/Application/AppCoordinator.swift b/ElementX/Sources/Application/AppCoordinator.swift index 1ae38e61e..45f3c8227 100644 --- a/ElementX/Sources/Application/AppCoordinator.swift +++ b/ElementX/Sources/Application/AppCoordinator.swift @@ -615,8 +615,6 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationCoordinatorDelegate, switch callback { case .didReceiveAuthError(let isSoftLogout): stateMachine.processEvent(.signOut(isSoft: isSoftLogout, disableAppLock: false)) - default: - break } } } diff --git a/ElementX/Sources/Screens/RoomScreen/View/Timeline/FormattedBodyText.swift b/ElementX/Sources/Screens/RoomScreen/View/Timeline/FormattedBodyText.swift index 68ffba554..5e956c535 100644 --- a/ElementX/Sources/Screens/RoomScreen/View/Timeline/FormattedBodyText.swift +++ b/ElementX/Sources/Screens/RoomScreen/View/Timeline/FormattedBodyText.swift @@ -157,12 +157,13 @@ struct FormattedBodyText: View { } private var blockquoteAttributes: AttributeContainer { - var container = AttributeContainer() + // The paragraph style removes the block style paragraph that the parser adds by default + // Set directly in the constructor to avoid `Conformance to 'Sendable'` warnings + var container = AttributeContainer([.paragraphStyle: NSParagraphStyle.default]) // Sadly setting SwiftUI fonts do not work so we would need UIFont equivalents for compound, this one is bodyMD container.font = UIFont.preferredFont(forTextStyle: .subheadline) container.foregroundColor = UIColor.compound.textSecondary - // To remove the block style paragraph that the parser adds by default - container.paragraphStyle = .default + return container } } diff --git a/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemFactory.swift b/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemFactory.swift index d9fb35136..6c7b79b66 100644 --- a/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemFactory.swift +++ b/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemFactory.swift @@ -54,7 +54,7 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol { return buildUnsupportedTimelineItem(eventItemProxy, eventType, error, isOutgoing) case .message: return buildMessageTimelineItem(eventItemProxy, isOutgoing) - case .state(let stateKey, let content): + case .state(_, let content): return buildStateTimelineItem(for: eventItemProxy, state: content, isOutgoing: isOutgoing) case .roomMembership(userId: let userID, change: let change): return buildStateMembershipChangeTimelineItem(for: eventItemProxy, member: userID, membershipChange: change, isOutgoing: isOutgoing)