Files
eqn.ios/Sources/Earthquake Network/Controllers/InApp/SubscriptionsActiveTableViewCell.swift
T
2020-10-15 08:40:02 +02:00

43 lines
1.1 KiB
Swift

//
// SubscriptionsActiveTableViewCell.swift
// Earthquake Network
//
// Created by Busi Andrea on 30/07/2020.
// Copyright © 2020 Earthquake Network. All rights reserved.
//
import UIKit
import StoreKit
class SubscriptionsActiveTableViewCell: EQNInsetTableViewCell {
var product: SKProduct? {
didSet {
updateUI()
}
}
@IBOutlet private weak var noSubscriptionsLabel: UILabel!
@IBOutlet private weak var activeSubscriptionImageView: UIImageView!
// MARK: - View Lifecycle
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
// MARK: - Private
private func updateUI() {
if let productIdentifier = product?.productIdentifier {
noSubscriptionsLabel.isHidden = true
activeSubscriptionImageView.isHidden = false
activeSubscriptionImageView.image = imageForProductIdentifier(productIdentifier)
} else {
noSubscriptionsLabel.isHidden = false
activeSubscriptionImageView.isHidden = true
}
}
}