-
-
Notifications
You must be signed in to change notification settings - Fork 45
Hide Notifications behind a feature flag #3358
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
Conversation
📝 WalkthroughWalkthroughThe change introduces a NOTIFICATIONS feature flag and integrates it into UI visibility logic. In BaseDrawerController, the notification view is now only visible when the user is signed in and the NOTIFICATIONS flag is enabled. The credential visibility check switches to using the imported isFeatureEnabled(WORK_HISTORY). In PersonalIdFeatureFlagChecker, a new public constant NOTIFICATIONS is added, and isFeatureEnabled is updated to handle it, returning false by default. Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant Drawer as BaseDrawerController
participant FF as FeatureFlagChecker
User->>Drawer: Open nav drawer
Drawer->>FF: isFeatureEnabled(WORK_HISTORY)
FF-->>Drawer: boolean
Drawer->>FF: isFeatureEnabled(NOTIFICATIONS)
FF-->>Drawer: false (default)
alt Signed in AND NOTIFICATIONS enabled
Drawer->>Drawer: Show notificationView
else
Drawer->>Drawer: Hide notificationView
end
Drawer->>Drawer: shouldShowCredential based on WORK_HISTORY
note over Drawer: Update UI visibility accordingly
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
app/src/org/commcare/navdrawer/BaseDrawerController.kt (1)
24-25: Remove unusedPersonalIdFeatureFlagCheckerimport
The class import on line 23 isn’t referenced (only its companion members are used via static imports).
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
app/src/org/commcare/navdrawer/BaseDrawerController.kt(2 hunks)app/src/org/commcare/personalId/PersonalIdFeatureFlagChecker.kt(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
app/src/org/commcare/navdrawer/BaseDrawerController.kt (1)
app/src/org/commcare/personalId/PersonalIdFeatureFlagChecker.kt (1)
isFeatureEnabled(21-28)
🔇 Additional comments (2)
app/src/org/commcare/personalId/PersonalIdFeatureFlagChecker.kt (1)
15-15: LGTM! Feature flag implementation follows existing pattern.The NOTIFICATIONS constant and its handling in
isFeatureEnabledare correctly implemented, consistent with the WORK_HISTORY flag pattern. The default value offalseappropriately hides notifications until the flag is enabled.Also applies to: 25-25
app/src/org/commcare/navdrawer/BaseDrawerController.kt (1)
238-238: Good refactor for consistency.Switching to the imported
isFeatureEnabledfunction improves consistency with the notification visibility check at line 233 and reduces verbosity.
| binding.navDrawerRecycler.visibility = if (isSignedIn) View.VISIBLE else View.GONE | ||
| binding.profileCard.visibility = if (isSignedIn) View.VISIBLE else View.GONE | ||
| binding.notificationView.visibility = if (isSignedIn) View.VISIBLE else View.GONE | ||
| binding.notificationView.visibility = if (isSignedIn && isFeatureEnabled(NOTIFICATIONS)) View.VISIBLE else View.GONE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
🧩 Analysis chain
LGTM! Notification visibility correctly gated by feature flag.
The visibility logic properly requires both user sign-in and the NOTIFICATIONS feature flag to be enabled.
Verify that all notification-related UI elements and functionality are consistently gated by this feature flag. For example, check if notification click handlers, notification data fetching, or other notification UI components also need feature flag checks.
🏁 Script executed:
#!/bin/bash
# Description: Find other notification-related code that might need feature flag gating
# Search for notification-related UI elements and methods
rg -n -C3 'notificationView|NotificationRecord|ic_bell|ic_new_notification_bell' app/src/org/commcare/navdrawer/BaseDrawerController.kt
# Search for notification navigation
rg -n 'goToNotification' app/src/org/commcare/Length of output: 2176
Wrap notification fetch and icon update in refreshDrawerContent with feature flag
In BaseDrawerController.refreshDrawerContent(), you still call getAllNotifications(...) and update binding.ivNotification whenever signed in, even if NOTIFICATIONS is disabled. Enclose that block in if (isFeatureEnabled(NOTIFICATIONS)) { … } to fully gate notification behavior.
🤖 Prompt for AI Agents
In app/src/org/commcare/navdrawer/BaseDrawerController.kt around line 233, the
notification fetch and icon update inside refreshDrawerContent are executed
whenever the user is signed in even if the NOTIFICATIONS feature flag is
disabled; wrap the entire block that calls getAllNotifications(...) and updates
binding.ivNotification in if (isFeatureEnabled(NOTIFICATIONS)) { ... } so both
fetching and UI updates only run when the feature is enabled, and ensure the
visibility update for binding.notificationView remains consistent with that
gating.
|
@shubham1g5 We might need to the control here also instead of just making visibility false? |
|
@Jignesh-dimagi is this what you meant ? |
Yes over here also and sorry I forgot to put link previously. I meant here |
|
@Jignesh-dimagi makes sense, added here |
|
@damagatchi retest this please |
Product Description
https://dimagi.atlassian.net/browse/QA-8140
Labels and Review