Integrate pulse metadata in station settings screen#314
Conversation
WalkthroughAdds a Pulse troubleshooting link and routes Pulse devices to it. Expands Device Info for Pulse (cellular) with new InfoField cases, gateway/station properties, warnings, localizations, mock fixture, and project resource wiring. Updates mock mapping and tests accordingly. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant View as DeviceInfoViewModel
participant Factory as DeviceInfoFactory
participant Device as DeviceDetails
participant Domain as NetworkDevicesInfoResponse
participant L10n as LocalizableString
User->>View: Open Device Info
View->>Device: read bundle?.connectivity
alt connectivity = wifi/helium/cellular
View->>View: select InfoField groups (includes pulse gateway/station groups)
else nil
View->>View: empty sections
end
loop each InfoField
View->>Factory: request title/value/warning(field, device, domain)
Factory->>Domain: read gateway/station props (rssi/sim/frequency/nextCommunication/stationId/batState)
Factory->>L10n: format strings (units, MCC/MNC, "is in use")
alt warning needed
Factory-->>View: CardWarningConfiguration (may reference Device.troubleShootingUrl)
else value only
Factory-->>View: formatted value
end
end
View-->>User: render sections, share text, buttons
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
a04317a to
7265239
Compare
There was a problem hiding this comment.
Actionable comments posted: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (14)
PresentationLayer/Constants/Strings/DisplayedLinks.swift(2 hunks)PresentationLayer/Extensions/DomainExtensions/DeviceDetails+.swift(1 hunks)PresentationLayer/UIComponents/Screens/DeviceInfo/DeviceInfoFactory.swift(8 hunks)PresentationLayer/UIComponents/Screens/DeviceInfo/DeviceInfoViewModel+Content.swift(3 hunks)PresentationLayer/UIComponents/Screens/DeviceInfo/DeviceInfoViewModel.swift(2 hunks)wxm-ios/DataLayer/DataLayer.xcodeproj/project.pbxproj(4 hunks)wxm-ios/DataLayer/DataLayer/Networking/ApiRequestBuilders/MeApiRequestBuilder.swift(1 hunks)wxm-ios/DataLayer/DataLayer/Networking/Mock/Jsons/get_device_info_pulse.json(1 hunks)wxm-ios/DomainLayer/DomainLayer/Entities/Codables/Devices/NetworkDevicesInfoResponse.swift(5 hunks)wxm-ios/DomainLayer/DomainLayer/Entities/Codables/Devices/NetworkDevicesTypes.swift(1 hunks)wxm-ios/Resources/Localizable/Localizable.xcstrings(6 hunks)wxm-ios/Resources/Localizable/LocalizableString+DeviceInfo.swift(5 hunks)wxm-ios/Resources/Localizable/LocalizableString+Units.swift(2 hunks)wxm-ios/Resources/Localizable/LocalizableUnits.xcstrings(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
PresentationLayer/UIComponents/Screens/DeviceInfo/DeviceInfoFactory.swift (1)
WeatherXMTests/PresentationLayer/Extensions/DomainExtensions/DeviceDetailsTests.swift (1)
troubleShootingUrl(36-49)
🔇 Additional comments (10)
PresentationLayer/Constants/Strings/DisplayedLinks.swift (2)
27-27: LGTM!The new enum case follows existing naming conventions and aligns with the pattern for other device troubleshooting links.
78-79: LGTM!The URL follows the established pattern for device troubleshooting documentation and is correctly mapped to the new enum case.
PresentationLayer/Extensions/DomainExtensions/DeviceDetails+.swift (1)
54-55: LGTM!The change correctly routes Pulse devices to the new troubleshooting URL, maintaining consistency with other device types.
wxm-ios/DataLayer/DataLayer.xcodeproj/project.pbxproj (1)
81-81: LGTM!The project file changes correctly integrate the new mock JSON resource into the build system.
Also applies to: 187-187, 269-269, 604-604
wxm-ios/Resources/Localizable/LocalizableUnits.xcstrings (1)
268-278: LGTM!The new MHz unit localization follows the established pattern and supports the new gateway frequency field.
wxm-ios/Resources/Localizable/LocalizableString+Units.swift (1)
43-43: LGTM!The new MHz enum case and its localization key mapping are correctly implemented and align with the localization resource.
Also applies to: 117-118
wxm-ios/DomainLayer/DomainLayer/Entities/Codables/Devices/NetworkDevicesTypes.swift (1)
112-116: LGTM!The new
Simstruct is cleanly implemented with appropriate optionality for SIM card metadata (MCC, MNC, ICCID).PresentationLayer/UIComponents/Screens/DeviceInfo/DeviceInfoViewModel.swift (2)
74-89: LGTM!The switch to a connectivity-based switch statement improves clarity and extensibility. The cellular case correctly routes to pulse-specific field sets.
327-346: LGTM!The new InfoField cases are appropriately handled with no-op implementations, consistent with other fields that don't require button actions.
wxm-ios/DataLayer/DataLayer/Networking/ApiRequestBuilders/MeApiRequestBuilder.swift (1)
213-214: Verify tests and fixtures for getUserDeviceInfoById
Ensure any tests or mock fixtures expecting M5 device data are updated for the newget_device_info_pulseendpoint and that a correspondingget_device_info_pulse.json(or equivalent) exists.
| "gps_sats_last_activity": "2025-10-01T14:25:44+03:00", | ||
| "wifi_rssi_last_activity": "2025-10-01T14:25:44+03:00", |
There was a problem hiding this comment.
Fix gateway GPS activity key mismatch. The mock uses gps_sats_last_activity, but the updated models decode gpsRssiLastActivity (JSON key gps_rssi_last_activity). This typo breaks decoding for the GPS activity timestamp when the mock feeds the UI, causing the new Pulse fields to appear empty. Rename the key to gps_rssi_last_activity so it matches the rest of the PR.
🤖 Prompt for AI Agents
In wxm-ios/DataLayer/DataLayer/Networking/Mock/Jsons/get_device_info_pulse.json
around lines 17 to 18, the mock JSON uses the incorrect key
"gps_sats_last_activity"; rename this key to "gps_rssi_last_activity" to match
the model's expected JSON key (gps_rssi_last_activity) so the decoder binds the
GPS RSSI activity timestamp correctly and the Pulse fields are populated in the
UI.
| self.networkRssiLastActivity = try container.decodeIfPresent(Date.self, forKey: .networkRssiLastActivity) | ||
| self.gatewayRssi = try container.decodeIfPresent(Int.self, forKey: .gatewayRssi) | ||
| self.gatewayRssiLastActivity = try container.decodeIfPresent(Date.self, forKey: .gatewayRssiLastActivity) | ||
| self.batState = try container.decodeIfPresent(BatteryState.self, forKey: .batState) | ||
| self.frequency = try container.decodeIfPresent(String.self, forKey: .frequency) | ||
| self.nextCommunication = try container.decodeIfPresent(Date.self, forKey: .nextCommunication) | ||
| self.sim = try container.decodeIfPresent(Sim.self, forKey: .sim) | ||
| } |
There was a problem hiding this comment.
Ensure backend delivers numeric RSSI values.
We now decode network_rssi and gateway_rssi as Int, but previous RSSI fields were strings. If the API still emits stringified RSSI (as it did for wifi_rssi), decoding will fail and drop the whole gateway payload. Please double-check the contract or adjust to accept strings. Let me know if you want a quick patch that tolerates both.
🤖 Prompt for AI Agents
In
wxm-ios/DomainLayer/DomainLayer/Entities/Codables/Devices/NetworkDevicesInfoResponse.swift
around lines 97 to 104, decoding of networkRssi and gatewayRssi currently
assumes Int and will fail if the backend emits stringified numeric RSSI; update
the decoder to tolerate both numeric and string RSSI by attempting to decode an
Int first and, if that fails, decode a String and convert it to Int (or nil on
conversion failure), or alternatively decode as String and parse to Int with a
numeric fallback — apply this pattern to both networkRssi and gatewayRssi so
malformed types won't drop the whole payload.
Code Coverage Summary
|
Code Coverage Summary
|
Why?
Pulse data in device settings
How?
Testing
Play with mock json (
get_device_info_pulse) and ensure everything is rendered as expectedAdditional context
fixes fe-2006
Summary by CodeRabbit
New Features
Bug Fixes / Improvements
Tests / Mocks
Localization