73 lines
1.9 KiB
Swift
73 lines
1.9 KiB
Swift
//
|
|
// ConnectionStatusView.swift
|
|
// PrivadoVPN
|
|
//
|
|
// Created by Zhandos Bolatbekov on 08.07.2021.
|
|
// Copyright © 2021 Privado LLC. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
protocol ConnectionStatusViewInput: AnyObject {
|
|
func updateConnectionStatus(title: String?)
|
|
}
|
|
|
|
protocol ConnectionStatusViewOutput: AnyObject { }
|
|
|
|
final class ConnectionStatusViewIPAD: BaseView, ConnectionStatusViewInput {
|
|
|
|
private enum Constants {
|
|
|
|
enum Color {
|
|
static let title = Colors.SystemCTA.lightPurple.color
|
|
}
|
|
|
|
enum Font {
|
|
static let title = UIFont.primary(size: 14, weight: .bold)
|
|
}
|
|
}
|
|
|
|
private let output: ConnectionStatusViewOutput
|
|
|
|
private var titleLabel: UILabel?
|
|
|
|
// MARK: - Init
|
|
|
|
init(output: ConnectionStatusViewOutput) {
|
|
self.output = output
|
|
super.init()
|
|
self.configureUI()
|
|
}
|
|
|
|
// MARK: - ConnectionStatusViewInput
|
|
|
|
func updateConnectionStatus(title: String?) {
|
|
self.titleLabel?.text = title
|
|
}
|
|
|
|
// MARK: - Private
|
|
|
|
private func configureUI() {
|
|
self.translatesAutoresizingMaskIntoConstraints = false
|
|
|
|
let titleLabel = self.initializeTitleLabel()
|
|
NSLayoutConstraint.activate([
|
|
titleLabel.topAnchor.constraint(equalTo: self.topAnchor),
|
|
titleLabel.leadingAnchor.constraint(equalTo: self.leadingAnchor),
|
|
titleLabel.trailingAnchor.constraint(equalTo: self.trailingAnchor),
|
|
titleLabel.bottomAnchor.constraint(equalTo: self.bottomAnchor)
|
|
])
|
|
}
|
|
|
|
private func initializeTitleLabel() -> UILabel {
|
|
let label = UILabel()
|
|
label.translatesAutoresizingMaskIntoConstraints = false
|
|
label.textColor = Constants.Color.title
|
|
label.textAlignment = .center
|
|
label.font = Constants.Font.title
|
|
self.addSubview(label)
|
|
self.titleLabel = label
|
|
return label
|
|
}
|
|
}
|