Skip to content

Comments

Notifications toggle state#317

Merged
pantelisss merged 1 commit intomainfrom
feature/fe-2024-notifications-toggle-is-always-greyed-out
Oct 14, 2025
Merged

Notifications toggle state#317
pantelisss merged 1 commit intomainfrom
feature/fe-2024-notifications-toggle-is-always-greyed-out

Conversation

@pantelisss
Copy link
Collaborator

@pantelisss pantelisss commented Oct 14, 2025

Why?

Notifications toggle is always greyed out

How?

Changed the toggle notifications state and use Binding to handle the toggle interactions

Testing

Launch the app with -WXMAnalyticsDisabled YES unchecked and ensure the notifications enable/disable functionality works as expected

Additional context

fixes fe-2024

Summary by CodeRabbit

  • Bug Fixes
    • Fixed the non-responsive Notifications toggle in Settings. It now correctly reflects your current notification status and applies changes when toggled.
    • Tapping the switch immediately updates your preference, ensuring consistent behavior across sessions.
    • Improved reliability of the toggle’s state updates to prevent misleading UI states.

@pantelisss pantelisss requested a review from PavlosTze October 14, 2025 09:50
@coderabbitai
Copy link

coderabbitai bot commented Oct 14, 2025

Walkthrough

SettingsView changes the notifications toggle from a direct property binding to an interactive Binding with a getter reading areNotificationsEnabled and a setter calling handleNotificationSwitchTap().

Changes

Cohort / File(s) Summary of Changes
Settings notifications toggle binding
PresentationLayer/UIComponents/Screens/Settings/SettingsView.swift
Replaced static binding with interactive Binding: getter reads areNotificationsEnabled; setter invokes handleNotificationSwitchTap() instead of directly mutating the ViewModel property. No public API changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant View as SettingsView
  participant Bind as Binding(setter/getter)
  participant VM as SettingsViewModel
  participant Sys as Notification Services

  User->>View: Toggle Notifications
  View->>Bind: Set value (onChange)
  Bind->>VM: handleNotificationSwitchTap()
  VM->>Sys: Enable/disable notifications
  Sys-->>VM: Result/status
  VM-->>View: State updated (areNotificationsEnabled)
  View-->>User: Toggle reflects current state
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • PavlosTze

Poem

A twitch of a switch, a hop of a bit,
I nudge the binding—now it’s smartly lit.
Getter sniffs state, setter taps the flow,
Carrots of side effects sprout below.
Boop! goes the toggle—notifications sing,
A happy hare debugs everything. 🥕🐇

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title Check ❓ Inconclusive The title “Notifications toggle state” is a short phrase that mentions the notifications toggle but does not clearly communicate the specific change of enabling its interactivity. It lacks context and fails to indicate that a Binding has been introduced to handle toggle interactions. As a result, it is too vague to provide meaningful insight into the main update. Consider revising the title to explicitly highlight the change, for example “Enable notifications toggle interactivity using Binding,” to clearly convey the primary update.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed The description follows the repository template by including Why, How, Testing, and Additional Context sections, and it provides clear reasoning, implementation details, and verification steps. The optional Screenshots section is appropriately omitted since no visual assets are provided. Overall, the description is sufficiently detailed to understand and test the change.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/fe-2024-notifications-toggle-is-always-greyed-out

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
PresentationLayer/UIComponents/Screens/Settings/SettingsView.swift (1)

123-129: Consider providing immediate visual feedback for toggle state.

Since handleNotificationSwitchTap() performs async operations (checking auth status, showing alerts), the user might experience a delay before seeing any response. Consider adding immediate UI feedback such as a loading indicator or temporary disabled state while permissions are being processed.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b905494 and 2ff9831.

📒 Files selected for processing (1)
  • PresentationLayer/UIComponents/Screens/Settings/SettingsView.swift (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
PresentationLayer/UIComponents/Screens/Settings/SettingsView.swift (1)
PresentationLayer/UIComponents/Screens/Settings/SettingsViewModel.swift (1)
  • handleNotificationSwitchTap (174-194)
⏰ 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)
  • GitHub Check: WeatherXM | Unit tests | wxm-ios - iOS
🔇 Additional comments (1)
PresentationLayer/UIComponents/Screens/Settings/SettingsView.swift (1)

123-129: Notification toggle binding is correct
State is updated asynchronously in SettingsViewModel.handleNotificationSwitchTap(), which fetches the authorization status and assigns areNotificationsEnabled accordingly. No changes required.

@weatherxmdev
Copy link
Collaborator

Code Coverage Summary

Framework Source Files Coverage
DataLayer.framework 48 65.25%
DomainLayer.framework 66 83.38%
Toolkit.framework 30 53.18%
WeatherXM.app 403 14.07%
station-intent.appex 2 83.04%
station-widgetExtension.appex 45 34.04%

@pantelisss pantelisss merged commit ee46ef0 into main Oct 14, 2025
4 checks passed
@pantelisss pantelisss deleted the feature/fe-2024-notifications-toggle-is-always-greyed-out branch October 14, 2025 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants