mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
Periphery cleanup (#5893)
This commit is contained in:
@@ -126,11 +126,6 @@ enum TimelineFixtures {
|
||||
singleMessageChunkProxies.buildRoomTimelineItems()
|
||||
}
|
||||
|
||||
/// A single text item.
|
||||
static var incomingMessage: RoomTimelineItemProtocol {
|
||||
incomingMessageProxy.buildRoomTimelineItem()
|
||||
}
|
||||
|
||||
/// A large chunk of events, containing 40 text items which should fill an iPad
|
||||
/// with enough items so that it won't perform another back pagination.
|
||||
static var largeChunk: [RoomTimelineItemProtocol] {
|
||||
|
||||
@@ -44,7 +44,6 @@ enum TimelineControllerError: Error {
|
||||
/// timeline items, grouping together state events, donating intents to the larger system etc.
|
||||
@MainActor
|
||||
protocol TimelineControllerProtocol: Sendable {
|
||||
var roomID: String { get }
|
||||
var timelineKind: TimelineKind { get }
|
||||
|
||||
/// The currently known items, use only for setting up the intial state.
|
||||
|
||||
@@ -26,6 +26,7 @@ nonisolated enum TimelineItemIdentifier: Hashable {
|
||||
self.init(rustValue.id)
|
||||
}
|
||||
|
||||
// periphery:ignore - might be useful to have
|
||||
var rustValue: TimelineUniqueId {
|
||||
.init(id: value)
|
||||
}
|
||||
@@ -69,6 +70,7 @@ nonisolated enum TimelineItemIdentifier: Hashable {
|
||||
return eventID
|
||||
}
|
||||
|
||||
// periphery:ignore - might be useful to have
|
||||
var transactionID: String? {
|
||||
guard case let .event(_, .transactionID(transactionID)) = self else { return nil }
|
||||
return transactionID
|
||||
|
||||
@@ -205,25 +205,6 @@ private nonisolated extension TimelineItemProxy {
|
||||
}
|
||||
}
|
||||
|
||||
private extension VirtualTimelineItem {
|
||||
var description: String {
|
||||
switch self {
|
||||
case .dateDivider(let timestamp):
|
||||
return "DayDiviver(\(timestamp))"
|
||||
case .readMarker:
|
||||
return "ReadMarker"
|
||||
case .timelineStart:
|
||||
return "TimelineStart"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private extension Array where Element == TimelineDiff {
|
||||
var debugDescription: String {
|
||||
"[" + map(\.debugDescription).joined(separator: ",") + "]"
|
||||
}
|
||||
}
|
||||
|
||||
extension TimelineDiff: @retroactive CustomDebugStringConvertible {
|
||||
public var debugDescription: String {
|
||||
switch self {
|
||||
|
||||
@@ -236,8 +236,11 @@ nonisolated struct SendHandleProxy: Hashable {
|
||||
nonisolated struct VideoInfoProxy: Hashable {
|
||||
let source: MediaSourceProxy
|
||||
private(set) var duration: TimeInterval
|
||||
// periphery:ignore - used via the synthesized Hashable conformance
|
||||
private(set) var size: CGSize?
|
||||
// periphery:ignore - used via the synthesized Hashable conformance
|
||||
private(set) var aspectRatio: CGFloat?
|
||||
// periphery:ignore - used via the synthesized Hashable conformance
|
||||
private(set) var mimeType: String?
|
||||
private(set) var fileSize: UInt?
|
||||
|
||||
@@ -281,6 +284,7 @@ nonisolated struct ImageInfoProxy: Hashable {
|
||||
let source: MediaSourceProxy
|
||||
private(set) var size: CGSize?
|
||||
private(set) var aspectRatio: CGFloat?
|
||||
// periphery:ignore - used via the synthesized Hashable conformance
|
||||
private(set) var mimeType: String?
|
||||
private(set) var fileSize: UInt?
|
||||
|
||||
|
||||
@@ -8,5 +8,4 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
// periphery: ignore - markdown protocol
|
||||
nonisolated protocol DecorationTimelineItemProtocol: RoomTimelineItemProtocol { }
|
||||
|
||||
+1
@@ -11,6 +11,7 @@ import UIKit
|
||||
nonisolated struct EmoteRoomTimelineItemContent: Hashable {
|
||||
let body: String
|
||||
var formattedBody: AttributedString?
|
||||
// periphery:ignore - used via the synthesized Hashable conformance
|
||||
/// The original textual representation of the formatted body directly from the event (usually HTML code)
|
||||
var formattedBodyHTMLString: String?
|
||||
}
|
||||
|
||||
-3
@@ -11,9 +11,6 @@ import Foundation
|
||||
nonisolated struct CallNotificationRoomTimelineItem: RoomTimelineItemProtocol, Equatable {
|
||||
let id: TimelineItemIdentifier
|
||||
let timestamp: Date
|
||||
let isEditable: Bool
|
||||
let canBeRepliedTo: Bool
|
||||
|
||||
let isDM: Bool
|
||||
let isDeclinedByMe: Bool
|
||||
let isDeclined: Bool
|
||||
|
||||
+1
@@ -25,6 +25,7 @@ nonisolated struct Poll: Hashable {
|
||||
let kind: Kind
|
||||
let maxSelections: Int
|
||||
let options: [Option]
|
||||
// periphery:ignore - used via the synthesized Hashable conformance
|
||||
let votes: [String: [String]]
|
||||
let endDate: Date?
|
||||
/// Whether the poll has been created by the account owner
|
||||
|
||||
@@ -857,8 +857,6 @@ nonisolated struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
|
||||
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.isEmpty,
|
||||
|
||||
@@ -48,10 +48,10 @@ struct RoomTimelineItemView: View {
|
||||
RedactedRoomTimelineView(timelineItem: item)
|
||||
case .encrypted(let item):
|
||||
EncryptedRoomTimelineView(timelineItem: item)
|
||||
case .readMarker(let item):
|
||||
ReadMarkerRoomTimelineView(timelineItem: item)
|
||||
case .paginationIndicator(let item):
|
||||
PaginationIndicatorRoomTimelineView(timelineItem: item)
|
||||
case .readMarker:
|
||||
ReadMarkerRoomTimelineView()
|
||||
case .paginationIndicator:
|
||||
PaginationIndicatorRoomTimelineView()
|
||||
case .sticker(let item):
|
||||
StickerRoomTimelineView(timelineItem: item)
|
||||
case .unsupported(let item):
|
||||
@@ -71,8 +71,8 @@ struct RoomTimelineItemView: View {
|
||||
title: L10n.commonVoiceMessage,
|
||||
duration: 0)
|
||||
VoiceMessageRoomTimelineView(timelineItem: item, playerState: playerState)
|
||||
case .callInvite(let item):
|
||||
CallInviteRoomTimelineView(timelineItem: item)
|
||||
case .callInvite:
|
||||
CallInviteRoomTimelineView()
|
||||
case .callNotification(let item):
|
||||
CallNotificationRoomTimelineView(timelineItem: item)
|
||||
case .liveLocation(let item):
|
||||
@@ -86,7 +86,7 @@ struct RoomTimelineItemView: View {
|
||||
if let item = context?.viewState.linkMetadataProvider?.metadataItems[url] {
|
||||
linkMetadata[url] = item
|
||||
} else {
|
||||
linkMetadata[url] = LinkMetadataProviderItem(url: url, metadata: nil)
|
||||
linkMetadata[url] = LinkMetadataProviderItem(metadata: nil)
|
||||
}
|
||||
}
|
||||
return linkMetadata
|
||||
|
||||
@@ -653,16 +653,4 @@ extension Array where Element == TimelineItemProxy {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func firstEventTimelineItemUsingEventOrTransactionID(_ eventOrTransactionID: TimelineItemIdentifier.EventOrTransactionID) -> EventTimelineItem? {
|
||||
for item in self {
|
||||
if case let .event(eventTimelineItem) = item,
|
||||
case let .event(_, identifier) = eventTimelineItem.id,
|
||||
identifier == eventOrTransactionID {
|
||||
return eventTimelineItem.item
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,8 +46,6 @@ enum TimelineAllowedMessageType {
|
||||
|
||||
enum TimelineProxyError: Error {
|
||||
case sdkError(Error)
|
||||
|
||||
case failedRedacting
|
||||
}
|
||||
|
||||
/// Element X proxies generally wrap the counterpart RustSDK objects while providing platform specific
|
||||
|
||||
Reference in New Issue
Block a user