Skip to content

Paywalls: initial configuration types#2780

Merged
NachoSoto merged 7 commits into
paywallsfrom
paywall-config
Jul 13, 2023
Merged

Paywalls: initial configuration types#2780
NachoSoto merged 7 commits into
paywallsfrom
paywall-config

Conversation

@NachoSoto

@NachoSoto NachoSoto commented Jul 10, 2023

Copy link
Copy Markdown
Contributor

Changes:

  • Added Offering.paywall
  • Decoding PaywallData in OfferingsResponse, using IgnoreDecodeErrors (this will be better after IgnoreDecodeErrors: log decoding error #2778)
  • New PaywallData struct
  • Added new APIs to testers
  • Testing paywall deserialization from Offerings
  • Testing paywall deserialization separately to check edge cases

Other changes:

  • Made DefaultDecodable and AnyDecodable Sendable

@NachoSoto NachoSoto added the pr:feat A new feature label Jul 10, 2023
@NachoSoto NachoSoto requested a review from a team July 10, 2023 22:41
@NachoSoto NachoSoto force-pushed the paywall-config branch 4 times, most recently from 06c9e6f to 55ff780 Compare July 11, 2023 19:27
Comment on lines 32 to 33

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important that we don't fail to load the offering if this fails. The error will get logged with #2778

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1000. At least for now

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should fail at the Paywalls SDK level though

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what I'm thinking:

if let paywall = offering.paywall {
  // The paywall is required
  PaywallView(offering: offering, paywall: paywall)
} else {
  // You gotta handle it and do something yourself.
}

With the public PaywallData constructor, users could to this:

} else {
  // This is hardcoded in the app
  let simplePaywall = PaywallData(
      template: .simple
      config: ...
  )
  PaywallView(offering: offering, paywall: simplePaywall)
}

Comment thread Sources/Paywalls/PaywallData.swift Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is empty for now.

Comment thread Sources/Paywalls/PaywallTemplate.swift Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will obviously change, just a placeholder.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We didn't update this when we exposed it for TestStoreProduct.

@NachoSoto NachoSoto marked this pull request as ready for review July 11, 2023 19:39
@NachoSoto NachoSoto changed the title [WIP] Paywalls: initial configuration types Paywalls: initial configuration types Jul 11, 2023
Base automatically changed from nacho/paywall-target to paywalls July 11, 2023 20:04

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are the changes from #2776, right? do we need to rebase?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@aboedo aboedo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

Comment on lines 32 to 33

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1000. At least for now

Comment on lines 32 to 33

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should fail at the Paywalls SDK level though

@NachoSoto NachoSoto force-pushed the paywall-config branch 2 times, most recently from 236de6f to 962b498 Compare July 11, 2023 21:54

@joshdholtz joshdholtz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few small comments but otherwise 💯

Comment thread Sources/Paywalls/PaywallData.swift Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a thing?! 🤯

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah to resolve ambiguity for types that conform to both protocols :)

