Update files following swiftformat upgrade

This commit is contained in:
Stefan Ceriu
2026-01-27 08:47:03 +02:00
committed by Stefan Ceriu
parent fe189fcfed
commit 23062901c0
343 changed files with 1502 additions and 1048 deletions
@@ -172,11 +172,15 @@ enum FormatType {
}
extension FormatType: CaseIterable, Identifiable {
var id: Self { self }
var id: Self {
self
}
}
extension FormatItem: Identifiable {
var id: FormatType { type }
var id: FormatType {
type
}
}
extension FormatItem {
@@ -782,12 +782,12 @@ private final class ComposerMentionReplacer: MentionReplacer {
self.replacementForMentionClosure = replacementForMentionClosure
}
// There is no internal Markdown to RTE switch implemented yet in the room so this one is never called
/// There is no internal Markdown to RTE switch implemented yet in the room so this one is never called
func postProcessMarkdown(in attributedString: NSAttributedString) -> NSAttributedString {
attributedString
}
// There is no internal RTE to Markdown switch implemented yet in the room so this one is never called
/// There is no internal RTE to Markdown switch implemented yet in the room so this one is never called
func restoreMarkdown(in attributedString: NSAttributedString) -> String {
attributedString.string
}
@@ -20,7 +20,7 @@ struct CompletionSuggestionView: View {
// added by the list itself when presenting the divider
static let listItemSpacing: CGFloat = 4.0
static let leadingPadding: CGFloat = 16.0
// To make the scrolling more apparent we show a factional amount
/// To make the scrolling more apparent we show a factional amount
static let maxVisibleRows: CGFloat = 4.5
}
@@ -114,7 +114,6 @@ struct ComposerToolbar: View {
HStackLayout(alignment: .bottom, spacing: 5)
}
@ViewBuilder
private var mainTopBarContent: some View {
ZStack(alignment: .bottom) {
topBarLayout {
@@ -23,9 +23,7 @@ struct RoomAttachmentPicker: View {
} label: {
CompoundIcon(asset: Asset.Images.composerAttachment, size: .custom(30), relativeTo: .compound.headingLG)
.scaledPadding(7, relativeTo: .compound.headingLG)
.foregroundColor(
isEnabled ? .compound.iconPrimary : .compound.iconDisabled
)
.foregroundColor(isEnabled ? .compound.iconPrimary : .compound.iconDisabled)
}
.buttonStyle(RoomAttachmentPickerButtonStyle())
.accessibilityLabel(L10n.actionAddToTimeline)
@@ -36,9 +36,7 @@ struct VoiceMessageRecordingButton: View {
switch mode {
case .idle:
CompoundIcon(\.micOn, size: .medium, relativeTo: .compound.headingLG)
.foregroundColor(
isEnabled ? .compound.iconSecondary : .compound.iconDisabled
)
.foregroundColor(isEnabled ? .compound.iconSecondary : .compound.iconDisabled)
.scaledPadding(10, relativeTo: .compound.headingLG)
case .recording:
CompoundIcon(asset: Asset.Images.stopRecording, size: .medium, relativeTo: .compound.headingLG)
@@ -190,9 +190,9 @@ enum PinnedEventsBannerState: Equatable {
}
}
// Note that if we are setting this value, this is definitely sent from the pinned events timeline
// so we can assume that the pinned events timeline is already loaded and we only need to set the
// selection for the loaded state
/// Note that if we are setting this value, this is definitely sent from the pinned events timeline
/// so we can assume that the pinned events timeline is already loaded and we only need to set the
/// selection for the loaded state
mutating func setSelectedPinnedEventID(_ eventID: String) {
switch self {
case .loaded(var state):
@@ -46,7 +46,6 @@ struct PinnedItemsBannerView: View {
.accessibilityElement(children: .contain)
}
@ViewBuilder
private var viewAllButton: some View {
Button { onViewAllButtonTap() } label: {
Text(state.isLoading ? "" : L10n.screenRoomPinnedBannerViewAllButtonTitle)
@@ -72,14 +72,12 @@ struct RoomScreen: View {
.sentryTrace("\(Self.self)")
}
@ViewBuilder
private var pinnedItemsBanner: some View {
PinnedItemsBannerView(state: context.viewState.pinnedEventsBannerState,
onMainButtonTap: { context.send(viewAction: .tappedPinnedEventsBanner) },
onViewAllButtonTap: { context.send(viewAction: .viewAllPins) })
}
@ViewBuilder
private var knockRequestsBanner: some View {
KnockRequestsBannerView(requests: context.viewState.displayedKnockRequests,
onDismiss: dismissKnockRequestsBanner,
@@ -49,7 +49,6 @@ struct SwipeRightAction<Label: View>: ViewModifier {
}
}
@ViewBuilder
private func mainContent(content: Content) -> some View {
content
.offset(x: xOffset, y: 0.0)
@@ -164,7 +163,9 @@ extension View {
}
struct SwipeRightAction_Previews: PreviewProvider, TestablePreview {
static var previews: some View { Preview() }
static var previews: some View {
Preview()
}
struct Preview: View {
@State private var isPresentingSheet = false
@@ -196,12 +197,14 @@ struct SwipeRightAction_Previews: PreviewProvider, TestablePreview {
}
}
// Fixes the issue on iOS 18 where DragGesture conflicts with the scroll view
// https://github.com/feedback-assistant/reports/issues/542#issuecomment-2581322968
/// Fixes the issue on iOS 18 where DragGesture conflicts with the scroll view
/// https://github.com/feedback-assistant/reports/issues/542#issuecomment-2581322968
private struct PanGestureRepresentable: UIGestureRecognizerRepresentable {
var handle: (UIPanGestureRecognizer) -> Void
func makeCoordinator(converter: CoordinateSpaceConverter) -> Coordinator { .init() }
func makeCoordinator(converter: CoordinateSpaceConverter) -> Coordinator {
.init()
}
func makeUIGestureRecognizer(context: Context) -> UIPanGestureRecognizer {
let gesture = UIPanGestureRecognizer()