diff --git a/Packages/Conversations/Sources/Conversations/Detail/ConversationDetailView.swift b/Packages/Conversations/Sources/Conversations/Detail/ConversationDetailView.swift index 850b2dcc..9b706e98 100644 --- a/Packages/Conversations/Sources/Conversations/Detail/ConversationDetailView.swift +++ b/Packages/Conversations/Sources/Conversations/Detail/ConversationDetailView.swift @@ -119,12 +119,17 @@ public struct ConversationDetailView: View { } label: { Image(systemName: "plus") } - .padding(.bottom, 6) + .padding(.bottom, 7) TextField("conversations.new.message.placeholder", text: $viewModel.newMessageText, axis: .vertical) - .textFieldStyle(.roundedBorder) .focused($isMessageFieldFocused) .keyboardType(.default) + .backgroundStyle(.thickMaterial) + .padding(6) + .overlay( + RoundedRectangle(cornerRadius: 14) + .stroke(.gray, lineWidth: 1) + ) .font(.scaledBody) if !viewModel.newMessageText.isEmpty { Button { @@ -139,7 +144,7 @@ public struct ConversationDetailView: View { } } .keyboardShortcut(.return, modifiers: .command) - .padding(.bottom, 5) + .padding(.bottom, 6) } } .padding(8) diff --git a/Packages/Conversations/Sources/Conversations/Detail/ConversationMessageView.swift b/Packages/Conversations/Sources/Conversations/Detail/ConversationMessageView.swift index 0ae8d542..f9b4ada7 100644 --- a/Packages/Conversations/Sources/Conversations/Detail/ConversationMessageView.swift +++ b/Packages/Conversations/Sources/Conversations/Detail/ConversationMessageView.swift @@ -66,9 +66,13 @@ struct ConversationMessageView: View { if isOwnMessage { Spacer() } - Text(message.createdAt.asDate, style: .time) - .font(.scaledFootnote) - .foregroundColor(.gray) + Group { + Text(message.createdAt.shortDateFormatted) + + Text(" ") + Text(message.createdAt.asDate, style: .time) + } + .font(.scaledFootnote) + .foregroundColor(.gray) if !isOwnMessage { Spacer() } diff --git a/Packages/Models/Sources/Models/Alias/ServerDate.swift b/Packages/Models/Sources/Models/Alias/ServerDate.swift index fe446f96..99a70b61 100644 --- a/Packages/Models/Sources/Models/Alias/ServerDate.swift +++ b/Packages/Models/Sources/Models/Alias/ServerDate.swift @@ -19,7 +19,8 @@ extension ServerDate { private static var createdAtShortDateFormatted: DateFormatter = { let dateFormatter = DateFormatter() - dateFormatter.dateStyle = .medium + dateFormatter.dateStyle = .short + dateFormatter.timeStyle = .none return dateFormatter }() @@ -32,14 +33,8 @@ extension ServerDate { public var relativeFormatted: String { return Self.createdAtRelativeFormatter.localizedString(for: asDate, relativeTo: Date()) } -} - -extension Calendar { - func numberOfDaysBetween(_ from: Date, and to: Date) -> Int { - let fromDate = startOfDay(for: from) - let toDate = startOfDay(for: to) - let numberOfDays = dateComponents([.day], from: fromDate, to: toDate) - - return numberOfDays.day! + + public var shortDateFormatted: String { + return Self.createdAtShortDateFormatted.string(from: asDate) } }