Skip to content

Offering: new getMetadataValue with Decodable type#3373

Merged
NachoSoto merged 4 commits into
mainfrom
offering-metadata-decodable
Nov 1, 2023
Merged

Offering: new getMetadataValue with Decodable type#3373
NachoSoto merged 4 commits into
mainfrom
offering-metadata-decodable

Conversation

@NachoSoto

@NachoSoto NachoSoto commented Nov 1, 2023

Copy link
Copy Markdown
Contributor

This allows to easily extract data from Offering.metadata in a structured way.

Example:

struct Data: Decodable {
    var number: Int
}

let elements: [Data] = offering.getMetadataValue(for: "elements") ?? []
let element: Data? = offering.getMetadataValue(for: "element")

This allows to easily extract data from `Offering.metadata` in a structured way.

Example:
```swift
struct Data: Decodable, Equatable {
    var number: Int
}

let elements: [Data] = offering.getMetadataValue(for: "elements") ?? []
let element: Data? = offering.getMetadataValue(for: "element")
```
@NachoSoto NachoSoto added the pr:feat A new feature label Nov 1, 2023
@NachoSoto NachoSoto requested review from a team and charliemchapman November 1, 2023 19:35

@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.

This looks amazing! Just one quick question about KeyDecodingStrategy

Comment thread Sources/Purchasing/Offering.swift Outdated

@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.

:shipit:

@NachoSoto NachoSoto enabled auto-merge (squash) November 1, 2023 20:12
@NachoSoto NachoSoto force-pushed the offering-metadata-decodable branch from ad32120 to da2b42c Compare November 1, 2023 20:18
@NachoSoto NachoSoto merged commit 4344ea9 into main Nov 1, 2023
@NachoSoto NachoSoto deleted the offering-metadata-decodable branch November 1, 2023 20:42
NachoSoto added a commit that referenced this pull request Nov 2, 2023
**This is an automatic release.**

### New Features
* `Offering`: new `getMetadataValue` with `Decodable` type (#3373) via
NachoSoto (@NachoSoto)
* Add `StoreProduct.pricePerWeek` (#3354) via NachoSoto (@NachoSoto)
### RevenueCatUI
* `Paywalls`: `.presentPaywallIfNeeded` allows overriding `Offering`
(#3370) via NachoSoto (@NachoSoto)
* `Paywalls`: new optional `displayCloseButton` parameter (#3359) via
NachoSoto (@NachoSoto)
* `Paywalls`: improve period abbreviations in Japanese (#3367) via
NachoSoto (@NachoSoto)
* `Paywalls`: new `{{ sub_price_per_week }}` variable (#3355) via
NachoSoto (@NachoSoto)
* `Paywalls`: log warning when attempting to purchase already-subscribed
product (#3366) via NachoSoto (@NachoSoto)
* `Paywalls`: improve Japanese localization (#3364) via NachoSoto
(@NachoSoto)
* `Paywalls`: fix template 2 top padding inside navigation view (#3363)
via NachoSoto (@NachoSoto)
* `Paywalls`: avoid animating `PurchaseButton` labels when text does not
change (#3361) via NachoSoto (@NachoSoto)
* `Paywalls`: improve `FooterView` accessibility (#3349) via NachoSoto
(@NachoSoto)
### Dependency Updates
* Bump cocoapods from 1.14.0 to 1.14.2 (#3356) via dependabot[bot]
(@dependabot[bot])
* Bump cocoapods from 1.13.0 to 1.14.0 (#3351) via dependabot[bot]
(@dependabot[bot])
### Other Changes
* `Paywalls`: simplify `PurchaseButton` (#3362) via NachoSoto
(@NachoSoto)
* `Paywalls`: refactored `IntroEligibilityStateView` (#3360) via
NachoSoto (@NachoSoto)
* `Paywall Tester`: improve template 5 dark colors (#3358) via NachoSoto
(@NachoSoto)
* `Paywalls`: improve conversion from `Color`/`UIColor` to
`PaywallColor` (#3357) via NachoSoto (@NachoSoto)
* `Paywalls Tester`: improve `.paywallFooter` presentation (#3348) via
NachoSoto (@NachoSoto)
* `Paywalls`: move size configuration to `TemplateViewType` (#3352) via
NachoSoto (@NachoSoto)

---------

Co-authored-by: NachoSoto <ignaciosoto90@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:feat A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants