mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +00:00
Room list notifications tweaks (#6106)
We decided against changing how unread activity is rendered in the room list, so the experiment and its developer option are no longer needed. we have also added a notification settings entry for hiding the room list gray dots.
This commit is contained in:
@@ -104,8 +104,6 @@ struct HomeScreenViewState: BindableState {
|
||||
|
||||
var hideInviteAvatars = false
|
||||
|
||||
var roomListActivityVisibility: RoomListActivityVisibility = .current
|
||||
|
||||
var reportRoomEnabled = false
|
||||
|
||||
var shouldShowSpaceFilters = false
|
||||
@@ -199,8 +197,6 @@ struct HomeScreenRoom: Identifiable, Equatable {
|
||||
let callBadgeType: CallBadgeType
|
||||
}
|
||||
|
||||
var hasUnreads = false
|
||||
|
||||
let name: String
|
||||
|
||||
let isDirect: Bool
|
||||
@@ -255,16 +251,15 @@ struct HomeScreenRoom: Identifiable, Equatable {
|
||||
|
||||
extension HomeScreenRoom {
|
||||
init(summary: RoomSummary,
|
||||
roomListActivityVisibility: RoomListActivityVisibility = .current,
|
||||
showAllActivity: Bool = true,
|
||||
seenInvites: Set<String> = []) {
|
||||
let roomID = summary.id
|
||||
|
||||
let isUnseenInvite = summary.joinRequestType?.isInvite == true && !seenInvites.contains(roomID)
|
||||
|
||||
let isDotShown = switch roomListActivityVisibility {
|
||||
case .current:
|
||||
let isDotShown = if showAllActivity {
|
||||
summary.hasUnreadMessages || summary.hasUnreadMentions || summary.hasUnreadNotifications || summary.isMarkedUnread || isUnseenInvite
|
||||
case .hide, .show:
|
||||
} else {
|
||||
(!summary.isMuted && (summary.hasUnreadNotifications || summary.hasUnreadMentions)) || summary.isMarkedUnread || isUnseenInvite
|
||||
}
|
||||
|
||||
@@ -292,7 +287,6 @@ extension HomeScreenRoom {
|
||||
isMentionShown: isMentionShown,
|
||||
isMuteShown: isMuteShown,
|
||||
callBadgeType: callBadge),
|
||||
hasUnreads: summary.hasUnreadMessages,
|
||||
name: summary.name,
|
||||
isDirect: summary.isDirect,
|
||||
isHighlighted: isHighlighted,
|
||||
|
||||
@@ -113,9 +113,9 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
|
||||
.weakAssign(to: \.state.selectedRoomID, on: self)
|
||||
.store(in: &cancellables)
|
||||
|
||||
appSettings.roomListActivityVisibilityPublisher
|
||||
.sink { [weak self] value in
|
||||
self?.state.roomListActivityVisibility = value
|
||||
appSettings.showAllRoomListActivityPublisher
|
||||
.removeDuplicates()
|
||||
.sink { [weak self] _ in
|
||||
self?.updateRooms()
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
@@ -376,7 +376,7 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
|
||||
|
||||
for summary in roomSummaryProvider.roomListPublisher.value {
|
||||
let room = HomeScreenRoom(summary: summary,
|
||||
roomListActivityVisibility: appSettings.roomListActivityVisibility,
|
||||
showAllActivity: appSettings.showAllRoomListActivity,
|
||||
seenInvites: seenInvites)
|
||||
rooms.append(room)
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ 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
|
||||
@@ -82,7 +81,7 @@ struct HomeScreenRoomCell: View {
|
||||
Text(String(statusEmoji))
|
||||
}
|
||||
}
|
||||
.font(headerFont)
|
||||
.font(.compound.bodyLGSemibold)
|
||||
.foregroundColor(.compound.textPrimary)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
|
||||
@@ -94,17 +93,6 @@ struct HomeScreenRoomCell: View {
|
||||
}
|
||||
}
|
||||
|
||||
private var headerFont: Font {
|
||||
switch roomListActivityVisibility {
|
||||
case .current:
|
||||
.compound.bodyLGSemibold
|
||||
case .show:
|
||||
room.hasUnreads ? .compound.bodyLGSemibold : .compound.bodyLG
|
||||
case .hide:
|
||||
room.isHighlighted ? .compound.bodyLGSemibold : .compound.bodyLG
|
||||
}
|
||||
}
|
||||
|
||||
private var footer: some View {
|
||||
HStack(alignment: .firstTextBaseline, spacing: 0) {
|
||||
ZStack(alignment: .topLeading) {
|
||||
@@ -190,21 +178,10 @@ struct HomeScreenRoomCell: View {
|
||||
private var lastMessage: some View {
|
||||
if let displayedLastMessage = room.displayedLastMessage {
|
||||
Text(displayedLastMessage)
|
||||
.font(lastMessageFont)
|
||||
.font(.compound.bodyMD)
|
||||
.lastMessageFormatting(hasFailed: room.lastMessageState == .failed)
|
||||
}
|
||||
}
|
||||
|
||||
private var lastMessageFont: Font {
|
||||
switch roomListActivityVisibility {
|
||||
case .current:
|
||||
.compound.bodyMD
|
||||
case .show:
|
||||
room.hasUnreads ? .compound.bodyMDSemibold : .compound.bodyMD
|
||||
case .hide:
|
||||
room.isHighlighted ? .compound.bodyMDSemibold : .compound.bodyMD
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct HomeScreenRoomCellButtonStyle: ButtonStyle {
|
||||
|
||||
@@ -36,7 +36,6 @@ struct HomeScreenRoomList: View {
|
||||
let isSelected = context.viewState.selectedRoomID == room.id
|
||||
|
||||
HomeScreenRoomCell(room: room,
|
||||
roomListActivityVisibility: context.viewState.roomListActivityVisibility,
|
||||
isSelected: isSelected,
|
||||
mediaProvider: context.mediaProvider,
|
||||
action: context.send)
|
||||
|
||||
Reference in New Issue
Block a user