Skip to content

Conversation

@hichamboushaba
Copy link
Member

@hichamboushaba hichamboushaba commented Sep 15, 2025

Closes WOOMOB-1274

Description

This is the first PR for updating the app to allow adjusting the experience for CIAB sites, the PR introduces the following changes:

  • It updates the SiteModel DB table to include the new fields added for the garden architecture.
  • It updates the SiteRestClient to make sure we read the new fields from the API (Check https://developer.wordpress.com/docs/api/1.1/get/sites/%24site/)
  • Adds the CIABSiteGateKeeper class for controlling which features we'll disable for CIAB sites.

Note: The CIABSiteGateKeeper and CIABAffectedFeature architecture is modeled after what the iOS team did, just with different names. I think the architecture makes sense, even though we'll disable all features of the enum CIABAffectedFeature initially. Also, even though I'm not sure we'll ever need this, the flexibility could be helpful in the future if we need to offer different features to the different partners.
For some context on the Garden Architecture, check this PdpAdu-2ai-p2

Steps to reproduce

For the CIABSiteGateKeeper just check the unit tests, as it's not used now.

For the sites API

  1. Apply the following patch
Patch
Index: WooCommerce/src/main/kotlin/com/woocommerce/android/ui/main/MainActivity.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/main/MainActivity.kt b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/main/MainActivity.kt
--- a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/main/MainActivity.kt	(revision 0acce60e28a92556603847c978a3940811087867)
+++ b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/main/MainActivity.kt	(date 1757956052483)
@@ -117,6 +117,7 @@
 import org.wordpress.android.login.LoginAnalyticsListener
 import org.wordpress.android.login.LoginMode
 import org.wordpress.android.util.NetworkUtils
+import org.wordpress.android.util.ToastUtils
 import java.lang.ref.WeakReference
 import java.math.BigDecimal
 import java.util.Locale
@@ -363,6 +364,12 @@
             viewModel.handleShortcutAction(intent?.action?.lowercase(Locale.ROOT))
             handleIncomingImages()
         }
+
+        selectedSite.get().let {
+            if (it.isGardenSite) {
+                ToastUtils.showToast(this, "Detected a Garden site:\nGarden Name: ${it.gardenName}\nGarden Partner: ${it.gardenPartner}")
+            }
+        }
     }
 
     private fun handleIncomingImages() {
  1. Create a CIAB site using this guide and tool pdpAdu-29A-p2
  2. Open the app and sign in to your account.
  3. Confirm a toast is shown with the garden name and partner when opening the app.

Testing information

  • Test the API integration.
  • Review the unit tests and logic.

The tests that have been performed

The above.

  • I have considered if this change warrants release notes and have added them to RELEASE-NOTES.txt if necessary. Use the "[Internal]" label for non-user-facing changes.

@hichamboushaba hichamboushaba marked this pull request as ready for review September 15, 2025 17:33
@hichamboushaba hichamboushaba added this to the 23.3 milestone Sep 15, 2025
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Sep 15, 2025

📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
App Name WooCommerce-Wear Android
Platform⌚️ Wear OS
FlavorJalapeno
Build TypeDebug
Commitd971bd9
Direct Downloadwoocommerce-wear-prototype-build-pr14616-d971bd9.apk

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Sep 15, 2025

📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.

App Name WooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commitd971bd9
Direct Downloadwoocommerce-prototype-build-pr14616-d971bd9.apk

public boolean single_user_site;
public List<String> jetpack_modules;
public boolean is_garden;
public String garden_name;

Check notice

Code scanning / Android Lint

Nullable/NonNull annotation missing on field Note

Missing null annotation
public List<String> jetpack_modules;
public boolean is_garden;
public String garden_name;
public String garden_partner;

Check notice

Code scanning / Android Lint

Nullable/NonNull annotation missing on field Note

Missing null annotation
@AdamGrzybkowski AdamGrzybkowski self-assigned this Sep 16, 2025
Copy link
Contributor

@AdamGrzybkowski AdamGrzybkowski left a comment

Choose a reason for hiding this comment

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

Looks good! Tested with the provided patch, but also checked the network responses and database table rows to confirm the values were set correctly.

I left a comment about the UI test failing. Approving because the test is missing a mock and the rest of the code works well.

@hichamboushaba hichamboushaba force-pushed the issue/WOOMOB-1274-garden-api-integration branch from 0acce60 to d971bd9 Compare September 16, 2025 10:12
@hichamboushaba hichamboushaba merged commit 8fe023f into trunk Sep 16, 2025
17 checks passed
@hichamboushaba hichamboushaba deleted the issue/WOOMOB-1274-garden-api-integration branch September 16, 2025 10:40
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 59.09091% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.40%. Comparing base (230c05c) to head (d971bd9).
⚠️ Report is 38 commits behind head on trunk.

Files with missing lines Patch % Lines
...rdpress/android/fluxc/persistence/WellSqlConfig.kt 0.00% 6 Missing ⚠️
...com/woocommerce/android/ciab/CIABSiteGateKeeper.kt 40.00% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##              trunk   #14616   +/-   ##
=========================================
  Coverage     38.39%   38.40%           
- Complexity     9724     9731    +7     
=========================================
  Files          2059     2061    +2     
  Lines        115273   115294   +21     
  Branches      15339    15340    +1     
=========================================
+ Hits          44260    44275   +15     
- Misses        66913    66917    +4     
- Partials       4100     4102    +2     

☔ 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants