mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Add history sharing badges to room details (#5043)
* chore: Add dependency `SwiftFlow` for use in avatar header badges. Signed-off-by: Skye Elliot <actuallyori@gmail.com> * feat: Display history sharing pill in room details. Signed-off-by: Skye Elliot <actuallyori@gmail.com> * tests: Add tests for history sharing room details pill. Signed-off-by: Skye Elliot <actuallyori@gmail.com> * tests: Update screenshots for RoomDetailsScreen preview tests. * fix: Use Localazy translations for room details badges * fix: Address review comments * fix: Remove line limit from room details badges --------- Signed-off-by: Skye Elliot <actuallyori@gmail.com>
This commit is contained in:
@@ -746,4 +746,53 @@ class RoomDetailsScreenViewModelTests: XCTestCase {
|
||||
|
||||
try await deferred.fulfill()
|
||||
}
|
||||
|
||||
// MARK: - History Sharing
|
||||
|
||||
func testHistorySharingPillDoesNotAppearIfFeatureFlagNotSet() async throws {
|
||||
ServiceLocator.shared.settings.enableKeyShareOnInvite = false
|
||||
|
||||
let configuration = JoinedRoomProxyMockConfiguration(historyVisibility: .shared)
|
||||
let infoSubject = CurrentValueSubject<RoomInfoProxyProtocol, Never>(RoomInfoProxyMock(configuration))
|
||||
let roomProxyMock = JoinedRoomProxyMock(configuration)
|
||||
roomProxyMock.underlyingInfoPublisher = infoSubject.asCurrentValuePublisher()
|
||||
|
||||
viewModel = RoomDetailsScreenViewModel(roomProxy: roomProxyMock,
|
||||
userSession: UserSessionMock(.init()),
|
||||
analyticsService: ServiceLocator.shared.analytics,
|
||||
userIndicatorController: ServiceLocator.shared.userIndicatorController,
|
||||
notificationSettingsProxy: notificationSettingsProxyMock,
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: ServiceLocator.shared.settings)
|
||||
|
||||
let deferredInvisible = deferFailure(context.observe(\.viewState),
|
||||
timeout: 1,
|
||||
message: "The pill should not be shown as the feature flag is not set") { state in
|
||||
state.details.historySharingState != nil
|
||||
}
|
||||
try await deferredInvisible.fulfill()
|
||||
}
|
||||
|
||||
func testHistorySharingPillDisplayedIfHistoryVisibilityShared() async throws {
|
||||
ServiceLocator.shared.settings.enableKeyShareOnInvite = true
|
||||
|
||||
let configuration = JoinedRoomProxyMockConfiguration(historyVisibility: .shared)
|
||||
let infoSubject = CurrentValueSubject<RoomInfoProxyProtocol, Never>(RoomInfoProxyMock(configuration))
|
||||
let roomProxyMock = JoinedRoomProxyMock(configuration)
|
||||
roomProxyMock.underlyingInfoPublisher = infoSubject.asCurrentValuePublisher()
|
||||
|
||||
viewModel = RoomDetailsScreenViewModel(roomProxy: roomProxyMock,
|
||||
userSession: UserSessionMock(.init()),
|
||||
analyticsService: ServiceLocator.shared.analytics,
|
||||
userIndicatorController: ServiceLocator.shared.userIndicatorController,
|
||||
notificationSettingsProxy: notificationSettingsProxyMock,
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: ServiceLocator.shared.settings)
|
||||
|
||||
let deferredShared = deferFulfillment(context.observe(\.viewState),
|
||||
message: "The pill should be shown for rooms with shared history visibility") { state in
|
||||
state.details.historySharingState == .shared
|
||||
}
|
||||
try await deferredShared.fulfill()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user