mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +00:00
Display whether a call is ongoing in any particular room on the room list
This commit is contained in:
committed by
Stefan Ceriu
parent
2e1b4cb80b
commit
5c4e0bd76d
@@ -124,6 +124,8 @@ struct HomeScreenRoom: Identifiable, Equatable {
|
||||
|
||||
var hasUnreads = false
|
||||
|
||||
var hasOngoingCall = false
|
||||
|
||||
var timestamp: String?
|
||||
|
||||
var lastMessage: AttributedString?
|
||||
@@ -132,12 +134,6 @@ struct HomeScreenRoom: Identifiable, Equatable {
|
||||
|
||||
var notificationMode: RoomNotificationModeProxy?
|
||||
|
||||
var hasDecoration: Bool {
|
||||
// notification setting is displayed only for .mentionsAndKeywords and .mute
|
||||
let showNotificationSettings = notificationMode != nil
|
||||
return hasUnreads || showNotificationSettings
|
||||
}
|
||||
|
||||
var isPlaceholder = false
|
||||
|
||||
static func placeholder() -> HomeScreenRoom {
|
||||
|
||||
@@ -311,6 +311,7 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
|
||||
roomId: details.id,
|
||||
name: details.name,
|
||||
hasUnreads: details.unreadNotificationCount > 0,
|
||||
hasOngoingCall: details.hasOngoingCall,
|
||||
timestamp: details.lastMessageFormattedTimestamp,
|
||||
lastMessage: details.lastMessage,
|
||||
avatarURL: details.avatarURL,
|
||||
|
||||
@@ -117,6 +117,11 @@ struct HomeScreenRoomCell: View {
|
||||
Spacer()
|
||||
|
||||
HStack(spacing: 8) {
|
||||
if room.hasOngoingCall {
|
||||
CompoundIcon(\.videoCallSolid, size: .xSmall, relativeTo: .compound.bodySM)
|
||||
.foregroundColor(room.hasUnreads ? .compound.iconAccentTertiary : .compound.iconQuaternary)
|
||||
}
|
||||
|
||||
notificationModeIcon
|
||||
.foregroundColor(room.hasUnreads ? .compound.iconAccentTertiary : .compound.iconQuaternary)
|
||||
|
||||
@@ -125,15 +130,7 @@ struct HomeScreenRoomCell: View {
|
||||
.frame(width: 12, height: 12)
|
||||
.foregroundColor(.compound.iconAccentTertiary)
|
||||
}
|
||||
|
||||
if !room.hasDecoration {
|
||||
// Force extra padding between last message text and the right border of the screen if there is no unread dot
|
||||
Circle()
|
||||
.frame(width: 12, height: 12)
|
||||
.hidden()
|
||||
}
|
||||
}
|
||||
.padding(.leading, room.hasDecoration ? 12 : 0)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,6 +202,7 @@ struct HomeScreenRoomCell_Previews: PreviewProvider, TestablePreview {
|
||||
roomId: details.id,
|
||||
name: details.name,
|
||||
hasUnreads: details.unreadNotificationCount > 0,
|
||||
hasOngoingCall: details.hasOngoingCall,
|
||||
timestamp: Date(timeIntervalSinceReferenceDate: 0).formattedMinimal(),
|
||||
lastMessage: details.lastMessage,
|
||||
notificationMode: details.notificationMode)
|
||||
|
||||
Reference in New Issue
Block a user