[Paywalls V2] Convert Codable structs to classes #4665
Merged
+607
−196
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
We were getting random-ish
EXC_BAD_ACCESS
after the merge of the badge PR. It took some debuggin and it turned out..When decoding 5-ish paywall v2 in an
OfferingsResponse
, thestruct
structure while in the encoder would just fail.Note that this is in the ENCODER... and not the DECODER. So this was happening when we decode string response to Swift object and then encode back for storage.
Description
After some debugging and experimentation with Mark, it was our conclusion that our OfferingsResponse struct with the Paywalls V2 struct were causing some sort of struct structure that was WAY too big causing some sort of buffer overflows or something.
We experiment with converting one struct to a class and it made the issue go away. So we continue this in the PR to convert all Paywalls V2 components that are codable from structs (value type) to classes (reference type) to mitigate this issue.