minor refactor on background

pull/874/head
Ryan ZHAO 2 years ago
parent 16fbffd3d5
commit 20db5a48a3

@ -21,9 +21,6 @@ struct DocumentView_SwiftUI: View {
spacing: 0
) {
ZStack {
Rectangle()
.foregroundColor(themeColor: .messageBubble_overlay)
Image(systemName: "doc")
.font(.system(size: Values.largeFontSize))
.foregroundColor(themeColor: textColor)
@ -45,6 +42,7 @@ struct DocumentView_SwiftUI: View {
width: 24 + Values.mediumSpacing * 2,
height: 32 + Values.smallSpacing * 2
)
.background(themeColor: .messageBubble_overlay)
VStack(
alignment: .leading

@ -70,25 +70,18 @@ public struct LinkPreviewView_SwiftUI: View {
state is LinkPreview.DraftState || state is LinkPreview.SentState,
let defaultImage: UIImage = UIImage(named: "Link")?.withRenderingMode(.alwaysTemplate)
{
ZStack {
if #available(iOS 14.0, *) {
ThemeManager.currentTheme.colorSwiftUI(for: .messageBubble_overlay).ignoresSafeArea()
} else {
ThemeManager.currentTheme.colorSwiftUI(for: .messageBubble_overlay)
}
Image(uiImage: defaultImage)
.foregroundColor(
themeColor: isOutgoing ?
.messageBubble_outgoingText :
.messageBubble_incomingText
)
.cornerRadius(state is LinkPreview.SentState ? 0 : 8)
}
.frame(
width: imageSize,
height: imageSize
)
Image(uiImage: defaultImage)
.foregroundColor(
themeColor: isOutgoing ?
.messageBubble_outgoingText :
.messageBubble_incomingText
)
.frame(
width: imageSize,
height: imageSize
)
.background(themeColor: .messageBubble_overlay)
.cornerRadius(state is LinkPreview.SentState ? 0 : 8)
} else {
ActivityIndicator(themeColor: .borderSeparator, width: 2)
.frame(

@ -96,16 +96,17 @@ struct QuoteView_SwiftUI: View {
}
let fallbackImageName: String = (MIMETypeUtil.isAudio(attachment.contentType) ? "attachment_audio" : "actionsheet_document_black")
return UIImage(named: fallbackImageName)?.withRenderingMode(.alwaysTemplate)
return UIImage(named: fallbackImageName)?
.resizedImage(to: CGSize(width: Self.iconSize, height: Self.iconSize))?
.withRenderingMode(.alwaysTemplate)
}() {
Image(uiImage: image)
.resizable()
.foregroundColor(themeColor: {
switch info.mode {
case .regular: return (info.direction == .outgoing ?
.messageBubble_outgoingText :
.messageBubble_incomingText
)
case .regular: return (info.direction == .outgoing ?
.messageBubble_outgoingText :
.messageBubble_incomingText
)
case .draft: return .textPrimary
}
}())
@ -114,6 +115,7 @@ struct QuoteView_SwiftUI: View {
height: Self.thumbnailSize,
alignment: .center
)
.background(themeColor: .messageBubble_overlay)
.cornerRadius(Self.cornerRadius)
}
} else {

@ -47,11 +47,13 @@ struct VoiceMessageView_SwiftUI: View {
)
}
// ActivityIndicator(themeColor: .textPrimary, width: 2)
// .frame(
// width: Self.toggleContainerSize,
// height: Self.toggleContainerSize
// )
if attachment.state == .downloading {
ActivityIndicator(themeColor: .textPrimary, width: 2)
.frame(
width: Self.toggleContainerSize,
height: Self.toggleContainerSize
)
}
}
Rectangle()

@ -137,9 +137,6 @@ struct MessageInfoView: View {
// Attachment Info
ZStack {
RoundedRectangle(cornerRadius: Self.cornerRadius)
.fill(themeColor: .backgroundSecondary)
VStack(
alignment: .leading,
spacing: Values.mediumSpacing
@ -205,6 +202,8 @@ struct MessageInfoView: View {
.padding(.all, Values.largeSpacing)
}
.frame(maxHeight: .infinity)
.background(themeColor: .backgroundSecondary)
.cornerRadius(Self.cornerRadius)
.fixedSize(horizontal: false, vertical: true)
.padding(.vertical, Values.verySmallSpacing)
.padding(.horizontal, Values.largeSpacing)
@ -212,9 +211,6 @@ struct MessageInfoView: View {
// Message Info
ZStack {
RoundedRectangle(cornerRadius: Self.cornerRadius)
.fill(themeColor: .backgroundSecondary)
VStack(
alignment: .leading,
spacing: Values.mediumSpacing
@ -293,6 +289,8 @@ struct MessageInfoView: View {
.padding(.all, Values.largeSpacing)
}
.frame(maxHeight: .infinity)
.background(themeColor: .backgroundSecondary)
.cornerRadius(Self.cornerRadius)
.fixedSize(horizontal: false, vertical: true)
.padding(.vertical, Values.verySmallSpacing)
.padding(.horizontal, Values.largeSpacing)
@ -300,9 +298,6 @@ struct MessageInfoView: View {
// Actions
if !actions.isEmpty {
ZStack {
RoundedRectangle(cornerRadius: Self.cornerRadius)
.fill(themeColor: .backgroundSecondary)
VStack(
alignment: .leading,
spacing: 0
@ -348,6 +343,8 @@ struct MessageInfoView: View {
.padding(.horizontal, Values.largeSpacing)
}
.frame(maxHeight: .infinity)
.background(themeColor: .backgroundSecondary)
.cornerRadius(Self.cornerRadius)
.fixedSize(horizontal: false, vertical: true)
.padding(.vertical, Values.verySmallSpacing)
.padding(.horizontal, Values.largeSpacing)

@ -8,6 +8,12 @@ public extension View {
ThemeManager.currentTheme.colorSwiftUI(for: themeColor)
)
}
func background(themeColor: ThemeValue) -> some View {
return self.background(
ThemeManager.currentTheme.colorSwiftUI(for: themeColor)
)
}
}
public extension Shape {

Loading…
Cancel
Save