mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 16:24:11 +00:00
Bump the RustSDK to v1.0.53: adopt latest record based timeline item APIs (#3356)
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
//
|
||||
// Copyright 2024 New Vector Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
// Please see LICENSE in the repository root for full details.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import LoremSwiftum
|
||||
import MatrixRustSDK
|
||||
|
||||
struct EventTimelineItemSDKMockConfiguration {
|
||||
var eventID: String = UUID().uuidString
|
||||
var sender = ""
|
||||
var isOwn = false
|
||||
var content: TimelineItemContent = .redactedMessage
|
||||
}
|
||||
|
||||
extension EventTimelineItem {
|
||||
init(configuration: EventTimelineItemSDKMockConfiguration) {
|
||||
self.init(isLocal: false,
|
||||
isRemote: true,
|
||||
eventOrTransactionId: .eventId(eventId: configuration.eventID),
|
||||
sender: configuration.sender,
|
||||
senderProfile: .pending,
|
||||
isOwn: configuration.isOwn,
|
||||
isEditable: false,
|
||||
content: configuration.content,
|
||||
timestamp: 0,
|
||||
reactions: [],
|
||||
debugInfoProvider: EventTimelineItemDebugInfoProviderSDKMock(),
|
||||
localSendState: nil,
|
||||
readReceipts: [:],
|
||||
origin: nil,
|
||||
canBeRepliedTo: false,
|
||||
shieldsProvider: EventShieldsProviderSDKMock())
|
||||
}
|
||||
|
||||
static var mockMessage: EventTimelineItem {
|
||||
let body = Lorem.sentences(Int.random(in: 1...5))
|
||||
let messageType = MessageType.text(content: .init(body: body, formatted: nil))
|
||||
|
||||
let content = TimelineItemContent.message(content: .init(msgType: messageType,
|
||||
body: body,
|
||||
inReplyTo: nil,
|
||||
threadRoot: nil,
|
||||
isEdited: false,
|
||||
mentions: nil))
|
||||
|
||||
return .init(configuration: .init(content: content))
|
||||
}
|
||||
|
||||
static func mockCallInvite(sender: String) -> EventTimelineItem {
|
||||
.init(configuration: .init(sender: sender, content: .callInvite))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user