Skip to content

Migrate "Settings > Sensors" to SwiftUI #3577

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

Merged
merged 6 commits into from
Apr 30, 2025

Conversation

bgoncal
Copy link
Member

@bgoncal bgoncal commented Apr 30, 2025

Summary

Screenshots

CleanShot 2025-04-30 at 15 14 57@2x

Link to pull request in Documentation repository

Documentation: home-assistant/companion.home-assistant#

Any other notes

@bgoncal bgoncal requested a review from Copilot April 30, 2025 13:15
@bgoncal bgoncal self-assigned this Apr 30, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR migrates the “Settings > Sensors” UI from UIKit/Eureka to SwiftUI by removing legacy view controllers and introducing new SwiftUI views and view models. Key changes include:

  • Removal of SensorListViewController and SensorDetailViewController and their associated UIKit code.
  • Introduction of SwiftUI screens (SensorRow, SensorListView, SensorDetailView, etc.) and corresponding view models.
  • Updates to localization strings and UI components to support the new SwiftUI design.

Reviewed Changes

Copilot reviewed 16 out of 18 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Tests/App/Settings/SensorRow.test.swift Added unit tests for the new SensorRow SwiftUI view.
Sources/Shared/Resources/Swiftgen/Strings.swift Added new localization entries for Unknown sensor, FocusPermission, and other sensor settings.
Sources/Shared/Environment/Environment.swift Updated comment to accurately describe the Date provider.
Sources/App/Settings/SettingsRootDataSource.swift Replaced legacy sensor view controller with SwiftUI view embedded in a hosting controller.
Sources/App/Settings/Sensors/* Removed obsolete UIKit-based sensor view controllers and introduced SwiftUI views and view models.
Sources/App/Settings/Gestures/AppleLikeListTopRowHeader.swift Modified initializer to allow for an optional subtitle for better flexibility.
Files not reviewed (2)
  • HomeAssistant.xcodeproj/project.pbxproj: Language not supported
  • Sources/App/Resources/en.lproj/Localizable.strings: Language not supported
Comments suppressed due to low confidence (1)

Sources/Shared/Resources/Swiftgen/Strings.swift:62

  • [nitpick] The key 'unknownLabel' is inconsistent with the snake_case convention used for other keys (e.g., 'save_label'). Consider aligning the naming convention.
public static var unknownLabel: String { return L10n.tr("Localizable", "unknownLabel") }

Copy link

codecov bot commented Apr 30, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 45.08%. Comparing base (4f60d68) to head (812f6fd).
Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3577      +/-   ##
==========================================
+ Coverage   44.72%   45.08%   +0.36%     
==========================================
  Files         232      232              
  Lines       13911    13916       +5     
==========================================
+ Hits         6221     6274      +53     
+ Misses       7690     7642      -48     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bgoncal bgoncal merged commit f677c05 into master Apr 30, 2025
14 checks passed
@bgoncal bgoncal deleted the swift-ui-migration/sensors-screen branch April 30, 2025 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant