Skip to content

Conversation

adalpari
Copy link
Contributor

@adalpari adalpari commented Oct 6, 2025

Description

This PR creates a generic taxonomies data view to replace hardcoded category and tag views. It introduces a new TermsDataViewActivity with a ViewModel that can handle any taxonomy type (categories, tags, or custom taxonomies) with support for hierarchical structures, searching, and sorting.

Important notes:

  1. This PR just shows the terms info. It does not allow to create or modify new ones. That will be done in next iterations
  2. This PR directly uses worpdress-rs API. The FluxC layer will be included in next iterations to take advantage of local storage.

Before:
Screenshot 2025-10-06 at 12 39 25

After:
Screenshot 2025-10-06 at 13 55 39

Testing instructions

  1. Log into a self-hosted site using Application Password
  2. Go to "Site settings"
  • Open any taxonomy and check they show the info inside a DataView as expected.

@adalpari adalpari changed the base branch from trunk to task/cmm-814-hide-or-show-taxonomies-in-the-menu-depending-on-the-server-configuration October 6, 2025 10:45
@dangermattic
Copy link
Collaborator

dangermattic commented Oct 6, 2025

3 Warnings
⚠️ strings.xml files should only be updated on release branches, when the translations are downloaded by our automation.
⚠️ This PR is larger than 300 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.
⚠️ PR is not assigned to a milestone.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Oct 6, 2025

Project manifest changes for WordPress

The following changes in the WordPress's merged AndroidManifest.xml file were detected (build variant: wordpressVanillaRelease):

--- ./build/reports/diff_manifest/WordPress/wordpressVanillaRelease/base_manifest.txt	2025-10-07 14:06:37.292791917 +0000
+++ ./build/reports/diff_manifest/WordPress/wordpressVanillaRelease/head_manifest.txt	2025-10-07 14:06:39.462807090 +0000
@@ -321,6 +321,10 @@
             android:label="@string/application_password_info_title"
             android:theme="@style/WordPress.NoActionBar" />
         <activity
+            android:name="org.wordpress.android.ui.taxonomies.TermsDataViewActivity"
+            android:label="@string/taxonomies_title"
+            android:theme="@style/WordPress.NoActionBar" />
+        <activity
             android:name="org.wordpress.android.ui.prefs.notifications.NotificationsSettingsActivity"
             android:configChanges="orientation|screenSize"
             android:exported="false"

Go to https://buildkite.com/automattic/wordpress-android/builds/23530/canvas?sid=0199befa-9717-4d30-891b-61c04506e906, click on the Artifacts tab and audit the files.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Oct 6, 2025

Project manifest changes for WordPress

The following changes in the WordPress's merged AndroidManifest.xml file were detected (build variant: jetpackVanillaRelease):

--- ./build/reports/diff_manifest/WordPress/jetpackVanillaRelease/base_manifest.txt	2025-10-07 14:06:58.291738296 +0000
+++ ./build/reports/diff_manifest/WordPress/jetpackVanillaRelease/head_manifest.txt	2025-10-07 14:07:00.901753039 +0000
@@ -455,6 +455,10 @@
             android:label="@string/application_password_info_title"
             android:theme="@style/WordPress.NoActionBar" />
         <activity
+            android:name="org.wordpress.android.ui.taxonomies.TermsDataViewActivity"
+            android:label="@string/taxonomies_title"
+            android:theme="@style/WordPress.NoActionBar" />
+        <activity
             android:name="org.wordpress.android.ui.prefs.notifications.NotificationsSettingsActivity"
             android:configChanges="orientation|screenSize"
             android:exported="false"

Go to https://buildkite.com/automattic/wordpress-android/builds/23530/canvas?sid=0199befa-9718-42f5-aeb5-56bea74b8df5, click on the Artifacts tab and audit the files.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Oct 6, 2025

WordPress📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress WordPress
FlavorJalapeno
Build TypeDebug
Versionpr22258-d2e9f03
Commitd2e9f03
Direct Downloadwordpress-prototype-build-pr22258-d2e9f03.apk
Note: Google Login is not supported on these builds.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Oct 6, 2025

