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 { #Preview {
static var previews: some View { VStack {
VStack { DocumentView_SwiftUI(
DocumentView_SwiftUI( attachment: Attachment(
attachment: Attachment( variant: .standard,
variant: .standard, contentType: "audio/mp4",
contentType: "audio/mp4", byteCount: 100
byteCount: 100 ),
), textColor: .messageBubble_outgoingText
textColor: .messageBubble_outgoingText )
) .frame(
.frame( width: 200,
width: 200, height: 58
height: 58 )
)
DocumentView_SwiftUI( DocumentView_SwiftUI(
attachment: Attachment( attachment: Attachment(
variant: .standard, variant: .standard,
contentType: "txt", contentType: "txt",
byteCount: 1000 byteCount: 1000
), ),
textColor: .messageBubble_outgoingText textColor: .messageBubble_outgoingText
) )
.frame( .frame(
width: 200, width: 200,
height: 58 height: 58
) )
}
} }
} }

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

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

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

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

@ -207,7 +207,22 @@ struct SessionCarouselView_SwiftUI_Previews: PreviewProvider {
Color.black 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