Files
eqn.ios/Sources/Earthquake Network/Controllers/Menu/MenuHeaderTableViewCell.swift
T

45 lines
1.4 KiB
Swift

//
// MenuHeaderTableViewCell.swift
// Earthquake Network
//
// Created by Busi Andrea on 27/07/2020.
// Copyright © 2020 Earthquake Network. All rights reserved.
//
import UIKit
class MenuHeaderTableViewCell: UITableViewCell {
@IBOutlet weak var appIconImageView: UIImageView!
@IBOutlet weak var appVersionLabel: UILabel!
@IBOutlet weak var appIdLabel: UILabel!
// MARK: - View Lifecycle
override func awakeFromNib() {
super.awakeFromNib()
// add a gradient for the background
let gradient = CAGradientLayer()
let blueColor = UIColor(red: 131.0/255.0, green: 200.0/255.0, blue: 255.0/255.0, alpha: 1.0)
gradient.frame = bounds
gradient.colors = [ blueColor.cgColor, UIColor.white.cgColor ]
layer.insertSublayer(gradient, at: 0)
}
// MARK: - Public
func updateUI() {
if let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String {
let version = NSLocalizedString("Versione", comment: "etichetta versione app")
appVersionLabel.text = "\(version): \(appVersion)"
}
let userId = EQNUser.default().user_ID ?? "n.d."
appIdLabel.text = "ID: \(userId)"
let image = EQNPurchaseUtility.isProVersionEnabled() ? UIImage(named: "eq_icon_pro")! : UIImage(named: "eq_icon")!
appIconImageView.image = image
}
}