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:
Richard van der Hoff
2026-04-27 12:43:18 +01:00
committed by GitHub
parent d0e60becf4
commit bc32a05a2c
39 changed files with 53 additions and 201 deletions

View File

@@ -23,7 +23,6 @@ protocol CommonSettingsProtocol: AnyObject {
var bugReportRageshakeURL: RemotePreference<RageshakeConfiguration> { get } var bugReportRageshakeURL: RemotePreference<RageshakeConfiguration> { get }
var enableOnlySignedDeviceIsolationMode: Bool { get } var enableOnlySignedDeviceIsolationMode: Bool { get }
var enableKeyShareOnInvite: Bool { get }
var threadsEnabled: Bool { get } var threadsEnabled: Bool { get }
var hideQuietNotificationAlerts: Bool { get } var hideQuietNotificationAlerts: Bool { get }
} }
@@ -76,7 +75,6 @@ final class AppSettings {
case fuzzyRoomListSearchEnabled case fuzzyRoomListSearchEnabled
case lowPriorityFilterEnabled case lowPriorityFilterEnabled
case enableOnlySignedDeviceIsolationMode case enableOnlySignedDeviceIsolationMode
case enableKeyShareOnInvite
case knockingEnabled case knockingEnabled
case threadsEnabled case threadsEnabled
case roomThreadListEnabled case roomThreadListEnabled
@@ -433,10 +431,6 @@ final class AppSettings {
@UserPreference(key: UserDefaultsKeys.enableOnlySignedDeviceIsolationMode, defaultValue: false, storageType: .userDefaults(store)) @UserPreference(key: UserDefaultsKeys.enableOnlySignedDeviceIsolationMode, defaultValue: false, storageType: .userDefaults(store))
var enableOnlySignedDeviceIsolationMode var enableOnlySignedDeviceIsolationMode
/// Configuration to enable encrypted history sharing on invite, and accepting keys from inviters.
@UserPreference(key: UserDefaultsKeys.enableKeyShareOnInvite, defaultValue: false, storageType: .userDefaults(store))
var enableKeyShareOnInvite
@UserPreference(key: UserDefaultsKeys.knockingEnabled, defaultValue: false, storageType: .userDefaults(store)) @UserPreference(key: UserDefaultsKeys.knockingEnabled, defaultValue: false, storageType: .userDefaults(store))
var knockingEnabled var knockingEnabled

View File

@@ -17,7 +17,6 @@ extension ClientBuilder {
sessionDelegate: ClientSessionDelegate, sessionDelegate: ClientSessionDelegate,
appHooks: AppHooks, appHooks: AppHooks,
enableOnlySignedDeviceIsolationMode: Bool, enableOnlySignedDeviceIsolationMode: Bool,
enableKeyShareOnInvite: Bool,
requestTimeout: UInt64? = 30000, requestTimeout: UInt64? = 30000,
maxRequestRetryTime: UInt64? = nil, maxRequestRetryTime: UInt64? = nil,
threadsEnabled: Bool) -> ClientBuilder { threadsEnabled: Bool) -> ClientBuilder {
@@ -40,7 +39,7 @@ extension ClientBuilder {
builder = builder builder = builder
.autoEnableCrossSigning(autoEnableCrossSigning: true) .autoEnableCrossSigning(autoEnableCrossSigning: true)
.backupDownloadStrategy(backupDownloadStrategy: .afterDecryptionFailure) .backupDownloadStrategy(backupDownloadStrategy: .afterDecryptionFailure)
.enableShareHistoryOnInvite(enableShareHistoryOnInvite: enableKeyShareOnInvite) .enableShareHistoryOnInvite(enableShareHistoryOnInvite: true)
.autoEnableBackups(autoEnableBackups: true) .autoEnableBackups(autoEnableBackups: true)
} }

View File

@@ -61,8 +61,7 @@ class InviteUsersScreenViewModel: InviteUsersScreenViewModelType, InviteUsersScr
case .cancel: case .cancel:
actionsSubject.send(.dismiss) actionsSubject.send(.dismiss)
case .proceed: case .proceed:
guard appSettings.enableKeyShareOnInvite, guard roomProxy.details.historySharingState != RoomHistorySharingState.hidden,
roomProxy.details.historySharingState != RoomHistorySharingState.hidden,
!state.usersToConfirm.isEmpty, !state.usersToConfirm.isEmpty,
!state.isSkippable else { !state.isSkippable else {
inviteUsers(state.selectedUsers.map(\.userID), roomProxy: roomProxy) inviteUsers(state.selectedUsers.map(\.userID), roomProxy: roomProxy)
@@ -107,11 +106,7 @@ class InviteUsersScreenViewModel: InviteUsersScreenViewModelType, InviteUsersScr
} }
private func inviteUsers(_ users: [String], roomProxy: JoinedRoomProxyProtocol) { private func inviteUsers(_ users: [String], roomProxy: JoinedRoomProxyProtocol) {
if appSettings.enableKeyShareOnInvite {
showLoadingIndicator(title: L10n.screenRoomDetailsInvitePeoplePreparing, message: L10n.screenRoomDetailsInvitePeopleDontClose) showLoadingIndicator(title: L10n.screenRoomDetailsInvitePeoplePreparing, message: L10n.screenRoomDetailsInvitePeopleDontClose)
} else {
showLoadingIndicator()
}
Task { Task {
defer { defer {

View File

@@ -61,13 +61,7 @@ class RoomDetailsScreenViewModel: RoomDetailsScreenViewModelType, RoomDetailsScr
let topic = attributedStringBuilder.fromPlain(roomProxy.infoPublisher.value.topic) let topic = attributedStringBuilder.fromPlain(roomProxy.infoPublisher.value.topic)
// Clear details.historySharingState manually while we are still behind a feature flag. super.init(initialViewState: .init(details: roomProxy.details,
var details = roomProxy.details
if !appSettings.enableKeyShareOnInvite {
details.historySharingState = nil
}
super.init(initialViewState: .init(details: details,
isEncrypted: roomProxy.infoPublisher.value.isEncrypted, isEncrypted: roomProxy.infoPublisher.value.isEncrypted,
isDirect: roomProxy.infoPublisher.value.isDirect, isDirect: roomProxy.infoPublisher.value.isDirect,
topic: topic, topic: topic,
@@ -280,14 +274,7 @@ class RoomDetailsScreenViewModel: RoomDetailsScreenViewModelType, RoomDetailsScr
state.joinedMembersCount = roomInfo.joinedMembersCount state.joinedMembersCount = roomInfo.joinedMembersCount
state.details = roomProxy.details state.details = roomProxy.details
// Set state.details.historySharingState manually while we are still behind
// a feature flag.
if appSettings.enableKeyShareOnInvite {
state.details.historySharingState = roomInfo.historySharingState state.details.historySharingState = roomInfo.historySharingState
} else {
state.details.historySharingState = nil
}
let topic = attributedStringBuilder.fromPlain(roomInfo.topic) let topic = attributedStringBuilder.fromPlain(roomInfo.topic)
state.topic = topic state.topic = topic

View File

@@ -374,7 +374,6 @@ struct RoomDetailsScreen_Previews: PreviewProvider, TestablePreview {
} }
private static func makeGenericRoomViewModel(historyVisibility: RoomHistoryVisibility) -> RoomDetailsScreenViewModel { private static func makeGenericRoomViewModel(historyVisibility: RoomHistoryVisibility) -> RoomDetailsScreenViewModel {
ServiceLocator.shared.settings.enableKeyShareOnInvite = true
ServiceLocator.shared.settings.knockingEnabled = true ServiceLocator.shared.settings.knockingEnabled = true
let knockRequests: [KnockRequestProxyMock] = [.init()] let knockRequests: [KnockRequestProxyMock] = [.init()]
@@ -418,7 +417,6 @@ struct RoomDetailsScreen_Previews: PreviewProvider, TestablePreview {
} }
private static func makeSimpleRoomViewModel() -> RoomDetailsScreenViewModel { private static func makeSimpleRoomViewModel() -> RoomDetailsScreenViewModel {
ServiceLocator.shared.settings.enableKeyShareOnInvite = true
ServiceLocator.shared.settings.knockingEnabled = true ServiceLocator.shared.settings.knockingEnabled = true
let knockRequests: [KnockRequestProxyMock] = [.init()] let knockRequests: [KnockRequestProxyMock] = [.init()]
@@ -448,8 +446,6 @@ struct RoomDetailsScreen_Previews: PreviewProvider, TestablePreview {
} }
private static func makeDMViewModel(verificationState: UserIdentityVerificationState) -> RoomDetailsScreenViewModel { private static func makeDMViewModel(verificationState: UserIdentityVerificationState) -> RoomDetailsScreenViewModel {
ServiceLocator.shared.settings.enableKeyShareOnInvite = true
let members: [RoomMemberProxyMock] = [ let members: [RoomMemberProxyMock] = [
.mockMe, .mockMe,
.mockDan .mockDan

View File

@@ -200,7 +200,7 @@ class RoomMemberDetailsScreenViewModel: RoomMemberDetailsScreenViewModelType, Ro
case .success(let roomID): case .success(let roomID):
if let roomID { if let roomID {
actionsSubject.send(.openDirectChat(roomID: roomID)) actionsSubject.send(.openDirectChat(roomID: roomID))
} else if appSettings.enableKeyShareOnInvite, roomProxy.details.historySharingState != RoomHistorySharingState.hidden { } else if roomProxy.details.historySharingState != RoomHistorySharingState.hidden {
Task { Task {
let identity = await self.userSession.clientProxy.userIdentity(for: roomMemberProxy.userID, fallBackToServer: false) let identity = await self.userSession.clientProxy.userIdentity(for: roomMemberProxy.userID, fallBackToServer: false)
let user: UserProfileProxy = .init(userID: roomMemberProxy.userID, displayName: roomMemberProxy.displayName, avatarURL: roomMemberProxy.avatarURL) let user: UserProfileProxy = .init(userID: roomMemberProxy.userID, displayName: roomMemberProxy.displayName, avatarURL: roomMemberProxy.avatarURL)

View File

@@ -94,7 +94,7 @@ struct RoomScreenViewState: BindableState {
(canAcceptKnocks || canDeclineKnocks || canBan) (canAcceptKnocks || canDeclineKnocks || canBan)
} }
/// If `enableKeyShareOnInvite` is set, determines the current history sharing state. /// The current history sharing state.
var roomHistorySharingState: RoomHistorySharingState? var roomHistorySharingState: RoomHistorySharingState?
var footerDetails: RoomScreenFooterViewDetails? var footerDetails: RoomScreenFooterViewDetails?

View File

@@ -67,18 +67,12 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
self.initialSelectedPinnedEventID = initialSelectedPinnedEventID self.initialSelectedPinnedEventID = initialSelectedPinnedEventID
pinnedEventStringBuilder = .pinnedEventStringBuilder(userID: roomProxy.ownUserID) pinnedEventStringBuilder = .pinnedEventStringBuilder(userID: roomProxy.ownUserID)
let roomHistorySharingState: RoomHistorySharingState? = if appSettings.enableKeyShareOnInvite {
roomProxy.infoPublisher.value.historySharingState
} else {
nil
}
let viewState = RoomScreenViewState(roomTitle: roomProxy.infoPublisher.value.displayName ?? roomProxy.id, let viewState = RoomScreenViewState(roomTitle: roomProxy.infoPublisher.value.displayName ?? roomProxy.id,
roomAvatar: roomProxy.infoPublisher.value.avatar, roomAvatar: roomProxy.infoPublisher.value.avatar,
hasOngoingCall: roomProxy.infoPublisher.value.hasRoomCall, hasOngoingCall: roomProxy.infoPublisher.value.hasRoomCall,
isDirectOneToOneRoom: roomProxy.isDirectOneToOneRoom, isDirectOneToOneRoom: roomProxy.isDirectOneToOneRoom,
hasSuccessor: roomProxy.infoPublisher.value.successor != nil, hasSuccessor: roomProxy.infoPublisher.value.successor != nil,
roomHistorySharingState: roomHistorySharingState) roomHistorySharingState: roomProxy.infoPublisher.value.historySharingState)
super.init(initialViewState: appHooks.roomScreenHook.update(viewState), super.init(initialViewState: appHooks.roomScreenHook.update(viewState),
mediaProvider: userSession.mediaProvider) mediaProvider: userSession.mediaProvider)
@@ -371,14 +365,8 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
state.canBan = powerLevels.canOwnUserBan() state.canBan = powerLevels.canOwnUserBan()
} }
// This causes the UI to become inconsistent with the user's mental model if the user
// does not restart the app after disabling the feature flag. We can probably ignore
// such cases, since we explicitly ask for an app restart in the caption of the feature
// flag switch.
if appSettings.enableKeyShareOnInvite {
state.roomHistorySharingState = roomInfo.historySharingState state.roomHistorySharingState = roomInfo.historySharingState
} }
}
private func setupPinnedEventsTimelineItemProviderIfNeeded() { private func setupPinnedEventsTimelineItemProviderIfNeeded() {
guard pinnedEventsTimelineItemProvider == nil else { guard pinnedEventsTimelineItemProvider == nil else {

View File

@@ -55,7 +55,6 @@ protocol DeveloperOptionsProtocol: AnyObject {
var traceLogPacks: Set<TraceLogPack> { get set } var traceLogPacks: Set<TraceLogPack> { get set }
var enableOnlySignedDeviceIsolationMode: Bool { get set } var enableOnlySignedDeviceIsolationMode: Bool { get set }
var enableKeyShareOnInvite: Bool { get set }
var hideQuietNotificationAlerts: Bool { get set } var hideQuietNotificationAlerts: Bool { get set }
var focusEventOnNotificationTap: Bool { get set } var focusEventOnNotificationTap: Bool { get set }
var automaticBackPaginationEnabled: Bool { get set } var automaticBackPaginationEnabled: Bool { get set }

View File

@@ -113,16 +113,6 @@ struct DeveloperOptionsScreen: View {
Text("This setting controls how end-to-end encryption (E2EE) keys are exchanged. Enabling it will prevent the inclusion of devices that have not been explicitly verified by their owners.") Text("This setting controls how end-to-end encryption (E2EE) keys are exchanged. Enabling it will prevent the inclusion of devices that have not been explicitly verified by their owners.")
} }
Section {
Toggle(isOn: $context.enableKeyShareOnInvite) {
Text("Share encrypted history with new members")
Text("Requires app reboot")
}
} footer: {
Text("When inviting a user to an encrypted room that has history visibility set to \"shared\", share encrypted history with that user, and accept encrypted history when you are invited to such a room.")
Text("WARNING: this feature is EXPERIMENTAL and not all security precautions are implemented. Do not enable on production accounts.")
}
Section("Element Call remote URL override") { Section("Element Call remote URL override") {
TextField("Leave empty to use EC locally", text: $elementCallURLOverrideString) TextField("Leave empty to use EC locally", text: $elementCallURLOverrideString)
.autocorrectionDisabled(true) .autocorrectionDisabled(true)

View File

@@ -67,7 +67,6 @@ class StartChatScreenViewModel: StartChatScreenViewModelType, StartChatScreenVie
hideLoadingIndicator() hideLoadingIndicator()
actionsSubject.send(.showRoom(roomID: roomId)) actionsSubject.send(.showRoom(roomID: roomId))
case .success: case .success:
if appSettings.enableKeyShareOnInvite {
Task { Task {
// If an error occured while fetching the identity, assume they are unknown. // If an error occured while fetching the identity, assume they are unknown.
let isUnknown = if case .success(let identity) = await self.userSession.clientProxy.userIdentity(for: user.userID, fallBackToServer: false) { let isUnknown = if case .success(let identity) = await self.userSession.clientProxy.userIdentity(for: user.userID, fallBackToServer: false) {
@@ -78,10 +77,6 @@ class StartChatScreenViewModel: StartChatScreenViewModelType, StartChatScreenVie
self.state.bindings.selectedUserToInvite = UserToInvite(user: user, isUnknown: isUnknown) self.state.bindings.selectedUserToInvite = UserToInvite(user: user, isUnknown: isUnknown)
hideLoadingIndicator() hideLoadingIndicator()
} }
} else {
hideLoadingIndicator()
state.bindings.selectedUserToInvite = UserToInvite(user: user, isUnknown: false)
}
case .failure: case .failure:
hideLoadingIndicator() hideLoadingIndicator()
displayError() displayError()

View File

@@ -144,8 +144,6 @@ struct TimelineViewState: BindableState {
var mapTilerConfiguration: MapTilerConfiguration var mapTilerConfiguration: MapTilerConfiguration
var enableKeyShareOnInvite: Bool
var stoppedLiveLocationIDs: Set<TimelineItemIdentifier> = [] var stoppedLiveLocationIDs: Set<TimelineItemIdentifier> = []
var bindings: TimelineViewStateBindings var bindings: TimelineViewStateBindings

View File

@@ -107,7 +107,6 @@ class TimelineViewModel: TimelineViewModelType, TimelineViewModelProtocol {
emojiProvider: emojiProvider, emojiProvider: emojiProvider,
linkMetadataProvider: hideTimelineMedia ? nil : linkMetadataProvider, linkMetadataProvider: hideTimelineMedia ? nil : linkMetadataProvider,
mapTilerConfiguration: appSettings.mapTilerConfiguration, mapTilerConfiguration: appSettings.mapTilerConfiguration,
enableKeyShareOnInvite: appSettings.enableKeyShareOnInvite,
bindings: .init(reactionsCollapsed: [:])), bindings: .init(reactionsCollapsed: [:])),
mediaProvider: userSession.mediaProvider) mediaProvider: userSession.mediaProvider)

View File

@@ -335,7 +335,6 @@ private extension TimelineItemKeyForwarder {
struct TimelineItemBubbledStylerView_Previews: PreviewProvider, TestablePreview { struct TimelineItemBubbledStylerView_Previews: PreviewProvider, TestablePreview {
static let viewModel: TimelineViewModel = { static let viewModel: TimelineViewModel = {
let appSettings = AppSettings() let appSettings = AppSettings()
appSettings.enableKeyShareOnInvite = true
appSettings.threadsEnabled = true appSettings.threadsEnabled = true
let roomProxy = JoinedRoomProxyMock(.init()) let roomProxy = JoinedRoomProxyMock(.init())

View File

@@ -15,8 +15,7 @@ extension View {
adjustedDeliveryStatus: TimelineItemDeliveryStatus?, adjustedDeliveryStatus: TimelineItemDeliveryStatus?,
context: TimelineViewModel.Context) -> some View { context: TimelineViewModel.Context) -> some View {
modifier(TimelineItemSendInfoModifier(sendInfo: .init(timelineItem: timelineItem, modifier(TimelineItemSendInfoModifier(sendInfo: .init(timelineItem: timelineItem,
adjustedDeliveryStatus: adjustedDeliveryStatus, adjustedDeliveryStatus: adjustedDeliveryStatus),
enableKeyShareOnInvite: context.viewState.enableKeyShareOnInvite),
context: context)) context: context))
} }
} }
@@ -150,7 +149,7 @@ private struct TimelineItemSendInfo {
} }
private extension TimelineItemSendInfo { private extension TimelineItemSendInfo {
init(timelineItem: EventBasedTimelineItemProtocol, adjustedDeliveryStatus: TimelineItemDeliveryStatus?, enableKeyShareOnInvite: Bool) { init(timelineItem: EventBasedTimelineItemProtocol, adjustedDeliveryStatus: TimelineItemDeliveryStatus?) {
itemID = timelineItem.id itemID = timelineItem.id
localizedString = timelineItem.localizedSendInfo localizedString = timelineItem.localizedSendInfo
@@ -158,7 +157,7 @@ private extension TimelineItemSendInfo {
.sendingFailed .sendingFailed
} else if let authenticity = timelineItem.properties.encryptionAuthenticity { } else if let authenticity = timelineItem.properties.encryptionAuthenticity {
.encryptionAuthenticity(authenticity) .encryptionAuthenticity(authenticity)
} else if enableKeyShareOnInvite, let forwarder = timelineItem.properties.encryptionForwarder { } else if let forwarder = timelineItem.properties.encryptionForwarder {
.encryptionForwarder(forwarder) .encryptionForwarder(forwarder)
} else { } else {
nil nil

View File

@@ -127,7 +127,6 @@ class UserProfileScreenViewModel: UserProfileScreenViewModelType, UserProfileScr
if let roomID { if let roomID {
actionsSubject.send(.openDirectChat(roomID: roomID)) actionsSubject.send(.openDirectChat(roomID: roomID))
} else { } else {
if appSettings.enableKeyShareOnInvite {
Task { Task {
let isUnknown = if case let .success(identity) = await userSession.clientProxy.userIdentity(for: userProfile.userID, fallBackToServer: false) { let isUnknown = if case let .success(identity) = await userSession.clientProxy.userIdentity(for: userProfile.userID, fallBackToServer: false) {
identity == nil identity == nil
@@ -136,9 +135,6 @@ class UserProfileScreenViewModel: UserProfileScreenViewModelType, UserProfileScr
} }
state.bindings.inviteConfirmationUser = .init(user: userProfile, isUnknown: isUnknown) state.bindings.inviteConfirmationUser = .init(user: userProfile, isUnknown: isUnknown)
} }
} else {
state.bindings.inviteConfirmationUser = .init(user: userProfile, isUnknown: false)
}
} }
case .failure: case .failure:
state.bindings.alertInfo = .init(id: .failedOpeningDirectChat) state.bindings.alertInfo = .init(id: .failedOpeningDirectChat)

View File

@@ -38,7 +38,6 @@ struct AuthenticationClientFactory: AuthenticationClientFactoryProtocol {
sessionDelegate: clientSessionDelegate, sessionDelegate: clientSessionDelegate,
appHooks: appHooks, appHooks: appHooks,
enableOnlySignedDeviceIsolationMode: appSettings.enableOnlySignedDeviceIsolationMode, enableOnlySignedDeviceIsolationMode: appSettings.enableOnlySignedDeviceIsolationMode,
enableKeyShareOnInvite: appSettings.enableKeyShareOnInvite,
threadsEnabled: appSettings.threadsEnabled) threadsEnabled: appSettings.threadsEnabled)
.sqliteStore(config: .init(dataPath: sessionDirectories.dataPath, cachePath: sessionDirectories.cachePath) .sqliteStore(config: .init(dataPath: sessionDirectories.dataPath, cachePath: sessionDirectories.cachePath)
.passphrase(passphrase: passphrase)) .passphrase(passphrase: passphrase))
@@ -56,7 +55,6 @@ struct AuthenticationClientFactory: AuthenticationClientFactoryProtocol {
sessionDelegate: clientSessionDelegate, sessionDelegate: clientSessionDelegate,
appHooks: appHooks, appHooks: appHooks,
enableOnlySignedDeviceIsolationMode: appSettings.enableOnlySignedDeviceIsolationMode, enableOnlySignedDeviceIsolationMode: appSettings.enableOnlySignedDeviceIsolationMode,
enableKeyShareOnInvite: appSettings.enableKeyShareOnInvite,
threadsEnabled: appSettings.threadsEnabled) threadsEnabled: appSettings.threadsEnabled)
.inMemoryStore() .inMemoryStore()
.serverNameOrHomeserverUrl(serverNameOrUrl: homeserverAddress) .serverNameOrHomeserverUrl(serverNameOrUrl: homeserverAddress)

View File

@@ -5,8 +5,7 @@
// Please see LICENSE files in the repository root for full details. // Please see LICENSE files in the repository root for full details.
// //
/// Enumeration of the two possible cases in which history sharing under MSC4268 is enabled. These /// Enumeration of the two possible cases in which history sharing under MSC4268 is enabled.
/// variants implicitly assume that the feature flag, `enableKeyShareOnInvite`, is set.
enum RoomHistorySharingState: Equatable { enum RoomHistorySharingState: Equatable {
/// The feature flag is set, and the room history visibility is either `invited` or `joined`. New /// The feature flag is set, and the room history visibility is either `invited` or `joined`. New
/// members of the room cannot read the room history. /// members of the room cannot read the room history.

View File

@@ -136,8 +136,7 @@ extension RoomInfoProxyProtocol {
return alternativeAliases.first return alternativeAliases.first
} }
/// If present, the state of history sharing in this room. This *does not* consider the `enableKeyShareOnInvite` /// If present, the state of history sharing in this room.
/// feature flag, so consumers should be careful to check the flag is true before utilising this property.
var historySharingState: RoomHistorySharingState? { var historySharingState: RoomHistorySharingState? {
guard isEncrypted else { guard isEncrypted else {
return nil return nil

View File

@@ -136,7 +136,6 @@ class UserSessionStore: UserSessionStoreProtocol {
sessionDelegate: keychainController, sessionDelegate: keychainController,
appHooks: appHooks, appHooks: appHooks,
enableOnlySignedDeviceIsolationMode: appSettings.enableOnlySignedDeviceIsolationMode, enableOnlySignedDeviceIsolationMode: appSettings.enableOnlySignedDeviceIsolationMode,
enableKeyShareOnInvite: appSettings.enableKeyShareOnInvite,
threadsEnabled: appSettings.threadsEnabled) threadsEnabled: appSettings.threadsEnabled)
.sqliteStore(config: .init(dataPath: credentials.restorationToken.sessionDirectories.dataPath, .sqliteStore(config: .init(dataPath: credentials.restorationToken.sessionDirectories.dataPath,
cachePath: credentials.restorationToken.sessionDirectories.cachePath) cachePath: credentials.restorationToken.sessionDirectories.cachePath)

View File

@@ -73,7 +73,6 @@ final class NSEUserSession: NSEUserSessionProtocol {
sessionDelegate: clientSessionDelegate, sessionDelegate: clientSessionDelegate,
appHooks: appHooks, appHooks: appHooks,
enableOnlySignedDeviceIsolationMode: appSettings.enableOnlySignedDeviceIsolationMode, enableOnlySignedDeviceIsolationMode: appSettings.enableOnlySignedDeviceIsolationMode,
enableKeyShareOnInvite: appSettings.enableKeyShareOnInvite,
requestTimeout: 15000, requestTimeout: 15000,
maxRequestRetryTime: 5000, maxRequestRetryTime: 5000,
threadsEnabled: appSettings.threadsEnabled) threadsEnabled: appSettings.threadsEnabled)

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:207bd394067c340f9e4b076fd16bd4343316bcd9d8d4d374cd236e47c164e145 oid sha256:089b0d9a304c3f40792be121ff4d186cd627fbac7c6cefcde1a055ea5fed4c32
size 292240 size 293242

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:6147dbb4bc53ade67de4805d0c1d98c9cd6efb741cb61bad36fb64979ac1d883 oid sha256:f3466a09ca0cf44e1277df51a1d7087140528f8215c9c1822646450e93cb31b7
size 299890 size 301071

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:85c53cd872455164e11487873edd381bcf6571a49c54cd5a66eb305b46d79f71 oid sha256:3ac4854adf7c566ce1de1183b0e70644d6451698bbeeb67e894676da661e4cfa
size 177231 size 178126

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:c0b83a35c2fbbd563df35d28c005fa9f27a89a54ebaeb8f86b705488a1f34c17 oid sha256:32fe31fc8d11c757017183ef709f9e295f95447749b795306b89ef4823b08601
size 177978 size 178855

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:92ff74f286a559e4346753371af24b1df1573b14f4c83675f73fb3337fda73cd oid sha256:38e268637715a7155390f76471957b6db4de180ca472e1118f2cdf68743c16f7
size 291851 size 292930

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:8cc07152be380cfe9e49788fba97efaef630692ac7565ae2351deaa4181a6d29 oid sha256:9b134060f2886bd68c6c0b61be6248ef6d3165e4b4e3e8b5998e1ef943f36ed4
size 302027 size 303186

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:2bcd291f0d52f8d3c6bbb9895ec9e557b8a7a56f884d530cd91f8ff333d0404a oid sha256:348acf96fccb8263d3b15faf60ac48bf566e0973c5336f91b29cd44969e99d6c
size 178411 size 179321

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:7bd1f293a3defcc41f51afceea1892cd70a8fc3dec76e32b815d2c8ade54cac4 oid sha256:6c8407aa04edb63d1295594fb626ea4b913f36dce94c1e12967f79d563b44d75
size 182434 size 183279

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:3b0c5f8e8d167ddc5f00adbf8cd3f19aae03bcb68817a6fccb1af21c1b800a03 oid sha256:6bde61b7ff9a65b26419c35eeabef756ad4e2c76b5cea99392774c3c174138c4
size 350621 size 351572

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:ceb2e3a809131e13d42cd68586e3b171bd080001c4400ed923dc4e25d7592fcb oid sha256:79a62923cdaea57cc20a1867a7d334f67d8f13c9d9e95a4264745d70c0f67115
size 364270 size 365168

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:c2da0576e9ed07c84367669e5e357f5597c041513079421b5df20588ca5cc76d oid sha256:0311bc192551d8f7859c6ed616d0925e49d8e81bd6d63ec7821aa7069e7012ea
size 205437 size 206286

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:359c5ac971a59aaa709189e21249ca3527c0d5892204e1a5007fe7b630c56a18 oid sha256:2d9d5cb4c421d1d7d164c4c4db0c20bf879f4969a1d66213114b108b6b7b1b7c
size 210703 size 211593

View File

@@ -103,8 +103,6 @@ final class InviteUsersScreenViewModelTests {
@Test @Test
func invitingUnknownUsersOpensConfirmationDialog() async throws { func invitingUnknownUsersOpensConfirmationDialog() async throws {
appSettings.enableKeyShareOnInvite = true
let mockedMembers: [RoomMemberProxyMock] = [.mockAlice, .mockBob] let mockedMembers: [RoomMemberProxyMock] = [.mockAlice, .mockBob]
let roomProxy = JoinedRoomProxyMock(.init(name: "test", members: mockedMembers)) let roomProxy = JoinedRoomProxyMock(.init(name: "test", members: mockedMembers))
roomProxy.inviteUserIDReturnValue = .success(()) roomProxy.inviteUserIDReturnValue = .success(())
@@ -138,8 +136,6 @@ final class InviteUsersScreenViewModelTests {
@Test @Test
func removeButtonRemovesUnknownUsers() async throws { func removeButtonRemovesUnknownUsers() async throws {
appSettings.enableKeyShareOnInvite = true
let mockedMembers: [RoomMemberProxyMock] = [.mockAlice, .mockBob] let mockedMembers: [RoomMemberProxyMock] = [.mockAlice, .mockBob]
let roomProxy = JoinedRoomProxyMock(.init(name: "test", members: mockedMembers)) let roomProxy = JoinedRoomProxyMock(.init(name: "test", members: mockedMembers))
roomProxy.inviteUserIDReturnValue = .success(()) roomProxy.inviteUserIDReturnValue = .success(())

View File

@@ -791,34 +791,7 @@ struct RoomDetailsScreenViewModelTests {
// MARK: - History Sharing // MARK: - History Sharing
@Test @Test
mutating func historySharingPillDoesNotAppearIfFeatureFlagNotSet() async throws { mutating func historySharingPillDisplayed() 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
let configuration = JoinedRoomProxyMockConfiguration(historyVisibility: .shared) let configuration = JoinedRoomProxyMockConfiguration(historyVisibility: .shared)
let infoSubject = CurrentValueSubject<RoomInfoProxyProtocol, Never>(RoomInfoProxyMock(configuration)) let infoSubject = CurrentValueSubject<RoomInfoProxyProtocol, Never>(RoomInfoProxyMock(configuration))
let roomProxyMock = JoinedRoomProxyMock(configuration) let roomProxyMock = JoinedRoomProxyMock(configuration)

View File

@@ -163,7 +163,6 @@ struct RoomMemberDetailsViewModelTests {
let waitForMemberToLoad = deferFulfillment(context.$viewState) { $0.memberDetails != nil } let waitForMemberToLoad = deferFulfillment(context.$viewState) { $0.memberDetails != nil }
try await waitForMemberToLoad.fulfill() try await waitForMemberToLoad.fulfill()
ServiceLocator.shared.settings.enableKeyShareOnInvite = true
clientProxy.directRoomForUserIDReturnValue = .success(nil) clientProxy.directRoomForUserIDReturnValue = .success(nil)
clientProxy.userIdentityForFallBackToServerReturnValue = .success(UserIdentityProxyMock(configuration: .init(verificationState: .notVerified))) clientProxy.userIdentityForFallBackToServerReturnValue = .success(UserIdentityProxyMock(configuration: .init(verificationState: .notVerified)))
@@ -185,7 +184,6 @@ struct RoomMemberDetailsViewModelTests {
let waitForMemberToLoad = deferFulfillment(context.$viewState) { $0.memberDetails != nil } let waitForMemberToLoad = deferFulfillment(context.$viewState) { $0.memberDetails != nil }
try await waitForMemberToLoad.fulfill() try await waitForMemberToLoad.fulfill()
ServiceLocator.shared.settings.enableKeyShareOnInvite = true
clientProxy.directRoomForUserIDReturnValue = .success(nil) clientProxy.directRoomForUserIDReturnValue = .success(nil)
clientProxy.userIdentityForFallBackToServerReturnValue = .failure(.forbiddenAccess) clientProxy.userIdentityForFallBackToServerReturnValue = .failure(.forbiddenAccess)

View File

@@ -452,46 +452,7 @@ final class RoomScreenViewModelTests {
// MARK: - History Sharing // MARK: - History Sharing
@Test @Test
func roomWithSharedHistoryDoesNotDisplayBadgeIfFeatureFlagNotSet() async throws { func roomWithSharedHistoryDisplaysBadge() 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
var configuration = JoinedRoomProxyMockConfiguration(isEncrypted: false, historyVisibility: .joined) var configuration = JoinedRoomProxyMockConfiguration(isEncrypted: false, historyVisibility: .joined)
let infoSubject = CurrentValueSubject<RoomInfoProxyProtocol, Never>(RoomInfoProxyMock(configuration)) let infoSubject = CurrentValueSubject<RoomInfoProxyProtocol, Never>(RoomInfoProxyMock(configuration))
let roomProxyMock = JoinedRoomProxyMock(configuration) let roomProxyMock = JoinedRoomProxyMock(configuration)

View File

@@ -89,7 +89,6 @@ struct StartChatScreenViewModelTests {
@Test @Test
func inviteConfirmationFetchesIdentity() async throws { func inviteConfirmationFetchesIdentity() async throws {
ServiceLocator.shared.settings.enableKeyShareOnInvite = true
clientProxy.directRoomForUserIDReturnValue = .success(nil) clientProxy.directRoomForUserIDReturnValue = .success(nil)
clientProxy.userIdentityForFallBackToServerReturnValue = .success(UserIdentityProxyMock(configuration: .init(verificationState: .notVerified))) clientProxy.userIdentityForFallBackToServerReturnValue = .success(UserIdentityProxyMock(configuration: .init(verificationState: .notVerified)))
@@ -105,7 +104,6 @@ struct StartChatScreenViewModelTests {
@Test @Test
func inviteConfirmationFallsBackToUnknownIdentityOnFailure() async throws { func inviteConfirmationFallsBackToUnknownIdentityOnFailure() async throws {
ServiceLocator.shared.settings.enableKeyShareOnInvite = true
clientProxy.directRoomForUserIDReturnValue = .success(nil) clientProxy.directRoomForUserIDReturnValue = .success(nil)
clientProxy.userIdentityForFallBackToServerReturnValue = .failure(.forbiddenAccess) clientProxy.userIdentityForFallBackToServerReturnValue = .failure(.forbiddenAccess)

View File

@@ -57,8 +57,6 @@ struct UserProfileScreenViewModelTests {
@Test @Test
func startingDmWithUnknownUserFetchesIdentity() async throws { func startingDmWithUnknownUserFetchesIdentity() async throws {
ServiceLocator.shared.settings.enableKeyShareOnInvite = true
let profile = UserProfileProxy.mockAlice let profile = UserProfileProxy.mockAlice
let clientProxy = ClientProxyMock(.init()) let clientProxy = ClientProxyMock(.init())