Mercurial > public > simoleon
comparison Simoleon/Helpers/SubscribeButton.swift @ 42:d25b02d439d4
Minor updates subscription and legal requirements
author | Dennis Concepción Martín <dennisconcepcionmartin@gmail.com> |
---|---|
date | Mon, 26 Jul 2021 15:35:06 +0100 |
parents | f76d0e26c178 |
children | 75c1a05176f6 |
comparison
equal
deleted
inserted
replaced
41:7703c122ce96 | 42:d25b02d439d4 |
---|---|
8 import SwiftUI | 8 import SwiftUI |
9 import Purchases | 9 import Purchases |
10 | 10 |
11 struct SubscribeButton: View { | 11 struct SubscribeButton: View { |
12 @Binding var showingSubscriptionPaywall: Bool | 12 @Binding var showingSubscriptionPaywall: Bool |
13 @EnvironmentObject var subscriptionController: SubscriptionController | |
14 | 13 |
15 @State private var price = "" | 14 @State private var price = "" |
16 @State private var alertTitle = "" | 15 @State private var alertTitle = "" |
17 @State private var alertMessage = "" | 16 @State private var alertMessage = "" |
18 @State private var showingAlert = false | 17 @State private var showingAlert = false |
64 if let package = offerings?.current?.monthly { | 63 if let package = offerings?.current?.monthly { |
65 | 64 |
66 Purchases.shared.purchasePackage(package) { (transaction, purchaserInfo, error, userCancelled) in | 65 Purchases.shared.purchasePackage(package) { (transaction, purchaserInfo, error, userCancelled) in |
67 if purchaserInfo?.entitlements["all"]?.isActive == true { | 66 if purchaserInfo?.entitlements["all"]?.isActive == true { |
68 showingPrice = true | 67 showingPrice = true |
69 subscriptionController.isActive = true | |
70 showingSubscriptionPaywall = false | 68 showingSubscriptionPaywall = false |
71 } | 69 } |
72 | 70 |
73 if let error = error as NSError? { | 71 if let error = error as NSError? { |
74 alertTitle = error.localizedDescription | 72 alertTitle = error.localizedDescription |