-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add debug-only Post Types module for wordpress-rs integration
#22405
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
base: trunk
Are you sure you want to change the base?
Conversation
Added debug-only experimental flag to enable/disable the Post Types screen. This flag will control visibility of the new post types functionality that allows users to view and navigate different post types from a unified screen. Changes: - Added EXPERIMENTAL_POST_TYPES feature to ExperimentalFeatures enum - Configured flag to only appear in debug builds via BuildConfig check - Added UI strings for feature name and description
Implements the initial UI for the experimental Post Types feature: - `PostTypesActivity` with Compose-based UI - `PostTypesViewModel` with hardcoded post types (Posts, Pages) - `PostTypesScreen` composable with list display - Navigation wiring from My Site menu (when feature flag enabled) The screen is accessible from My Site menu when the experimental Post Types feature flag is enabled in debug builds. Changes: - Add `PostTypesActivity`, `PostTypesViewModel`, and `PostTypesScreen` - Register activity in AndroidManifest - Add `OpenPostTypes` navigation action and `POST_TYPES` list item action - Wire up navigation in `MySiteFragment`, `MenuActivity`, and handlers - Add `post_types_screen_title` string resource
- Add proper import for `PostTypesActivity` in `ActivityLauncher.java`
- Add `@Suppress("unused")` annotation for `site` property in
`PostTypesViewModel` (will be used when API integration is added)
Introduces `CptFlatPostListActivity` - a Compose-based screen that displays a flat list of posts for a given post type. This is a skeleton implementation with mock data to establish the navigation flow. The `Cpt` prefix is used for all new types in this feature to avoid naming conflicts with existing types and to indicate WIP status. Changes: - Add `CptFlatPostListActivity` with Compose UI - Add `CptFlatPostListViewModel` with mock post data - Add `CptFlatPostListScreen` composable with title, excerpt, and status - Add `CptPostListItem` and `CptFlatPostListUiState` data classes - Add `PostTypesNavigationAction` sealed class for type-safe navigation - Wire up navigation from `PostTypesActivity` using SharedFlow - Register new activity in AndroidManifest
Renames all new types in the posttypes package to use the `Cpt` prefix for consistency and to avoid naming conflicts with existing types. Renames: - `PostTypesActivity` → `CptPostTypesActivity` - `PostTypesViewModel` → `CptPostTypesViewModel` - `PostTypesScreen` → `CptPostTypesScreen` - `PostTypesUiState` → `CptPostTypesUiState` - `PostTypeItem` → `CptPostTypeItem` - `PostTypesNavigationAction` → `CptNavigationAction`
Moves the Custom Post Types (CPT) feature to `libs/posttypes` module to enforce clean boundaries and prevent accidental FluxC usage during wordpress-rs integration. The module is intentionally isolated with minimal dependencies. A `bridge` package contains temporary coupling code (`SiteReference`, `CptTheme`, `BridgeConstants`) that explicitly documents what needs attention when integrating wordpress-rs or merging back. Changes: - Create `libs/posttypes` module with Compose, Hilt, and Parcelize - Add `bridge` package with documented temporary bridging types - Move CPT activities, ViewModels, and Compose screens to new module - Update `ActivityLauncher` to convert `SiteModel` to `SiteReference` - Add comprehensive README with migration instructions
Fixes navigation not working and removes green action bar header that appeared due to inheriting the app's default theme. Changes: - Add `extraBufferCapacity = 1` to SharedFlow for reliable navigation - Add `CptActivity` interface with `applyBaseSetup()` extension for composition over inheritance pattern - Add `Cpt.NoActionBar` theme to prevent action bar from showing - Update activities to use new composition pattern - Document bridge components and migration notes in README
Resolve 8 detekt violations: - Rename ActivitySetup.kt to CptActivity.kt to match top-level declaration - Remove TODO markers from suppression comments - Refactor mock data generation to use loop instead of hardcoded list - Add @Suppress annotations for intentional violations (mock data, stub handler)
Add separate UI for hierarchical post types (like Pages) that displays posts with visual indentation based on parent-child relationships. Changes: - Add `hierarchical` flag to `CptPostTypeItem` model - Create `CptHierarchicalPostListActivity` and ViewModel with mock hierarchy - Create `CptHierarchicalPostListScreen` with indent-based display - Route Pages to hierarchical screen, Posts to flat screen
Generated by 🚫 Danger |
Project manifest changes for WordPressThe following changes in the --- ./build/reports/diff_manifest/WordPress/wordpressVanillaRelease/base_manifest.txt 2025-12-08 22:32:44.208430632 +0000
+++ ./build/reports/diff_manifest/WordPress/wordpressVanillaRelease/head_manifest.txt 2025-12-08 22:32:53.318362726 +0000
@@ -132,7 +132,8 @@
android:preserveLegacyExternalStorage="true"
android:requestLegacyExternalStorage="true"
android:supportsRtl="true"
- android:theme="@style/WordPress" >
+ android:theme="@style/WordPress"
+ android:usesCleartextTraffic="false" >
<provider
android:name="org.wordpress.android.localcontentmigration.LocalMigrationContentProvider"
android:authorities="org.wordpress.android.LocalMigrationContentProvider"
@@ -1309,6 +1310,18 @@
android:name="org.wordpress.android.editor.WPGutenbergWebViewActivity"
android:theme="@style/Base.GutenbergWebView" />
<activity
+ android:name="org.wordpress.android.posttypes.CptPostTypesActivity"
+ android:exported="false"
+ android:theme="@style/Cpt.NoActionBar" />
+ <activity
+ android:name="org.wordpress.android.posttypes.CptFlatPostListActivity"
+ android:exported="false"
+ android:theme="@style/Cpt.NoActionBar" />
+ <activity
+ android:name="org.wordpress.android.posttypes.CptHierarchicalPostListActivity"
+ android:exported="false"
+ android:theme="@style/Cpt.NoActionBar" />
+ <activity
android:name="com.gravatar.quickeditor.ui.GravatarQuickEditorActivity"
android:exported="true"
android:launchMode="singleTask"Go to https://buildkite.com/automattic/wordpress-android/builds/24155/canvas?sid=019b0014-370a-44f7-a3a8-04e579d2b137, click on the |
Project manifest changes for WordPressThe following changes in the --- ./build/reports/diff_manifest/WordPress/jetpackVanillaRelease/base_manifest.txt 2025-12-08 22:32:55.135333612 +0000
+++ ./build/reports/diff_manifest/WordPress/jetpackVanillaRelease/head_manifest.txt 2025-12-08 22:33:04.125330285 +0000
@@ -131,7 +131,8 @@
android:preserveLegacyExternalStorage="true"
android:requestLegacyExternalStorage="true"
android:supportsRtl="true"
- android:theme="@style/WordPress" > <!-- Deep Linking Activity -->
+ android:theme="@style/WordPress"
+ android:usesCleartextTraffic="false" > <!-- Deep Linking Activity -->
<activity
android:name="org.wordpress.android.ui.deeplinks.DeepLinkingIntentReceiverActivity"
android:excludeFromRecents="true"
@@ -1336,6 +1337,18 @@
android:name="org.wordpress.android.editor.WPGutenbergWebViewActivity"
android:theme="@style/Base.GutenbergWebView" />
<activity
+ android:name="org.wordpress.android.posttypes.CptPostTypesActivity"
+ android:exported="false"
+ android:theme="@style/Cpt.NoActionBar" />
+ <activity
+ android:name="org.wordpress.android.posttypes.CptFlatPostListActivity"
+ android:exported="false"
+ android:theme="@style/Cpt.NoActionBar" />
+ <activity
+ android:name="org.wordpress.android.posttypes.CptHierarchicalPostListActivity"
+ android:exported="false"
+ android:theme="@style/Cpt.NoActionBar" />
+ <activity
android:name="com.gravatar.quickeditor.ui.GravatarQuickEditorActivity"
android:exported="true"
android:launchMode="singleTask"Go to https://buildkite.com/automattic/wordpress-android/builds/24155/canvas?sid=019b0014-370b-48a2-8657-b5f9ce40e9d5, click on the |
Set explicit secure defaults for `allowBackup` and `usesCleartextTraffic` to satisfy static analysis. Main app values override during manifest merge.
|
| App Name | WordPress | |
| Flavor | Jalapeno | |
| Build Type | Debug | |
| Version | pr22405-1676e98 | |
| Commit | 1676e98 | |
| Direct Download | wordpress-prototype-build-pr22405-1676e98.apk |
|
| App Name | Jetpack | |
| Flavor | Jalapeno | |
| Build Type | Debug | |
| Version | pr22405-1676e98 | |
| Commit | 1676e98 | |
| Direct Download | jetpack-prototype-build-pr22405-1676e98.apk |
Add mock for ExperimentalFeatures and pass it to SiteItemsBuilder constructor to fix compilation error after adding the dependency.
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## trunk #22405 +/- ##
=======================================
Coverage 39.07% 39.07%
=======================================
Files 2207 2207
Lines 106795 106819 +24
Branches 15146 15150 +4
=======================================
+ Hits 41732 41742 +10
- Misses 61553 61566 +13
- Partials 3510 3511 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|





Summary
Adds a debug-only Custom Post Types browser as the Android foundation for
wordpress-rsservice layer integration. The feature is behind an experimental flag and uses mock data - real data will come fromwordpress-rsonce the CPT service/repository layer is implemented.Key decisions:
libs/posttypes) - Intentionally decoupled from FluxC to force cleanwordpress-rsintegrationSiteReferencebridges app authentication to the module without FluxC dependencyCptActivityinterface instead of extendingBaseAppCompatActivityChanges
POST_TYPESexperimental feature flag (debug builds only)libs/posttypesmodule with:Demo
custom.post.types.webm