Promote "history sharing on invite" out of developer options (#5480)
* Enable key-share-on-invite irrespective of feature flag * Remove feature-flag dep: warning on starting chat with new people * Remove feature-flag dep: invite from room member details * Remove feature-flag dep: warning on new users in invite screen * Remove feature-flag dep: from room details screen * Remove feature-flag dep: starting chat from user profile screen * Remove feature-flag dep: timeline info on forwarded keys * Remove feature-flag dep: RoomScreenModel * Remove `enableKeyShareOnInvite` from AppSettings * Remove `enableKeyShareOnInvite` feature flag * Remove outdated comments * Update preview test room snapshots as their header now includes the history sharing icon
This commit is contained in:
committed by
GitHub
parent
d0e60becf4
commit
bc32a05a2c
@@ -103,8 +103,6 @@ final class InviteUsersScreenViewModelTests {
|
||||
|
||||
@Test
|
||||
func invitingUnknownUsersOpensConfirmationDialog() async throws {
|
||||
appSettings.enableKeyShareOnInvite = true
|
||||
|
||||
let mockedMembers: [RoomMemberProxyMock] = [.mockAlice, .mockBob]
|
||||
let roomProxy = JoinedRoomProxyMock(.init(name: "test", members: mockedMembers))
|
||||
roomProxy.inviteUserIDReturnValue = .success(())
|
||||
@@ -138,8 +136,6 @@ final class InviteUsersScreenViewModelTests {
|
||||
|
||||
@Test
|
||||
func removeButtonRemovesUnknownUsers() async throws {
|
||||
appSettings.enableKeyShareOnInvite = true
|
||||
|
||||
let mockedMembers: [RoomMemberProxyMock] = [.mockAlice, .mockBob]
|
||||
let roomProxy = JoinedRoomProxyMock(.init(name: "test", members: mockedMembers))
|
||||
roomProxy.inviteUserIDReturnValue = .success(())
|
||||
|
||||
@@ -791,34 +791,7 @@ struct RoomDetailsScreenViewModelTests {
|
||||
// MARK: - History Sharing
|
||||
|
||||
@Test
|
||||
mutating func historySharingPillDoesNotAppearIfFeatureFlagNotSet() 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: .seconds(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()
|
||||
}
|
||||
|
||||
@Test
|
||||
mutating func historySharingPillDisplayedIfHistoryVisibilityShared() async throws {
|
||||
ServiceLocator.shared.settings.enableKeyShareOnInvite = true
|
||||
|
||||
mutating func historySharingPillDisplayed() async throws {
|
||||
let configuration = JoinedRoomProxyMockConfiguration(historyVisibility: .shared)
|
||||
let infoSubject = CurrentValueSubject<RoomInfoProxyProtocol, Never>(RoomInfoProxyMock(configuration))
|
||||
let roomProxyMock = JoinedRoomProxyMock(configuration)
|
||||
|
||||
@@ -163,7 +163,6 @@ struct RoomMemberDetailsViewModelTests {
|
||||
let waitForMemberToLoad = deferFulfillment(context.$viewState) { $0.memberDetails != nil }
|
||||
try await waitForMemberToLoad.fulfill()
|
||||
|
||||
ServiceLocator.shared.settings.enableKeyShareOnInvite = true
|
||||
clientProxy.directRoomForUserIDReturnValue = .success(nil)
|
||||
clientProxy.userIdentityForFallBackToServerReturnValue = .success(UserIdentityProxyMock(configuration: .init(verificationState: .notVerified)))
|
||||
|
||||
@@ -185,7 +184,6 @@ struct RoomMemberDetailsViewModelTests {
|
||||
let waitForMemberToLoad = deferFulfillment(context.$viewState) { $0.memberDetails != nil }
|
||||
try await waitForMemberToLoad.fulfill()
|
||||
|
||||
ServiceLocator.shared.settings.enableKeyShareOnInvite = true
|
||||
clientProxy.directRoomForUserIDReturnValue = .success(nil)
|
||||
clientProxy.userIdentityForFallBackToServerReturnValue = .failure(.forbiddenAccess)
|
||||
|
||||
|
||||
@@ -452,46 +452,7 @@ final class RoomScreenViewModelTests {
|
||||
// MARK: - History Sharing
|
||||
|
||||
@Test
|
||||
func roomWithSharedHistoryDoesNotDisplayBadgeIfFeatureFlagNotSet() async throws {
|
||||
ServiceLocator.shared.settings.enableKeyShareOnInvite = false
|
||||
|
||||
var configuration = JoinedRoomProxyMockConfiguration(historyVisibility: .joined)
|
||||
let infoSubject = CurrentValueSubject<RoomInfoProxyProtocol, Never>(RoomInfoProxyMock(configuration))
|
||||
let roomProxyMock = JoinedRoomProxyMock(configuration)
|
||||
|
||||
// setup the room proxy actions publisher
|
||||
roomProxyMock.underlyingInfoPublisher = infoSubject.asCurrentValuePublisher()
|
||||
let viewModel = RoomScreenViewModel(userSession: UserSessionMock(.init()),
|
||||
roomProxy: roomProxyMock,
|
||||
initialSelectedPinnedEventID: nil,
|
||||
ongoingCallRoomIDPublisher: .init(.init(nil)),
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
appHooks: AppHooks(),
|
||||
analyticsService: ServiceLocator.shared.analytics,
|
||||
userIndicatorController: ServiceLocator.shared.userIndicatorController)
|
||||
self.viewModel = viewModel
|
||||
|
||||
let deferredInvisible = deferFailure(viewModel.context.$viewState,
|
||||
timeout: .seconds(1),
|
||||
message: "The icon should not be shown when the room history visibility is not .shared or .worldReadable") { viewState in
|
||||
viewState.roomHistorySharingState != nil
|
||||
}
|
||||
try await deferredInvisible.fulfill()
|
||||
|
||||
configuration.historyVisibility = .shared
|
||||
infoSubject.send(RoomInfoProxyMock(configuration))
|
||||
let deferredShared = deferFailure(viewModel.context.$viewState,
|
||||
timeout: .seconds(1),
|
||||
message: "The icon should not be shown when the room history visibility is .shared, since the flag isn't set") { viewState in
|
||||
viewState.roomHistorySharingState != nil
|
||||
}
|
||||
try await deferredShared.fulfill()
|
||||
}
|
||||
|
||||
@Test
|
||||
func roomWithSharedHistoryDisplaysBadgeWhenFeatureFlagSet() async throws {
|
||||
ServiceLocator.shared.settings.enableKeyShareOnInvite = true
|
||||
|
||||
func roomWithSharedHistoryDisplaysBadge() async throws {
|
||||
var configuration = JoinedRoomProxyMockConfiguration(isEncrypted: false, historyVisibility: .joined)
|
||||
let infoSubject = CurrentValueSubject<RoomInfoProxyProtocol, Never>(RoomInfoProxyMock(configuration))
|
||||
let roomProxyMock = JoinedRoomProxyMock(configuration)
|
||||
|
||||
@@ -89,7 +89,6 @@ struct StartChatScreenViewModelTests {
|
||||
|
||||
@Test
|
||||
func inviteConfirmationFetchesIdentity() async throws {
|
||||
ServiceLocator.shared.settings.enableKeyShareOnInvite = true
|
||||
clientProxy.directRoomForUserIDReturnValue = .success(nil)
|
||||
clientProxy.userIdentityForFallBackToServerReturnValue = .success(UserIdentityProxyMock(configuration: .init(verificationState: .notVerified)))
|
||||
|
||||
@@ -105,7 +104,6 @@ struct StartChatScreenViewModelTests {
|
||||
|
||||
@Test
|
||||
func inviteConfirmationFallsBackToUnknownIdentityOnFailure() async throws {
|
||||
ServiceLocator.shared.settings.enableKeyShareOnInvite = true
|
||||
clientProxy.directRoomForUserIDReturnValue = .success(nil)
|
||||
clientProxy.userIdentityForFallBackToServerReturnValue = .failure(.forbiddenAccess)
|
||||
|
||||
|
||||
@@ -57,8 +57,6 @@ struct UserProfileScreenViewModelTests {
|
||||
|
||||
@Test
|
||||
func startingDmWithUnknownUserFetchesIdentity() async throws {
|
||||
ServiceLocator.shared.settings.enableKeyShareOnInvite = true
|
||||
|
||||
let profile = UserProfileProxy.mockAlice
|
||||
|
||||
let clientProxy = ClientProxyMock(.init())
|
||||
|
||||
Reference in New Issue
Block a user