Jetpack📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack Jetpack
FlavorJalapeno
Build TypeDebug
Versionpr22258-d2e9f03
Commitd2e9f03
Direct Downloadjetpack-prototype-build-pr22258-d2e9f03.apk
Note: Google Login is not supported on these builds.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR creates a generic taxonomies data view to replace hardcoded category and tag views. It introduces a new TermsDataViewActivity with a ViewModel that can handle any taxonomy type (categories, tags, or custom taxonomies) with support for hierarchical structures, searching, and sorting.

  • Adds generic terms view with support for hierarchical and non-hierarchical taxonomies
  • Refactors site settings to use the new generic terms view instead of hardcoded category/tag activities
  • Implements proper sorting, searching, and detail view functionality for terms

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
TermsViewModel.kt Core logic for handling terms data, sorting, hierarchy, and API calls
TermsDataViewActivity.kt Activity with Compose UI for displaying terms list and detail views
TermsViewModelTest.kt Unit tests covering sorting logic and offline state handling
ActivityLauncher.java Added method to launch the new terms view
SiteSettingsFragment.java Updated to use generic terms view instead of hardcoded category/tag activities
AndroidManifest.xml Registered the new TermsDataViewActivity
strings.xml Added string resources for terms UI

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@adalpari adalpari marked this pull request as ready for review October 6, 2025 12:24
Copy link

codecov bot commented Oct 6, 2025

Codecov Report

❌ Patch coverage is 20.86957% with 91 lines in your changes missing coverage. Please review.
✅ Project coverage is 39.91%. Comparing base (191cff0) to head (d2e9f03).
⚠️ Report is 2 commits behind head on trunk.

Files with missing lines Patch % Lines
.../wordpress/android/ui/taxonomies/TermsViewModel.kt 20.37% 86 Missing ⚠️
...ava/org/wordpress/android/ui/ActivityLauncher.java 0.00% 2 Missing ⚠️
...ess/android/ui/taxonomies/TermsDataViewActivity.kt 0.00% 2 Missing ⚠️
.../wordpress/android/ui/dataview/DataViewItemCard.kt 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            trunk   #22258      +/-   ##
==========================================
- Coverage   39.93%   39.91%   -0.02%     
==========================================
  Files        2166     2168       +2     
  Lines      102536   102650     +114     
  Branches    14774    14793      +19     
==========================================
+ Hits        40945    40970      +25     
- Misses      58123    58212      +89     
  Partials     3468     3468              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…mies-in-the-menu-depending-on-the-server-configuration' into feature/CMM-802-Create-TaxonomiesDataView
Base automatically changed from task/cmm-814-hide-or-show-taxonomies-in-the-menu-depending-on-the-server-configuration to trunk October 7, 2025 11:20
…te-TaxonomiesDataView

# Conflicts:
#	WordPress/src/main/java/org/wordpress/android/ui/prefs/SiteSettingsFragment.java
Copy link
Member

@dcalhoun dcalhoun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Test plan succeeded for me. Left a few suggestions to consider, but nothing blocking.

)

term.parent?.let { parentId ->
val parentName = allTerms.firstOrNull { it.id == parentId }?.name
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Asking for my own education to better understand Jetpack Compose: are there downsides (performance?) to passing the entire list of items for filtering the parent name? Should we instead provide the parent or its name to TermDetailCard? I.e., perform the filtering higher in the Compose tree.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there is one downside: running the filtering in the UI thread. But no matter at what level it is filtered, I don't see it making any difference. We are executing it in every CardDetails composition.

I don't like this approach tbh, because the Composable items are asking directly to the ViewModel (and even performing some logic). I would prefer the ViewModel executing all the logic and giving just the state to the View. But the current DataView flow does not work that way, so a refactor is needed to do that.

But from this discussion, I think I'll give it a try. So, thank you :)

@adalpari adalpari enabled auto-merge (squash) October 7, 2025 14:03
Copy link

sonarqubecloud bot commented Oct 7, 2025

@adalpari adalpari merged commit eb7c3fa into trunk Oct 7, 2025
26 checks passed
@adalpari adalpari deleted the feature/CMM-802-Create-TaxonomiesDataView branch October 7, 2025 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants