-
Notifications
You must be signed in to change notification settings - Fork 121
[Universal Links] Do not enter undetermined state if the user does not have access to the passed blog Id #7866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
toupper
merged 5 commits into
trunk
from
issue/7864-app-in-wrong-state-link-wrong-blog-id
Oct 17, 2022
Merged
[Universal Links] Do not enter undetermined state if the user does not have access to the passed blog Id #7866
toupper
merged 5 commits into
trunk
from
issue/7864-app-in-wrong-state-link-wrong-blog-id
Oct 17, 2022
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Collaborator
You can test the changes from this Pull Request by:
|
Ecarrion
approved these changes
Oct 14, 2022
Contributor
Ecarrion
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
| /// - Returns: a boolean that indicates whether the site was changed. | ||
| /// | ||
| func switchToStoreIfSiteIsStored(with storeID: Int64, onCompletion: @escaping (Bool) -> Void) { | ||
| self.refreshStoredSites() |
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
| self.refreshStoredSites() | |
| refreshStoredSites() |
| func switchToStoreIfSiteIsStored(with storeID: Int64, onCompletion: @escaping (Bool) -> Void) { | ||
| self.refreshStoredSites() | ||
|
|
||
| let siteWasStored = self.wooCommerceSites.first(where: { $0.siteID == storeID }) != nil |
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
| let siteWasStored = self.wooCommerceSites.first(where: { $0.siteID == storeID }) != nil | |
| let siteWasStored = wooCommerceSites.first(where: { $0.siteID == storeID }) != nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
feature: deep links
Related to the universal and deep links
feature: notifications
Related to notifications or notifs.
type: bug
A confirmed bug.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes: #7864
Description
Before, when the user tapped on "order details" universal link with a blog Id parameter value they couldn't access, the app opened and switched to an undetermined state where data couldn't be loaded (see video below).
The reason is that, when switching to the new store, we logged out from the previous one without checking if the user could actually access the new site. Once we do that, the app cannot load any data (stats, orders, products ...) of the new site because the user doesn't have access.
With this PR we check first if the switching store was previously synced and stored in CoreData, which means the user has access to it. Since we synchronize the sites remotely on every startup and we want the navigation to be quick, I consider enough checking locally for the store instead of syncing remotely after opening the app following a universal link.
Testing instructions
3a. Before: App opens, the order load fails and the app cannot retrieve data anymore until you switch store again in settings.
3b. After: App opens and navigates to orders.
Screenshots
Before
RPReplay_Final1665756881.MP4
After
RPReplay_Final1665757863.MP4
RELEASE-NOTES.txtif necessary.