From 1e7ea129acc6d0c996fd49419ca019c93e976fab Mon Sep 17 00:00:00 2001 From: Annmarie Ziegler Date: Tue, 17 Oct 2023 15:55:35 -0400 Subject: [PATCH 1/8] Add field single_user_site to response object --- .../fluxc/network/rest/wpcom/site/SiteWPComRestResponse.java | 1 + 1 file changed, 1 insertion(+) diff --git a/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpcom/site/SiteWPComRestResponse.java b/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpcom/site/SiteWPComRestResponse.java index 44c9987cbc..e0f9e00989 100644 --- a/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpcom/site/SiteWPComRestResponse.java +++ b/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpcom/site/SiteWPComRestResponse.java @@ -125,4 +125,5 @@ public class BloggingPromptsSettings { public Quota quota; public ZendeskSiteMeta zendesk_site_meta; public boolean was_ecommerce_trial; + public boolean single_user_site; } From cc93827a1c0025f2aa7cd44869881e78e0756ef2 Mon Sep 17 00:00:00 2001 From: Annmarie Ziegler Date: Tue, 17 Oct 2023 15:58:27 -0400 Subject: [PATCH 2/8] Set single_user_site to site and add to filter site_fields --- .idea/checkstyle-idea.xml | 28 +++++++++---------- .../network/rest/wpcom/site/SiteRestClient.kt | 3 +- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml index 7f921dc349..3c94116173 100644 --- a/.idea/checkstyle-idea.xml +++ b/.idea/checkstyle-idea.xml @@ -1,18 +1,18 @@ - - + \ No newline at end of file diff --git a/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpcom/site/SiteRestClient.kt b/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpcom/site/SiteRestClient.kt index e653fea1d0..a759af4d96 100644 --- a/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpcom/site/SiteRestClient.kt +++ b/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpcom/site/SiteRestClient.kt @@ -1203,6 +1203,7 @@ class SiteRestClient @Inject constructor( site.origin = SiteModel.ORIGIN_WPCOM_REST site.planActiveFeatures = (from.plan?.features?.active?.joinToString(",")).orEmpty() site.wasEcommerceTrial = from.was_ecommerce_trial + site.setIsSingleUserSite(from.single_user_site) return site } @@ -1265,7 +1266,7 @@ class SiteRestClient @Inject constructor( private const val NEW_SITE_TIMEOUT_MS = 90000 private const val SITE_FIELDS = "ID,URL,name,description,jetpack,jetpack_connection,visible,is_private," + "options,plan,capabilities,quota,icon,meta,zendesk_site_meta,organization_id," + - "was_ecommerce_trial" + "was_ecommerce_trial, single_user_site" private const val FIELDS = "fields" private const val FILTERS = "filters" } From 1b745608057cacb000825acdd2cbd17a044c8afc Mon Sep 17 00:00:00 2001 From: Annmarie Ziegler Date: Tue, 17 Oct 2023 15:59:04 -0400 Subject: [PATCH 3/8] Add mIsSingleUserSite column --- .../org/wordpress/android/fluxc/model/SiteModel.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fluxc/src/main/java/org/wordpress/android/fluxc/model/SiteModel.java b/fluxc/src/main/java/org/wordpress/android/fluxc/model/SiteModel.java index d29d841cc1..cc0ceaad75 100644 --- a/fluxc/src/main/java/org/wordpress/android/fluxc/model/SiteModel.java +++ b/fluxc/src/main/java/org/wordpress/android/fluxc/model/SiteModel.java @@ -258,6 +258,8 @@ public class SiteModel extends Payload implements Identifiable private String mPlanActiveFeatures; @Column private Boolean mWasEcommerceTrial; + @Column + private Boolean mIsSingleUserSite; @Override public int getId() { @@ -1111,4 +1113,12 @@ public String getPlanActiveFeatures() { public void setPlanActiveFeatures(final String planActiveFeatures) { this.mPlanActiveFeatures = planActiveFeatures; } + + public boolean isSingleUserSite() { + return mIsSingleUserSite; + } + + public void setIsSingleUserSite(boolean isSingleUserSite) { + mIsSingleUserSite = isSingleUserSite; + } } From 53ecb453eec378639a24c625250b2d8159473964 Mon Sep 17 00:00:00 2001 From: Annmarie Ziegler Date: Tue, 17 Oct 2023 16:00:08 -0400 Subject: [PATCH 4/8] Update dbVersion and migration for is_single_user_site in SiteModel --- .../org/wordpress/android/fluxc/persistence/WellSqlConfig.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fluxc/src/main/java/org/wordpress/android/fluxc/persistence/WellSqlConfig.kt b/fluxc/src/main/java/org/wordpress/android/fluxc/persistence/WellSqlConfig.kt index 053e622361..ab7f004d18 100644 --- a/fluxc/src/main/java/org/wordpress/android/fluxc/persistence/WellSqlConfig.kt +++ b/fluxc/src/main/java/org/wordpress/android/fluxc/persistence/WellSqlConfig.kt @@ -41,7 +41,7 @@ open class WellSqlConfig : DefaultWellConfig { annotation class AddOn override fun getDbVersion(): Int { - return 196 + return 197 } override fun getDbName(): String { @@ -1990,6 +1990,9 @@ open class WellSqlConfig : DefaultWellConfig { "_id INTEGER PRIMARY KEY AUTOINCREMENT)" ) } + 196 -> migrate(version) { + db.execSQL("ALTER TABLE SiteModel ADD IS_SINGLE_USER_SITE BOOLEAN") + } } } db.setTransactionSuccessful() From 49d87a638219ead6c367548b6b44be2f014bbc01 Mon Sep 17 00:00:00 2001 From: Annmarie Ziegler Date: Tue, 17 Oct 2023 16:02:08 -0400 Subject: [PATCH 5/8] Revert "Set single_user_site to site and add to filter site_fields" This reverts commit cc93827a1c0025f2aa7cd44869881e78e0756ef2. --- .idea/checkstyle-idea.xml | 28 +++++++++---------- .../network/rest/wpcom/site/SiteRestClient.kt | 3 +- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml index 3c94116173..7f921dc349 100644 --- a/.idea/checkstyle-idea.xml +++ b/.idea/checkstyle-idea.xml @@ -1,18 +1,18 @@ - - 8.2 - AllSourcesWithTests - - \ No newline at end of file + diff --git a/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpcom/site/SiteRestClient.kt b/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpcom/site/SiteRestClient.kt index a759af4d96..e653fea1d0 100644 --- a/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpcom/site/SiteRestClient.kt +++ b/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpcom/site/SiteRestClient.kt @@ -1203,7 +1203,6 @@ class SiteRestClient @Inject constructor( site.origin = SiteModel.ORIGIN_WPCOM_REST site.planActiveFeatures = (from.plan?.features?.active?.joinToString(",")).orEmpty() site.wasEcommerceTrial = from.was_ecommerce_trial - site.setIsSingleUserSite(from.single_user_site) return site } @@ -1266,7 +1265,7 @@ class SiteRestClient @Inject constructor( private const val NEW_SITE_TIMEOUT_MS = 90000 private const val SITE_FIELDS = "ID,URL,name,description,jetpack,jetpack_connection,visible,is_private," + "options,plan,capabilities,quota,icon,meta,zendesk_site_meta,organization_id," + - "was_ecommerce_trial, single_user_site" + "was_ecommerce_trial" private const val FIELDS = "fields" private const val FILTERS = "filters" } From f2cd1e0822ab196d79b7e36e6644623c7bcfc6b2 Mon Sep 17 00:00:00 2001 From: Annmarie Ziegler Date: Tue, 17 Oct 2023 16:04:20 -0400 Subject: [PATCH 6/8] Set isSingleUserSite on site and add to site_fields --- .../android/fluxc/network/rest/wpcom/site/SiteRestClient.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpcom/site/SiteRestClient.kt b/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpcom/site/SiteRestClient.kt index e653fea1d0..831d3db488 100644 --- a/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpcom/site/SiteRestClient.kt +++ b/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpcom/site/SiteRestClient.kt @@ -1203,6 +1203,7 @@ class SiteRestClient @Inject constructor( site.origin = SiteModel.ORIGIN_WPCOM_REST site.planActiveFeatures = (from.plan?.features?.active?.joinToString(",")).orEmpty() site.wasEcommerceTrial = from.was_ecommerce_trial + site.setIsSingleUserSite(from.single_user_site) return site } @@ -1265,7 +1266,7 @@ class SiteRestClient @Inject constructor( private const val NEW_SITE_TIMEOUT_MS = 90000 private const val SITE_FIELDS = "ID,URL,name,description,jetpack,jetpack_connection,visible,is_private," + "options,plan,capabilities,quota,icon,meta,zendesk_site_meta,organization_id," + - "was_ecommerce_trial" + "was_ecommerce_trial,single_user_site" private const val FIELDS = "fields" private const val FILTERS = "filters" } From be41f256a85a0ce6b6f39a83d823e02628d7c9fb Mon Sep 17 00:00:00 2001 From: Annmarie Ziegler Date: Tue, 17 Oct 2023 17:50:50 -0400 Subject: [PATCH 7/8] Switch primitive type --- .../java/org/wordpress/android/fluxc/model/SiteModel.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fluxc/src/main/java/org/wordpress/android/fluxc/model/SiteModel.java b/fluxc/src/main/java/org/wordpress/android/fluxc/model/SiteModel.java index cc0ceaad75..4654320048 100644 --- a/fluxc/src/main/java/org/wordpress/android/fluxc/model/SiteModel.java +++ b/fluxc/src/main/java/org/wordpress/android/fluxc/model/SiteModel.java @@ -1114,11 +1114,11 @@ public void setPlanActiveFeatures(final String planActiveFeatures) { this.mPlanActiveFeatures = planActiveFeatures; } - public boolean isSingleUserSite() { + public Boolean isSingleUserSite() { return mIsSingleUserSite; } - public void setIsSingleUserSite(boolean isSingleUserSite) { + public void setIsSingleUserSite(Boolean isSingleUserSite) { mIsSingleUserSite = isSingleUserSite; } } From d5837e7e54a0a06e75ac854bc1831c6dfd56f70a Mon Sep 17 00:00:00 2001 From: Annmarie Ziegler Date: Tue, 17 Oct 2023 18:17:59 -0400 Subject: [PATCH 8/8] Update tests to support the addition of single_user_site field request --- .../fluxc/network/rest/wpcom/site/SiteRestClientTest.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/example/src/test/java/org/wordpress/android/fluxc/network/rest/wpcom/site/SiteRestClientTest.kt b/example/src/test/java/org/wordpress/android/fluxc/network/rest/wpcom/site/SiteRestClientTest.kt index 33f1d8f3ae..74f0290963 100644 --- a/example/src/test/java/org/wordpress/android/fluxc/network/rest/wpcom/site/SiteRestClientTest.kt +++ b/example/src/test/java/org/wordpress/android/fluxc/network/rest/wpcom/site/SiteRestClientTest.kt @@ -93,7 +93,7 @@ class SiteRestClientTest { mapOf( "fields" to "ID,URL,name,description,jetpack,jetpack_connection," + "visible,is_private,options,plan,capabilities,quota,icon,meta,zendesk_site_meta," + - "organization_id,was_ecommerce_trial" + "organization_id,was_ecommerce_trial,single_user_site" ) ) } @@ -145,7 +145,7 @@ class SiteRestClientTest { "filters" to "wpcom", "fields" to "ID,URL,name,description,jetpack,jetpack_connection," + "visible,is_private,options,plan,capabilities,quota,icon,meta,zendesk_site_meta," + - "organization_id,was_ecommerce_trial" + "organization_id,was_ecommerce_trial,single_user_site" ) ) } @@ -174,7 +174,7 @@ class SiteRestClientTest { mapOf( "fields" to "ID,URL,name,description,jetpack,jetpack_connection," + "visible,is_private,options,plan,capabilities,quota,icon,meta,zendesk_site_meta," + - "organization_id,was_ecommerce_trial" + "organization_id,was_ecommerce_trial,single_user_site" ) ) }