mirror of
https://github.com/passepartoutvpn/passepartout-apple.git
synced 2025-02-17 13:22:09 +00:00
parent
7d7aaa8b0c
commit
47c6b02c4d
@ -75,6 +75,35 @@ extension PaywallView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private struct FeatureModel: Identifiable, Comparable {
|
||||||
|
let productIdentifier: String
|
||||||
|
|
||||||
|
let title: String
|
||||||
|
|
||||||
|
let subtitle: String?
|
||||||
|
|
||||||
|
init(localProduct: LocalProduct, title: String) {
|
||||||
|
productIdentifier = localProduct.rawValue
|
||||||
|
self.title = title
|
||||||
|
subtitle = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
init(product: InAppProduct) {
|
||||||
|
productIdentifier = product.productIdentifier
|
||||||
|
title = product.localizedTitle
|
||||||
|
let description = product.localizedDescription
|
||||||
|
subtitle = description != title ? description : nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var id: String {
|
||||||
|
productIdentifier
|
||||||
|
}
|
||||||
|
|
||||||
|
static func < (lhs: Self, rhs: Self) -> Bool {
|
||||||
|
lhs.title.lowercased() < rhs.title.lowercased()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private struct PurchaseRow: View {
|
private struct PurchaseRow: View {
|
||||||
var product: InAppProduct?
|
var product: InAppProduct?
|
||||||
|
|
||||||
@ -94,12 +123,12 @@ private struct PurchaseRow: View {
|
|||||||
private extension PaywallView.PurchaseView {
|
private extension PaywallView.PurchaseView {
|
||||||
var featuresSection: some View {
|
var featuresSection: some View {
|
||||||
Section {
|
Section {
|
||||||
ForEach(features, id: \.productIdentifier) { product in
|
ForEach(features) { feature in
|
||||||
VStack(alignment: .leading) {
|
VStack(alignment: .leading) {
|
||||||
Text(product.localizedTitle)
|
Text(feature.title)
|
||||||
.themeCellTitleStyle()
|
.themeCellTitleStyle()
|
||||||
if product.localizedDescription != product.localizedTitle {
|
feature.subtitle.map {
|
||||||
Text(product.localizedDescription)
|
Text($0)
|
||||||
.themeCellSubtitleStyle()
|
.themeCellSubtitleStyle()
|
||||||
.themeSecondaryTextStyle()
|
.themeSecondaryTextStyle()
|
||||||
}
|
}
|
||||||
@ -166,12 +195,12 @@ private extension PaywallView.PurchaseView {
|
|||||||
return productManager.product(withIdentifier: .fullVersion)
|
return productManager.product(withIdentifier: .fullVersion)
|
||||||
}
|
}
|
||||||
|
|
||||||
var features: [InAppProduct] {
|
var features: [FeatureModel] {
|
||||||
productManager.featureProducts(excluding: {
|
productManager.featureProducts(excluding: {
|
||||||
$0 == .fullVersion || $0.isPlatformVersion
|
$0 == .fullVersion || $0.isPlatformVersion
|
||||||
})
|
})
|
||||||
.sorted {
|
.map {
|
||||||
$0.localizedTitle.lowercased() < $1.localizedTitle.lowercased()
|
FeatureModel(product: $0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user