Skip to content

Commit ffd7c59

Browse files
Merge pull request #10688 from woocommerce/fix-jetpack-cp-login
Fix Jetpack CP login
2 parents 37c6ea8 + 2c6baa5 commit ffd7c59

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

RELEASE-NOTES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
17.2
1111
-----
1212
- [**] [Available for users with WooCommerce version of 8.7+, which is not released yet] Every order have a receipt now. The receipts can be shared via many apps installed on the phone [https://github.com/woocommerce/woocommerce-android/pull/10650]
13+
- [*] Fix login for sites with Jetpack Connection Package [https://github.com/woocommerce/woocommerce-android/pull/10688]
1314

1415
17.1
1516
-----

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/sitepicker/SitePickerViewModel.kt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,7 @@ class SitePickerViewModel @Inject constructor(
187187
}
188188

189189
private fun onSitesLoaded(sites: List<SiteModel>) {
190-
val filteredSites = sites.filter { !it.isJetpackCPConnected }
191-
192-
if (filteredSites.isEmpty()) {
190+
if (sites.isEmpty()) {
193191
when {
194192
loginSiteAddress != null -> showAccountMismatchScreen(loginSiteAddress!!)
195193
navArgs.openedFromLogin -> onEmptyStoresList()
@@ -198,8 +196,8 @@ class SitePickerViewModel @Inject constructor(
198196
return
199197
}
200198

201-
val wooSites = filteredSites.filter { it.hasWooCommerce }
202-
val nonWooSites = filteredSites.filter { !it.hasWooCommerce }
199+
val wooSites = sites.filter { it.hasWooCommerce }
200+
val nonWooSites = sites.filter { !it.hasWooCommerce }
203201

204202
if (_sites.value == null) {
205203
// Track events only on the first call
@@ -231,7 +229,7 @@ class SitePickerViewModel @Inject constructor(
231229
}
232230
}
233231
sitePickerViewState = sitePickerViewState.copy(
234-
hasConnectedStores = filteredSites.isNotEmpty(),
232+
hasConnectedStores = sites.isNotEmpty(),
235233
isPrimaryBtnVisible = wooSites.isNotEmpty(),
236234
isNoStoresViewVisible = false,
237235
currentSitePickerState = SitePickerState.StoreListState
@@ -263,7 +261,7 @@ class SitePickerViewModel @Inject constructor(
263261
* - Has WooCommerce installed
264262
*/
265263
private fun processLoginSiteAddress(url: String) {
266-
val site = repository.getSiteBySiteUrl(url)?.takeIf { !it.isJetpackCPConnected }
264+
val site = repository.getSiteBySiteUrl(url)
267265
when {
268266
site == null -> {
269267
// The url doesn't match any sites for this account.

0 commit comments

Comments
 (0)