Skip to content

Commit

Permalink
Add whats new section to settings (#2477)
Browse files Browse the repository at this point in the history
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->
Add whats new section to settings
## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->
![Simulator Screenshot - iPhone 15 Pro - 2023-12-12 at 12 19
37](https://github.com/home-assistant/iOS/assets/5808343/6be1c217-94b1-4980-9394-7b629a814618)

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
  • Loading branch information
bgoncal authored Dec 12, 2023
1 parent a5d07b9 commit e075dc5
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class DropSupportMessageViewController: UIViewController {
}

@objc private func linkButtonTapped() {
guard let url = URL(string: "https://www.home-assistant.io/blog/") else { return }
guard let url = URL(string: "https://www.home-assistant.io/latest-ios-release-notes/") else { return }
UIApplication.shared.open(url)
}
}
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 @@ -313,6 +313,7 @@ Home Assistant is free and open source home automation software with a focus on
"settings.connection_section.websocket.status.disconnected.title" = "Disconnected";
"settings.connection_section.websocket.title" = "WebSocket";
"settings.debugging.title" = "Debugging";
"settings.whats_new.title" = "What's new?";
"settings.details_section.location_settings_row.title" = "Location";
"settings.details_section.notification_settings_row.title" = "Notifications";
"settings.details_section.watch_row.title" = "Apple Watch";
Expand Down
17 changes: 17 additions & 0 deletions Sources/App/Settings/SettingsRootDataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ enum SettingsRootDataSource {
case help
case privacy
case debugging
case whatsNew

var row: SettingsButtonRow {
let row = { () -> SettingsButtonRow in
Expand All @@ -44,6 +45,7 @@ enum SettingsRootDataSource {
case .help: return SettingsRootDataSource.help()
case .privacy: return SettingsRootDataSource.privacy()
case .debugging: return SettingsRootDataSource.debugging()
case .whatsNew: return SettingsRootDataSource.whatsNew()
}
}()
row.tag = rawValue
Expand Down Expand Up @@ -180,4 +182,19 @@ enum SettingsRootDataSource {
}, onDismiss: nil)
}
}

private static func whatsNew() -> SettingsButtonRow {
SettingsButtonRow {
$0.title = L10n.Settings.WhatsNew.title
$0.icon = .starIcon
$0.accessoryIcon = .openInNewIcon
$0.onCellSelection { cell, row in
openURLInBrowser(
URL(string: "https://www.home-assistant.io/latest-ios-release-notes/")!,
cell.formViewController()
)
row.deselect(animated: true)
}
}
}
}
3 changes: 3 additions & 0 deletions Sources/App/Settings/SettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ class SettingsViewController: HAFormViewController {
<<< SettingsRootDataSource.Row.privacy.row
<<< SettingsRootDataSource.Row.debugging.row
}

form +++ Section()
<<< SettingsRootDataSource.Row.whatsNew.row
}

@objc func openAbout(_ sender: UIButton) {
Expand Down
4 changes: 4 additions & 0 deletions Sources/Shared/Resources/Swiftgen/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1217,6 +1217,10 @@ public enum L10n {
/// Edit Template
public static var title: String { return L10n.tr("Localizable", "settings.template_edit.title") }
}
public enum WhatsNew {
/// What's new?
public static var title: String { return L10n.tr("Localizable", "settings.whats_new.title") }
}
}

public enum SettingsDetails {
Expand Down

0 comments on commit e075dc5

Please sign in to comment.