swiftformat

This commit is contained in:
Mauro Romito
2026-06-08 10:46:34 +02:00
committed by Mauro
parent 34ada2d933
commit 6ec1f0eb10
5 changed files with 36 additions and 42 deletions
@@ -92,13 +92,11 @@ struct GlobalSearchScreen: View {
} }
private var keyboardShortcuts: some View { private var keyboardShortcuts: some View {
Group { Button("") {
Button("") { context.send(viewAction: .dismiss)
context.send(viewAction: .dismiss)
}
// Need this to enable escape on the textField and forward the presses
.keyboardShortcut(.escape, modifiers: [])
} }
// Need this to enable escape on the textField and forward the presses
.keyboardShortcut(.escape, modifiers: [])
} }
private func backgroundColor(for room: GlobalSearchRoom) -> Color { private func backgroundColor(for room: GlobalSearchRoom) -> Color {
@@ -187,36 +187,34 @@ struct MediaEventsTimelineScreen: View {
} bottomContent: { EmptyView() } } bottomContent: { EmptyView() }
} }
@ViewBuilder
private var emptyMedia: some View { private var emptyMedia: some View {
Group { BigIcon(icon: \.image)
BigIcon(icon: \.image)
Text(L10n.screenMediaBrowserMediaEmptyStateTitle)
Text(L10n.screenMediaBrowserMediaEmptyStateTitle) .foregroundColor(.compound.textPrimary)
.foregroundColor(.compound.textPrimary) .font(.compound.headingMDBold)
.font(.compound.headingMDBold) .multilineTextAlignment(.center)
.multilineTextAlignment(.center)
Text(L10n.screenMediaBrowserMediaEmptyStateSubtitle)
Text(L10n.screenMediaBrowserMediaEmptyStateSubtitle) .foregroundColor(.compound.textSecondary)
.foregroundColor(.compound.textSecondary) .font(.compound.bodyMD)
.font(.compound.bodyMD) .multilineTextAlignment(.center)
.multilineTextAlignment(.center)
}
} }
@ViewBuilder
private var emptyFiles: some View { private var emptyFiles: some View {
Group { BigIcon(icon: \.document)
BigIcon(icon: \.document)
Text(L10n.screenMediaBrowserFilesEmptyStateTitle)
Text(L10n.screenMediaBrowserFilesEmptyStateTitle) .foregroundColor(.compound.textPrimary)
.foregroundColor(.compound.textPrimary) .font(.compound.headingMDBold)
.font(.compound.headingMDBold) .multilineTextAlignment(.center)
.multilineTextAlignment(.center)
Text(L10n.screenMediaBrowserFilesEmptyStateSubtitle)
Text(L10n.screenMediaBrowserFilesEmptyStateSubtitle) .foregroundColor(.compound.textSecondary)
.foregroundColor(.compound.textSecondary) .font(.compound.bodyMD)
.font(.compound.bodyMD) .multilineTextAlignment(.center)
.multilineTextAlignment(.center)
}
} }
@ToolbarContentBuilder @ToolbarContentBuilder
@@ -42,13 +42,11 @@ struct MessageComposerTextField: View {
} }
private var keyboardShortcuts: some View { private var keyboardShortcuts: some View {
Group { Button("") {
Button("") { keyHandler(.keyboardEscape)
keyHandler(.keyboardEscape)
}
// Need this to enable escape on the textView and forward the presses
.keyboardShortcut(.escape, modifiers: [])
} }
// Need this to enable escape on the textView and forward the presses
.keyboardShortcut(.escape, modifiers: [])
} }
} }
@@ -346,8 +344,8 @@ struct MessageComposerTextField_Previews: PreviewProvider, TestablePreview {
@State var text: NSAttributedString @State var text: NSAttributedString
init(text: String) { init(text: String) {
_text = .init(initialValue: .init(string: text, attributes: [.font: UIFont.preferredFont(forTextStyle: .body), self.text = .init(string: text, attributes: [.font: UIFont.preferredFont(forTextStyle: .body),
.foregroundColor: UIColor.compound.textPrimary])) .foregroundColor: UIColor.compound.textPrimary])
} }
var body: some View { var body: some View {
@@ -21,7 +21,7 @@ struct TimelineStyler<Content: View>: View {
init(timelineItem: EventBasedTimelineItemProtocol, @ViewBuilder content: @escaping () -> Content) { init(timelineItem: EventBasedTimelineItemProtocol, @ViewBuilder content: @escaping () -> Content) {
self.timelineItem = timelineItem self.timelineItem = timelineItem
self.content = content self.content = content
_adjustedDeliveryStatus = State(initialValue: timelineItem.properties.deliveryStatus) adjustedDeliveryStatus = timelineItem.properties.deliveryStatus
} }
var body: some View { var body: some View {
@@ -18,7 +18,7 @@ struct LiveLocationRoomTimelineView: View {
init(currentDate: Date = .now, timelineItem: LiveLocationRoomTimelineItem, isStopped: Bool = false) { init(currentDate: Date = .now, timelineItem: LiveLocationRoomTimelineItem, isStopped: Bool = false) {
self.currentDate = currentDate self.currentDate = currentDate
self.timelineItem = timelineItem self.timelineItem = timelineItem
_hasExpired = State(initialValue: isStopped || currentDate >= timelineItem.content.timeoutDate) hasExpired = isStopped || currentDate >= timelineItem.content.timeoutDate
} }
/// A publisher that fires once when the timeoutDate is reached, setting `hasExpired` to true. /// A publisher that fires once when the timeoutDate is reached, setting `hasExpired` to true.