minor refactor

pull/874/head
Ryan ZHAO 2 years ago
parent 3c5c68f10d
commit 2b42ffd6d4

@ -71,34 +71,32 @@ struct DocumentView_SwiftUI: View {
}
}
struct DocumentView_SwiftUI_Previews: PreviewProvider {
static var previews: some View {
VStack {
DocumentView_SwiftUI(
attachment: Attachment(
variant: .standard,
contentType: "audio/mp4",
byteCount: 100
),
textColor: .messageBubble_outgoingText
)
.frame(
width: 200,
height: 58
)
DocumentView_SwiftUI(
attachment: Attachment(
variant: .standard,
contentType: "txt",
byteCount: 1000
),
textColor: .messageBubble_outgoingText
)
.frame(
width: 200,
height: 58
)
}
#Preview {
VStack {
DocumentView_SwiftUI(
attachment: Attachment(
variant: .standard,
contentType: "audio/mp4",
byteCount: 100
),
textColor: .messageBubble_outgoingText
)
.frame(
width: 200,
height: 58
)
DocumentView_SwiftUI(
attachment: Attachment(
variant: .standard,
contentType: "txt",
byteCount: 1000
),
textColor: .messageBubble_outgoingText
)
.frame(
width: 200,
height: 58
)
}
}

@ -134,30 +134,28 @@ public struct LinkPreviewView_SwiftUI: View {
}
}
struct LinkPreviewView_SwiftUI_Previews: PreviewProvider {
static var previews: some View {
VStack {
LinkPreviewView_SwiftUI(
state: LinkPreview.DraftState(
linkPreviewDraft: .init(
urlString: "https://github.com/oxen-io",
title: "Github - oxen-io/session-ios: A private messenger for iOS.",
jpegImageData: UIImage(named: "AppIcon")?.jpegData(compressionQuality: 1)
)
),
isOutgoing: true
)
.padding(.horizontal, Values.mediumSpacing)
LinkPreviewView_SwiftUI(
state: LinkPreview.LoadingState(),
isOutgoing: true
)
.frame(
width: .infinity,
height: 80
)
.padding(.horizontal, Values.mediumSpacing)
}
#Preview {
VStack {
LinkPreviewView_SwiftUI(
state: LinkPreview.DraftState(
linkPreviewDraft: .init(
urlString: "https://github.com/oxen-io",
title: "Github - oxen-io/session-ios: A private messenger for iOS.",
jpegImageData: UIImage(named: "AppIcon")?.jpegData(compressionQuality: 1)
)
),
isOutgoing: true
)
.padding(.horizontal, Values.mediumSpacing)
LinkPreviewView_SwiftUI(
state: LinkPreview.LoadingState(),
isOutgoing: true
)
.frame(
width: .infinity,
height: 80
)
.padding(.horizontal, Values.mediumSpacing)
}
}

@ -83,13 +83,11 @@ struct OpenGroupInvitationView_SwiftUI: View {
}
}
struct OpenGroupInvitationView_SwiftUI_Previews: PreviewProvider {
static var previews: some View {
OpenGroupInvitationView_SwiftUI(
name: "Session",
url: "http://open.getsession.org/session?public_key=a03c383cf63c3c4efe67acc52112a6dd734b3a946b9545f488aaa93da7991238",
textColor: .messageBubble_outgoingText,
isOutgoing: true
)
}
#Preview {
OpenGroupInvitationView_SwiftUI(
name: "Session",
url: "http://open.getsession.org/session?public_key=a03c383cf63c3c4efe67acc52112a6dd734b3a946b9545f488aaa93da7991238",
textColor: .messageBubble_outgoingText,
isOutgoing: true
)
}

@ -79,9 +79,13 @@ struct VoiceMessageView_SwiftUI: View {
}
}
struct VoiceMessageView_SwiftUI_Previews: PreviewProvider {
static var previews: some View {
VoiceMessageView_SwiftUI(attachment: Attachment(variant: .voiceMessage, contentType: "mp4", byteCount: 100))
.frame(height: 58)
}
#Preview {
VoiceMessageView_SwiftUI(
attachment: Attachment(
variant: .voiceMessage,
contentType: "mp4",
byteCount: 100
)
)
.frame(height: 58)
}

@ -72,14 +72,12 @@ public struct ActivityIndicator: View {
}
}
struct ActivityIndicator_Previews: PreviewProvider {
static var previews: some View {
ActivityIndicator(themeColor: .textPrimary, width: 2)
.frame(
width: 40,
height: 40
)
}
#Preview {
ActivityIndicator(themeColor: .textPrimary, width: 2)
.frame(
width: 40,
height: 40
)
}

@ -207,7 +207,22 @@ struct SessionCarouselView_SwiftUI_Previews: PreviewProvider {
Color.black
}
SessionCarouselView_SwiftUI(index: $index, isOutgoing: true, contentInfos: [])
SessionCarouselView_SwiftUI(
index: $index,
isOutgoing: true,
contentInfos: [
Attachment(
variant: .standard,
contentType: "jpeg",
byteCount: 100
),
Attachment(
variant: .standard,
contentType: "jpeg",
byteCount: 100
)
]
)
}
}
}

Loading…
Cancel
Save