-
-
Notifications
You must be signed in to change notification settings - Fork 45
Disable menu items while downloading the applications #2968
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 changes consolidate the state management for the back button and action bar in two core components. In the activity, the variable formerly known as Sequence Diagram(s)sequenceDiagram
participant U as User
participant CA as ConnectActivity
participant M as Menu
U->>CA: Press Back Button
CA->>CA: Check backButtonAndActionBarEnabled
alt backButtonAndActionBarEnabled is true
CA->>CA: Process back press normally
else backButtonAndActionBarEnabled is false
CA->>CA: Ignore back press
end
CA->>CA: setBackButtonAndActionBarState(enabled)
CA->>CA: Invalidate options menu
CA->>M: onPrepareOptionsMenu updates (action_sync, action_notification)
sequenceDiagram
participant F as ConnectDownloadingFragment
Note over F: On events such as onCreate, onSuccessfulVerification, or error display
F->>F: setBackButtonAndActionBarState(enabled)
Note right of F: Updates the state controlling both back button and action bar
Possibly related PRs
Suggested labels
Suggested reviewers
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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/ConnectActivity.java (1)
240-246: Consider renaming the updateBackButton method for consistency.While the current implementation works correctly, for better code clarity and consistency with the other renamed elements, consider renaming this method to something like
updateBackButtonDisplay()to clearly indicate it only affects the visual display of the back button rather than its functionality.-private void updateBackButton() { +private void updateBackButtonDisplay() { ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayShowHomeEnabled(isBackEnabled()); actionBar.setDisplayHomeAsUpEnabled(isBackEnabled()); } }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
app/src/org/commcare/activities/connect/ConnectActivity.java(4 hunks)app/src/org/commcare/fragments/connect/ConnectDownloadingFragment.java(3 hunks)
🔇 Additional comments (8)
app/src/org/commcare/fragments/connect/ConnectDownloadingFragment.java (4)
52-52: Method name change accurately reflects expanded functionality.The updated method name
setBackButtonAndActionBarStatenow better represents its true purpose - controlling both the back button and action bar functionality during the application download process.
60-65: Method renamed to align with expanded functionality.The method has been appropriately renamed from
setBackButtonEnabledtosetBackButtonAndActionBarStateto accurately reflect its expanded role in controlling both the back button and action bar.
112-112: Properly re-enables back button and action bar after verification.The call has been correctly updated to the new method name, ensuring that once app verification is successful, both the back button and action bar become interactive again.
130-130: Ensures UI controls are re-enabled during error states.Good practice to re-enable the back button and action bar when an error occurs, allowing users to navigate away or try different actions after a failure.
app/src/org/commcare/activities/connect/ConnectActivity.java (4)
44-44: Variable renamed to reflect expanded functionality.The variable has been appropriately renamed from
backButtonEnabledtobackButtonAndActionBarEnabledto accurately reflect its expanded purpose of controlling both the back button and action bar functionality.
163-168: New method effectively implements menu item disabling.This new implementation of
onPrepareOptionsMenuproperly disables the sync and notification menu items based on thebackButtonAndActionBarEnabledstate, which aligns with the PR objective of preventing user interaction with menu items during application downloads.
202-202: Back button behavior updated to use the renamed variable.The
onBackPressedmethod now properly checks the renamed variable to determine if the back button action should be processed.
231-234: Method renamed and enhanced to control both back button and menu state.The method has been appropriately renamed from
setBackButtonEnabledtosetBackButtonAndActionBarStateand now includes a call toinvalidateOptionsMenu(), which ensures the menu items' state is updated whenever the back button state changes.
Product Description
Menu items of connect page are disabled while downloading the application
Technical Summary
https://dimagi.atlassian.net/browse/CCCT-721
Feature Flag
For better user experience and fixing the bugs by pressing back/menu items while downloading the app
Safety Assurance
Safety story
This is small change and test on staging variant
QA Plan
General QA