mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
feat: Render declined calls in DM timeline (#5512)
* feat: Render declined calls in DM timeline * Record preview snapshots * review: Use CallIntent constant * review: clean-up * Record preview snapshots * review: Move private field to the bottom with MARK: - Private * review: Male CallIntent a string enum to use rawValue --------- Co-authored-by: Element CI <ci@element.io>
This commit is contained in:
+4
-1
@@ -14,7 +14,10 @@ struct CallNotificationRoomTimelineItem: RoomTimelineItemProtocol, Equatable {
|
||||
let isEditable: Bool
|
||||
let canBeRepliedTo: Bool
|
||||
|
||||
let sender: TimelineItemSender
|
||||
let isDM: Bool
|
||||
let isDeclinedByMe: Bool
|
||||
let isDeclined: Bool
|
||||
let isVoiceCall: Bool
|
||||
|
||||
var properties = RoomTimelineItemProperties()
|
||||
}
|
||||
|
||||
@@ -69,8 +69,8 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
|
||||
isOutgoing: isOutgoing)
|
||||
case .callInvite:
|
||||
return buildCallInviteTimelineItem(for: eventItemProxy)
|
||||
case .rtcNotification:
|
||||
return buildCallNotificationTimelineItem(for: eventItemProxy)
|
||||
case .rtcNotification(let callIntent, let declinedBy):
|
||||
return buildCallNotificationTimelineItem(for: eventItemProxy, isDM: isDM, callIntent: callIntent, declinedBy: declinedBy)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -771,12 +771,20 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
|
||||
sender: eventItemProxy.sender)
|
||||
}
|
||||
|
||||
private func buildCallNotificationTimelineItem(for eventItemProxy: EventTimelineItemProxy) -> RoomTimelineItemProtocol {
|
||||
CallNotificationRoomTimelineItem(id: eventItemProxy.id,
|
||||
timestamp: eventItemProxy.timestamp,
|
||||
isEditable: eventItemProxy.isEditable,
|
||||
canBeRepliedTo: eventItemProxy.canBeRepliedTo,
|
||||
sender: eventItemProxy.sender)
|
||||
private func buildCallNotificationTimelineItem(for eventItemProxy: EventTimelineItemProxy,
|
||||
isDM: Bool,
|
||||
callIntent: String?,
|
||||
declinedBy: [String]) -> RoomTimelineItemProtocol {
|
||||
let isVoiceCall = callIntent == CallIntent.audio.rawValue
|
||||
return CallNotificationRoomTimelineItem(id: eventItemProxy.id,
|
||||
timestamp: eventItemProxy.timestamp,
|
||||
isEditable: eventItemProxy.isEditable,
|
||||
canBeRepliedTo: eventItemProxy.canBeRepliedTo,
|
||||
isDM: isDM,
|
||||
isDeclinedByMe: declinedBy.contains(userID),
|
||||
isDeclined: declinedBy.count > 0,
|
||||
isVoiceCall: isVoiceCall,
|
||||
properties: .init())
|
||||
}
|
||||
|
||||
// MARK: - State Events
|
||||
|
||||
Reference in New Issue
Block a user