Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add button to manually sync server Actions #2733

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion Sources/App/Resources/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ Home Assistant is free and open source home automation software with a focus on
"settings_details.actions.scenes.title" = "Scene Actions";
"settings_details.actions.title" = "Actions";
"settings_details.actions.watch.available.title" = "Show in Watch";
"settings_details.actions.server_controlled.update.title" = "Update server Actions";
"settings_details.general.app_icon.enum.beta" = "Beta";
"settings_details.general.app_icon.enum.black" = "Black";
"settings_details.general.app_icon.enum.blue" = "Blue";
Expand Down Expand Up @@ -848,4 +849,4 @@ Home Assistant is free and open source home automation software with a focus on
"widgets.open_page.description" = "Open a frontend page in Home Assistant.";
"widgets.open_page.not_configured" = "No Pages Available";
"widgets.open_page.title" = "Open Page";
"yes_label" = "Yes";
"yes_label" = "Yes";
15 changes: 15 additions & 0 deletions Sources/App/Settings/SettingsDetailViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,21 @@ class SettingsDetailViewController: HAFormViewController, TypedRowControllerType
}
)

form +++ ButtonRow {
$0.title = L10n.SettingsDetails.Actions.ServerControlled.Update.title
$0.onCellSelection { _, _ in
let result = Current.modelManager.fetch()
result.pipe { result in
switch result {
case .fulfilled:
break
case let .rejected(error):
Current.Log.error("Failed to manually update server Actions: \(error.localizedDescription)")
}
}
}
}

let scenes = realm.objects(RLMScene.self).sorted(byKeyPath: RLMScene.positionKeyPath)

let toggleAllSwitch = SwitchRow()
Expand Down
1 change: 1 addition & 0 deletions Sources/Shared/API/Models/Action.swift
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ public final class Action: Object, ImmutableMappable, UpdatableModel {
}

public func update(with object: MobileAppConfigAction, server: Server, using realm: Realm) -> Bool {
Current.Log.info("Updating server configured Actions")
if self.realm == nil {
ID = object.name
Name = object.name
Expand Down
6 changes: 6 additions & 0 deletions Sources/Shared/Resources/Swiftgen/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1451,6 +1451,12 @@ public enum L10n {
/// Scene Actions
public static var title: String { return L10n.tr("Localizable", "settings_details.actions.scenes.title") }
}
public enum ServerControlled {
public enum Update {
/// Update server Actions
public static var title: String { return L10n.tr("Localizable", "settings_details.actions.server_controlled.update.title") }
}
}
public enum Watch {
public enum Available {
/// Show in Watch
Expand Down