Fix construction of provider in-app products

Fixes #141
This commit is contained in:
Davide De Rosa 2020-05-11 21:14:02 +02:00
parent 297b32c71f
commit c4d1419c73
2 changed files with 10 additions and 4 deletions

View File

@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
### Fixed
- In-app purchase unavailable for new providers. [#141](https://github.com/passepartoutvpn/passepartout-ios/issues/141)
## 1.11.1 (2020-05-11)
### Added

View File

@ -88,12 +88,12 @@ struct Product: RawRepresentable, Equatable, Hashable {
static var allProviders: [Product] {
return InfrastructureFactory.shared.allMetadata.map {
return Product(providerId: $0.description)
return Product(providerMetadata: $0)
}
}
fileprivate init(providerId: String) {
self.init(rawValue: "\(Product.providersBundle).\(providerId)")!
fileprivate init(providerMetadata: Infrastructure.Metadata) {
self.init(rawValue: "\(Product.providersBundle).\(providerMetadata.inApp ?? providerMetadata.name)")!
}
// MARK: All
@ -137,7 +137,7 @@ struct Product: RawRepresentable, Equatable, Hashable {
extension Infrastructure.Metadata {
var product: Product {
return Product(providerId: inApp ?? name)
return Product(providerMetadata: self)
}
}