Skip to content

Commit c33d815

Browse files
authored
Merge pull request #5508 from woocommerce/issue/5493-preselected-site-after-login-with-site-address
Store picker: pre-select currently selected store instead of the store from login with store address flow
2 parents 0429405 + 46e141b commit c33d815

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

RELEASE-NOTES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
-----
55
- [***] Now it's possible to filter Order List by multiple statuses and date ranges. Plus, we removed the top tab bar on Orders Tab. [https://github.com/woocommerce/woocommerce-ios/pull/5491]
66
- [*] Login: Password AutoFill will suggest wordpress.com accounts. [https://github.com/woocommerce/woocommerce-ios/pull/5399]
7+
- [*] Store picker: after logging in with store address, the pre-selected store is now the currently selected store instead of the store from login flow. [https://github.com/woocommerce/woocommerce-ios/pull/5508]
78
- [internal] Migrated Settings screen to MVVM [https://github.com/woocommerce/woocommerce-ios/pull/5393]
89

910

WooCommerce/Classes/Authentication/Epilogue/StorePickerViewController.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -334,15 +334,15 @@ private extension StorePickerViewController {
334334
return
335335
}
336336

337-
// If a site address was passed in credentials, select it
338-
if let siteAddress = ServiceLocator.stores.sessionManager.defaultCredentials?.siteAddress,
339-
let site = sites.filter({ $0.url == siteAddress }).first {
337+
// If there is a defaultSite already set, select it
338+
if let site = ServiceLocator.stores.sessionManager.defaultSite {
340339
currentlySelectedSite = site
341340
return
342341
}
343342

344-
// If there is a defaultSite already set, select it
345-
if let site = ServiceLocator.stores.sessionManager.defaultSite {
343+
// If a site address was passed in credentials, select it
344+
if let siteAddress = ServiceLocator.stores.sessionManager.defaultCredentials?.siteAddress,
345+
let site = sites.filter({ $0.url == siteAddress }).first {
346346
currentlySelectedSite = site
347347
return
348348
}

0 commit comments

Comments
 (0)