feat: Add "What's New" changelog bottom sheet#82
Conversation
Adds a changelog system that automatically shows users what changed after an app update via a native iOS bottom sheet. - Add ChangelogProvider: reads versioned .md files from the Changelog/ bundle directory, filters by version range, and assembles a combined markdown string with section headers and dividers - Add ChangelogViewModel: tracks last-seen version in UserDefaults, suppresses display on first install, and exposes showAllChangelogs() for the Settings menu - Add ChangelogBottomSheet: native SwiftUI sheet with orange→pink→purple gradient title, sparkles icon, MarkdownUI rendering, and an 'Awesome' dismiss button - Add Changelog/ directory with 7.0.0.md, 7.1.0.md, dev.md (beta only), and CHANGELOG_GUIDE.md documenting the dev workflow - Integrate into DeviceListView: auto-shows after version upgrade - Add 'Show Changelog' button to Settings > About section - Add localizations for en and fr-CA (What's New, Awesome, Show Changelog, Version %@, Close)
Reduce vertical padding on the 'Awesome' button from 14 to 10 and add 16pt top padding to the bottom sheet container to improve visual spacing. Preserves existing horizontal and bottom paddings, button style, and background material.
There was a problem hiding this comment.
Code Review
This pull request introduces a comprehensive changelog system, including a ChangelogProvider for managing versioned markdown files and a ChangelogBottomSheet for displaying updates. It also adds localization support and a ChangelogViewModel to track the user's last seen version. Feedback was provided regarding a logging error and the proper localization of interpolated strings.
| /// - Returns: A combined markdown string, or `nil` if no changelogs apply. | ||
| func getChangelog(lastSeenVersion lastSeenVersionStr: String, currentVersion currentVersionStr: String) -> String? { | ||
| guard let currentVersion = SemanticVersion(currentVersionStr) else { | ||
| Self.logger.error("Invalid current version string: \(lastSeenVersionStr)") |
There was a problem hiding this comment.
The log message incorrectly references lastSeenVersionStr when the validation failure occurs for currentVersionStr. It should be updated to reflect the correct variable name.
| Self.logger.error("Invalid current version string: \(lastSeenVersionStr)") | |
| Self.logger.error("Invalid current version string: \(currentVersionStr)") |
| for changelogFile in validChangelogs { | ||
| guard let content = readChangelogFile(changelogFile.filename) else { continue } | ||
|
|
||
| let versionHeader = "# " + String(localized: "Version \(changelogFile.displayVersion)") |
There was a problem hiding this comment.
According to the general rules for this repository, interpolated strings should be localized using String(format: NSLocalizedString(...), ...) to ensure they are correctly processed by the localization system, especially when matching keys in Localizable.xcstrings that contain placeholders like %@.
| let versionHeader = "# " + String(localized: "Version \(changelogFile.displayVersion)") | |
| let versionHeader = "# " + String(format: NSLocalizedString("Version %@", comment: ""), changelogFile.displayVersion) |
References
- In SwiftUI, interpolated strings are not automatically localized even if a matching format string exists in Localizable.xcstrings. Explicitly use String(format: NSLocalizedString("KEY", comment: ""), ...) for localization of strings with variables.
Summary
Adds a changelog system that automatically shows users what's new after an app update, mirroring the feature added to WLED Android in PR #155.
How it works
ChangelogViewModelcompares the current app version against the last-seen version stored inUserDefaults.New Files
wled/Changelog/7.0.0.mdwled/Changelog/7.1.0.mdwled/Changelog/dev.mdwled/Changelog/CHANGELOG_GUIDE.mdwled/Service/ChangelogProvider.swiftwled/ViewModel/ChangelogViewModel.swiftwled/View/ChangelogBottomSheet.swiftChanges
DeviceListView: owns theChangelogViewModeland auto-presents the sheet on version changeSettings: new "Show Changelog" button (with ✨ sparkles icon) in the About sectionLocalizable.xcstrings: new strings forenandfr-CA(What's New,Awesome,Show Changelog,Version %@,Close)Changelog Developer Workflow
When contributing, append your changes to
dev.md. Before a release, renamedev.mdto the target version (e.g.7.2.0.md). SeeCHANGELOG_GUIDE.mdfor full details.Notes
MarkdownUISPM package already in the project.symbolEffectpulse on the sparkles icon is gated behind@available(iOS 17.0, *))