mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
Guard user suggestions behind feature flag so that they don't impact releasability of other room creation features (#770)
This commit is contained in:
@@ -28,6 +28,7 @@ final class AppSettings: ObservableObject {
|
|||||||
case pusherProfileTag
|
case pusherProfileTag
|
||||||
case shouldCollapseRoomStateEvents
|
case shouldCollapseRoomStateEvents
|
||||||
case startChatFlowEnabled = "showStartChatFlow"
|
case startChatFlowEnabled = "showStartChatFlow"
|
||||||
|
case startChatUserSuggestionsEnabled
|
||||||
case mediaUploadingFlowEnabled
|
case mediaUploadingFlowEnabled
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,6 +165,9 @@ final class AppSettings: ObservableObject {
|
|||||||
@UserSetting(key: UserDefaultsKeys.startChatFlowEnabled.rawValue, defaultValue: false, persistIn: store)
|
@UserSetting(key: UserDefaultsKeys.startChatFlowEnabled.rawValue, defaultValue: false, persistIn: store)
|
||||||
var startChatFlowEnabled
|
var startChatFlowEnabled
|
||||||
|
|
||||||
|
@UserSetting(key: UserDefaultsKeys.startChatUserSuggestionsEnabled.rawValue, defaultValue: false, persistIn: nil)
|
||||||
|
var startChatUserSuggestionsEnabled
|
||||||
|
|
||||||
// MARK: Media Uploading
|
// MARK: Media Uploading
|
||||||
|
|
||||||
@UserSetting(key: UserDefaultsKeys.mediaUploadingFlowEnabled.rawValue, defaultValue: false, persistIn: nil)
|
@UserSetting(key: UserDefaultsKeys.mediaUploadingFlowEnabled.rawValue, defaultValue: false, persistIn: nil)
|
||||||
|
|||||||
@@ -25,11 +25,13 @@ struct DeveloperOptionsScreenViewState: BindableState {
|
|||||||
struct DeveloperOptionsScreenViewStateBindings {
|
struct DeveloperOptionsScreenViewStateBindings {
|
||||||
var shouldCollapseRoomStateEvents: Bool
|
var shouldCollapseRoomStateEvents: Bool
|
||||||
var startChatFlowEnabled: Bool
|
var startChatFlowEnabled: Bool
|
||||||
|
var startChatUserSuggestionsEnabled: Bool
|
||||||
var mediaUploadFlowEnabled: Bool
|
var mediaUploadFlowEnabled: Bool
|
||||||
}
|
}
|
||||||
|
|
||||||
enum DeveloperOptionsScreenViewAction {
|
enum DeveloperOptionsScreenViewAction {
|
||||||
case changedShouldCollapseRoomStateEvents
|
case changedShouldCollapseRoomStateEvents
|
||||||
case changedStartChatFlowEnabled
|
case changedStartChatFlowEnabled
|
||||||
|
case changedStartChatUserSuggestionsEnabled
|
||||||
case changedMediaUploadFlowEnabled
|
case changedMediaUploadFlowEnabled
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ class DeveloperOptionsScreenViewModel: DeveloperOptionsScreenViewModelType, Deve
|
|||||||
init() {
|
init() {
|
||||||
let bindings = DeveloperOptionsScreenViewStateBindings(shouldCollapseRoomStateEvents: ServiceLocator.shared.settings.shouldCollapseRoomStateEvents,
|
let bindings = DeveloperOptionsScreenViewStateBindings(shouldCollapseRoomStateEvents: ServiceLocator.shared.settings.shouldCollapseRoomStateEvents,
|
||||||
startChatFlowEnabled: ServiceLocator.shared.settings.startChatFlowEnabled,
|
startChatFlowEnabled: ServiceLocator.shared.settings.startChatFlowEnabled,
|
||||||
|
startChatUserSuggestionsEnabled: ServiceLocator.shared.settings.startChatUserSuggestionsEnabled,
|
||||||
mediaUploadFlowEnabled: ServiceLocator.shared.settings.mediaUploadingFlowEnabled)
|
mediaUploadFlowEnabled: ServiceLocator.shared.settings.mediaUploadingFlowEnabled)
|
||||||
let state = DeveloperOptionsScreenViewState(bindings: bindings)
|
let state = DeveloperOptionsScreenViewState(bindings: bindings)
|
||||||
|
|
||||||
@@ -40,6 +41,8 @@ class DeveloperOptionsScreenViewModel: DeveloperOptionsScreenViewModelType, Deve
|
|||||||
ServiceLocator.shared.settings.shouldCollapseRoomStateEvents = state.bindings.shouldCollapseRoomStateEvents
|
ServiceLocator.shared.settings.shouldCollapseRoomStateEvents = state.bindings.shouldCollapseRoomStateEvents
|
||||||
case .changedStartChatFlowEnabled:
|
case .changedStartChatFlowEnabled:
|
||||||
ServiceLocator.shared.settings.startChatFlowEnabled = state.bindings.startChatFlowEnabled
|
ServiceLocator.shared.settings.startChatFlowEnabled = state.bindings.startChatFlowEnabled
|
||||||
|
case .changedStartChatUserSuggestionsEnabled:
|
||||||
|
ServiceLocator.shared.settings.startChatUserSuggestionsEnabled = state.bindings.startChatUserSuggestionsEnabled
|
||||||
case .changedMediaUploadFlowEnabled:
|
case .changedMediaUploadFlowEnabled:
|
||||||
ServiceLocator.shared.settings.mediaUploadingFlowEnabled = state.bindings.mediaUploadFlowEnabled
|
ServiceLocator.shared.settings.mediaUploadingFlowEnabled = state.bindings.mediaUploadFlowEnabled
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,13 @@ struct DeveloperOptionsScreen: View {
|
|||||||
context.send(viewAction: .changedStartChatFlowEnabled)
|
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.mediaUploadFlowEnabled) {
|
Toggle(isOn: $context.mediaUploadFlowEnabled) {
|
||||||
Text("Show Media Uploading flow")
|
Text("Show Media Uploading flow")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -142,6 +142,10 @@ class StartChatViewModel: StartChatViewModelType, StartChatViewModelProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func fetchSuggestions() {
|
private func fetchSuggestions() {
|
||||||
|
guard ServiceLocator.shared.settings.startChatUserSuggestionsEnabled else {
|
||||||
|
state.usersSection = .init(type: .suggestions, users: [])
|
||||||
|
return
|
||||||
|
}
|
||||||
state.usersSection = .init(type: .suggestions, users: [.mockAlice, .mockBob, .mockCharlie])
|
state.usersSection = .init(type: .suggestions, users: [.mockAlice, .mockBob, .mockCharlie])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -81,20 +81,23 @@ struct StartChatScreen: View {
|
|||||||
.formSectionStyle()
|
.formSectionStyle()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ViewBuilder
|
||||||
private var usersSection: some View {
|
private var usersSection: some View {
|
||||||
Section {
|
if !context.viewState.usersSection.users.isEmpty {
|
||||||
ForEach(context.viewState.usersSection.users, id: \.userID) { user in
|
Section {
|
||||||
Button { context.send(viewAction: .selectUser(user)) } label: {
|
ForEach(context.viewState.usersSection.users, id: \.userID) { user in
|
||||||
StartChatSuggestedUserCell(user: user, imageProvider: context.imageProvider)
|
Button { context.send(viewAction: .selectUser(user)) } label: {
|
||||||
|
StartChatSuggestedUserCell(user: user, imageProvider: context.imageProvider)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} header: {
|
||||||
|
if let title = context.viewState.usersSection.type.title {
|
||||||
|
Text(title)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} header: {
|
.listRowSeparator(.automatic)
|
||||||
if let title = context.viewState.usersSection.type.title {
|
.formSectionStyle()
|
||||||
Text(title)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.listRowSeparator(.automatic)
|
|
||||||
.formSectionStyle()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private var noResultsContent: some View {
|
private var noResultsContent: some View {
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
Guard user suggestions behind feature flag so that they don't impact releasability of other room creation features
|
||||||
Reference in New Issue
Block a user