Skip to content

Commit

Permalink
PR improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
bgoncal committed Nov 2, 2023
1 parent ff8c777 commit 6893e1d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
1 change: 1 addition & 0 deletions Sources/App/Resources/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
13 changes: 5 additions & 8 deletions Sources/App/Settings/SettingsDetailViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
Expand Down
2 changes: 2 additions & 0 deletions Sources/Shared/Resources/Swiftgen/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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") }
}
Expand Down

0 comments on commit 6893e1d

Please sign in to comment.