mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Remove feature flags for the rooms epic (#1042)
* Delete rooms feature flags * Rename suggestions feature flag * Cleanup test targets
This commit is contained in:
@@ -27,11 +27,7 @@ final class AppSettings {
|
||||
case enableInAppNotifications
|
||||
case pusherProfileTag
|
||||
case shouldCollapseRoomStateEvents
|
||||
case startChatFlowEnabled
|
||||
case startChatUserSuggestionsEnabled
|
||||
case editRoomDetailsFlowEnabled
|
||||
case invitesFlowEnabled
|
||||
case inviteMorePeopleFlowEnabled
|
||||
case userSuggestionsEnabled
|
||||
case readReceiptsEnabled
|
||||
}
|
||||
|
||||
@@ -181,27 +177,11 @@ final class AppSettings {
|
||||
|
||||
// MARK: Start Chat
|
||||
|
||||
@UserPreference(key: UserDefaultsKeys.startChatFlowEnabled, defaultValue: false, storageType: .userDefaults(store))
|
||||
var startChatFlowEnabled
|
||||
|
||||
@UserPreference(key: UserDefaultsKeys.startChatUserSuggestionsEnabled, defaultValue: false, storageType: .volatile)
|
||||
var startChatUserSuggestionsEnabled
|
||||
|
||||
// MARK: Invites
|
||||
|
||||
@UserPreference(key: UserDefaultsKeys.invitesFlowEnabled, defaultValue: false, storageType: .userDefaults(store))
|
||||
var invitesFlowEnabled
|
||||
|
||||
@UserPreference(key: UserDefaultsKeys.inviteMorePeopleFlowEnabled, defaultValue: false, storageType: .userDefaults(store))
|
||||
var inviteMorePeopleFlowEnabled
|
||||
@UserPreference(key: UserDefaultsKeys.userSuggestionsEnabled, defaultValue: false, storageType: .volatile)
|
||||
var userSuggestionsEnabled
|
||||
|
||||
// MARK: Receipts
|
||||
|
||||
@UserPreference(key: UserDefaultsKeys.readReceiptsEnabled, defaultValue: false, storageType: .userDefaults(store))
|
||||
var readReceiptsEnabled
|
||||
|
||||
// MARK: Room details edit
|
||||
|
||||
@UserPreference(key: UserDefaultsKeys.editRoomDetailsFlowEnabled, defaultValue: false, storageType: .userDefaults(store))
|
||||
var editRoomDetailsFlowEnabled
|
||||
}
|
||||
|
||||
@@ -26,19 +26,11 @@ struct DeveloperOptionsScreenViewState: BindableState {
|
||||
|
||||
struct DeveloperOptionsScreenViewStateBindings {
|
||||
var shouldCollapseRoomStateEvents: Bool
|
||||
var startChatFlowEnabled: Bool
|
||||
var startChatUserSuggestionsEnabled: Bool
|
||||
var invitesFlowEnabled: Bool
|
||||
var inviteMorePeopleFlowEnabled: Bool
|
||||
var editRoomDetailsFlowEnabled: Bool
|
||||
var userSuggestionsEnabled: Bool
|
||||
}
|
||||
|
||||
enum DeveloperOptionsScreenViewAction {
|
||||
case changedShouldCollapseRoomStateEvents
|
||||
case changedStartChatFlowEnabled
|
||||
case changedStartChatUserSuggestionsEnabled
|
||||
case changedInvitesFlowEnabled
|
||||
case changedInviteMorePeopleFlowEnabled
|
||||
case changedEditRoomDetailsFlowEnabled
|
||||
case changedUserSuggestionsEnabled
|
||||
case clearCache
|
||||
}
|
||||
|
||||
+3
-15
@@ -26,11 +26,7 @@ class DeveloperOptionsScreenViewModel: DeveloperOptionsScreenViewModelType, Deve
|
||||
init() {
|
||||
appSettings = ServiceLocator.shared.settings
|
||||
let bindings = DeveloperOptionsScreenViewStateBindings(shouldCollapseRoomStateEvents: appSettings.shouldCollapseRoomStateEvents,
|
||||
startChatFlowEnabled: appSettings.startChatFlowEnabled,
|
||||
startChatUserSuggestionsEnabled: appSettings.startChatUserSuggestionsEnabled,
|
||||
invitesFlowEnabled: appSettings.invitesFlowEnabled,
|
||||
inviteMorePeopleFlowEnabled: appSettings.inviteMorePeopleFlowEnabled,
|
||||
editRoomDetailsFlowEnabled: appSettings.editRoomDetailsFlowEnabled)
|
||||
userSuggestionsEnabled: appSettings.userSuggestionsEnabled)
|
||||
let state = DeveloperOptionsScreenViewState(bindings: bindings)
|
||||
|
||||
super.init(initialViewState: state)
|
||||
@@ -44,16 +40,8 @@ class DeveloperOptionsScreenViewModel: DeveloperOptionsScreenViewModelType, Deve
|
||||
switch viewAction {
|
||||
case .changedShouldCollapseRoomStateEvents:
|
||||
appSettings.shouldCollapseRoomStateEvents = state.bindings.shouldCollapseRoomStateEvents
|
||||
case .changedStartChatFlowEnabled:
|
||||
appSettings.startChatFlowEnabled = state.bindings.startChatFlowEnabled
|
||||
case .changedStartChatUserSuggestionsEnabled:
|
||||
appSettings.startChatUserSuggestionsEnabled = state.bindings.startChatUserSuggestionsEnabled
|
||||
case .changedInvitesFlowEnabled:
|
||||
appSettings.invitesFlowEnabled = state.bindings.invitesFlowEnabled
|
||||
case .changedInviteMorePeopleFlowEnabled:
|
||||
appSettings.inviteMorePeopleFlowEnabled = state.bindings.inviteMorePeopleFlowEnabled
|
||||
case .changedEditRoomDetailsFlowEnabled:
|
||||
appSettings.editRoomDetailsFlowEnabled = state.bindings.editRoomDetailsFlowEnabled
|
||||
case .changedUserSuggestionsEnabled:
|
||||
appSettings.userSuggestionsEnabled = state.bindings.userSuggestionsEnabled
|
||||
case .clearCache:
|
||||
callback?(.clearCache)
|
||||
}
|
||||
|
||||
@@ -30,39 +30,11 @@ struct DeveloperOptionsScreen: View {
|
||||
context.send(viewAction: .changedShouldCollapseRoomStateEvents)
|
||||
}
|
||||
|
||||
Toggle(isOn: $context.startChatFlowEnabled) {
|
||||
Text("Show start chat flow")
|
||||
Toggle(isOn: $context.userSuggestionsEnabled) {
|
||||
Text("User suggestions")
|
||||
}
|
||||
.onChange(of: context.startChatFlowEnabled) { _ in
|
||||
context.send(viewAction: .changedStartChatFlowEnabled)
|
||||
}
|
||||
|
||||
Toggle(isOn: $context.startChatUserSuggestionsEnabled) {
|
||||
Text("Start chat user suggestions")
|
||||
}
|
||||
.onChange(of: context.startChatUserSuggestionsEnabled) { _ in
|
||||
context.send(viewAction: .changedStartChatUserSuggestionsEnabled)
|
||||
}
|
||||
|
||||
Toggle(isOn: $context.invitesFlowEnabled) {
|
||||
Text("Show invites flow")
|
||||
}
|
||||
.onChange(of: context.invitesFlowEnabled) { _ in
|
||||
context.send(viewAction: .changedInvitesFlowEnabled)
|
||||
}
|
||||
|
||||
Toggle(isOn: $context.inviteMorePeopleFlowEnabled) {
|
||||
Text("Show invite more people flow")
|
||||
}
|
||||
.onChange(of: context.inviteMorePeopleFlowEnabled) { _ in
|
||||
context.send(viewAction: .changedInviteMorePeopleFlowEnabled)
|
||||
}
|
||||
|
||||
Toggle(isOn: $context.editRoomDetailsFlowEnabled) {
|
||||
Text("Show edit room details flow")
|
||||
}
|
||||
.onChange(of: context.editRoomDetailsFlowEnabled) { _ in
|
||||
context.send(viewAction: .changedEditRoomDetailsFlowEnabled)
|
||||
.onChange(of: context.userSuggestionsEnabled) { _ in
|
||||
context.send(viewAction: .changedUserSuggestionsEnabled)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -74,10 +74,6 @@ struct HomeScreenViewState: BindableState {
|
||||
var hasPendingInvitations = false
|
||||
var hasUnreadPendingInvitations = false
|
||||
|
||||
var startChatFlowEnabled: Bool {
|
||||
ServiceLocator.shared.settings.startChatFlowEnabled
|
||||
}
|
||||
|
||||
var visibleRooms: [HomeScreenRoom] {
|
||||
if roomListMode == .skeletons {
|
||||
return placeholderRooms
|
||||
|
||||
@@ -34,7 +34,7 @@ struct HomeScreen: View {
|
||||
sessionVerificationBanner
|
||||
}
|
||||
|
||||
if context.viewState.hasPendingInvitations, ServiceLocator.shared.settings.invitesFlowEnabled {
|
||||
if context.viewState.hasPendingInvitations {
|
||||
HomeScreenInvitesButton(title: L10n.actionInvitesList, hasBadge: context.viewState.hasUnreadPendingInvitations) {
|
||||
context.send(viewAction: .selectInvites)
|
||||
}
|
||||
@@ -136,10 +136,8 @@ struct HomeScreen: View {
|
||||
}
|
||||
|
||||
ToolbarItemGroup(placement: .bottomBar) {
|
||||
if context.viewState.startChatFlowEnabled {
|
||||
Spacer()
|
||||
newRoomButton
|
||||
}
|
||||
Spacer()
|
||||
newRoomButton
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ class InviteUsersScreenViewModel: InviteUsersScreenViewModelType, InviteUsersScr
|
||||
}
|
||||
|
||||
private func fetchSuggestions() {
|
||||
guard ServiceLocator.shared.settings.startChatUserSuggestionsEnabled else {
|
||||
guard ServiceLocator.shared.settings.userSuggestionsEnabled else {
|
||||
state.usersSection = .init(type: .suggestions, users: [])
|
||||
return
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ struct RoomDetailsScreenViewState: BindableState {
|
||||
}
|
||||
|
||||
var canEdit: Bool {
|
||||
!isDirect && ServiceLocator.shared.settings.editRoomDetailsFlowEnabled && (canEditRoomName || canEditRoomTopic || canEditRoomAvatar)
|
||||
!isDirect && (canEditRoomName || canEditRoomTopic || canEditRoomAvatar)
|
||||
}
|
||||
|
||||
var hasTopicSection: Bool {
|
||||
|
||||
@@ -150,7 +150,7 @@ struct RoomDetailsScreen: View {
|
||||
}
|
||||
.accessibilityIdentifier(A11yIdentifiers.roomDetailsScreen.people)
|
||||
|
||||
if context.viewState.canInviteUsers, ServiceLocator.shared.settings.inviteMorePeopleFlowEnabled {
|
||||
if context.viewState.canInviteUsers {
|
||||
Button {
|
||||
context.send(viewAction: .processTapInvite)
|
||||
} label: {
|
||||
|
||||
@@ -61,7 +61,7 @@ struct RoomMembersListScreen: View {
|
||||
|
||||
@ViewBuilder
|
||||
private var inviteButton: some View {
|
||||
if context.viewState.canInviteUsers, ServiceLocator.shared.settings.inviteMorePeopleFlowEnabled {
|
||||
if context.viewState.canInviteUsers {
|
||||
Button {
|
||||
context.send(viewAction: .invite)
|
||||
} label: {
|
||||
|
||||
@@ -106,7 +106,7 @@ class StartChatScreenViewModel: StartChatScreenViewModelType, StartChatScreenVie
|
||||
}
|
||||
|
||||
private func fetchSuggestions() {
|
||||
guard ServiceLocator.shared.settings.startChatUserSuggestionsEnabled else {
|
||||
guard ServiceLocator.shared.settings.userSuggestionsEnabled else {
|
||||
state.usersSection = .init(type: .suggestions, users: [])
|
||||
return
|
||||
}
|
||||
|
||||
@@ -318,7 +318,6 @@ class MockScreen: Identifiable {
|
||||
navigationStackCoordinator.setRootCoordinator(coordinator)
|
||||
return navigationStackCoordinator
|
||||
case .roomDetailsScreenWithEmptyTopic:
|
||||
ServiceLocator.shared.settings.editRoomDetailsFlowEnabled = true
|
||||
let navigationStackCoordinator = NavigationStackCoordinator()
|
||||
let members: [RoomMemberProxyMock] = [.mockOwner(allowedStateEvents: [.roomTopic]), .mockBob, .mockCharlie]
|
||||
let roomProxy = RoomProxyMock(with: .init(id: "MockRoomIdentifier",
|
||||
@@ -336,7 +335,6 @@ class MockScreen: Identifiable {
|
||||
navigationStackCoordinator.setRootCoordinator(coordinator)
|
||||
return navigationStackCoordinator
|
||||
case .roomDetailsScreenWithInvite:
|
||||
ServiceLocator.shared.settings.inviteMorePeopleFlowEnabled = true
|
||||
let navigationStackCoordinator = NavigationStackCoordinator()
|
||||
let members: [RoomMemberProxyMock] = [.mockMe, .mockBob, .mockCharlie]
|
||||
let roomProxy = RoomProxyMock(with: .init(id: "MockRoomIdentifier",
|
||||
@@ -388,7 +386,7 @@ class MockScreen: Identifiable {
|
||||
navigationStackCoordinator.setRootCoordinator(coordinator)
|
||||
return navigationStackCoordinator
|
||||
case .startChat:
|
||||
ServiceLocator.shared.settings.startChatUserSuggestionsEnabled = true
|
||||
ServiceLocator.shared.settings.userSuggestionsEnabled = true
|
||||
let navigationStackCoordinator = NavigationStackCoordinator()
|
||||
let userDiscoveryMock = UserDiscoveryServiceMock()
|
||||
userDiscoveryMock.fetchSuggestionsReturnValue = .success([.mockAlice, .mockBob, .mockCharlie])
|
||||
@@ -469,7 +467,7 @@ class MockScreen: Identifiable {
|
||||
navigationStackCoordinator.setRootCoordinator(coordinator)
|
||||
return navigationStackCoordinator
|
||||
case .inviteUsers, .inviteUsersInRoom, .inviteUsersInRoomExistingMembers:
|
||||
ServiceLocator.shared.settings.startChatUserSuggestionsEnabled = true
|
||||
ServiceLocator.shared.settings.userSuggestionsEnabled = true
|
||||
let navigationStackCoordinator = NavigationStackCoordinator()
|
||||
let userDiscoveryMock = UserDiscoveryServiceMock()
|
||||
userDiscoveryMock.fetchSuggestionsReturnValue = .success([.mockAlice, .mockBob, .mockCharlie])
|
||||
|
||||
Reference in New Issue
Block a user