-
-
Notifications
You must be signed in to change notification settings - Fork 45
Enables Work History and hides pending tab #3380
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
📝 WalkthroughWalkthroughThis pull request enables the WORK_HISTORY feature flag and temporarily reduces the work history view pager to display a single page instead of two. The changes include: updating the feature flag checker to return true for WORK_HISTORY, reducing TOTAL_PAGES in the ViewPager adapter from 2 to 1, adding conditional logic in the activity to hide the tab layout when only one page exists, and hiding a "Learn More" text view in the layout by default. Sequence DiagramsequenceDiagram
participant Activity as PersonalIdWorkHistoryActivity
participant Adapter as WorkHistoryViewPagerAdapter
participant TabLayout as TabLayoutMediator
Activity->>Adapter: Check TOTAL_PAGES
alt TOTAL_PAGES == 1
Activity->>Activity: Hide TabLayout
Note over Activity: Single page mode<br/>(tabs not displayed)
else TOTAL_PAGES > 1
Activity->>TabLayout: Create and attach mediator
TabLayout->>TabLayout: Bind tabs with titles/icons
Note over TabLayout: Multi-page mode<br/>(tabs displayed)
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related PRs
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: 0
🧹 Nitpick comments (1)
app/src/org/commcare/activities/connect/PersonalIdWorkHistoryActivity.kt (1)
50-59: Conditional tab handling implemented correctly.The logic appropriately hides the TabLayout when displaying a single page and configures it with tabs when multiple pages are available. The implementation handles the temporary single-page state while preserving the infrastructure for the multi-page flow.
For slightly more defensive coding, consider checking
TOTAL_PAGES < 2instead of== 1to handle any edge cases:- if (WorkHistoryViewPagerAdapter.TOTAL_PAGES == 1) { + if (WorkHistoryViewPagerAdapter.TOTAL_PAGES < 2) { binding.tabWorkHistory.visibility = android.view.View.GONE } else {However, this is optional since TOTAL_PAGES is a compile-time constant.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
app/res/layout/activity_personal_id_work_history.xml(1 hunks)app/src/org/commcare/activities/connect/PersonalIdWorkHistoryActivity.kt(1 hunks)app/src/org/commcare/adapters/WorkHistoryViewPagerAdapter.kt(1 hunks)app/src/org/commcare/personalId/PersonalIdFeatureFlagChecker.kt(1 hunks)
⏰ 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: Lint Code Base
🔇 Additional comments (3)
app/res/layout/activity_personal_id_work_history.xml (1)
51-51: LGTM - View hidden for single-page flow.Hiding the "Learn More" view is appropriate when displaying only one page in the work history.
app/src/org/commcare/adapters/WorkHistoryViewPagerAdapter.kt (1)
13-13: Temporary change documented appropriately.The reduction to a single page makes the PENDING_TAB_INDEX case in
createFragment(line 22) unreachable, but this is acceptable for a temporary change. The comment clearly documents the intent, and all infrastructure remains in place for easy rollback.app/src/org/commcare/personalId/PersonalIdFeatureFlagChecker.kt (1)
24-24: LGTM - Feature flag enabled.Straightforward enablement of the WORK_HISTORY feature flag, consistent with the PR objectives.
b2fe149 to
588fd07
Compare
588fd07 to
a532525
Compare
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.
With the push to general availability and getting rid of feature flags, are we going to be deleting this class in the near future?
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.
@conroy-ricketts Great question, but not really, these are meant to just be short term flags just to help us with release planning or deployment of the feature. Currently it provides us an easy switch to turn the feature off if it's not ready to deploy in the upcoming release but we soon plan to hook this class to a server endpoint so that we can potentially release a feature out for a sub-set of users before releasing to all users.
OrangeAndGreen
left a 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.
Noting the broken build but I think it's a failing test that has intermittent issues
|
|
||
| companion object { | ||
| const val TOTAL_PAGES = 2 | ||
| const val TOTAL_PAGES = 1 // temporary set to 1 until pending work history is rolled out |
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.
@shubham1g5 As discussed we will get rid of this hard coding and will use FeatureFlag.WORK_HISTORY_PENDING kind of variable to decide the number of total pages. Hope you are on same page?
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.
dc4790a
dc4790a to
08e39c1
Compare
Product Description
https://dimagi.atlassian.net/browse/CCCT-1722
Refer to #3221 for feature context.
Safety Assurance
Safety story
Labels and Review
Release Note: A new work history menu in side navigation drawer to see records of past jobs user did as part of Connect Programs