Store creation M3: handle IAP ineligible scenario by showing an alert #8393
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.
First iteration for #8392
Description
Why
Please see the background in p1670855348591299/1670855146.255439-slack-C0354HSNUJH. I'm going with option 1 since I'm AFK soon, and don't want our app to be blocked from release. We can update the UX later after design confirmation.
Implementation
In
StoreCreationCoordinator, it currently throws variousPlanPurchaseErrors at the beginning after checking a series of IAP conditions:woocommerce-ios/WooCommerce/Classes/Authentication/Store Creation/StoreCreationCoordinator.swift
Lines 79 to 97 in 618b3a0
Then in the catch closure, we currently show the M1 webview if there's an error. However, when we launch IAP with the
storeCreationM2WithInAppPurchasesEnabledfeature flag enabled, we can't fall back to the webview implementation. Therefore, I updated the error handling to show an alert if thestoreCreationM2WithInAppPurchasesEnabledfeature flag is enabled.In order to not present the alert before the in-progress view is presented in case the result comes back immediately like when using a mock
MockInAppPurchases, I updated thepresentStoreCreationfunction toasyncto wait for the presentation completion.Testing instructions
It's the easiest to test with a mock implementation using
MockInAppPurchases.IAP is not supported
return MockInAppPurchases(isIAPSupported: false). Also, inDefaultFeatureFlagService, returntrueforstoreCreationM2WithInAppPurchasesEnabledfeature flagSwitch store+ Add a storeCreate a new store--> the in-progress view should be shown first. after a bit, an alert should be shown that indicates store creation isn't supported for the countryUser is already entitled to the plan
return MockInAppPurchases(userIsEntitledToProduct: true). Also, inDefaultFeatureFlagService, returntrueforstoreCreationM2WithInAppPurchasesEnabledfeature flagSwitch store+ Add a storeCreate a new store--> the in-progress view should be shown first. after a bit, an alert should be shown that indicates store creation isn't supported because their account is already associated with another storeOther errors, like product cannot be fetched
return MockInAppPurchases(products: []). Also, inDefaultFeatureFlagService, returntrueforstoreCreationM2WithInAppPurchasesEnabledfeature flagSwitch store+ Add a storeCreate a new store--> the in-progress view should be shown first. after a bit, an alert should be shown that indicates store creation isn't supported in the appScreenshots
Please feel free to suggest any improvements to the copy:
RELEASE-NOTES.txtif necessary.