[Paywalls V2] Store decoding errors in individual paywall (instead of failing entire offerings response) #4473
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.
Motivation
Don't error the whole offerings response if only one paywall has an error
Description
PaywallComponentsData
will now silently fail with any decoding issues in the Decodable. It will store all decoding errors locally within itself for the Paywalls V2 logic to handle later by showing console logs and fallback paywalls.The main purpose of this is so that an issue with one paywall doesn't ruin the functionality of offerings and any other paywalls.
Example
The Paywalls Tester app has been updated for this to show an error icon on paywalls that don't meet the spec. In the example below, the error s are on paywalls that are essentially in a "draft state".
We will have BE and FE server validation for paywalls schemas but this is still a good safety measure in the SDK and benefits viewing paywalls in the alpha phase in the SDK.
Screen.Recording.2024-11-11.at.9.18.45.PM.mov