mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-05 11:58:32 +00:00
Notification Decoration Revised (#5312)
1. I removed the grey dots for when there is activity in rooms set to mentions or mute. 2. For all unread rooms, I made the message preview text bold for better legibility 3. For rooms with no unreads, I made the font weight regular, again for legibility We have also mergeg the new room list activity rendering with the existing feature hide unread badge feature flag and provide 3 variations: current production behavior, no badge but bolding, and no bolding and no badge
This commit is contained in:
@@ -15,6 +15,7 @@ struct HomeScreenRoomCell: View {
|
||||
@Environment(\.redactionReasons) private var redactionReasons
|
||||
|
||||
let room: HomeScreenRoom
|
||||
var roomListActivityVisibility: RoomListActivityVisibility = .current
|
||||
let isSelected: Bool
|
||||
let mediaProvider: MediaProviderProtocol!
|
||||
let action: (HomeScreenViewAction) -> Void
|
||||
@@ -74,7 +75,7 @@ struct HomeScreenRoomCell: View {
|
||||
private var header: some View {
|
||||
HStack(alignment: .top, spacing: 16) {
|
||||
Text(room.name)
|
||||
.font(.compound.bodyLGSemibold)
|
||||
.font(headerFont)
|
||||
.foregroundColor(.compound.textPrimary)
|
||||
.lineLimit(1)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
@@ -87,6 +88,17 @@ struct HomeScreenRoomCell: View {
|
||||
}
|
||||
}
|
||||
|
||||
private var headerFont: Font {
|
||||
switch roomListActivityVisibility {
|
||||
case .current:
|
||||
.compound.bodyLGSemibold
|
||||
case .show:
|
||||
room.hasUnreads ? .compound.bodyLGSemibold : .compound.bodyLG
|
||||
case .hide:
|
||||
.compound.bodyLG
|
||||
}
|
||||
}
|
||||
|
||||
private var footer: some View {
|
||||
HStack(alignment: .firstTextBaseline, spacing: 0) {
|
||||
ZStack(alignment: .topLeading) {
|
||||
@@ -157,6 +169,7 @@ struct HomeScreenRoomCell: View {
|
||||
private var lastMessage: some View {
|
||||
if let displayedLastMessage = room.displayedLastMessage {
|
||||
Text(displayedLastMessage)
|
||||
.font(roomListActivityVisibility == .show ? (room.hasUnreads ? .compound.bodyMDSemibold : .compound.bodyMD) : .compound.bodyMD)
|
||||
.lastMessageFormatting(hasFailed: room.lastMessageState == .failed)
|
||||
}
|
||||
}
|
||||
@@ -175,8 +188,7 @@ struct HomeScreenRoomCellButtonStyle: ButtonStyle {
|
||||
|
||||
private extension View {
|
||||
func lastMessageFormatting(hasFailed: Bool) -> some View {
|
||||
font(.compound.bodyMD)
|
||||
.foregroundColor(hasFailed ? .compound.textCriticalPrimary : .compound.textSecondary)
|
||||
foregroundColor(hasFailed ? .compound.textCriticalPrimary : .compound.textSecondary)
|
||||
.lineLimit(2)
|
||||
.multilineTextAlignment(.leading)
|
||||
}
|
||||
@@ -224,7 +236,7 @@ struct HomeScreenRoomCell_Previews: PreviewProvider, TestablePreview {
|
||||
}
|
||||
|
||||
static func mockRoom(summary: RoomSummary) -> HomeScreenRoom? {
|
||||
HomeScreenRoom(summary: summary, hideUnreadMessagesBadge: false)
|
||||
HomeScreenRoom(summary: summary)
|
||||
}
|
||||
|
||||
static func makeViewModel(roomSummaryProvider: RoomSummaryProviderProtocol) -> HomeScreenViewModel {
|
||||
@@ -263,6 +275,6 @@ struct HomeScreenRoomCell_Previews: PreviewProvider, TestablePreview {
|
||||
isFavourite: false,
|
||||
isTombstoned: false)
|
||||
|
||||
return .init(summary: summary, hideUnreadMessagesBadge: false)
|
||||
return .init(summary: summary)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user