feat/optimize-global-ifw-rule-screen - #1519
Open
juliewww wants to merge 30 commits into
Open
Conversation
- Move IFW rule models, filters, and string matchers from `feature/globalifwrule` and `core/ifw-api` to `core/model` for better architectural separation - Relocate IFW rule editor models and mappers to `core/model` - Update `core/ifw-api` to use `api` dependency on `core/model` - Add UI preview parameter providers and states for global IFW rules in `core/ui` - Implement Compose previews for `AddRuleScreen`, `SimpleGlobalIfwRuleScreen`, and `GlobalIfwRuleScreen` - Refactor `GlobalIfwRuleScreen` to improve delete dialog handling and clean up unused parameters - Extract `IfwComponentType` resource labels into a dedicated `GlobalIfwRuleResources.kt` file
- Replace local `ErrorContent` and `EmptyContent` with centralized `ErrorScreen` and `EmptyScreen` in `GlobalIfwRuleScreen` - Update `EmptyScreen` to support an optional content description/subtext field - Add preview for `EmptyScreen` with description support - Improve `GlobalIfwRuleScreen` empty state with specific title and description resources
- Redesign the Global IFW Rule screen with a card-based layout, grouping rules by package using `Surface` containers with elevated backgrounds and borders - Add `PackageAvatar` component to display app icons or letter placeholders in rule group headers - Introduce `RuleItemPresentationUiState` and `GlobalIfwRuleMapper` logic to extract more readable titles, target paths, and supporting text from rule filters - Replace `AssistChip` badges in rule items with custom `RuleMetaBadge` components for better status visualization (block, log, component type) - Refactor rule editor components by splitting `GlobalIfwRuleEditorComponents.kt` and `SimpleGlobalIfwRuleEditorComponents.kt` into dedicated files - Update preview providers with the new presentation model and refined summary formats
- Redesign the Global IFW Rule screen with a card-based layout, grouping rules by package using `Surface` containers with elevated backgrounds and borders - Add `PackageAvatar` component to display app icons or letter placeholders in rule group headers - Introduce `RuleItemPresentationUiState` and `GlobalIfwRuleMapper` logic to extract more readable titles, target paths, and supporting text from rule filters - Replace `AssistChip` badges in rule items with custom `RuleMetaBadge` components for better status visualization (block, log, component type) - Refactor rule editor components by splitting `GlobalIfwRuleEditorComponents.kt` and `SimpleGlobalIfwRuleEditorComponents.kt` into dedicated files - Update preview providers with the new presentation model and refined summary formats
- Update `optional_action` and `optional_category` string resources to use "Intent action" and "Intent category" (and their respective translations) across all supported languages - Reformat `GlobalIfwRuleScreen.kt` for consistent indentation
- Move shared UI components (`RuleMetaBadge`, `RulePrimaryMetadataText`, `RuleSecondaryMetadataText`, `DeleteConfirmationDialog`) from `GlobalIfwRuleScreen.kt` to a new `GlobalIfwRuleUiComponents.kt` file - Extract `AdvancedGlobalIfwRuleDetailScreen` into its own file for better maintainability - Update `GlobalIfwRuleScreen` to use the new common text components and refined spacing (from 8dp/12dp to 10dp) for metadata sections - Standardize typography and colors across IFW rule displays using the new shared components
- Move shared UI components (`RuleMetaBadge`, `RulePrimaryMetadataText`, `RuleSecondaryMetadataText`, `DeleteConfirmationDialog`) from `GlobalIfwRuleScreen.kt` to a new `GlobalIfwRuleUiComponents.kt` file - Extract `AdvancedGlobalIfwRuleDetailScreen` into its own file for better maintainability - Update `GlobalIfwRuleScreen` to use the new common text components and refined spacing (from 8dp/12dp to 10dp) for metadata sections - Standardize typography and colors across IFW rule displays using the new shared components
- Relocate `GlobalIfwRuleEditorComponents.kt`, `GlobalIfwRuleUiComponents.kt`, `GlobalIfwRuleMapper.kt`, `SimpleGlobalIfwRuleEditorComponents.kt`, and `GlobalIfwRuleResources.kt` to the `com.merxury.blocker.feature.globalifwrule.impl.components` package - Update package declarations and import statements across the module to reflect the new structure - Update copyright year to 2026 in `GlobalIfwRuleEditorComponents.kt` - Minor formatting adjustment in `GlobalIfwRuleViewModel.kt`
…preview provider - Replace `AdvancedGlobalIfwRuleScreenPreviewParameterProvider` with explicit `@Preview` functions for different states (Add, Edit, and Missing Selector) - Remove `AdvancedGlobalIfwRuleScreenPreviewState` data class - Update `AdvancedGlobalIfwRuleScreenPreview` to accept direct parameters instead of a state object - Improve preview coverage by adding specific test cases for different IFW rule configurations
- Update `BlockerOutlinedCard` to support optional `onClick` and customizable `outerPadding` - Improve accessibility for toggles and radio buttons by using `Modifier.toggleable` and `Modifier.selectable` with appropriate `Role` and larger touch targets - Refactor `GroupModeSelector` to use `FlowRow` for better layout of logic options - Refactor `AddRuleScreen` to use `Scaffold` for better top bar and padding management - Move IFW validation messages into `GroupEditorCard` for better visual grouping - Add `contentDescription` to the back button in `BlockerTopAppBar` - Fix UI issues such as missing single-line constraints in dropdowns and spacing in row layouts
- **UI Enhancements**:
- Update colors and typography for `IntentFilterBanner` and `SectionLabel`.
- Replace the save icon button with a `BlockerTextButton` in the top app bar.
- Organize "Target" and "Behavior" sections in `AddRuleScreen` using labels and grouped surfaces.
- Reduce horizontal padding/indentation for nested rules (from 12dp to 8dp).
- **IFW Rule Editor**:
- Implement expandable/collapsible groups in `GroupEditorCard` with an animated transition and a summary view for collapsed nodes.
- Simplify the `ConditionEditorCard` layout by moving the delete button and making the condition kind dropdown full-width.
- Use `Surface` with semi-transparent variant colors instead of `BlockerOutlinedCard` for nested group/condition containers.
- Update "Add" action styling: root groups use full-width outlined buttons, while nested groups use a combination of outlined and text buttons.
- **Preview**: Add validation and valid state previews for `IfwRuleTreeEditor`.
…h translations - Reorder `modifier` parameter in `GroupEditorCard` and `BlockerOutlinedCard` to follow standard Compose conventions (placed before optional trailing parameters) - Escape apostrophes in `feature/globalifwrule/api` French string resources to ensure proper XML parsing
- Wrap `SimpleGlobalIfwRuleScreen` in a `Scaffold` and use `innerPadding` for correct layout - Replace `BlockerSwitch` with context-aware `RadioButton` (for single selection) and `Checkbox` (for multiple selection) in component lists - Update `TargetModeRow` and component items to use `selectable` and `toggleable` modifiers with appropriate semantic roles for better accessibility - Redesign section layouts using `Surface` containers with `surfaceVariant` backgrounds to group related fields - Replace `SectionTitle` with `SectionLabel` using `labelMedium` typography and `onSurfaceVariant` color - Improve spacing and alignment across the rule editor screen - Add unsaved changes confirmation logic when navigating back (referenced in `handleBack`)
- Delete `SimpleGlobalIfwRuleScreenPreviewParameterProvider` and its associated state data class `SimpleGlobalIfwRuleScreenPreviewState` from `GlobalIfwRulePreviewParameterProvider.kt`. - Remove unused `SimpleTargetMode` import.
- Extract UI sections into focused `@Composable` functions: `TargetSection`, `TargetModeSection`, `TargetComponentSection`, `BehaviorSection`, and `OptionalConditionsSection` - Create `SimpleGlobalIfwRuleContent` to manage the high-level layout of the screen - Improve code readability and maintainability by reducing the nesting level and complexity of the main screen function - Pass specific state and callbacks to sub-components to reduce parameter overhead in nested calls
- Move `SectionLabel` and `BehaviorSection` to `GlobalIfwRuleEditorComponents.kt` for reuse - Update `AddRuleScreen` and `SimpleGlobalIfwRuleScreen` to use the shared components - Remove duplicate component definitions from individual screen files
- Extract content into `AdvancedGlobalIfwRuleContent` - Extract target package and component type logic into `AdvancedTargetSection` - Extract IFW condition tree logic into `ConditionsSection` - Improve code readability and structure in `AddRuleScreen.kt`
- Add `GlobalIfwRuleScreenScreenshotTests` covering list, simple editor, advanced editor, and detail screens - Support light/dark mode and multi-device screenshot testing for IFW features - Update `feature/globalifwrule/impl/build.gradle.kts` with Roborazzi and screenshot testing dependencies - Add `waitForIdle()` calls in `ScreenshotHelper.kt` to ensure UI stability before capturing images
Migrate `createAndroidComposeRule` and `createComposeRule` imports from `androidx.compose.ui.test.junit4` to `androidx.compose.ui.test.junit4.v2` across all screenshot and UI tests.
- Refactor `componentSelectionModifier` into an extension function on `Modifier` - Simplify the `Modifier` chain in `SimpleGlobalIfwRuleEditorComponents.kt` by removing the `.then()` call site usage
lihenggui
reviewed
Mar 31, 2026
…e module - Relocate `GlobalIfwRuleModels.kt` from `core:model` to `feature:globalifwrule:impl` as `GlobalIfwRuleUiModels.kt` - Move `GlobalIfwRulePreviewParameterProvider.kt` from `core:ui` to `feature:globalifwrule:impl` - Update all internal references and imports to point to the new package structure in the `feature` module - Change `core:model` dependency in `core:ifw-api` from `api` to `implementation` - Update `IfwRuleTreeEditor` preview to use explicit node definitions instead of the moved preview data - Update copyright years to 2026 in touched files
- Replace `DefaultTestDevices.PHONE.spec` with a local `PHONE_DEVICE_SPEC` constant - Remove helper `capturePhoneDark` method in favor of direct `composeTestRule.captureForDevice` calls - Inline screenshot capture logic within individual test methods - Move helper Composable functions outside of the test class scope
…reen' into feat/optimize-global-ifw-rule-screen
- Move `IfwFilter.toSummary()` from `core:ifw-api` to `feature:globalifwrule` - Rename the imported extension to `toIntentFilterSummary` in `GlobalIfwRuleMapper` to avoid name collisions - Update internal visibility for the relocated summary utility functions
These data classes (IfwFilter, IfwRule, IfwRules, IfwComponentType, IfwIntentFilter, StringMatcher, IfwRuleEditorMapper, IfwRuleEditorModel) are IFW implementation details and should stay scoped to core:ifw-api rather than being exposed via core:model to 13+ unrelated modules. Both core:ui and feature:globalifwrule:impl already depend on core:ifw-api, so no dependency problem exists. Change-Id: I206dfa2c09a81304e3c1bdbb298ee0d0dfe25ebc
lihenggui
force-pushed
the
feat/optimize-global-ifw-rule-screen
branch
from
April 9, 2026 18:34
f743540 to
418adcc
Compare
- Deduplicate SwitchRow: remove duplicate from feature/globalifwrule, reuse core/ui version with textStyle/contentPadding parameters - Replace duplicate AdvancedRuleReadOnlyNotice with IntentFilterBanner - Fix fully-qualified IfwEditorConditionKind references in GroupEditorCard - Fix BlockerOutlinedCard non-clickable variant using inconsistent colors - Rename misleading contentDescriptionRes to descriptionRes in EmptyScreen Change-Id: Ib782508b54a450d2ded8bd35878f4032d622a009
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
name: Pull request
about: Create a pull request
label: 'triage me'
Thank you for opening a Pull Request!
Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
we can discuss the change, evaluate designs, and agree on the general idea
pass (
./gradlew --init-script gradle/init.gradle.kts spotlessApplyto automatically applyformatting)
Is this your first Pull Request?
./tools/setup.shFixes #<issue_number_goes_here> 🦕