Comment thread Tests/UnitTests/Networking/Responses/OfferingsDecodingTests.swift Outdated
@NachoSoto NachoSoto force-pushed the paywall-config branch 4 times, most recently from a8fd3b0 to f2a5df3 Compare July 12, 2023 16:12
- Added `Offering.paywall`
- Decoding `PaywallData` in `OfferingsResponse`, using `IgnoreDecodeErrors` (this will be better after #2778)
- New `PaywallData` `struct`
- Added new APIs to testers
- Testing paywall deserialization from `Offerings`
- Testing paywall deserialization separately to check edge cases

- Made `DefaultDecodable` and `AnyDecodable` `Sendable`
@NachoSoto

Copy link
Copy Markdown
Contributor Author

Finally figured out the test issues: #2802.
I changed this test to also use expect {}.to(throwAssertion()) to fix it.

@NachoSoto NachoSoto merged commit b192d6a into paywalls Jul 13, 2023
@NachoSoto NachoSoto deleted the paywall-config branch July 13, 2023 04:27
NachoSoto added a commit that referenced this pull request Jul 13, 2023
- Added `Offering.paywall`
- Decoding `PaywallData` in `OfferingsResponse`, using
`IgnoreDecodeErrors` (this will be better after #2778)
- New `PaywallData` `struct`
- Added new APIs to testers
- Testing paywall deserialization from `Offerings`
- Testing paywall deserialization separately to check edge cases
NachoSoto added a commit that referenced this pull request Jul 13, 2023
- Added `Offering.paywall`
- Decoding `PaywallData` in `OfferingsResponse`, using
`IgnoreDecodeErrors` (this will be better after #2778)
- New `PaywallData` `struct`
- Added new APIs to testers
- Testing paywall deserialization from `Offerings`
- Testing paywall deserialization separately to check edge cases
NachoSoto added a commit that referenced this pull request Jul 13, 2023
- Added `Offering.paywall`
- Decoding `PaywallData` in `OfferingsResponse`, using
`IgnoreDecodeErrors` (this will be better after #2778)
- New `PaywallData` `struct`
- Added new APIs to testers
- Testing paywall deserialization from `Offerings`
- Testing paywall deserialization separately to check edge cases
NachoSoto added a commit that referenced this pull request Jul 13, 2023
- Added `Offering.paywall`
- Decoding `PaywallData` in `OfferingsResponse`, using
`IgnoreDecodeErrors` (this will be better after #2778)
- New `PaywallData` `struct`
- Added new APIs to testers
- Testing paywall deserialization from `Offerings`
- Testing paywall deserialization separately to check edge cases
NachoSoto added a commit that referenced this pull request Jul 17, 2023
- Added `Offering.paywall`
- Decoding `PaywallData` in `OfferingsResponse`, using
`IgnoreDecodeErrors` (this will be better after #2778)
- New `PaywallData` `struct`
- Added new APIs to testers
- Testing paywall deserialization from `Offerings`
- Testing paywall deserialization separately to check edge cases
NachoSoto added a commit that referenced this pull request Jul 18, 2023
- Added `Offering.paywall`
- Decoding `PaywallData` in `OfferingsResponse`, using
`IgnoreDecodeErrors` (this will be better after #2778)
- New `PaywallData` `struct`
- Added new APIs to testers
- Testing paywall deserialization from `Offerings`
- Testing paywall deserialization separately to check edge cases
NachoSoto added a commit that referenced this pull request Jul 18, 2023
- Added `Offering.paywall`
- Decoding `PaywallData` in `OfferingsResponse`, using
`IgnoreDecodeErrors` (this will be better after #2778)
- New `PaywallData` `struct`
- Added new APIs to testers
- Testing paywall deserialization from `Offerings`
- Testing paywall deserialization separately to check edge cases
NachoSoto added a commit that referenced this pull request Jul 20, 2023
- Added `Offering.paywall`
- Decoding `PaywallData` in `OfferingsResponse`, using
`IgnoreDecodeErrors` (this will be better after #2778)
- New `PaywallData` `struct`
- Added new APIs to testers
- Testing paywall deserialization from `Offerings`
- Testing paywall deserialization separately to check edge cases
NachoSoto added a commit that referenced this pull request Jul 23, 2023
- Added `Offering.paywall`
- Decoding `PaywallData` in `OfferingsResponse`, using
`IgnoreDecodeErrors` (this will be better after #2778)
- New `PaywallData` `struct`
- Added new APIs to testers
- Testing paywall deserialization from `Offerings`
- Testing paywall deserialization separately to check edge cases
NachoSoto added a commit that referenced this pull request Jul 24, 2023
- Added `Offering.paywall`
- Decoding `PaywallData` in `OfferingsResponse`, using
`IgnoreDecodeErrors` (this will be better after #2778)
- New `PaywallData` `struct`
- Added new APIs to testers
- Testing paywall deserialization from `Offerings`
- Testing paywall deserialization separately to check edge cases
NachoSoto added a commit that referenced this pull request Jul 24, 2023
- Added `Offering.paywall`
- Decoding `PaywallData` in `OfferingsResponse`, using
`IgnoreDecodeErrors` (this will be better after #2778)
- New `PaywallData` `struct`
- Added new APIs to testers
- Testing paywall deserialization from `Offerings`
- Testing paywall deserialization separately to check edge cases
NachoSoto added a commit that referenced this pull request Jul 25, 2023
- Added `Offering.paywall`
- Decoding `PaywallData` in `OfferingsResponse`, using
`IgnoreDecodeErrors` (this will be better after #2778)
- New `PaywallData` `struct`
- Added new APIs to testers
- Testing paywall deserialization from `Offerings`
- Testing paywall deserialization separately to check edge cases
NachoSoto added a commit that referenced this pull request Jul 26, 2023
- Added `Offering.paywall`
- Decoding `PaywallData` in `OfferingsResponse`, using
`IgnoreDecodeErrors` (this will be better after #2778)
- New `PaywallData` `struct`
- Added new APIs to testers
- Testing paywall deserialization from `Offerings`
- Testing paywall deserialization separately to check edge cases
NachoSoto added a commit that referenced this pull request Jul 27, 2023
- Added `Offering.paywall`
- Decoding `PaywallData` in `OfferingsResponse`, using
`IgnoreDecodeErrors` (this will be better after #2778)
- New `PaywallData` `struct`
- Added new APIs to testers
- Testing paywall deserialization from `Offerings`
- Testing paywall deserialization separately to check edge cases
NachoSoto added a commit that referenced this pull request Jul 31, 2023
- Added `Offering.paywall`
- Decoding `PaywallData` in `OfferingsResponse`, using
`IgnoreDecodeErrors` (this will be better after #2778)
- New `PaywallData` `struct`
- Added new APIs to testers
- Testing paywall deserialization from `Offerings`
- Testing paywall deserialization separately to check edge cases
NachoSoto added a commit that referenced this pull request Aug 3, 2023
- Added `Offering.paywall`
- Decoding `PaywallData` in `OfferingsResponse`, using
`IgnoreDecodeErrors` (this will be better after #2778)
- New `PaywallData` `struct`
- Added new APIs to testers
- Testing paywall deserialization from `Offerings`
- Testing paywall deserialization separately to check edge cases
NachoSoto added a commit that referenced this pull request Aug 7, 2023
- Added `Offering.paywall`
- Decoding `PaywallData` in `OfferingsResponse`, using
`IgnoreDecodeErrors` (this will be better after #2778)
- New `PaywallData` `struct`
- Added new APIs to testers
- Testing paywall deserialization from `Offerings`
- Testing paywall deserialization separately to check edge cases
NachoSoto added a commit that referenced this pull request Aug 9, 2023
- Added `Offering.paywall`
- Decoding `PaywallData` in `OfferingsResponse`, using
`IgnoreDecodeErrors` (this will be better after #2778)
- New `PaywallData` `struct`
- Added new APIs to testers
- Testing paywall deserialization from `Offerings`
- Testing paywall deserialization separately to check edge cases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants