use theme color for message info screen

pull/874/head
Ryan Zhao 2 years ago
parent 42578623d9
commit 1a22bd07ef

@ -26,11 +26,19 @@ struct MessageInfoView: View {
) { ) {
// Message bubble snapshot // Message bubble snapshot
if let body: String = messageViewModel.body { if let body: String = messageViewModel.body {
let (bubbleBackgroundColor, bubbleTextColor): (ThemeValue, ThemeValue) = (
messageViewModel.variant == .standardIncoming ||
messageViewModel.variant == .standardIncomingDeleted
) ?
(.messageBubble_incomingBackground, .messageBubble_incomingText) :
(.messageBubble_outgoingBackground, .messageBubble_outgoingText)
ZStack { ZStack {
RoundedRectangle(cornerRadius: 18) RoundedRectangle(cornerRadius: 18)
.fill(Color(red: 49.0/255, green: 241.0/255, blue: 150.0/255)) .fill(themeColor: bubbleBackgroundColor)
Text(body) Text(body)
.foregroundColor(themeColor: bubbleTextColor)
.padding( .padding(
EdgeInsets( EdgeInsets(
top: 8, top: 8,
@ -67,14 +75,14 @@ struct MessageInfoView: View {
Image(uiImage: image) Image(uiImage: image)
.resizable() .resizable()
.scaledToFit() .scaledToFit()
.foregroundColor(.red) .foregroundColor(themeColor: tintColor)
.frame(width: 13, height: 12) .frame(width: 13, height: 12)
} }
if let statusText: String = statusText { if let statusText: String = statusText {
Text(statusText) Text(statusText)
.font(.system(size: 11)) .font(.system(size: 11))
.foregroundColor(.red) .foregroundColor(themeColor: tintColor)
} }
} }
.padding( .padding(
@ -116,7 +124,7 @@ struct MessageInfoView: View {
InfoBlock(title: "ATTACHMENT_INFO_FILE_ID".localized() + ":") { InfoBlock(title: "ATTACHMENT_INFO_FILE_ID".localized() + ":") {
Text("12378965485235985214") Text("12378965485235985214")
.font(.system(size: 16)) .font(.system(size: 16))
.foregroundColor(.white) .foregroundColor(themeColor: .textPrimary)
} }
HStack( HStack(
@ -125,7 +133,7 @@ struct MessageInfoView: View {
InfoBlock(title: "ATTACHMENT_INFO_FILE_TYPE".localized() + ":") { InfoBlock(title: "ATTACHMENT_INFO_FILE_TYPE".localized() + ":") {
Text(".PNG") Text(".PNG")
.font(.system(size: 16)) .font(.system(size: 16))
.foregroundColor(.white) .foregroundColor(themeColor: .textPrimary)
} }
Spacer() Spacer()
@ -133,7 +141,7 @@ struct MessageInfoView: View {
InfoBlock(title: "ATTACHMENT_INFO_FILE_SIZE".localized() + ":") { InfoBlock(title: "ATTACHMENT_INFO_FILE_SIZE".localized() + ":") {
Text("6mb") Text("6mb")
.font(.system(size: 16)) .font(.system(size: 16))
.foregroundColor(.white) .foregroundColor(themeColor: .textPrimary)
} }
Spacer() Spacer()
@ -145,7 +153,7 @@ struct MessageInfoView: View {
InfoBlock(title: "ATTACHMENT_INFO_RESOLUTION".localized() + ":") { InfoBlock(title: "ATTACHMENT_INFO_RESOLUTION".localized() + ":") {
Text("550×550") Text("550×550")
.font(.system(size: 16)) .font(.system(size: 16))
.foregroundColor(.white) .foregroundColor(themeColor: .textPrimary)
} }
Spacer() Spacer()
@ -153,7 +161,7 @@ struct MessageInfoView: View {
InfoBlock(title: "ATTACHMENT_INFO_DURATION".localized() + ":") { InfoBlock(title: "ATTACHMENT_INFO_DURATION".localized() + ":") {
Text("N/A") Text("N/A")
.font(.system(size: 16)) .font(.system(size: 16))
.foregroundColor(.white) .foregroundColor(themeColor: .textPrimary)
} }
Spacer() Spacer()
@ -188,7 +196,7 @@ struct MessageInfoView: View {
// Message Info // Message Info
ZStack { ZStack {
RoundedRectangle(cornerRadius: 17) RoundedRectangle(cornerRadius: 17)
.fill(Color(red: 27.0/255, green: 27.0/255, blue: 27.0/255)) .fill(themeColor: .backgroundSecondary)
VStack( VStack(
alignment: .leading, alignment: .leading,
@ -197,13 +205,13 @@ struct MessageInfoView: View {
InfoBlock(title: "Sent:") { InfoBlock(title: "Sent:") {
Text(messageViewModel.dateForUI.fromattedForMessageInfo) Text(messageViewModel.dateForUI.fromattedForMessageInfo)
.font(.system(size: 16)) .font(.system(size: 16))
.foregroundColor(.white) .foregroundColor(themeColor: .textPrimary)
} }
InfoBlock(title: "Received:") { InfoBlock(title: "Received:") {
Text(messageViewModel.receivedDateForUI.fromattedForMessageInfo) Text(messageViewModel.receivedDateForUI.fromattedForMessageInfo)
.font(.system(size: 16)) .font(.system(size: 16))
.foregroundColor(.white) .foregroundColor(themeColor: .textPrimary)
} }
if isMessageFailed { if isMessageFailed {
@ -211,7 +219,7 @@ struct MessageInfoView: View {
InfoBlock(title: "Error:") { InfoBlock(title: "Error:") {
Text(failureText) Text(failureText)
.font(.system(size: 16)) .font(.system(size: 16))
.foregroundColor(.red) .foregroundColor(themeColor: .danger)
} }
} }
@ -225,7 +233,7 @@ struct MessageInfoView: View {
height: 46, height: 46,
alignment: .topLeading alignment: .topLeading
) )
.foregroundColor(Color(red: 49.0/255, green: 241.0/255, blue: 150.0/255)) .foregroundColor(themeColor: .primary)
// ProfilePictureSwiftUI(size: .message) // ProfilePictureSwiftUI(size: .message)
@ -236,10 +244,10 @@ struct MessageInfoView: View {
Text(messageViewModel.senderName ?? "Tester") Text(messageViewModel.senderName ?? "Tester")
.bold() .bold()
.font(.system(size: 18)) .font(.system(size: 18))
.foregroundColor(.white) .foregroundColor(themeColor: .textPrimary)
Text(messageViewModel.authorId) Text(messageViewModel.authorId)
.font(.system(size: 16)) .font(.system(size: 16))
.foregroundColor(.white) .foregroundColor(themeColor: .textPrimary)
} }
} }
} }
@ -273,7 +281,7 @@ struct MessageInfoView: View {
if !actions.isEmpty { if !actions.isEmpty {
ZStack { ZStack {
RoundedRectangle(cornerRadius: 17) RoundedRectangle(cornerRadius: 17)
.fill(Color(red: 27.0/255, green: 27.0/255, blue: 27.0/255)) .fill(themeColor: .backgroundSecondary)
VStack( VStack(
alignment: .leading, alignment: .leading,
@ -283,17 +291,17 @@ struct MessageInfoView: View {
0...(actions.count - 1), 0...(actions.count - 1),
id: \.self id: \.self
) { index in ) { index in
let tintColor: Color = actions[index].isDestructive ? .red : .white let tintColor: ThemeValue = actions[index].isDestructive ? .danger : .textPrimary
HStack(spacing: 24) { HStack(spacing: 24) {
Image(uiImage: actions[index].icon!.withRenderingMode(.alwaysTemplate)) Image(uiImage: actions[index].icon!.withRenderingMode(.alwaysTemplate))
.resizable() .resizable()
.scaledToFit() .scaledToFit()
.foregroundColor(tintColor) .foregroundColor(themeColor: tintColor)
.frame(width: 26, height: 26) .frame(width: 26, height: 26)
Text(actions[index].title) Text(actions[index].title)
.bold() .bold()
.font(.system(size: 18)) .font(.system(size: 18))
.foregroundColor(tintColor) .foregroundColor(themeColor: tintColor)
} }
.frame(width: .infinity, height: 60) .frame(width: .infinity, height: 60)
.onTapGesture { .onTapGesture {
@ -302,7 +310,7 @@ struct MessageInfoView: View {
if index < (actions.count - 1) { if index < (actions.count - 1) {
Divider() Divider()
.foregroundColor(.gray) .foregroundColor(themeColor: .borderSeparator)
} }
} }
} }
@ -349,7 +357,7 @@ struct InfoBlock<Content>: View where Content: View {
Text(self.title) Text(self.title)
.bold() .bold()
.font(.system(size: 18)) .font(.system(size: 18))
.foregroundColor(.white) .foregroundColor(themeColor: .textPrimary)
self.content() self.content()
} }
.frame( .frame(

@ -3,9 +3,17 @@
import SwiftUI import SwiftUI
public extension View { public extension View {
func themeForegroundColor(themeColor: ThemeValue) -> some View { func foregroundColor(themeColor: ThemeValue) -> some View {
return self.foregroundColor( return self.foregroundColor(
Color(.white) ThemeManager.currentTheme.colorSwiftUI(for: themeColor)
)
}
}
public extension Shape {
func fill(themeColor: ThemeValue) -> some View {
return self.fill(
ThemeManager.currentTheme.colorSwiftUI(for: themeColor) ?? Color.primary
) )
} }
} }

@ -176,3 +176,7 @@ internal extension Color {
static let oceanLight6: Color = Color(#colorLiteral(red: 0.9254901961, green: 0.9803921569, blue: 0.9843137255, alpha: 1)) // #ECFAFB static let oceanLight6: Color = Color(#colorLiteral(red: 0.9254901961, green: 0.9803921569, blue: 0.9843137255, alpha: 1)) // #ECFAFB
static let oceanLight7: Color = Color(#colorLiteral(red: 0.9882352941, green: 1, blue: 1, alpha: 1)) // #FCFFFF static let oceanLight7: Color = Color(#colorLiteral(red: 0.9882352941, green: 1, blue: 1, alpha: 1)) // #FCFFFF
} }
public extension Color {
static let primary: Color = ThemeManager.primaryColor.colorSwiftUI
}

Loading…
Cancel
Save