diff --git a/Sources/App/Resources/en.lproj/Localizable.strings b/Sources/App/Resources/en.lproj/Localizable.strings index 33fbc5bb8..bfd02e959 100644 --- a/Sources/App/Resources/en.lproj/Localizable.strings +++ b/Sources/App/Resources/en.lproj/Localizable.strings @@ -361,6 +361,7 @@ Home Assistant is free and open source home automation software with a focus on "settings_details.actions.scenes.empty" = "No Scenes"; "settings_details.actions.scenes.footer" = "When enabled, Scenes display alongside actions. When performed, they trigger scene changes."; "settings_details.actions.scenes.title" = "Scene Actions"; +"settings_details.actions.scenes.select_all" = "Select All"; "settings_details.actions.title" = "Actions"; "settings_details.general.app_icon.enum.beta" = "Beta"; "settings_details.general.app_icon.enum.black" = "Black"; diff --git a/Sources/App/Settings/SettingsDetailViewController.swift b/Sources/App/Settings/SettingsDetailViewController.swift index 28c036766..6f338bf75 100644 --- a/Sources/App/Settings/SettingsDetailViewController.swift +++ b/Sources/App/Settings/SettingsDetailViewController.swift @@ -456,19 +456,16 @@ class SettingsDetailViewController: HAFormViewController, TypedRowControllerType var baseRows: [BaseRow] = [] if $0 == scenes.first { let toggleAllSwitch = SwitchRow() - toggleAllSwitch.title = NSLocalizedString( - "Select All", - comment: "Toggle to select/unselect all actions that are displayed in watchOS app" - ) + toggleAllSwitch.title = L10n.SettingsDetails.Actions.Scenes.selectAll toggleAllSwitch.value = scenes.filter(\.actionEnabled).count == scenes.count toggleAllSwitch.onChange { [weak self] row in guard let self = self, let value = row.value else { return } - self.realm.beginWrite() - scenes.forEach { scene in - scene.actionEnabled = value + self.realm.reentrantWrite { + scenes.forEach { scene in + scene.actionEnabled = value + } } - try? self.realm.commitWrite() } baseRows = [toggleAllSwitch] } diff --git a/Sources/Shared/Resources/Swiftgen/Strings.swift b/Sources/Shared/Resources/Swiftgen/Strings.swift index 48fa0ce00..4522f58e5 100644 --- a/Sources/Shared/Resources/Swiftgen/Strings.swift +++ b/Sources/Shared/Resources/Swiftgen/Strings.swift @@ -1227,6 +1227,8 @@ public enum L10n { public static var empty: String { return L10n.tr("Localizable", "settings_details.actions.scenes.empty") } /// When enabled, Scenes display alongside actions. When performed, they trigger scene changes. public static var footer: String { return L10n.tr("Localizable", "settings_details.actions.scenes.footer") } + /// Select All + public static var selectAll: String { return L10n.tr("Localizable", "settings_details.actions.scenes.select_all") } /// Scene Actions public static var title: String { return L10n.tr("Localizable", "settings_details.actions.scenes.title") } }