Skip to content

Commit

Permalink
remove plain case
Browse files Browse the repository at this point in the history
removed name
  • Loading branch information
Velin92 committed Jun 27, 2024
1 parent 5b58ea3 commit 45bd554
Show file tree
Hide file tree
Showing 122 changed files with 16 additions and 759 deletions.
42 changes: 15 additions & 27 deletions ElementX.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,11 @@ import Foundation
import SwiftUI

enum TimelineStyle: String, CaseIterable, Codable {
case plain
case bubbles

/// List row insets for a timeline
var rowInsets: EdgeInsets {
switch self {
case .plain:
return EdgeInsets(top: 4, leading: 20, bottom: 4, trailing: 20)
case .bubbles:
return EdgeInsets(top: 1, leading: 8, bottom: 1, trailing: 8)
}
Expand All @@ -34,8 +31,6 @@ enum TimelineStyle: String, CaseIterable, Codable {
/// Short hand for `self == .bubbles`
var isBubbles: Bool {
switch self {
case .plain:
return false
case .bubbles:
return true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ struct TimelineStyler<Content: View>: View {
@ViewBuilder
var mainContent: some View {
switch style {
case .plain:
TimelineItemPlainStylerView(timelineItem: timelineItem, adjustedDeliveryStatus: adjustedDeliveryStatus, content: content)
case .bubbles:
TimelineItemBubbledStylerView(timelineItem: timelineItem, adjustedDeliveryStatus: adjustedDeliveryStatus, content: content)
}
Expand Down Expand Up @@ -204,11 +202,6 @@ struct TimelineItemStyler_Previews: PreviewProvider, TestablePreview {
.environmentObject(viewModel.context)
.environment(\.timelineStyle, .bubbles)
.previewDisplayName("Bubbles")

testView
.environmentObject(viewModel.context)
.environment(\.timelineStyle, .plain)
.previewDisplayName("Plain")

languagesTestView
.environmentObject(viewModel.context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,7 @@ struct TimelineItemStatusView: View {
TimelineDeliveryStatusView(deliveryStatus: .sent)
}
case .sendingFailed:
// Bubbles handle the failure internally, but plain items don't.
if style == .plain {
CompoundIcon(\.error, size: .xSmall, relativeTo: .compound.bodyMD)
.foregroundColor(.compound.iconCriticalPrimary)
.accessibilityLabel(L10n.commonSendingFailed)
.accessibilityHint(L10n.actionTapForOptions)
}
EmptyView()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ struct AudioRoomTimelineView_Previews: PreviewProvider, TestablePreview {

static var previews: some View {
body.environmentObject(viewModel.context)
body
.environment(\.timelineStyle, .plain)
.environmentObject(viewModel.context)
}

static var body: some View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ struct EmoteRoomTimelineView_Previews: PreviewProvider, TestablePreview {

static var previews: some View {
body.environmentObject(viewModel.context)
body
.environment(\.timelineStyle, .plain)
.environmentObject(viewModel.context)
}

static var body: some View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@ struct EncryptedRoomTimelineView_Previews: PreviewProvider, TestablePreview {

static var previews: some View {
body.environmentObject(viewModel.context)
body
.environment(\.timelineStyle, .plain)
.environmentObject(viewModel.context)
}

static var body: some View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ struct FileRoomTimelineView_Previews: PreviewProvider, TestablePreview {

static var previews: some View {
body.environmentObject(viewModel.context)
body
.environment(\.timelineStyle, .plain)
.environmentObject(viewModel.context)
}

static var body: some View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,6 @@ struct FormattedBodyText: View {
struct FormattedBodyText_Previews: PreviewProvider, TestablePreview {
static var previews: some View {
body
body
.environment(\.timelineStyle, .plain)
}

@ViewBuilder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ struct ImageRoomTimelineView_Previews: PreviewProvider, TestablePreview {
static var previews: some View {
body
.environmentObject(viewModel.context)
body
.environment(\.timelineStyle, .plain)
.environmentObject(viewModel.context)
}

static var body: some View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,6 @@ struct LocationRoomTimelineView_Previews: PreviewProvider, TestablePreview {
}
.environmentObject(viewModel.context)
.previewDisplayName("Bubbles")

ScrollView {
VStack(spacing: 0) {
states
}
}
.environment(\.timelineStyle, .plain)
.environmentObject(viewModel.context)
.previewDisplayName("Plain")
}

@ViewBuilder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ struct NoticeRoomTimelineView_Previews: PreviewProvider, TestablePreview {

static var previews: some View {
body.environmentObject(viewModel.context)
body
.environment(\.timelineStyle, .plain)
.environmentObject(viewModel.context)
}

static var body: some View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,40 +77,10 @@ struct PollRoomTimelineView_Previews: PreviewProvider, TestablePreview {
.environment(\.timelineStyle, .bubbles)
.environmentObject(viewModel.context)
.previewDisplayName("Creator, disclosed, Bubble")

PollRoomTimelineView(timelineItem: .mock(poll: .disclosed(), isOutgoing: false))
.environment(\.timelineStyle, .plain)
.environmentObject(viewModel.context)
.previewDisplayName("Disclosed, Plain")

PollRoomTimelineView(timelineItem: .mock(poll: .undisclosed(), isOutgoing: false))
.environment(\.timelineStyle, .plain)
.environmentObject(viewModel.context)
.previewDisplayName("Undisclosed, Plain")

PollRoomTimelineView(timelineItem: .mock(poll: .endedDisclosed))
.environment(\.timelineStyle, .plain)
.environmentObject(viewModel.context)
.previewDisplayName("Ended, Disclosed, Plain")

PollRoomTimelineView(timelineItem: .mock(poll: .endedUndisclosed))
.environment(\.timelineStyle, .plain)
.environmentObject(viewModel.context)
.previewDisplayName("Ended, Undisclosed, Plain")

PollRoomTimelineView(timelineItem: .mock(poll: .disclosed(createdByAccountOwner: true)))
.environment(\.timelineStyle, .plain)
.environmentObject(viewModel.context)
.previewDisplayName("Creator, disclosed, Plain")

PollRoomTimelineView(timelineItem: .mock(poll: .emptyDisclosed, isEditable: true))
.environment(\.timelineStyle, .bubbles)
.environmentObject(viewModel.context)
.previewDisplayName("Creator, no votes, Bubble")

PollRoomTimelineView(timelineItem: .mock(poll: .emptyDisclosed, isEditable: true))
.environment(\.timelineStyle, .plain)
.environmentObject(viewModel.context)
.previewDisplayName("Creator, no votes, Plain")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ struct StateRoomTimelineView: View {
struct StateRoomTimelineView_Previews: PreviewProvider, TestablePreview {
static var previews: some View {
body
body
.environment(\.timelineStyle, .plain)
}

static var body: some View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ struct StickerRoomTimelineView_Previews: PreviewProvider, TestablePreview {

static var previews: some View {
body.environmentObject(viewModel.context)
body
.environment(\.timelineStyle, .plain)
.environmentObject(viewModel.context)
}

static var body: some View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,10 @@ struct TextRoomTimelineView_Previews: PreviewProvider, TestablePreview {
static var previews: some View {
body.environmentObject(viewModel.context)
.previewDisplayName("Bubble")
body
.environment(\.timelineStyle, .plain)
.environmentObject(viewModel.context)
.previewDisplayName("Plain")
body
.environmentObject(viewModel.context)
.environment(\.layoutDirection, .rightToLeft)
.previewDisplayName("Bubble RTL")
body
.environment(\.timelineStyle, .plain)
.environmentObject(viewModel.context)
.environment(\.layoutDirection, .rightToLeft)
.previewDisplayName("Plain RTL")
}

static var body: some View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ struct UnsupportedRoomTimelineView_Previews: PreviewProvider, TestablePreview {

static var previews: some View {
body.environmentObject(viewModel.context)
body
.environment(\.timelineStyle, .plain)
.environmentObject(viewModel.context)
}

static var body: some View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@ struct VideoRoomTimelineView_Previews: PreviewProvider, TestablePreview {

static var previews: some View {
body.environmentObject(viewModel.context)
body
.environment(\.timelineStyle, .plain)
.environmentObject(viewModel.context)
}

static var body: some View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,6 @@ struct AdvancedSettingsScreen: View {
}
}

private extension TimelineStyle {
var name: String {
switch self {
case .plain:
return L10n.commonModern
case .bubbles:
return L10n.commonBubbles
}
}
}

private extension AppAppearance {
var name: String {
switch self {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ struct VoiceMessageRoomTimelineView_Previews: PreviewProvider, TestablePreview {
static var previews: some View {
body.environmentObject(viewModel.context)
.previewDisplayName("Bubble")
body
.environment(\.timelineStyle, .plain)
.environmentObject(viewModel.context)
.previewDisplayName("Plain")
}

static var body: some View {
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Loading

0 comments on commit 45bd554

Please sign in to comment.