mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +00:00
Reduce boilerplate in Developer Options Screen (#1378)
* Reduce developer options boilerplate * Add protocol DeveloperOptions * Delete timelineDiffableAnimationsEnabled * Refactor DeveloperOptions -> DeveloperOptionsProtocol
This commit is contained in:
+1
-16
@@ -26,17 +26,11 @@ struct DeveloperOptionsScreen: View {
|
||||
Toggle(isOn: $context.shouldCollapseRoomStateEvents) {
|
||||
Text("Collapse room state events")
|
||||
}
|
||||
.onChange(of: context.shouldCollapseRoomStateEvents) { _ in
|
||||
context.send(viewAction: .changedShouldCollapseRoomStateEvents)
|
||||
}
|
||||
|
||||
Toggle(isOn: $context.readReceiptsEnabled) {
|
||||
Text("Show read receipts")
|
||||
Text("Requires app reboot")
|
||||
}
|
||||
.onChange(of: context.readReceiptsEnabled) { _ in
|
||||
context.send(viewAction: .changedReadReceiptsEnabled)
|
||||
}
|
||||
}
|
||||
|
||||
Section("Notifications") {
|
||||
@@ -44,25 +38,16 @@ struct DeveloperOptionsScreen: View {
|
||||
Text("Use notification encryption sync")
|
||||
Text("Requires app reboot")
|
||||
}
|
||||
.onChange(of: context.isEncryptionSyncEnabled) { _ in
|
||||
context.send(viewAction: .changedIsEncryptionSyncEnabled)
|
||||
}
|
||||
|
||||
Toggle(isOn: $context.notificationSettingsEnabled) {
|
||||
Text("Show notification settings")
|
||||
}
|
||||
.onChange(of: context.notificationSettingsEnabled) { _ in
|
||||
context.send(viewAction: .changedNotificationSettingsEnabled)
|
||||
}
|
||||
}
|
||||
|
||||
Section("Room creation") {
|
||||
Toggle(isOn: $context.userSuggestionsEnabled) {
|
||||
Text("User suggestions")
|
||||
}
|
||||
.onChange(of: context.userSuggestionsEnabled) { _ in
|
||||
context.send(viewAction: .changedUserSuggestionsEnabled)
|
||||
}
|
||||
}
|
||||
|
||||
Section {
|
||||
@@ -116,7 +101,7 @@ struct DeveloperOptionsScreen: View {
|
||||
// MARK: - Previews
|
||||
|
||||
struct DeveloperOptionsScreen_Previews: PreviewProvider {
|
||||
static let viewModel = DeveloperOptionsScreenViewModel(appSettings: ServiceLocator.shared.settings)
|
||||
static let viewModel = DeveloperOptionsScreenViewModel(developerOptions: ServiceLocator.shared.settings)
|
||||
static var previews: some View {
|
||||
NavigationStack {
|
||||
DeveloperOptionsScreen(context: viewModel.context)
|
||||
|
||||
Reference in New Issue
Block a user