From 2cbcebe0b99f8836d7367ca122f5986e5ae18b24 Mon Sep 17 00:00:00 2001 From: Djorkaeff Alexandre Date: Thu, 21 Mar 2024 08:16:16 -0300 Subject: [PATCH] Update colors --- .../Extensions/Color+Extensions.swift | 27 +++++++++++++++++++ .../Views/AttachmentView.swift | 2 +- .../Views/MessageView.swift | 8 +++--- ios/RocketChat Watch App/Views/RoomView.swift | 8 +++--- .../Views/ServerView.swift | 4 +-- ios/RocketChatRN.xcodeproj/project.pbxproj | 6 +++++ 6 files changed, 45 insertions(+), 10 deletions(-) create mode 100644 ios/RocketChat Watch App/Extensions/Color+Extensions.swift diff --git a/ios/RocketChat Watch App/Extensions/Color+Extensions.swift b/ios/RocketChat Watch App/Extensions/Color+Extensions.swift new file mode 100644 index 000000000..95bc5c918 --- /dev/null +++ b/ios/RocketChat Watch App/Extensions/Color+Extensions.swift @@ -0,0 +1,27 @@ +import SwiftUI + +extension Color { + static var titleLabels: Color { + Color(hex: 0xF2F3F5) + } + + static var `default`: Color { + Color(hex: 0xE4E7EA) + } + + static var secondaryInfo: Color { + Color(hex: 0x9EA2A8) + } +} + +private extension Color { + init(hex: UInt, alpha: Double = 1) { + self.init( + .sRGB, + red: Double((hex >> 16) & 0xff) / 255, + green: Double((hex >> 08) & 0xff) / 255, + blue: Double((hex >> 00) & 0xff) / 255, + opacity: alpha + ) + } +} diff --git a/ios/RocketChat Watch App/Views/AttachmentView.swift b/ios/RocketChat Watch App/Views/AttachmentView.swift index 8f1a66e16..03e83f0a7 100644 --- a/ios/RocketChat Watch App/Views/AttachmentView.swift +++ b/ios/RocketChat Watch App/Views/AttachmentView.swift @@ -26,7 +26,7 @@ struct AttachmentView: View { } else { Text("Attachment not supported.") .font(.caption.italic()) - .foregroundStyle(.primary) + .foregroundStyle(Color.secondaryInfo) } } } diff --git a/ios/RocketChat Watch App/Views/MessageView.swift b/ios/RocketChat Watch App/Views/MessageView.swift index 52363823c..07a8be6b9 100644 --- a/ios/RocketChat Watch App/Views/MessageView.swift +++ b/ios/RocketChat Watch App/Views/MessageView.swift @@ -65,7 +65,7 @@ struct MessageView: View { Text(viewModel.sender ?? "") .lineLimit(1) .font(.caption.bold()) - .foregroundStyle(.primary) + .foregroundStyle(Color.default) Text(viewModel.time ?? "") .lineLimit(1) .font(.footnote) @@ -76,15 +76,16 @@ struct MessageView: View { .foregroundStyle(.secondary) } } + .padding(.bottom, 4) } if let text = viewModel.info { (Text("\(viewModel.sender ?? "") ").font(.caption.bold().italic()) + Text(text).font(.caption.italic())) - .foregroundStyle(.primary) + .foregroundStyle(Color.default) } else if let text = viewModel.message.msg { HStack(alignment: .top) { Text(text) .font(.caption) - .foregroundStyle(viewModel.message.status == "temp" ? .secondary : .primary) + .foregroundStyle(viewModel.message.status == "temp" ? Color.secondaryInfo : Color.default) if viewModel.message.status == "error" { Button( @@ -113,6 +114,7 @@ struct MessageView: View { } } } + .padding(.top, 8) .sheet(item: $message) { message in MessageActionView( message: message, diff --git a/ios/RocketChat Watch App/Views/RoomView.swift b/ios/RocketChat Watch App/Views/RoomView.swift index 2dbb539ec..65b8863f4 100644 --- a/ios/RocketChat Watch App/Views/RoomView.swift +++ b/ios/RocketChat Watch App/Views/RoomView.swift @@ -19,18 +19,18 @@ struct RoomView: View { Text(viewModel.title ?? "") .lineLimit(1) .font(.caption.weight(isUnread ? .bold : .medium)) - .foregroundStyle(.primary) + .foregroundStyle(Color.default) Spacer() Text(viewModel.updatedAt ?? "") .lineLimit(1) .font(.footnote.weight(isUnread ? .bold : .medium)) - .foregroundStyle(isUnread ? .blue : .primary) + .foregroundStyle(isUnread ? .blue : Color.default) } HStack(alignment: .top) { Text(viewModel.lastMessage) .lineLimit(2) .font(.caption2) - .foregroundStyle(isUnread ? .primary : .secondary) + .foregroundStyle(isUnread ? Color.titleLabels : Color.default) Spacer() if isUnread, viewModel.room.unread > 0 { Text(String(viewModel.room.unread)) @@ -40,7 +40,7 @@ struct RoomView: View { Circle() .fill(.blue) ) - .foregroundColor(.primary) + .foregroundColor(Color.default) } } } diff --git a/ios/RocketChat Watch App/Views/ServerView.swift b/ios/RocketChat Watch App/Views/ServerView.swift index 8100cbb24..274bab1f5 100644 --- a/ios/RocketChat Watch App/Views/ServerView.swift +++ b/ios/RocketChat Watch App/Views/ServerView.swift @@ -7,10 +7,10 @@ struct ServerView: View { VStack(alignment: .leading) { Text(server.name) .font(.caption.bold()) - .foregroundStyle(.primary) + .foregroundStyle(Color.titleLabels) Text(server.url.host ?? "") .font(.caption) - .foregroundStyle(.primary) + .foregroundStyle(Color.default) } } } diff --git a/ios/RocketChatRN.xcodeproj/project.pbxproj b/ios/RocketChatRN.xcodeproj/project.pbxproj index 33f9bf9ca..6b349ef7e 100644 --- a/ios/RocketChatRN.xcodeproj/project.pbxproj +++ b/ios/RocketChatRN.xcodeproj/project.pbxproj @@ -101,6 +101,8 @@ 1E638E992B5F0A2900E645E4 /* ChatScrollView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E638E982B5F0A2900E645E4 /* ChatScrollView.swift */; }; 1E638E9E2B5F0F5800E645E4 /* URL+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E638E9D2B5F0F5800E645E4 /* URL+Extensions.swift */; }; 1E67380424DC529B0009E081 /* String+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E67380324DC529B0009E081 /* String+Extensions.swift */; }; + 1E675B722BAC49B000438590 /* Color+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E675B712BAC49B000438590 /* Color+Extensions.swift */; }; + 1E675B732BAC49B000438590 /* Color+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E675B712BAC49B000438590 /* Color+Extensions.swift */; }; 1E680ED92512990700C9257A /* Request.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E680ED82512990700C9257A /* Request.swift */; }; 1E6CC61F2513DBF400965591 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 7A006F13229C83B600803143 /* GoogleService-Info.plist */; }; 1E76CBC2251529560067298C /* Storage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EB8EF712510F1EE00F352B7 /* Storage.swift */; }; @@ -518,6 +520,7 @@ 1E638E9D2B5F0F5800E645E4 /* URL+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "URL+Extensions.swift"; sourceTree = ""; }; 1E6737FF24DC52660009E081 /* NotificationService-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NotificationService-Bridging-Header.h"; sourceTree = ""; }; 1E67380324DC529B0009E081 /* String+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Extensions.swift"; sourceTree = ""; }; + 1E675B712BAC49B000438590 /* Color+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Color+Extensions.swift"; sourceTree = ""; }; 1E680ED82512990700C9257A /* Request.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Request.swift; sourceTree = ""; }; 1E8979462B6063FC001D99F0 /* WatchSession.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WatchSession.swift; sourceTree = ""; }; 1E9A71682B59B6E100477BA2 /* MessageSender.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageSender.swift; sourceTree = ""; }; @@ -804,6 +807,7 @@ isa = PBXGroup; children = ( 1E29A31C2B5871B60093C03C /* Date+Extensions.swift */, + 1E675B712BAC49B000438590 /* Color+Extensions.swift */, ); path = Extensions; sourceTree = ""; @@ -2094,6 +2098,7 @@ 1EDFD1062B58A66E002FEE5F /* CancelBag.swift in Sources */, 1E29A2FF2B585B070093C03C /* TokenAdapter.swift in Sources */, 1E29A3052B585B070093C03C /* Request.swift in Sources */, + 1E675B722BAC49B000438590 /* Color+Extensions.swift in Sources */, 1E9A71772B59FCA900477BA2 /* URLSessionCertificateHandling.swift in Sources */, 1E388AC12B934CD4006FBDB0 /* RemoteImage.swift in Sources */, 1E388ABE2B934C64006FBDB0 /* ImageLoader.swift in Sources */, @@ -2173,6 +2178,7 @@ 1ED1ECB62B86997F00F6620C /* CancelBag.swift in Sources */, 1ED1ECB72B86997F00F6620C /* TokenAdapter.swift in Sources */, 1ED1ECB82B86997F00F6620C /* Request.swift in Sources */, + 1E675B732BAC49B000438590 /* Color+Extensions.swift in Sources */, 1ED1ECB92B86997F00F6620C /* URLSessionCertificateHandling.swift in Sources */, 1E388AC22B934CD4006FBDB0 /* RemoteImage.swift in Sources */, 1E388ABF2B934C64006FBDB0 /* ImageLoader.swift in Sources */,