mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user