mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Read Receipts sheet + enabled RR by default (#2123)
This commit is contained in:
@@ -556,10 +556,42 @@ class RoomScreenViewModelTests: XCTestCase {
|
||||
|
||||
return (viewModel, roomProxy, timelineController, notificationCenter)
|
||||
}
|
||||
|
||||
func testShowReadReceipts() async throws {
|
||||
let receipts: [ReadReceipt] = [.init(userID: "@alice:matrix.org", formattedTimestamp: "12:00"),
|
||||
.init(userID: "@charlie:matrix.org", formattedTimestamp: "11:00")]
|
||||
// Given 3 messages from Bob where the middle message has a reaction.
|
||||
let message = TextRoomTimelineItem(text: "Test",
|
||||
sender: "bob",
|
||||
addReadReceipts: receipts)
|
||||
let id = message.id
|
||||
|
||||
// When showing them in a timeline.
|
||||
let timelineController = MockRoomTimelineController()
|
||||
timelineController.timelineItems = [message]
|
||||
let viewModel = RoomScreenViewModel(roomProxy: RoomProxyMock(with: .init(displayName: "",
|
||||
members: [RoomMemberProxyMock.mockAlice, RoomMemberProxyMock.mockCharlie])),
|
||||
timelineController: timelineController,
|
||||
mediaProvider: MockMediaProvider(),
|
||||
mediaPlayerProvider: MediaPlayerProviderMock(),
|
||||
voiceMessageMediaManager: VoiceMessageMediaManagerMock(),
|
||||
userIndicatorController: userIndicatorControllerMock,
|
||||
application: ApplicationMock.default,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
analyticsService: ServiceLocator.shared.analytics,
|
||||
notificationCenter: NotificationCenterMock())
|
||||
|
||||
let deferred = deferFulfillment(viewModel.context.$viewState) { value in
|
||||
value.bindings.readReceiptsSummaryInfo?.orderedReceipts == receipts
|
||||
}
|
||||
|
||||
viewModel.context.send(viewAction: .showReadReceipts(itemID: id))
|
||||
try await deferred.fulfill()
|
||||
}
|
||||
}
|
||||
|
||||
private extension TextRoomTimelineItem {
|
||||
init(text: String, sender: String, addReactions: Bool = false) {
|
||||
init(text: String, sender: String, addReactions: Bool = false, addReadReceipts: [ReadReceipt] = []) {
|
||||
let reactions = addReactions ? [AggregatedReaction(accountOwnerID: "bob", key: "🦄", senders: [ReactionSender(senderID: sender, timestamp: Date())])] : []
|
||||
self.init(id: .random,
|
||||
timestamp: "10:47 am",
|
||||
@@ -569,7 +601,7 @@ private extension TextRoomTimelineItem {
|
||||
isThreaded: false,
|
||||
sender: .init(id: "@\(sender):server.com", displayName: sender),
|
||||
content: .init(body: text),
|
||||
properties: RoomTimelineItemProperties(reactions: reactions))
|
||||
properties: RoomTimelineItemProperties(reactions: reactions, orderedReadReceipts: addReadReceipts))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2431b131a71e3ecc537771ac267f6a3c613fe469fd28cb78cb79af628e1205d6
|
||||
size 65811
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:cf54a03ff167095cc424d2578fdf9c94274f22d9a172a93e04628bb5cbf504b7
|
||||
size 66209
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:cbf4d823916f3dad79f996cf00380ac17df33c2774a65bc6a75bdaad534c3b32
|
||||
size 68826
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:098b0a6b4b4afea40281b37c0fa173f15ee28b05332050d045fe3b8bbb08b42d
|
||||
size 111724
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:610e0a0946e4bb26642f84c5dfb6fd91caf7d623290c501e70fbd83073a7e191
|
||||
size 318638
|
||||
oid sha256:349cab6a64a17c9c0ed6d76c902f06edec4763cd4b7a3304178efba6b733a321
|
||||
size 311524
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:cf7addca5dd6f7347d38227a5b03e36a3ff9430e24bafc06976ffe7e478baa67
|
||||
size 315120
|
||||
oid sha256:265541e4885dd109da0212857cbb43393784782e54b6608851b7da1385a59f4c
|
||||
size 308464
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:cf7addca5dd6f7347d38227a5b03e36a3ff9430e24bafc06976ffe7e478baa67
|
||||
size 315120
|
||||
oid sha256:265541e4885dd109da0212857cbb43393784782e54b6608851b7da1385a59f4c
|
||||
size 308464
|
||||
|
||||
Reference in New Issue
Block a user